bcc32 patch from Russell Hind applied

[SVN r28811]
This commit is contained in:
Pavol Droba
2005-05-11 09:17:14 +00:00
parent 5419d39b2e
commit e00fd7f159
8 changed files with 82 additions and 66 deletions

View File

@ -14,7 +14,7 @@
#include <locale>
/*! \file
Defines element comparison predicates. Many algorithms in this library can
Defines element comparison predicates. Many algorithms in this library can
take an additional argument with a predicate used to compare elements.
This makes it possible, for instance, to have case insensitive versions
of the algorithms.
@ -22,7 +22,7 @@
namespace boost {
namespace algorithm {
// is_equal functor -----------------------------------------------//
//! is_equal functor
@ -54,24 +54,28 @@ namespace boost {
/*!
\param Loc locales used for comparison
*/
is_iequal( const std::locale& Loc=std::locale() ) :
is_iequal( const std::locale& Loc=std::locale() ) :
m_Loc( Loc ) {}
//! Function operator
//! Function operator
/*!
Compare two operands. Case is ignored.
*/
template< typename T1, typename T2 >
bool operator ()( const T1& Arg1, const T2& Arg2 ) const
{
return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc);
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
return std::toupper(Arg1)==std::toupper(Arg2);
#else
return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc);
#endif
}
private:
std::locale m_Loc;
};
} // namespace algorithm
} // namespace algorithm
// pull names to the boost namespace
using algorithm::is_equal;

View File

@ -17,11 +17,7 @@
# error "macro already defined!"
#endif
#ifdef __BORLANDC__
#define BOOST_STRING_TYPENAME
#else
#define BOOST_STRING_TYPENAME BOOST_DEDUCED_TYPENAME
#endif
// Metrowerks workaround
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // 8.x

View File

