1 #ifndef SILICIUM_MEMORY_RANGE_HPP
2 #define SILICIUM_MEMORY_RANGE_HPP
5 #include <boost/mpl/if.hpp>
6 #include <boost/type_traits/add_const.hpp>
7 #include <boost/type_traits/remove_const.hpp>
8 #include <boost/type_traits/is_const.hpp>
9 #include <boost/static_assert.hpp>
10 #include <boost/utility/addressof.hpp>
20 template <
class To,
class From>
23 typedef typename boost::mpl::if_<boost::is_const<From>, boost::add_const<To>, boost::remove_const<To>>::type::type
type;
26 template <class Byte, class DestType = typename copy_const<char, Byte>::type>
28 #if !SILICIUM_COMPILER_HAS_AUTO_RETURN_TYPE
35 reinterpret_cast<DestType *>(begin),
36 reinterpret_cast<DestType *>(end)
47 template <
class ContiguousRange>
49 #if !SILICIUM_COMPILER_HAS_AUTO_RETURN_TYPE
56 auto begin_ =
begin(range);
57 auto end_ =
end(range);
58 BOOST_STATIC_ASSERT((std::is_same<std::random_access_iterator_tag,
typename std::iterator_traits<decltype(begin_)>::iterator_category>::value));
59 auto data = boost::addressof(*begin_);
65 #if !SILICIUM_COMPILER_HAS_AUTO_RETURN_TYPE
BOOST_STATIC_ASSERT(Si::is_handle< absolute_path >::value)
Definition: absolute_path.hpp:19
BOOST_CONSTEXPR Iterator const & end(iterator_range< Iterator > const &range)
Definition: iterator_range.hpp:136
auto make_c_str_range(C const *str) -> iterator_range< C const * >
Definition: memory_range.hpp:64
iterator_range< char * > mutable_memory_range
Definition: memory_range.hpp:15
BOOST_CONSTEXPR Iterator const & begin(iterator_range< Iterator > const &range)
Definition: iterator_range.hpp:123
Definition: iterator_range.hpp:26
Definition: memory_range.hpp:21
BOOST_CONSTEXPR auto make_iterator_range(Iterator1 &&begin, Iterator2 &&end) -> iterator_range< typename std::decay< Iterator1 >::type >
Definition: iterator_range.hpp:142
Definition: is_handle.hpp:21
boost::mpl::if_< boost::is_const< From >, boost::add_const< To >, boost::remove_const< To > >::type::type type
Definition: memory_range.hpp:23
iterator_range< char const * > memory_range
Definition: memory_range.hpp:14
auto make_memory_range(Byte *begin, Byte *end) -> iterator_range< DestType * >
Definition: memory_range.hpp:27