make use of partial template specialization where available.

-> fixed metrowerks


[SVN r22555]
This commit is contained in:
Pavol Droba
2004-03-26 09:14:17 +00:00
parent 6dccaf3fcb
commit d9f4e3524d
5 changed files with 209 additions and 52 deletions

View File

@ -35,6 +35,8 @@ namespace boost {
// sequence traits -----------------------------------------------//
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
//! Native replace tester
/*!
Declare an override of this tester function with return
@ -45,21 +47,6 @@ namespace boost {
*/
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
/*!
Declare an override of this tester function with return
@ -70,23 +57,6 @@ namespace boost {
*/
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
/*!
Declare an override of this tester function with return
@ -96,22 +66,6 @@ namespace boost {
*/
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
/*!
Declare an override of this tester function with return
@ -121,6 +75,78 @@ namespace boost {
*/
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
/*!
This trait specifies that the sequence's erase method has
@ -129,11 +155,17 @@ namespace boost {
template< typename T >
class has_const_time_erase
{
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
private:
static T* t;
public:
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;
};