@ -20,7 +20,7 @@ namespace boost {
// case conversion functors -----------------------------------------------//
// a tolower functor
// a tolower functor
template<typename CharT>
struct to_lowerF : public std::unary_function<CharT, CharT>
{
@ -30,13 +30,17 @@ namespace boost {
// Operation
CharT operator ()( CharT Ch ) const
{
return std::tolower( Ch, m_Loc );
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
return std::tolower( Ch);
#else
return std::tolower( Ch, m_Loc );
#endif
}
private:
const std::locale& m_Loc;
};
// a toupper functor
// a toupper functor
template<typename CharT>
struct to_upperF : public std::unary_function<CharT, CharT>
{
@ -46,7 +50,11 @@ namespace boost {
// Operation
CharT operator ()( CharT Ch ) const
{
return std::toupper( Ch, m_Loc );
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
return std::toupper( Ch);
#else
return std::toupper( Ch, m_Loc );
#endif
}
private:
const std::locale& m_Loc;

View File

@ -25,9 +25,9 @@
namespace boost {
namespace algorithm {
namespace detail {
// classification functors -----------------------------------------------//
// is_classified functor
struct is_classifiedF :
public predicate_facade<is_classifiedF>
@ -35,7 +35,7 @@ namespace boost {
// Boost.Lambda support
template <class Args> struct sig { typedef bool type; };
// Constructor from a locale
// Constructor from a locale
is_classifiedF(std::ctype_base::mask Type, std::locale const & Loc = std::locale()) :
m_Type(Type), m_Locale(Loc) {}
@ -46,13 +46,21 @@ namespace boost {
return std::use_facet< std::ctype<CharT> >(m_Locale).is( m_Type, Ch );
}
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
template<>
bool operator()( char const Ch ) const
{
return std::use_facet< std::ctype<char> >(m_Locale).is( m_Type, Ch );
}
#endif
private:
const std::ctype_base::mask m_Type;
const std::locale m_Locale;
};
// is_any_of functor
/*
// is_any_of functor
/*
returns true if the value is from the specified set
*/
template<typename CharT>
@ -62,26 +70,26 @@ namespace boost {
// Boost.Lambda support
template <class Args> struct sig { typedef bool type; };
// Constructor
// Constructor
template<typename RangeT>
is_any_ofF( const RangeT& Range ) :
is_any_ofF( const RangeT& Range ) :
m_Set( begin(Range), end(Range) ) {}
// Operation
template<typename Char2T>
bool operator()( Char2T Ch ) const
{
return m_Set.find(Ch)!=m_Set.end();
}
private:
// set cannot operate on const value-type
typedef typename remove_const<CharT>::type set_value_type;
std::set<set_value_type> m_Set;
std::set<set_value_type> m_Set;
};
// is_from_range functor
/*
// is_from_range functor
/*
returns true if the value is from the specified range.
(i.e. x>=From && x>=To)
*/
@ -92,16 +100,16 @@ namespace boost {
// Boost.Lambda support
template <class Args> struct sig { typedef bool type; };
// Constructor
// Constructor
is_from_rangeF( CharT From, CharT To ) : m_From(From), m_To(To) {}
// Operation
template<typename Char2T>
bool operator()( Char2T Ch ) const
{
return ( m_From <= Ch ) && ( Ch <= m_To );
return ( m_From <= Ch ) && ( Ch <= m_To );
}
private:
CharT m_From;
CharT m_To;
@ -123,11 +131,11 @@ namespace boost {
// Operation
template<typename CharT>
bool operator()( CharT Ch ) const
bool operator()( CharT Ch ) const
{
return m_Pred1(Ch) && m_Pred2(Ch);
}
private:
Pred1T m_Pred1;
Pred2T m_Pred2;
@ -148,11 +156,11 @@ namespace boost {
// Operation
template<typename CharT>
bool operator()( CharT Ch ) const
bool operator()( CharT Ch ) const
{
return m_Pred1(Ch) || m_Pred2(Ch);
}
private:
Pred1T m_Pred1;
Pred2T m_Pred2;
@ -172,11 +180,11 @@ namespace boost {
// Operation
template<typename CharT>
bool operator()( CharT Ch ) const
bool operator()( CharT Ch ) const
{
return !m_Pred(Ch);
}
private:
PredT m_Pred;
};

View File

@ -24,7 +24,7 @@
Due to a language restriction, it is not currently possible to define specializations for
stl containers without including the corresponding header. To decrease the overhead
needed by this inclusion, user can selectively include a specialization
needed by this inclusion, user can selectively include a specialization
header for a specific container. They are located in boost/algorithm/string/stl
directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp
header which contains specializations for all stl containers.
@ -39,7 +39,7 @@ namespace boost {
//! Native replace tester
/*!
Declare an override of this tester function with return
Declare an override of this tester function with return
type boost::string_algo::yes_type for a sequence with this property.
\return yes_type if the container has basic_string like native replace
@ -49,31 +49,31 @@ namespace boost {
//! Stable iterators tester
/*!
Declare an override of this tester function with return
Declare an override of this tester function with return
type boost::string_algo::yes_type for a sequence with this property.
\return yes_type if the sequence's insert/replace/erase methods do not invalidate
existing iterators.
*/
no_type has_stable_iterators_tester(...);
no_type has_stable_iterators_tester(...);
//! const time insert tester
/*!
Declare an override of this tester function with return
Declare an override of this tester function with return
type boost::string_algo::yes_type for a sequence with this property.
\return yes_type if the sequence's insert method is working in constant time
*/
no_type has_const_time_insert_tester(...);
no_type has_const_time_insert_tester(...);
//! const time erase tester
/*!
Declare an override of this tester function with return
Declare an override of this tester function with return
type boost::string_algo::yes_type for a sequence with this property.
\return yes_type if the sequence's erase method is working in constant time
*/
no_type has_const_time_erase_tester(...);
no_type has_const_time_erase_tester(...);
#endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
@ -89,7 +89,7 @@ namespace boost {
private:
static T* t;
public:
BOOST_STATIC_CONSTANT(bool, value=(
BOOST_STATIC_CONSTANT(bool, value=(
sizeof(has_native_replace_tester(t))==sizeof(yes_type) ) );
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
public:
@ -99,9 +99,9 @@ namespace boost {
BOOST_STATIC_CONSTANT(bool, value=false);
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_native_replace<T>::value> type;
};
@ -117,7 +117,7 @@ namespace boost {
private:
static T* t;
public:
BOOST_STATIC_CONSTANT(bool, value=(
BOOST_STATIC_CONSTANT(bool, value=(
sizeof(has_stable_iterators_tester(t))==sizeof(yes_type) ) );
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
public:
@ -128,13 +128,13 @@ namespace boost {
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_stable_iterators<T>::value> type;
};
//! Const time insert trait
/*!
This trait specifies that the sequence's insert method has
This trait specifies that the sequence's insert method has
constant time complexity.
*/
template< typename T >
@ -144,7 +144,7 @@ namespace boost {
private:
static T* t;
public:
BOOST_STATIC_CONSTANT(bool, value=(
BOOST_STATIC_CONSTANT(bool, value=(
sizeof(has_const_time_insert_tester(t))==sizeof(yes_type) ) );
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
public:
@ -155,13 +155,13 @@ namespace boost {
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_const_time_insert<T>::value> type;
};
//! Const time erase trait
/*!
This trait specifies that the sequence's erase method has
This trait specifies that the sequence's erase method has
constant time complexity.
*/
template< typename T >
@ -171,7 +171,7 @@ namespace boost {
private:
static T* t;
public:
BOOST_STATIC_CONSTANT(bool, value=(
BOOST_STATIC_CONSTANT(bool, value=(
sizeof(has_const_time_erase_tester(t))==sizeof(yes_type) ) );
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
public:
@ -182,7 +182,7 @@ namespace boost {
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_const_time_erase<T>::value> type;
};
} // namespace algorithm

View File

@ -33,9 +33,9 @@ namespace boost {
template<typename T, typename 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> >
@ -46,7 +46,7 @@ namespace boost {
#else
BOOST_STATIC_CONSTANT(bool, value=true);
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_stable_iterators<T>::value> type;
};
// const time insert trait
@ -59,7 +59,7 @@ namespace boost {
#else
BOOST_STATIC_CONSTANT(bool, value=true);
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_const_time_insert<T>::value> type;
};
// const time erase trait
@ -72,11 +72,11 @@ namespace boost {
#else
BOOST_STATIC_CONSTANT(bool, value=true);
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_const_time_erase<T>::value> type;
};
#endif
} // namespace algorithm
} // namespace boost

View File

@ -35,7 +35,7 @@ namespace boost {
yes_type has_const_time_erase_tester( const BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT>* );
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// stable iterators trait
template<typename T, typename AllocT>
class has_stable_iterators< BOOST_STD_EXTENSION_NAMESPACE::slist<T,AllocT> >
@ -46,7 +46,7 @@ namespace boost {
#else
BOOST_STATIC_CONSTANT(bool, value=true);
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_stable_iterators<T>::value> type;
};
// const time insert trait
@ -59,7 +59,7 @@ namespace boost {
#else
BOOST_STATIC_CONSTANT(bool, value=true);
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_const_time_insert<T>::value> type;
};
// const time erase trait
@ -72,7 +72,7 @@ namespace boost {
#else
BOOST_STATIC_CONSTANT(bool, value=true);
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_const_time_erase<T>::value> type;
};
#endif

View File

@ -38,7 +38,7 @@ namespace boost {
BOOST_STATIC_CONSTANT(bool, value=true);
#endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
typedef mpl::bool_<value> type;
typedef mpl::bool_<has_native_replace<T>::value> type;
};