forked from boostorg/range
*** empty log message ***
[SVN r23988]
This commit is contained in:
@ -17,29 +17,29 @@
|
|||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_CT_DEDUCED_TYPENAME
|
#ifdef BOOST_RANGE_DEDUCED_TYPENAME
|
||||||
#error "macro already defined!"
|
#error "macro already defined!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#define BOOST_CT_DEDUCED_TYPENAME
|
#define BOOST_RANGE_DEDUCED_TYPENAME
|
||||||
#else
|
#else
|
||||||
#define BOOST_CT_DEDUCED_TYPENAME BOOST_DEDUCED_TYPENAME
|
#define BOOST_RANGE_DEDUCED_TYPENAME BOOST_DEDUCED_TYPENAME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BOOST_CT_NO_ARRAY_SUPPORT
|
#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT
|
||||||
#error "macro already defined!"
|
#error "macro already defined!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER <= 1200 && !defined( __COMO__ ) && !defined( _GNUC_ )
|
#if _MSC_VER <= 1200 && !defined( __COMO__ ) && !defined( __GNUC__ )
|
||||||
#define BOOST_CT_NO_ARRAY_SUPPORT
|
#define BOOST_RANGE_NO_ARRAY_SUPPORT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BOOST_CT_NO_ARRAY_SUPPORT
|
#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT
|
||||||
#define BOOST_ARRAY_REF (array)
|
#define BOOST_RANGE_ARRAY_REF() (array)
|
||||||
#define BOOST_CT_NO_STATIC_ASSERT
|
#define BOOST_RANGE_NO_STATIC_ASSERT
|
||||||
#else
|
#else
|
||||||
#define BOOST_ARRAY_REF (&array)
|
#define BOOST_RANGE_ARRAY_REF() (&array)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ namespace boost
|
|||||||
struct range_begin<std_container_>
|
struct range_begin<std_container_>
|
||||||
{
|
{
|
||||||
template< typename C >
|
template< typename C >
|
||||||
static BOOST_CT_DEDUCED_TYPENAME result_iterator_of<C>::type fun( C& c )
|
static BOOST_RANGE_DEDUCED_TYPENAME result_iterator_of<C>::type fun( C& c )
|
||||||
{
|
{
|
||||||
return c.begin();
|
return c.begin();
|
||||||
};
|
};
|
||||||
@ -44,7 +44,7 @@ namespace boost
|
|||||||
struct range_begin<std_pair_>
|
struct range_begin<std_pair_>
|
||||||
{
|
{
|
||||||
template< typename P >
|
template< typename P >
|
||||||
static BOOST_CT_DEDUCED_TYPENAME result_iterator_of<P>::type fun( const P& p )
|
static BOOST_RANGE_DEDUCED_TYPENAME result_iterator_of<P>::type fun( const P& p )
|
||||||
{
|
{
|
||||||
return p.first;
|
return p.first;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace boost
|
|||||||
typedef mpl::int_<12>::type string_;
|
typedef mpl::int_<12>::type string_;
|
||||||
|
|
||||||
template< typename C >
|
template< typename C >
|
||||||
struct collection_helper
|
struct range_helper
|
||||||
{
|
{
|
||||||
static C* c;
|
static C* c;
|
||||||
static C ptr;
|
static C ptr;
|
||||||
@ -79,35 +79,35 @@ namespace boost
|
|||||||
template< typename C >
|
template< typename C >
|
||||||
class range
|
class range
|
||||||
{
|
{
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::is_pair_,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_pair_,
|
||||||
boost::range_detail::std_pair_,
|
boost::range_detail::std_pair_,
|
||||||
void >::type pair_t;
|
void >::type pair_t;
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::is_array_,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_array_,
|
||||||
boost::range_detail::array_,
|
boost::range_detail::array_,
|
||||||
pair_t >::type array_t;
|
pair_t >::type array_t;
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::is_string_,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_string_,
|
||||||
boost::range_detail::string_,
|
boost::range_detail::string_,
|
||||||
array_t >::type string_t;
|
array_t >::type string_t;
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::is_const_char_ptr_,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_const_char_ptr_,
|
||||||
boost::range_detail::const_char_ptr_,
|
boost::range_detail::const_char_ptr_,
|
||||||
string_t >::type const_char_ptr_t;
|
string_t >::type const_char_ptr_t;
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::is_char_ptr_,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_char_ptr_,
|
||||||
boost::range_detail::char_ptr_,
|
boost::range_detail::char_ptr_,
|
||||||
const_char_ptr_t >::type char_ptr_t;
|
const_char_ptr_t >::type char_ptr_t;
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::is_const_wchar_t_ptr_,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_const_wchar_t_ptr_,
|
||||||
boost::range_detail::const_wchar_t_ptr_,
|
boost::range_detail::const_wchar_t_ptr_,
|
||||||
char_ptr_t >::type const_wchar_ptr_t;
|
char_ptr_t >::type const_wchar_ptr_t;
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::is_wchar_t_ptr_,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_wchar_t_ptr_,
|
||||||
boost::range_detail::wchar_t_ptr_,
|
boost::range_detail::wchar_t_ptr_,
|
||||||
const_wchar_ptr_t >::type wchar_ptr_t;
|
const_wchar_ptr_t >::type wchar_ptr_t;
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::is_wchar_t_array_,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_wchar_t_array_,
|
||||||
boost::range_detail::wchar_t_array_,
|
boost::range_detail::wchar_t_array_,
|
||||||
wchar_ptr_t >::type wchar_array_t;
|
wchar_ptr_t >::type wchar_array_t;
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::collection_helper<C>::is_char_array_,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper<C>::is_char_array_,
|
||||||
boost::range_detail::char_array_,
|
boost::range_detail::char_array_,
|
||||||
wchar_array_t >::type char_array_t;
|
wchar_array_t >::type char_array_t;
|
||||||
public:
|
public:
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< boost::is_void<char_array_t>::value,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::is_void<char_array_t>::value,
|
||||||
boost::range_detail::std_container_,
|
boost::range_detail::std_container_,
|
||||||
char_array_t >::type type;
|
char_array_t >::type type;
|
||||||
}; // class 'range'
|
}; // class 'range'
|
||||||
|
@ -44,8 +44,26 @@ namespace boost
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct range_const_iterator_<array_>; // give up
|
struct range_const_iterator_<array_>
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef void /*dummy*/ type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_const_iterator_<char_array_>
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef void /*dummy*/ type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct range_const_iterator_<char_ptr_>
|
struct range_const_iterator_<char_ptr_>
|
||||||
|
@ -41,7 +41,7 @@ namespace boost
|
|||||||
template< typename P >
|
template< typename P >
|
||||||
struct pts
|
struct pts
|
||||||
{
|
{
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::iterator_difference< BOOST_DEDUCED_TYPENAME P::first_type>::type type;
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::iterator_difference< BOOST_DEDUCED_TYPENAME P::first_type>::type type;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -55,6 +55,16 @@ namespace boost
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_difference_type_<char_array_>
|
||||||
|
{
|
||||||
|
template< typename A >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct range_difference_type_<char_ptr_>
|
struct range_difference_type_<char_ptr_>
|
||||||
{
|
{
|
||||||
@ -100,9 +110,9 @@ namespace boost
|
|||||||
template< typename C >
|
template< typename C >
|
||||||
class difference_type_of
|
class difference_type_of
|
||||||
{
|
{
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
|
typedef BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
|
||||||
public:
|
public:
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME range_detail::range_difference_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
typedef BOOST_RANGE_DEDUCED_TYPENAME range_detail::range_difference_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ namespace boost
|
|||||||
inline bool
|
inline bool
|
||||||
empty( const C& c )
|
empty( const C& c )
|
||||||
{
|
{
|
||||||
return range_detail::collection_empty< BOOST_CT_DEDUCED_TYPENAME range_detail::collection<C>::type >::fun( c );
|
return range_detail::collection_empty< BOOST_RANGE_DEDUCED_TYPENAME range_detail::collection<C>::type >::fun( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace 'boost'
|
} // namespace 'boost'
|
||||||
|
@ -20,17 +20,17 @@ namespace boost
|
|||||||
namespace range_detail
|
namespace range_detail
|
||||||
{
|
{
|
||||||
template< typename T >
|
template< typename T >
|
||||||
struct collection_end;
|
struct range_end;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// default
|
// default
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct collection_end<std_container_>
|
struct range_end<std_container_>
|
||||||
{
|
{
|
||||||
template< typename C >
|
template< typename C >
|
||||||
static BOOST_CT_DEDUCED_TYPENAME result_iterator_of<C>::type fun( C& c )
|
static BOOST_RANGE_DEDUCED_TYPENAME result_iterator_of<C>::type fun( C& c )
|
||||||
{
|
{
|
||||||
return c.end();
|
return c.end();
|
||||||
};
|
};
|
||||||
@ -41,10 +41,10 @@ namespace boost
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct collection_end<std_pair_>
|
struct range_end<std_pair_>
|
||||||
{
|
{
|
||||||
template< typename P >
|
template< typename P >
|
||||||
static BOOST_CT_DEDUCED_TYPENAME result_iterator_of<P>::type fun( const P& p )
|
static BOOST_RANGE_DEDUCED_TYPENAME result_iterator_of<P>::type fun( const P& p )
|
||||||
{
|
{
|
||||||
return p.second;
|
return p.second;
|
||||||
}
|
}
|
||||||
@ -55,10 +55,10 @@ namespace boost
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct collection_end<array_>
|
struct range_end<array_>
|
||||||
{
|
{
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
static T* fun( T BOOST_ARRAY_REF[sz] )
|
static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||||
{
|
{
|
||||||
return boost::range_detail::array_end( array );
|
return boost::range_detail::array_end( array );
|
||||||
}
|
}
|
||||||
@ -66,20 +66,20 @@ namespace boost
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct collection_end<char_array_>
|
struct range_end<char_array_>
|
||||||
{
|
{
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
static std::size_t fun( T BOOST_ARRAY_REF[sz] )
|
static std::size_t fun( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||||
{
|
{
|
||||||
return boost::range_detail::array_end( array );
|
return boost::range_detail::array_end( array );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct collection_end<wchar_t_array_>
|
struct range_end<wchar_t_array_>
|
||||||
{
|
{
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
static std::size_t fun( T BOOST_ARRAY_REF[sz] )
|
static std::size_t fun( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||||
{
|
{
|
||||||
return boost::range_detail::array_end( array );
|
return boost::range_detail::array_end( array );
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ namespace boost
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct collection_end<char_ptr_>
|
struct range_end<char_ptr_>
|
||||||
{
|
{
|
||||||
static char* fun( char* s )
|
static char* fun( char* s )
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct collection_end<const_char_ptr_>
|
struct range_end<const_char_ptr_>
|
||||||
{
|
{
|
||||||
static const char* fun( const char* s )
|
static const char* fun( const char* s )
|
||||||
{
|
{
|
||||||
@ -108,7 +108,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct collection_end<wchar_t_ptr_>
|
struct range_end<wchar_t_ptr_>
|
||||||
{
|
{
|
||||||
static wchar_t* fun( wchar_t* s )
|
static wchar_t* fun( wchar_t* s )
|
||||||
{
|
{
|
||||||
@ -118,7 +118,7 @@ namespace boost
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct collection_end<const_wchar_t_ptr_>
|
struct range_end<const_wchar_t_ptr_>
|
||||||
{
|
{
|
||||||
static const wchar_t* fun( const wchar_t* s )
|
static const wchar_t* fun( const wchar_t* s )
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ namespace boost
|
|||||||
inline BOOST_DEDUCED_TYPENAME result_iterator_of<C>::type
|
inline BOOST_DEDUCED_TYPENAME result_iterator_of<C>::type
|
||||||
end( C& c )
|
end( C& c )
|
||||||
{
|
{
|
||||||
return range_detail::collection_end< BOOST_DEDUCED_TYPENAME range_detail::collection<C>::type >::fun( c );
|
return range_detail::range_end< BOOST_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace 'boost'
|
} // namespace 'boost'
|
||||||
|
@ -58,33 +58,33 @@ namespace boost
|
|||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline T* array_end( T (&array)[sz], int )
|
inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz], int )
|
||||||
{
|
{
|
||||||
return array + sz;
|
return array + sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline const T* array_end( const T (&array)[sz], int )
|
inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz], int )
|
||||||
{
|
{
|
||||||
return array + sz;
|
return array + sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline T* array_end( T (&array)[sz], char_or_wchar_t_array_tag )
|
inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz], char_or_wchar_t_array_tag )
|
||||||
{
|
{
|
||||||
return array + sz - 1;
|
return array + sz - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline const T* array_end( const T (&array)[sz], char_or_wchar_t_array_tag )
|
inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz], char_or_wchar_t_array_tag )
|
||||||
{
|
{
|
||||||
return array + sz - 1;
|
return array + sz - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline T* array_end( T (&array)[sz] )
|
inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||||
{
|
{
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< is_same<char,T>::value || is_same<wchar_t,T>::value,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same<char,T>::value || is_same<wchar_t,T>::value,
|
||||||
char_or_wchar_t_array_tag,
|
char_or_wchar_t_array_tag,
|
||||||
int >::type tag;
|
int >::type tag;
|
||||||
|
|
||||||
@ -92,9 +92,9 @@ namespace boost
|
|||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline const T* array_end( const T (&array)[sz] )
|
inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||||
{
|
{
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< is_same<char,T>::value || is_same<wchar_t,T>::value,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same<char,T>::value || is_same<wchar_t,T>::value,
|
||||||
char_or_wchar_t_array_tag,
|
char_or_wchar_t_array_tag,
|
||||||
int >::type tag;
|
int >::type tag;
|
||||||
|
|
||||||
@ -112,42 +112,42 @@ namespace boost
|
|||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline std::size_t array_size( T BOOST_ARRAY_REF[sz], int )
|
inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz], int )
|
||||||
{
|
{
|
||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline std::size_t array_size( const T BOOST_ARRAY_REF[sz], int )
|
inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz], int )
|
||||||
{
|
{
|
||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline std::size_t array_size( T BOOST_ARRAY_REF[sz], char_or_wchar_t_array_tag )
|
inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz], char_or_wchar_t_array_tag )
|
||||||
{
|
{
|
||||||
return sz - 1;
|
return sz - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline std::size_t array_size( const T BOOST_ARRAY_REF[sz], char_or_wchar_t_array_tag )
|
inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz], char_or_wchar_t_array_tag )
|
||||||
{
|
{
|
||||||
return sz - 1;
|
return sz - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline std::size_t array_size( T (&array)[sz] )
|
inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||||
{
|
{
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< is_same<char,T>::value || is_same<wchar_t,T>::value,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same<char,T>::value || is_same<wchar_t,T>::value,
|
||||||
char_or_wchar_t_array_tag,
|
char_or_wchar_t_array_tag,
|
||||||
int >::type tag;
|
int >::type tag;
|
||||||
return array_size<T,sz>( array, tag() );
|
return array_size<T,sz>( array, tag() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
inline std::size_t array_size( const T (&array)[sz] )
|
inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||||
{
|
{
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME boost::mpl::if_c< is_same<char,T>::value || is_same<wchar_t,T>::value,
|
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< is_same<char,T>::value || is_same<wchar_t,T>::value,
|
||||||
char_or_wchar_t_array_tag,
|
char_or_wchar_t_array_tag,
|
||||||
int >::type tag;
|
int >::type tag;
|
||||||
return array_size<T,sz>( array, tag() );
|
return array_size<T,sz>( array, tag() );
|
||||||
|
@ -45,7 +45,24 @@ namespace boost
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct range_iterator_<array_>; // give up
|
struct range_iterator_<array_>
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef void /*dummy*/ type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_iterator_<char_array_>
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef void /*dummy*/ type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct range_iterator_<char_ptr_>
|
struct range_iterator_<char_ptr_>
|
||||||
|
@ -32,7 +32,7 @@ namespace boost
|
|||||||
struct collection_size<std_container_>
|
struct collection_size<std_container_>
|
||||||
{
|
{
|
||||||
template< typename C >
|
template< typename C >
|
||||||
static BOOST_CT_DEDUCED_TYPENAME C::size_type fun( const C& c )
|
static BOOST_RANGE_DEDUCED_TYPENAME C::size_type fun( const C& c )
|
||||||
{
|
{
|
||||||
return c.size();
|
return c.size();
|
||||||
};
|
};
|
||||||
@ -46,7 +46,7 @@ namespace boost
|
|||||||
struct collection_size<std_pair_>
|
struct collection_size<std_pair_>
|
||||||
{
|
{
|
||||||
template< typename P >
|
template< typename P >
|
||||||
static BOOST_CT_DEDUCED_TYPENAME size_type_of<P>::type fun( const P& p )
|
static BOOST_RANGE_DEDUCED_TYPENAME size_type_of<P>::type fun( const P& p )
|
||||||
{
|
{
|
||||||
return std::distance( p.first, p.second );
|
return std::distance( p.first, p.second );
|
||||||
}
|
}
|
||||||
@ -130,10 +130,10 @@ namespace boost
|
|||||||
|
|
||||||
|
|
||||||
template< typename C >
|
template< typename C >
|
||||||
BOOST_CT_DEDUCED_TYPENAME size_type_of<C>::type
|
BOOST_RANGE_DEDUCED_TYPENAME size_type_of<C>::type
|
||||||
size( const C& c )
|
size( const C& c )
|
||||||
{
|
{
|
||||||
return range_detail::collection_size< BOOST_CT_DEDUCED_TYPENAME range_detail::collection<C>::type >::fun( c );
|
return range_detail::collection_size< BOOST_RANGE_DEDUCED_TYPENAME range_detail::collection<C>::type >::fun( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace 'boost'
|
} // namespace 'boost'
|
||||||
|
@ -54,6 +54,16 @@ namespace boost
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_size_type_<char_array_>
|
||||||
|
{
|
||||||
|
template< typename A >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef std::size_t type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct range_size_type_<char_ptr_>
|
struct range_size_type_<char_ptr_>
|
||||||
{
|
{
|
||||||
|
@ -26,11 +26,11 @@ namespace boost
|
|||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
char&
|
char&
|
||||||
sizer( const T BOOST_ARRAY_REF[sz] )[sz];
|
sizer( const T BOOST_RANGE_ARRAY_REF()[sz] )[sz];
|
||||||
|
|
||||||
template< typename T, std::size_t sz >
|
template< typename T, std::size_t sz >
|
||||||
char&
|
char&
|
||||||
sizer( T BOOST_ARRAY_REF[sz] )[sz];
|
sizer( T BOOST_RANGE_ARRAY_REF()[sz] )[sz];
|
||||||
|
|
||||||
} // namespace 'boost'
|
} // namespace 'boost'
|
||||||
|
|
||||||
|
@ -41,12 +41,29 @@ namespace boost
|
|||||||
template< typename P >
|
template< typename P >
|
||||||
struct pts
|
struct pts
|
||||||
{
|
{
|
||||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_value< BOOST_CT_DEDUCED_TYPENAME P::first_type >::type type;
|
typedef BOOST_DEDUCED_TYPENAME boost::iterator_value< BOOST_RANGE_DEDUCED_TYPENAME P::first_type >::type type;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct range_value_type_<array_>
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef void /*dummy*/ type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct range_value_type_<array_>; // give up
|
struct range_value_type_<char_array_>
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
|
struct pts
|
||||||
|
{
|
||||||
|
typedef char type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct range_value_type_<char_ptr_>
|
struct range_value_type_<char_ptr_>
|
||||||
|
@ -30,7 +30,7 @@ namespace boost
|
|||||||
template< typename C >
|
template< typename C >
|
||||||
struct result_iterator_of
|
struct result_iterator_of
|
||||||
{
|
{
|
||||||
typedef BOOST_CT_DEDUCED_TYPENAME
|
typedef BOOST_RANGE_DEDUCED_TYPENAME
|
||||||
mpl::if_< BOOST_DEDUCED_TYPENAME is_const<C>::type,
|
mpl::if_< BOOST_DEDUCED_TYPENAME is_const<C>::type,
|
||||||
BOOST_DEDUCED_TYPENAME const_iterator_of<C>::type,
|
BOOST_DEDUCED_TYPENAME const_iterator_of<C>::type,
|
||||||
BOOST_DEDUCED_TYPENAME iterator_of<C>::type >::type type;
|
BOOST_DEDUCED_TYPENAME iterator_of<C>::type >::type type;
|
||||||
|
@ -35,7 +35,7 @@ namespace range
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template< typename C >
|
template< typename C >
|
||||||
inline BOOST_CT_DEDUCED_TYPENAME C::size_type
|
inline BOOST_RANGE_DEDUCED_TYPENAME C::size_type
|
||||||
size( const C& c )
|
size( const C& c )
|
||||||
{
|
{
|
||||||
return c.size();
|
return c.size();
|
||||||
|
Reference in New Issue
Block a user