|
using | extent_type = typename section_handle::extent_type |
| The extent type.
|
|
using | size_type = typename section_handle::size_type |
| The size type.
|
|
using | element_type = typename span< T >::element_type |
| The index type.
|
|
using | value_type = typename span< T >::value_type |
| The value type.
|
|
using | reference = typename span< T >::reference |
| The reference type.
|
|
using | pointer = typename span< T >::pointer |
| The pointer type.
|
|
using | const_reference = typename span< T >::const_reference |
| The const reference type.
|
|
using | const_pointer = typename span< T >::const_pointer |
| The const pointer type.
|
|
using | iterator = typename span< T >::iterator |
| The iterator type.
|
|
using | reverse_iterator = typename span< T >::reverse_iterator |
| The const iterator type.
|
|
using | difference_type = typename span< T >::difference_type |
| The const reverse iterator type.
|
|
|
constexpr | mapped () |
| Default constructor.
|
|
| mapped (const mapped &)=delete |
|
| mapped (mapped &&o) noexcept |
|
mapped & | operator= (const mapped &)=delete |
|
mapped & | operator= (mapped &&o) noexcept |
|
| ~mapped () |
| Detaches the array of T , before tearing down the map.
|
|
const section_handle & | section () const noexcept |
| Returns a reference to the internal section handle.
|
|
const map_handle & | map () const noexcept |
| Returns a reference to the internal map handle.
|
|
span< T > | as_span () const noexcept |
| Returns a span referring to this mapped region.
|
|
| mapped (size_type length, bool zeroed=false, section_handle::flag _flag=section_handle::flag::readwrite) |
|
| mapped (section_handle &sh, size_type length=(size_type) -1, extent_type byteoffset=0, section_handle::flag _flag=section_handle::flag::readwrite) |
|
| mapped (file_handle &backing, size_type length=(size_type) -1, extent_type maximum_size=0, extent_type byteoffset=0, section_handle::flag _flag=section_handle::flag::readwrite) |
|
template<class T>
class llfio_v2_xxx::mapped< T >
Provides an owning, typed view of memory mapped from a section_handle
or a file_handle
suitable for feeding to STL algorithms or the Ranges TS.
This opens a new map_handle
(and if necessary a section_handle
) onto the requested offset and length of the supplied source, and thus is an owning view of mapped memory. It can be moved, but not copied.
The array of objects upon which the owning view is opened is attached via in_place_detach<T>()
in the mapped
constructor. In the final destructor (i.e. not the destructor of any moved-from instances), the array of objects is detached via in_place_detach<T>()
just before the map_handle
is destroyed. As it is illegal to attach objects into more than one address or process at a time, you must not call mapped
on objects already mapped into any process anywhere else.
These owning semantics are convenient, but may be too heavy for your use case. You can gain more fine grained control using map_handle
/mapped_file_handle
directly with P1631 attached<T>
.
- Note
- Only on the clang compiler, does
mapped
actually use P1631 in_place_attach/in_place_detach, as currently GCC and MSVC do two memcpy's of the mapped region. Also, we restrict the use of in_place_attach/in_place_detach to regions less than 4Kb in size, as even clang falls down on large regions.
Optionally can issue a blocking write barrier on destruction of the mapped view by setting the flag section_handle::flag::barrier_on_close
, thus forcing any changes to data referred to by this to storage before the destructor returns.