*** empty log message ***

[SVN r23988]
This commit is contained in:
Thorsten Jørgen Ottosen
2004-07-23 14:00:36 +00:00
parent 25ecc19ec1
commit d78d5e3fd6
15 changed files with 145 additions and 73 deletions

View File

@ -17,29 +17,29 @@
#include <boost/config.hpp>
#ifdef BOOST_CT_DEDUCED_TYPENAME
#ifdef BOOST_RANGE_DEDUCED_TYPENAME
#error "macro already defined!"
#endif
#ifdef __BORLANDC__
#define BOOST_CT_DEDUCED_TYPENAME
#define BOOST_RANGE_DEDUCED_TYPENAME
#else
#define BOOST_CT_DEDUCED_TYPENAME BOOST_DEDUCED_TYPENAME
#define BOOST_RANGE_DEDUCED_TYPENAME BOOST_DEDUCED_TYPENAME
#endif
#ifdef BOOST_CT_NO_ARRAY_SUPPORT
#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT
#error "macro already defined!"
#endif
#if _MSC_VER <= 1200 && !defined( __COMO__ ) && !defined( _GNUC_ )
#define BOOST_CT_NO_ARRAY_SUPPORT
#if _MSC_VER <= 1200 && !defined( __COMO__ ) && !defined( __GNUC__ )
#define BOOST_RANGE_NO_ARRAY_SUPPORT 1
#endif
#ifdef BOOST_CT_NO_ARRAY_SUPPORT
#define BOOST_ARRAY_REF (array)
#define BOOST_CT_NO_STATIC_ASSERT
#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT
#define BOOST_RANGE_ARRAY_REF() (array)
#define BOOST_RANGE_NO_STATIC_ASSERT
#else
#define BOOST_ARRAY_REF (&array)
#define BOOST_RANGE_ARRAY_REF() (&array)
#endif

View File

@ -30,7 +30,7 @@ namespace boost
struct range_begin<std_container_>
{
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();
};
@ -44,7 +44,7 @@ namespace boost
struct range_begin<std_pair_>
{
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;
}

View File

@ -59,7 +59,7 @@ namespace boost
typedef mpl::int_<12>::type string_;
template< typename C >
struct collection_helper
struct range_helper
{
static C* c;
static C ptr;
@ -79,35 +79,35 @@ namespace boost
template< typename C >
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_,
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_,
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_,
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_,
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_,
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_,
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_,
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_,
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_,
wchar_array_t >::type char_array_t;
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_,
char_array_t >::type type;
}; // class 'range'

View File

@ -44,8 +44,26 @@ namespace boost
};
};
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<>
struct range_const_iterator_<char_ptr_>

View File

@ -41,7 +41,7 @@ namespace boost
template< typename P >
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<>
struct range_difference_type_<char_ptr_>
{
@ -100,9 +110,9 @@ namespace boost
template< typename C >
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:
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;
};
}

View File

@ -111,7 +111,7 @@ namespace boost
inline bool
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'

View File

@ -20,17 +20,17 @@ namespace boost
namespace range_detail
{
template< typename T >
struct collection_end;
struct range_end;
//////////////////////////////////////////////////////////////////////
// default
//////////////////////////////////////////////////////////////////////
template<>
struct collection_end<std_container_>
struct range_end<std_container_>
{
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();
};
@ -41,10 +41,10 @@ namespace boost
//////////////////////////////////////////////////////////////////////
template<>
struct collection_end<std_pair_>
struct range_end<std_pair_>
{
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;
}
@ -55,10 +55,10 @@ namespace boost
//////////////////////////////////////////////////////////////////////
template<>
struct collection_end<array_>
struct range_end<array_>
{
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 );
}
@ -66,20 +66,20 @@ namespace boost
template<>
struct collection_end<char_array_>
struct range_end<char_array_>
{
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 );
}
};
template<>
struct collection_end<wchar_t_array_>
struct range_end<wchar_t_array_>
{
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 );
}
@ -90,7 +90,7 @@ namespace boost
//////////////////////////////////////////////////////////////////////
template<>
struct collection_end<char_ptr_>
struct range_end<char_ptr_>
{
static char* fun( char* s )
{
@ -99,7 +99,7 @@ namespace boost
};
template<>
struct collection_end<const_char_ptr_>
struct range_end<const_char_ptr_>
{
static const char* fun( const char* s )
{
@ -108,7 +108,7 @@ namespace boost
};
template<>
struct collection_end<wchar_t_ptr_>
struct range_end<wchar_t_ptr_>
{
static wchar_t* fun( wchar_t* s )
{
@ -118,7 +118,7 @@ namespace boost
template<>
struct collection_end<const_wchar_t_ptr_>
struct range_end<const_wchar_t_ptr_>
{
static const wchar_t* fun( const wchar_t* s )
{
@ -132,7 +132,7 @@ namespace boost
inline BOOST_DEDUCED_TYPENAME result_iterator_of<C>::type
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'

View File

@ -58,33 +58,33 @@ namespace boost
}
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;
}
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;
}
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;
}
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;
}
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,
int >::type tag;
@ -92,9 +92,9 @@ namespace boost
}
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,
int >::type tag;
@ -112,42 +112,42 @@ namespace boost
}
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;
}
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;
}
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;
}
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;
}
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,
int >::type tag;
return array_size<T,sz>( array, tag() );
}
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,
int >::type tag;
return array_size<T,sz>( array, tag() );

View File

@ -45,7 +45,24 @@ namespace boost
};
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<>
struct range_iterator_<char_ptr_>

View File

@ -32,7 +32,7 @@ namespace boost
struct collection_size<std_container_>
{
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();
};
@ -46,7 +46,7 @@ namespace boost
struct collection_size<std_pair_>
{
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 );
}
@ -130,10 +130,10 @@ namespace boost
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 )
{
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'

View File

@ -54,6 +54,16 @@ namespace boost
};
};
template<>
struct range_size_type_<char_array_>
{
template< typename A >
struct pts
{
typedef std::size_t type;
};
};
template<>
struct range_size_type_<char_ptr_>
{

View File

@ -26,11 +26,11 @@ namespace boost
template< typename T, std::size_t sz >
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 >
char&
sizer( T BOOST_ARRAY_REF[sz] )[sz];
sizer( T BOOST_RANGE_ARRAY_REF()[sz] )[sz];
} // namespace 'boost'

View File

@ -41,12 +41,29 @@ namespace boost
template< typename P >
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_>; // give up
struct range_value_type_<array_>
{
template< typename T >
struct pts
{
typedef void /*dummy*/ type;
};
};
template<>
struct range_value_type_<char_array_>
{
template< typename T >
struct pts
{
typedef char type;
};
};
template<>
struct range_value_type_<char_ptr_>

View File

@ -30,7 +30,7 @@ namespace boost
template< typename C >
struct result_iterator_of
{
typedef BOOST_CT_DEDUCED_TYPENAME
typedef BOOST_RANGE_DEDUCED_TYPENAME
mpl::if_< BOOST_DEDUCED_TYPENAME is_const<C>::type,
BOOST_DEDUCED_TYPENAME const_iterator_of<C>::type,
BOOST_DEDUCED_TYPENAME iterator_of<C>::type >::type type;

View File

@ -35,7 +35,7 @@ namespace range
//////////////////////////////////////////////////////////////////////
template< typename C >
inline BOOST_CT_DEDUCED_TYPENAME C::size_type
inline BOOST_RANGE_DEDUCED_TYPENAME C::size_type
size( const C& c )
{
return c.size();