$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r73064 - sandbox/gil/boost/gil/extension/io2/detail
From: dsaritz_at_[hidden]
Date: 2011-07-13 15:38:51
Author: psiha
Date: 2011-07-13 15:38:50 EDT (Wed, 13 Jul 2011)
New Revision: 73064
URL: http://svn.boost.org/trac/boost/changeset/73064
Log:
Moved the memory_mapping module into a separate library (mmap) and used it through SVN externals.
Removed:
   sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.cpp
   sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.hpp
Properties modified: 
   sandbox/gil/boost/gil/extension/io2/detail/   (props changed)
Deleted: sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.cpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.cpp	2011-07-13 15:38:50 EDT (Wed, 13 Jul 2011)
+++ (empty file)
@@ -1,413 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file memory_mapping.cpp
-/// ------------------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-///  Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-///  (See accompanying file LICENSE_1_0.txt or copy at
-///  http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#include "memory_mapping.hpp"
-
-#include "boost/assert.hpp"
-
-#ifdef _WIN32
-    #ifndef WIN32_LEAN_AND_MEAN
-        #define WIN32_LEAN_AND_MEAN
-    #endif // WIN32_LEAN_AND_MEAN
-    #include "windows.h"
-
-    #pragma warning ( disable : 4996 ) // "The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name."
-    #include "io.h"
-#else
-    #include <sys/mman.h>      // mmap, munmap.
-    #include <sys/stat.h>
-    #include <sys/types.h>     // struct stat.
-    #include <unistd.h>        // sysconf.
-#endif // _WIN32
-#include <errno.h>
-#include <fcntl.h>
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-namespace guard
-{
-
-#ifdef _WIN32
-windows_handle::windows_handle( handle_t const handle )
-    :
-    handle_( handle )
-{}
-
-windows_handle::~windows_handle()
-{
-    BOOST_VERIFY
-    (
-        ( ::CloseHandle( handle_ ) != false               ) ||
-        ( handle_ == 0 || handle_ == INVALID_HANDLE_VALUE )
-    );
-}
-
-windows_handle::handle_t const & windows_handle::handle() const
-{
-    return handle_;
-}
-#endif // _WIN32
-
-posix_handle::posix_handle( handle_t const handle )
-    :
-    handle_( handle )
-{}
-
-#ifdef _WIN32
-posix_handle::posix_handle( windows_handle::handle_t const native_handle )
-    :
-    handle_( ::_open_osfhandle( reinterpret_cast<intptr_t>( native_handle ), _O_APPEND ) )
-{
-    if ( handle_ == -1 )
-    {
-        BOOST_VERIFY
-        (
-            ( ::CloseHandle( native_handle ) != false                     ) ||
-            ( native_handle == 0 || native_handle == INVALID_HANDLE_VALUE )
-        );
-    }
-}
-#endif // _WIN32
-
-posix_handle::~posix_handle()
-{
-    BOOST_VERIFY
-    (
-        ( ::close( handle() ) == 0 ) ||
-        (
-            ( handle() == -1    ) &&
-            ( errno    == EBADF )
-        )
-    );                
-}
-
-
-posix_handle::handle_t const & posix_handle::handle() const
-{
-    return handle_;
-}
-
-//------------------------------------------------------------------------------
-} // guard
-
-
-guard::native_handle create_file( char const * const file_name, file_flags const & flags )
-{
-    BOOST_ASSERT( file_name );
-
-#ifdef _WIN32
-
-    HANDLE const file_handle
-    (
-        ::CreateFileA
-        (
-            file_name, flags.desired_access, flags.share_mode, 0, flags.creation_disposition, flags.flags_and_attributes, 0
-        )
-    );
-    BOOST_ASSERT( ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) || ( ::GetLastError() == ERROR_ALREADY_EXISTS ) );
-
-#else
-
-    mode_t const current_mask( ::umask( 0 ) );
-    int    const file_handle ( ::open( file_name, flags.oflag, flags.pmode ) );
-    BOOST_VERIFY( ::umask( current_mask ) == 0 );
-
-#endif // _WIN32
-
-    return guard::native_handle( file_handle );
-}
-
-
-bool set_file_size( guard::native_handle_t const file_handle, unsigned int const desired_size )
-{
-#ifdef _WIN32
-    // It is 'OK' to send null/invalid handles to Windows functions (they will
-    // simply fail), this simplifies error handling (it is enough to go through
-    // all the logic, inspect the final result and then throw on error).
-    DWORD const new_size( ::SetFilePointer( file_handle, desired_size, 0, FILE_BEGIN ) );
-    BOOST_ASSERT( ( new_size == desired_size ) || ( file_handle == INVALID_HANDLE_VALUE ) );
-    ignore_unused_variable_warning( new_size );
-
-    BOOL const success( ::SetEndOfFile( file_handle ) );
-
-    BOOST_VERIFY( ( ::SetFilePointer( file_handle, 0, 0, FILE_BEGIN ) == 0 ) || ( file_handle == INVALID_HANDLE_VALUE ) );
-
-    return success != false;
-#else
-    return ::ftruncate( file_handle, desired_size ) != -1;
-#endif // _WIN32
-}
-
-
-std::size_t get_file_size( guard::native_handle_t const file_handle )
-{
-#ifdef _WIN32
-    DWORD const file_size( ::GetFileSize( file_handle, 0 ) );
-    BOOST_ASSERT( ( file_size != INVALID_FILE_SIZE ) || ( file_handle == INVALID_HANDLE_VALUE ) || ( ::GetLastError() == NO_ERROR ) );
-    return file_size;
-#else
-    struct stat file_info;
-    BOOST_VERIFY( ::fstat( file_handle, &file_info ) == 0 );
-    return file_info.st_size;
-#endif // _WIN32
-}
-
-
-unsigned int const file_flags::handle_access_rights::read    = BOOST_AUX_IO_WIN32_OR_POSIX( GENERIC_READ   , O_RDONLY );
-unsigned int const file_flags::handle_access_rights::write   = BOOST_AUX_IO_WIN32_OR_POSIX( GENERIC_WRITE  , O_WRONLY );
-unsigned int const file_flags::handle_access_rights::execute = BOOST_AUX_IO_WIN32_OR_POSIX( GENERIC_EXECUTE, O_RDONLY );
-
-unsigned int const file_flags::share_mode::none   = BOOST_AUX_IO_WIN32_OR_POSIX( 0                , 0 );
-unsigned int const file_flags::share_mode::read   = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_SHARE_READ  , 0 );
-unsigned int const file_flags::share_mode::write  = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_SHARE_WRITE , 0 );
-unsigned int const file_flags::share_mode::remove = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_SHARE_DELETE, 0 );
-
-unsigned int const file_flags::system_hints::random_access     = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_FLAG_RANDOM_ACCESS                         , O_RANDOM      );
-unsigned int const file_flags::system_hints::sequential_access = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_FLAG_SEQUENTIAL_SCAN                       , O_SEQUENTIAL  );
-unsigned int const file_flags::system_hints::non_cached        = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, O_DIRECT      );
-unsigned int const file_flags::system_hints::delete_on_close   = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_FLAG_DELETE_ON_CLOSE                       , O_TEMPORARY   );
-unsigned int const file_flags::system_hints::temporary         = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_ATTRIBUTE_TEMPORARY                        , O_SHORT_LIVED );
-
-unsigned int const file_flags::on_construction_rights::read    = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_ATTRIBUTE_READONLY, S_IRUSR );
-unsigned int const file_flags::on_construction_rights::write   = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_ATTRIBUTE_NORMAL  , S_IWUSR );
-unsigned int const file_flags::on_construction_rights::execute = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_ATTRIBUTE_NORMAL  , S_IXUSR );
-
-file_flags file_flags::create
-(
-    unsigned int  const handle_access_flags   ,
-    unsigned int  const share_mode            ,
-    open_policy_t const open_flags            ,
-    unsigned int  const system_hints          ,
-    unsigned int  const on_construction_rights
-)
-{
-    file_flags const flags =
-    {
-    #ifdef _WIN32
-        handle_access_flags, // desired_access
-        share_mode, // share_mode
-        open_flags, // creation_disposition
-        system_hints
-            |
-        (
-            ( on_construction_rights & FILE_ATTRIBUTE_NORMAL )
-                ? ( on_construction_rights & ~FILE_ATTRIBUTE_READONLY )
-                :   on_construction_rights
-        ) // flags_and_attributes
-    #else // POSIX
-        ( ( handle_access_flags == O_RDONLY | O_WRONLY ) ? O_RDWR : handle_access_flags )
-            |
-        open_flags
-            |
-        system_hints, // oflag
-        on_construction_rights // pmode
-    #endif // OS impl
-    };
-
-    return flags;
-}
-
-
-file_flags file_flags::create_for_opening_existing_files( unsigned int const handle_access_flags, unsigned int const share_mode , bool const truncate, unsigned int const system_hints )
-{
-    return create
-    (
-        handle_access_flags,
-        share_mode,
-        truncate
-            ? open_policy::open_and_truncate_existing
-            : open_policy::open_existing,
-        system_hints,
-        0
-    );
-}
-
-
-unsigned int const mapping_flags::handle_access_rights::read    = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_MAP_READ   , PROT_READ  );
-unsigned int const mapping_flags::handle_access_rights::write   = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_MAP_WRITE  , PROT_WRITE );
-unsigned int const mapping_flags::handle_access_rights::execute = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_MAP_EXECUTE, PROT_EXEC  );
-
-unsigned int const mapping_flags::share_mode::shared = BOOST_AUX_IO_WIN32_OR_POSIX(             0, MAP_SHARED  );
-unsigned int const mapping_flags::share_mode::hidden = BOOST_AUX_IO_WIN32_OR_POSIX( FILE_MAP_COPY, MAP_PRIVATE );
-
-unsigned int const mapping_flags::system_hint::strict_target_address   = BOOST_AUX_IO_WIN32_OR_POSIX(           0, MAP_FIXED              );
-unsigned int const mapping_flags::system_hint::lock_to_ram             = BOOST_AUX_IO_WIN32_OR_POSIX( SEC_COMMIT , MAP_LOCKED             );
-unsigned int const mapping_flags::system_hint::reserve_page_file_space = BOOST_AUX_IO_WIN32_OR_POSIX( SEC_RESERVE, /*khm#1*/MAP_NORESERVE );
-unsigned int const mapping_flags::system_hint::precommit               = BOOST_AUX_IO_WIN32_OR_POSIX( SEC_COMMIT , MAP_POPULATE           );
-unsigned int const mapping_flags::system_hint::uninitialized           = BOOST_AUX_IO_WIN32_OR_POSIX(           0, MAP_UNINITIALIZED      );
-
-
-mapping_flags mapping_flags::create
-(
-    unsigned int handle_access_flags,
-    unsigned int share_mode         ,
-    unsigned int system_hints
-)
-{
-    mapping_flags flags;
-#ifdef _WIN32
-    flags.create_mapping_flags = ( handle_access_flags & handle_access_rights::execute ) ? PAGE_EXECUTE : PAGE_NOACCESS;
-    if ( share_mode & share_mode::hidden ) // WRITECOPY
-        flags.create_mapping_flags *= 8;
-    else
-    if ( handle_access_flags & handle_access_rights::write )
-        flags.create_mapping_flags *= 4;
-    else
-    {
-        BOOST_ASSERT( handle_access_flags & handle_access_rights::read );
-        flags.create_mapping_flags *= 2;
-    }
-
-    flags.create_mapping_flags |= system_hints;
-
-    flags.map_view_flags        = handle_access_flags;
-#else
-    flags.protection = handle_access_rights;
-    flags.flags      = share_mode | system_hints;
-    if ( ( system_hints & system_hint::reserve_page_file_space ) ) /*khm#1*/
-        flags.flags &= ~MAP_NORESERVE;
-    else
-        flags.flags |= MAP_NORESERVE;
-#endif // _WIN32
-
-    return flags;
-}
-
-
-template <>
-mapped_view<unsigned char> mapped_view<unsigned char>::map
-(
-    guard::native_handle_t const   object_handle,
-    mapping_flags          const & flags,
-    std::size_t            const   desired_size,
-    std::size_t            const   offset
-)
-{
-    typedef mapped_view<unsigned char>::iterator iterator_t;
-
-#ifdef _WIN32
-
-    // Implementation note:
-    // Mapped views hold internal references to the following handles so we do
-    // not need to hold/store them ourselves:
-    // http://msdn.microsoft.com/en-us/library/aa366537(VS.85).aspx
-    //                                        (26.03.2010.) (Domagoj Saric)
-
-    ULARGE_INTEGER large_integer;
-
-    // CreateFileMapping accepts INVALID_HANDLE_VALUE as valid input but only if
-    // the size parameter is not null.
-    large_integer.QuadPart = desired_size;
-    guard::windows_handle const mapping
-    (
-        ::CreateFileMapping( object_handle, 0, flags.create_mapping_flags, large_integer.HighPart, large_integer.LowPart, 0 )
-    );
-    BOOST_ASSERT
-    (
-        !mapping.handle() || ( object_handle == INVALID_HANDLE_VALUE ) || ( desired_size != 0 )
-    );
-
-    large_integer.QuadPart = offset;
-    iterator_t const view_start( static_cast<iterator_t>( ::MapViewOfFile( mapping.handle(), flags.map_view_flags, large_integer.HighPart, large_integer.LowPart, desired_size ) ) );
-    return mapped_view<unsigned char>
-    (
-        view_start,
-        ( view_start && ( object_handle != INVALID_HANDLE_VALUE ) )
-            ? view_start + desired_size
-            : view_start
-    );
-
-#else // POSIX
-
-    iterator_t const view_start( static_cast<iterator_t>( ::mmap( 0, desired_size, flags.protection, flags.flags, file_handle, 0 ) ) );
-    return mapped_view<unsigned char>
-    (
-        view_start,
-        ( view_start != MAP_FAILED )
-            ? view_start + desired_size
-            : view_start
-    );
-
-#endif // OS API
-}
-
-template <>
-void detail::mapped_view_base<unsigned char const>::unmap( detail::mapped_view_base<unsigned char const> const & mapped_range )
-{
-#ifdef _WIN32
-    BOOST_VERIFY( ::UnmapViewOfFile( mapped_range.begin()                      ) || mapped_range.empty() );
-#else
-    BOOST_VERIFY( ( ::munmap( mapped_range.begin(), mapped_range.size() ) == 0 ) || mapped_range.empty() );
-#endif // _WIN32
-}
-
-template <>
-mapped_view<unsigned char const> mapped_view<unsigned char const>::map
-(
-    guard::native_handle_t const object_handle,
-    std::size_t            const desired_size,
-    std::size_t            const offset,
-    bool                   const map_for_code_execution,
-    unsigned int           const mapping_system_hints
-)
-{
-    return mapped_view<unsigned char>::map
-    (
-        object_handle,
-        mapping_flags::create
-        (
-            mapping_flags::handle_access_rights::read | ( map_for_code_execution ? mapping_flags::handle_access_rights::execute : 0 ),
-            mapping_flags::share_mode::shared,
-            mapping_system_hints
-        ),
-        desired_size,
-        offset
-    );
-}
-
-
-mapped_view<unsigned char const> map_read_only_file( char const * const file_name )
-{
-    guard::native_handle const file_handle
-    (
-        create_file
-        (
-            file_name,
-            file_flags::create_for_opening_existing_files
-            (
-                file_flags::handle_access_rights::read,
-                file_flags::share_mode          ::read | file_flags::share_mode::write,
-                false,
-                file_flags::system_hints        ::sequential_access
-            )
-        )
-    );
-
-    return mapped_view<unsigned char const>::map
-    (
-        file_handle.handle(),
-        #ifdef _WIN32
-            0 // Windows APIs interpret zero as 'whole file'
-        #else // POSIX
-            get_file_size( file_handle.handle() )
-        #endif // OS impl
-    );
-}
-
-
-//------------------------------------------------------------------------------
-} // boost
-//------------------------------------------------------------------------------
Deleted: sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.hpp	2011-07-13 15:38:50 EDT (Wed, 13 Jul 2011)
+++ (empty file)
@@ -1,425 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///
-/// \file memory_mapping.hpp
-/// ------------------------
-///
-/// Copyright (c) Domagoj Saric 2010.-2011.
-///
-///  Use, modification and distribution is subject to the Boost Software License, Version 1.0.
-///  (See accompanying file LICENSE_1_0.txt or copy at
-///  http://www.boost.org/LICENSE_1_0.txt)
-///
-/// For more information, see http://www.boost.org
-///
-////////////////////////////////////////////////////////////////////////////////
-//------------------------------------------------------------------------------
-#pragma once
-#ifndef memory_mapping_hpp__D9C84FF5_E506_4ECB_9778_61E036048D28
-#define memory_mapping_hpp__D9C84FF5_E506_4ECB_9778_61E036048D28
-//------------------------------------------------------------------------------
-#include "boost/assert.hpp"
-#include "boost/noncopyable.hpp"
-#include "boost/range/iterator_range.hpp"
-
-#ifndef _WIN32
-    #include "fcntl.h"
-#endif // _WIN32
-
-#ifdef _WIN32
-    #define BOOST_AUX_IO_WIN32_OR_POSIX( win32, posix ) win32
-#else
-    #define BOOST_AUX_IO_WIN32_OR_POSIX( win32, posix ) posix
-#endif
-//------------------------------------------------------------------------------
-namespace boost
-{
-//------------------------------------------------------------------------------
-
-// Implementation note:
-//   Using structs with public members and factory functions to enable (almost)
-// zero-overhead 'link-time' conversion to native flag formats and to allow the
-// user to modify the created flags or create fully custom ones so that specific
-// platform-dependent use-cases, not otherwise covered through the generic
-// interface, can also be covered.
-//                                            (10.10.2010.) (Domagoj Saric)
-
-struct file_flags
-{
-    struct handle_access_rights
-    {
-        static unsigned int const read   ;
-        static unsigned int const write  ;
-        static unsigned int const execute;
-    };
-
-    struct share_mode
-    {
-        static unsigned int const none  ;
-        static unsigned int const read  ;
-        static unsigned int const write ;
-        static unsigned int const remove;
-    };
-
-    struct open_policy
-    {
-        enum value_type
-        {
-            create_new                      = BOOST_AUX_IO_WIN32_OR_POSIX( 1, O_CREAT | O_EXCL  ),
-            create_new_or_truncate_existing = BOOST_AUX_IO_WIN32_OR_POSIX( 2, O_CREAT | O_TRUNC ),
-            open_existing                   = BOOST_AUX_IO_WIN32_OR_POSIX( 3, 0                 ),
-            open_or_create                  = BOOST_AUX_IO_WIN32_OR_POSIX( 4, O_CREAT           ),
-            open_and_truncate_existing      = BOOST_AUX_IO_WIN32_OR_POSIX( 5, O_TRUNC           )
-        };
-    };
-    typedef open_policy::value_type open_policy_t;
-
-    struct system_hints
-    {
-        static unsigned int const random_access    ;
-        static unsigned int const sequential_access;
-        static unsigned int const non_cached       ;
-        static unsigned int const delete_on_close  ;
-        static unsigned int const temporary        ;
-    };
-
-    struct on_construction_rights
-    {
-        static unsigned int const read   ;
-        static unsigned int const write  ;
-        static unsigned int const execute;
-    };
-
-    static file_flags create
-    (
-        unsigned int handle_access_flags   ,
-        unsigned int share_mode            ,
-        open_policy_t                      ,
-        unsigned int system_hints          ,
-        unsigned int on_construction_rights
-    );
-
-    static file_flags create_for_opening_existing_files
-    (
-        unsigned int handle_access_flags,
-        unsigned int share_mode         ,
-        bool         truncate           ,
-        unsigned int system_hints
-    );
-
-#ifdef _WIN32
-    unsigned long desired_access      ;
-    unsigned long share_mode          ;
-    unsigned long creation_disposition;
-    unsigned long flags_and_attributes;
-#else
-    int oflag;
-    int pmode;
-#endif // _WIN32
-};
-
-struct mapping_flags
-{
-    struct handle_access_rights
-    {
-        static unsigned int const read   ;
-        static unsigned int const write  ;
-        static unsigned int const execute;
-    };
-
-    struct share_mode
-    {
-        static unsigned int const shared;
-        static unsigned int const hidden;
-    };
-
-    struct system_hint
-    {
-        static unsigned int const strict_target_address  ;
-        static unsigned int const lock_to_ram            ;
-        static unsigned int const reserve_page_file_space;
-        static unsigned int const precommit              ;
-        static unsigned int const uninitialized          ;
-    };
-
-    static mapping_flags create
-    (
-        unsigned int handle_access_rights,
-        unsigned int share_mode          ,
-        unsigned int system_hints
-    );
-
-#ifdef _WIN32
-    unsigned int create_mapping_flags;
-    unsigned int map_view_flags;
-#else
-    int protection;
-    int flags     ;
-#endif // _WIN32
-};
-
-
-typedef iterator_range<unsigned char       *> basic_memory_range_t;
-typedef iterator_range<unsigned char const *> basic_read_only_memory_range_t;
-
-template <typename Element>
-class mapped_view;
-
-namespace guard
-{
-//------------------------------------------------------------------------------
-
-#ifdef _WIN32
-class windows_handle : noncopyable
-{
-public:
-    typedef void * handle_t;
-
-    explicit windows_handle( handle_t );
-    ~windows_handle();
-
-    handle_t const & handle() const;
-
-private:
-    handle_t const handle_;
-};
-#endif // _WIN32
-
-class posix_handle : noncopyable
-{
-public:
-    typedef int handle_t;
-
-    explicit posix_handle( handle_t );
-
-    #ifdef _WIN32
-        explicit posix_handle( windows_handle::handle_t );
-    #endif // _WIN32
-
-    ~posix_handle();
-
-    handle_t const & handle() const;
-
-private:
-    handle_t const handle_;
-};
-
-
-#ifdef _WIN32
-    typedef windows_handle native_handle;
-#else
-    typedef posix_handle   native_handle;
-#endif // _WIN32
-typedef native_handle::handle_t native_handle_t;
-
-
-template <typename Element>
-class mapped_view : public boost::mapped_view<Element>
-{
-public:
-    mapped_view( boost::mapped_view<Element> const range ) : boost::mapped_view<Element>( range ) {}
-    ~mapped_view<Element>() { boost::mapped_view<Element>::unmap( *this ); }
-};
-
-//------------------------------------------------------------------------------
-} // namespace guard
-
-guard::native_handle create_file( char const * file_name, file_flags const &                            );
-guard::native_handle create_file( char const * file_name, file_flags const &, unsigned int desired_size );
-
-bool        set_file_size( guard::native_handle_t, std::size_t desired_size );
-std::size_t get_file_size( guard::native_handle_t                           );
-
-
-namespace detail
-{
-    template <typename Element>
-    class mapped_view_base : public iterator_range<Element *>
-    {
-    public:
-        typedef iterator_range<Element> memory_range_t;
-
-    public: // Factory methods.
-        static void unmap( mapped_view_base const & );
-
-    protected:
-        mapped_view_base( iterator_range<Element *> const & mapped_range ) : iterator_range<Element *>( mapped_range   ) {}
-        mapped_view_base( Element * const p_begin, Element * const p_end ) : iterator_range<Element *>( p_begin, p_end ) {}
-
-        static mapped_view<unsigned char const>
-        #ifdef BOOST_MSVC
-            const &
-        #endif
-        make_basic_view( mapped_view_base<Element> const & );
-
-        static mapped_view<Element>
-        #ifdef BOOST_MSVC
-            const &
-        #endif
-        make_typed_range( mapped_view_base<unsigned char const> const & );
-
-    private: // Hide mutable members
-        iterator_range & advance_begin( difference_type );
-        iterator_range & advance_end  ( difference_type );
-
-        void pop_front();
-        void pop_back ();
-    };
-
-
-    template <typename Element>
-    void mapped_view_base<Element>::unmap( mapped_view_base<Element> const & mapped_range )
-    {
-        unmap<unsigned char const>( make_basic_view( mapped_range ) );
-    }
-
-    template <>
-    void mapped_view_base<unsigned char const>::unmap( mapped_view_base<unsigned char const> const & );
-
-    template <typename Element>
-    mapped_view<unsigned char const>
-    #ifdef BOOST_MSVC
-        const &
-    #endif
-    mapped_view_base<Element>::make_basic_view( mapped_view_base<Element> const & range )
-    {
-        return
-        #ifdef BOOST_MSVC
-            reinterpret_cast<mapped_view<unsigned char const> const &>( range );
-        #else // compiler might care about strict aliasing rules
-            mapped_view<unsigned char const>
-            (
-                static_cast<unsigned char const *>( static_cast<void const *>( range.begin() ) ),
-                static_cast<unsigned char const *>( static_cast<void const *>( range.end  () ) )
-            );
-        #endif // compiler
-    }
-
-
-    template <typename Element>
-    mapped_view<Element>
-    #ifdef BOOST_MSVC
-            const &
-    #endif
-    mapped_view_base<Element>::make_typed_range( mapped_view_base<unsigned char const> const & range )
-    {
-        BOOST_ASSERT( range.begin() % sizeof( Element ) == 0 );
-        BOOST_ASSERT( range.end  () % sizeof( Element ) == 0 );
-        BOOST_ASSERT( range.size () % sizeof( Element ) == 0 );
-        return
-        #ifdef BOOST_MSVC
-            reinterpret_cast<mapped_view<Element> const &>( range );
-        #else // compiler might care about strict aliasing rules
-            mapped_view<unsigned char const>
-            (
-                static_cast<Element *>( static_cast<void *>( range.begin() ) ),
-                static_cast<Element *>( static_cast<void *>( range.end  () ) )
-            );
-        #endif // compiler
-    }
-} // namespace detail
-
-template <typename Element>
-class mapped_view : public detail::mapped_view_base<Element>
-{
-public:
-    basic_memory_range_t basic_range() const
-    {
-        return basic_memory_range_t
-        (
-            static_cast<unsigned char *>( static_cast<void *>( begin() ) ),
-            static_cast<unsigned char *>( static_cast<void *>( end  () ) )
-        );
-    }
-
-public: // Factory methods.
-    static mapped_view map
-    (
-        guard::native_handle_t,
-        mapping_flags const &,
-        std::size_t desired_size,
-        std::size_t offset
-    );
-
-private:
-    mapped_view( iterator_range<Element *> const & mapped_range ) : mapped_view_base( mapped_range   ) {}
-    mapped_view( Element * const p_begin, Element * const p_end ) : mapped_view_base( p_begin, p_end ) {}
-};
-
-template <typename Element>
-class mapped_view<Element const> : public detail::mapped_view_base<Element const>
-{
-public:
-    basic_memory_range_t basic_range() const
-    {
-        return basic_memory_range_t
-        (
-            static_cast<unsigned char const *>( static_cast<void const *>( begin() ) ),
-            static_cast<unsigned char const *>( static_cast<void const *>( end  () ) )
-        );
-    }
-
-public: // Factory methods.
-    static mapped_view map
-    (
-        guard::native_handle_t object_handle,
-        std::size_t            desired_size,
-        std::size_t            offset                 = 0,
-        bool                   map_for_code_execution = false,
-        unsigned int           mapping_system_hints   = mapping_flags::system_hint::uninitialized
-    );
-
-private:
-    mapped_view( iterator_range<Element const *> const & mapped_range       ) : mapped_view_base( mapped_range   ) {}
-    mapped_view( Element const * const p_begin, Element const * const p_end ) : mapped_view_base( p_begin, p_end ) {}
-};
-
-template <typename Handle>
-struct is_mappable : mpl::false_ {};
-
-template <> struct is_mappable<char                                  *> : mpl::true_ {};
-template <> struct is_mappable<char                            const *> : mpl::true_ {};
-template <> struct is_mappable<FILE                                  *> : mpl::true_ {};
-template <> struct is_mappable<guard::posix_handle::handle_t          > : mpl::true_ {};
-#ifdef _WIN32
-template <> struct is_mappable<wchar_t                               *> : mpl::true_ {};
-template <> struct is_mappable<wchar_t                         const *> : mpl::true_ {};
-template <> struct is_mappable<guard::windows_handle::handle_t        > : mpl::true_ {};
-#endif // _WIN32
-
-
-template <typename Element>
-mapped_view<Element> mapped_view<Element>::map
-(
-    guard::native_handle_t,
-    mapping_flags const &,
-    std::size_t desired_size,
-    std::size_t offset
-);
-
-
-template <>
-mapped_view<unsigned char> mapped_view<unsigned char>::map
-(
-    guard::native_handle_t,
-    mapping_flags const &,
-    std::size_t desired_size,
-    std::size_t offset
-);
-
-template <>
-mapped_view<unsigned char const> mapped_view<unsigned char const>::map
-(
-    guard::native_handle_t object_handle,
-    std::size_t            desired_size,
-    std::size_t            offset,
-    bool                   map_for_code_execution,
-    unsigned int           mapping_system_hints
-);
-
-
-mapped_view<unsigned char const> map_read_only_file( char const * file_name );
-
-//------------------------------------------------------------------------------
-} // namespace boost
-//------------------------------------------------------------------------------
-#endif // memory_mapping_hpp