mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-05 00:36:32 +02:00
make use of partial template specialization where available.
-> fixed metrowerks [SVN r22555]
This commit is contained in:
@ -35,6 +35,8 @@ namespace boost {
|
|||||||
|
|
||||||
// sequence traits -----------------------------------------------//
|
// sequence traits -----------------------------------------------//
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
//! Native replace tester
|
//! Native replace tester
|
||||||
/*!
|
/*!
|
||||||
Declare an override of this tester function with return
|
Declare an override of this tester function with return
|
||||||
@ -45,21 +47,6 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
no_type has_native_replace_tester(...);
|
no_type has_native_replace_tester(...);
|
||||||
|
|
||||||
//! Native replace trait
|
|
||||||
/*!
|
|
||||||
This trait specifies that the sequence has \c std::string like replace method
|
|
||||||
*/
|
|
||||||
template< typename T >
|
|
||||||
class has_native_replace
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
static T* t;
|
|
||||||
public:
|
|
||||||
BOOST_STATIC_CONSTANT(bool, value=(
|
|
||||||
sizeof(has_native_replace_tester(t))==sizeof(yes_type) ) );
|
|
||||||
typedef mpl::bool_<value> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Stable iterators tester
|
//! Stable iterators tester
|
||||||
/*!
|
/*!
|
||||||
Declare an override of this tester function with return
|
Declare an override of this tester function with return
|
||||||
@ -70,23 +57,6 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
no_type has_stable_iterators_tester(...);
|
no_type has_stable_iterators_tester(...);
|
||||||
|
|
||||||
//! Stable iterators trait
|
|
||||||
/*!
|
|
||||||
This trait specifies that the sequence has stable iterators. It means,
|
|
||||||
that operations like insert/erase/replace do not invalidate iterators.
|
|
||||||
*/
|
|
||||||
template< typename T >
|
|
||||||
class has_stable_iterators
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
static T* t;
|
|
||||||
public:
|
|
||||||
|
|
||||||
BOOST_STATIC_CONSTANT(bool, value=(
|
|
||||||
sizeof(has_stable_iterators_tester(t))==sizeof(yes_type) ) );
|
|
||||||
typedef mpl::bool_<value> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! const time insert tester
|
//! const time insert tester
|
||||||
/*!
|
/*!
|
||||||
Declare an override of this tester function with return
|
Declare an override of this tester function with return
|
||||||
@ -96,22 +66,6 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
no_type has_const_time_insert_tester(...);
|
no_type has_const_time_insert_tester(...);
|
||||||
|
|
||||||
//! Const time insert trait
|
|
||||||
/*!
|
|
||||||
This trait specifies that the sequence's insert method has
|
|
||||||
constant time complexity.
|
|
||||||
*/
|
|
||||||
template< typename T >
|
|
||||||
class has_const_time_insert
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
static T* t;
|
|
||||||
public:
|
|
||||||
BOOST_STATIC_CONSTANT(bool, value=(
|
|
||||||
sizeof(has_const_time_insert_tester(t))==sizeof(yes_type) ) );
|
|
||||||
typedef mpl::bool_<value> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! const time erase tester
|
//! const time erase tester
|
||||||
/*!
|
/*!
|
||||||
Declare an override of this tester function with return
|
Declare an override of this tester function with return
|
||||||
@ -121,6 +75,78 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
no_type has_const_time_erase_tester(...);
|
no_type has_const_time_erase_tester(...);
|
||||||
|
|
||||||
|
#endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
//! Native replace trait
|
||||||
|
/*!
|
||||||
|
This trait specifies that the sequence has \c std::string like replace method
|
||||||
|
*/
|
||||||
|
template< typename T >
|
||||||
|
class has_native_replace
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
private:
|
||||||
|
static T* t;
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=(
|
||||||
|
sizeof(has_native_replace_tester(t))==sizeof(yes_type) ) );
|
||||||
|
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=false);
|
||||||
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//! Stable iterators trait
|
||||||
|
/*!
|
||||||
|
This trait specifies that the sequence has stable iterators. It means,
|
||||||
|
that operations like insert/erase/replace do not invalidate iterators.
|
||||||
|
*/
|
||||||
|
template< typename T >
|
||||||
|
class has_stable_iterators
|
||||||
|
{
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
private:
|
||||||
|
static T* t;
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=(
|
||||||
|
sizeof(has_stable_iterators_tester(t))==sizeof(yes_type) ) );
|
||||||
|
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=false);
|
||||||
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//! Const time insert trait
|
||||||
|
/*!
|
||||||
|
This trait specifies that the sequence's insert method has
|
||||||
|
constant time complexity.
|
||||||
|
*/
|
||||||
|
template< typename T >
|
||||||
|
class has_const_time_insert
|
||||||
|
{
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
private:
|
||||||
|
static T* t;
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=(
|
||||||
|
sizeof(has_const_time_insert(t))==sizeof(yes_type) ) );
|
||||||
|
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=false);
|
||||||
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//! Const time erase trait
|
//! Const time erase trait
|
||||||
/*!
|
/*!
|
||||||
This trait specifies that the sequence's erase method has
|
This trait specifies that the sequence's erase method has
|
||||||
@ -129,11 +155,17 @@ namespace boost {
|
|||||||
template< typename T >
|
template< typename T >
|
||||||
class has_const_time_erase
|
class has_const_time_erase
|
||||||
{
|
{
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
private:
|
private:
|
||||||
static T* t;
|
static T* t;
|
||||||
public:
|
public:
|
||||||
BOOST_STATIC_CONSTANT(bool, value=(
|
BOOST_STATIC_CONSTANT(bool, value=(
|
||||||
sizeof(has_const_time_erase_tester(t))==sizeof(yes_type) ) );
|
sizeof(has_const_time_erase))==sizeof(yes_type) ) );
|
||||||
|
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=false);
|
||||||
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<value> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,17 +18,51 @@ namespace boost {
|
|||||||
|
|
||||||
// std::list<> traits -----------------------------------------------//
|
// std::list<> traits -----------------------------------------------//
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
// stable iterators tester
|
// stable iterators tester
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
yes_type has_stable_iterators_tester( const std::list<T,AllocT>* );
|
yes_type has_stable_iterators_tester( const ::std::list<T,AllocT>* )
|
||||||
|
|
||||||
// const time insert tester
|
// const time insert tester
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
yes_type has_const_time_insert_tester( const std::list<T,AllocT>* );
|
yes_type has_const_time_insert_tester( const ::std::list<T,AllocT>* )
|
||||||
|
|
||||||
// const time erase tester
|
// const time erase tester
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
yes_type has_const_time_erase_tester( const std::list<T,AllocT>* );
|
yes_type has_const_time_erase_tester( const ::std::list<T,AllocT>* );
|
||||||
|
|
||||||
|
|
||||||
|
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
// stable iterators trait
|
||||||
|
template<typename T, typename AllocT>
|
||||||
|
class has_stable_iterators< ::std::list<T,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// const time insert trait
|
||||||
|
template<typename T, typename AllocT>
|
||||||
|
class has_const_time_insert< ::std::list<T,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// const time erase trait
|
||||||
|
template<typename T, typename AllocT>
|
||||||
|
class has_const_time_erase< ::std::list<T,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // namespace algorithm
|
} // namespace algorithm
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
@ -18,6 +18,8 @@ namespace boost {
|
|||||||
|
|
||||||
// SGI's std::rope<> traits -----------------------------------------------//
|
// SGI's std::rope<> traits -----------------------------------------------//
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
// native replace tester
|
// native replace tester
|
||||||
template<typename T, typename TraitsT, typename AllocT>
|
template<typename T, typename TraitsT, typename AllocT>
|
||||||
yes_type has_native_replace_tester( const std::rope<T, TraitsT, AllocT>* );
|
yes_type has_native_replace_tester( const std::rope<T, TraitsT, AllocT>* );
|
||||||
@ -34,6 +36,46 @@ namespace boost {
|
|||||||
template<typename T, typename TraitsT, typename AllocT>
|
template<typename T, typename TraitsT, typename AllocT>
|
||||||
yes_type has_const_time_erase_tester( const std::rope<T, TraitsT, AllocT>* );
|
yes_type has_const_time_erase_tester( const std::rope<T, TraitsT, AllocT>* );
|
||||||
|
|
||||||
|
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
// native replace trait
|
||||||
|
template<typename T, typename TraitsT, typename AllocT>
|
||||||
|
class has_native_replace< std::rope<T,TraitsT,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// stable iterators trait
|
||||||
|
template<typename T, typename TraitsT, typename AllocT>
|
||||||
|
class has_stable_iterators< std::rope<T,TraitsT,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// const time insert trait
|
||||||
|
template<typename T, typename TraitsT, typename AllocT>
|
||||||
|
class has_const_time_insert< std::rope<T,TraitsT,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// const time erase trait
|
||||||
|
template<typename T, typename TraitsT, typename AllocT>
|
||||||
|
class has_const_time_erase< std::rope<T,TraitsT,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // namespace algorithm
|
} // namespace algorithm
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ namespace boost {
|
|||||||
|
|
||||||
// SGI's std::slist<> traits -----------------------------------------------//
|
// SGI's std::slist<> traits -----------------------------------------------//
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
// stable iterators tester
|
// stable iterators tester
|
||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
yes_type has_stable_iterators_tester( const std::slist<T,AllocT>* );
|
yes_type has_stable_iterators_tester( const std::slist<T,AllocT>* );
|
||||||
@ -30,6 +32,37 @@ namespace boost {
|
|||||||
template<typename T, typename AllocT>
|
template<typename T, typename AllocT>
|
||||||
yes_type has_const_time_erase_tester( const std::slist<T,AllocT>* );
|
yes_type has_const_time_erase_tester( const std::slist<T,AllocT>* );
|
||||||
|
|
||||||
|
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
// stable iterators trait
|
||||||
|
template<typename T, typename AllocT>
|
||||||
|
class has_stable_iterators< std::slist<T,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// const time insert trait
|
||||||
|
template<typename T, typename AllocT>
|
||||||
|
class has_const_time_insert< std::slist<T,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
// const time erase trait
|
||||||
|
template<typename T, typename AllocT>
|
||||||
|
class has_const_time_erase< std::slist<T,AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // namespace algorithm
|
} // namespace algorithm
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
@ -18,10 +18,26 @@ namespace boost {
|
|||||||
|
|
||||||
// std::basic_string<> traits -----------------------------------------------//
|
// std::basic_string<> traits -----------------------------------------------//
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
// native replace tester
|
// native replace tester
|
||||||
template<typename T, typename TraitsT, typename AllocT>
|
template<typename T, typename TraitsT, typename AllocT>
|
||||||
yes_type has_native_replace_tester( const std::basic_string<T, TraitsT, AllocT>* );
|
yes_type has_native_replace_tester( const std::basic_string<T, TraitsT, AllocT>* );
|
||||||
|
|
||||||
|
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
|
// native replace trait
|
||||||
|
template<typename T, typename TraitsT, typename AllocT>
|
||||||
|
class has_native_replace< std::basic_string<T, TraitsT, AllocT> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BOOST_STATIC_CONSTANT(bool, value=true);
|
||||||
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
|
||||||
} // namespace algorithm
|
} // namespace algorithm
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user