1 #ifndef stk_util_util_random_access_iterator_wrapper_hpp 2 #define stk_util_util_random_access_iterator_wrapper_hpp 4 #include <boost/iterator/iterator_adaptor.hpp> 6 #ifndef BOOST_NO_SFINAE 7 # include <boost/type_traits/is_convertible.hpp> 8 # include <boost/utility/enable_if.hpp> 14 template <
class Value>
15 class random_access_iterator_wrapper
16 :
public boost::iterator_adaptor<
17 random_access_iterator_wrapper<Value>
20 , boost::random_access_traversal_tag
25 typedef boost::iterator_adaptor<
26 random_access_iterator_wrapper<Value>,
29 boost::random_access_traversal_tag
35 random_access_iterator_wrapper()
38 explicit random_access_iterator_wrapper(Value* p)
41 Value& operator[] (ptrdiff_t index)
42 {
return *(*
this + index); }
44 template <
class OtherValue>
45 random_access_iterator_wrapper(
46 random_access_iterator_wrapper<OtherValue>
const& other
47 # ifndef BOOST_NO_SFINAE
48 ,
typename boost::enable_if<
49 boost::is_convertible<OtherValue*,Value*>
54 : base_type(other.base()) {}