forked from boostorg/range
*** empty log message ***
[SVN r30927]
This commit is contained in:
@ -22,11 +22,13 @@ namespace boost
|
|||||||
// Specialize metafunctions. We must include the range.hpp header.
|
// Specialize metafunctions. We must include the range.hpp header.
|
||||||
// We must open the 'boost' namespace.
|
// We must open the 'boost' namespace.
|
||||||
//
|
//
|
||||||
|
/*
|
||||||
template< class T >
|
template< class T >
|
||||||
struct range_value< Foo::Pair<T> >
|
struct range_value< Foo::Pair<T> >
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<T>::value_type type;
|
typedef typename std::iterator_traits<T>::value_type type;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
struct range_iterator< Foo::Pair<T> >
|
struct range_iterator< Foo::Pair<T> >
|
||||||
@ -45,11 +47,13 @@ namespace boost
|
|||||||
typedef T type;
|
typedef T type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
template< class T >
|
template< class T >
|
||||||
struct range_difference< Foo::Pair<T> >
|
struct range_difference< Foo::Pair<T> >
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<T>::difference_type type;
|
typedef typename std::iterator_traits<T>::difference_type type;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
struct range_size< Foo::Pair<T> >
|
struct range_size< Foo::Pair<T> >
|
||||||
@ -108,6 +112,7 @@ int main()
|
|||||||
{
|
{
|
||||||
typedef std::vector<int>::iterator iter;
|
typedef std::vector<int>::iterator iter;
|
||||||
std::vector<int> vec;
|
std::vector<int> vec;
|
||||||
|
vec.push_back( 42 );
|
||||||
Foo::Pair<iter> pair = { vec.begin(), vec.end() };
|
Foo::Pair<iter> pair = { vec.begin(), vec.end() };
|
||||||
const Foo::Pair<iter>& cpair = pair;
|
const Foo::Pair<iter>& cpair = pair;
|
||||||
//
|
//
|
||||||
@ -122,4 +127,15 @@ int main()
|
|||||||
boost::range_const_reverse_iterator< Foo::Pair<iter> >::type
|
boost::range_const_reverse_iterator< Foo::Pair<iter> >::type
|
||||||
ri = boost::rbegin( cpair ),
|
ri = boost::rbegin( cpair ),
|
||||||
re = boost::rend( cpair );
|
re = boost::rend( cpair );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test metafunctions
|
||||||
|
//
|
||||||
|
|
||||||
|
boost::range_value< Foo::Pair<iter> >::type
|
||||||
|
v = *boost::begin(pair);
|
||||||
|
|
||||||
|
boost::range_difference< Foo::Pair<iter> >::type
|
||||||
|
d = boost::end(pair) - boost::begin(pair);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/range/config.hpp>
|
#include <boost/range/config.hpp>
|
||||||
|
/*
|
||||||
#include <boost/range/difference_type.hpp>
|
#include <boost/range/difference_type.hpp>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@ -62,8 +63,8 @@ namespace boost
|
|||||||
type;
|
type;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
#include <boost/range/detail/size_type.hpp>
|
#include <boost/range/detail/size_type.hpp>
|
||||||
#else
|
#else
|
||||||
@ -170,6 +171,6 @@ namespace boost
|
|||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
*/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,11 +62,13 @@ namespace Foo
|
|||||||
return x.vec.begin();
|
return x.vec.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline X::const_iterator boost_range_begin( const X& x )
|
inline X::const_iterator boost_range_begin( const X& x )
|
||||||
{
|
{
|
||||||
return x.vec.begin();
|
return x.vec.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline X::iterator boost_range_end( X& x )
|
inline X::iterator boost_range_end( X& x )
|
||||||
{
|
{
|
||||||
return x.vec.end();
|
return x.vec.end();
|
||||||
|
Reference in New Issue
Block a user