Merge pull request #24 from steveire/remove-algorithm-dep

Remove algorithm dep
This commit is contained in:
neilgroves
2014-09-25 01:12:32 +01:00
2 changed files with 48 additions and 48 deletions

View File

@@ -22,7 +22,6 @@
#ifndef BOOST_RANGE_STRING_COLLECTION_TRAITS_HPP #ifndef BOOST_RANGE_STRING_COLLECTION_TRAITS_HPP
#define BOOST_RANGE_STRING_COLLECTION_TRAITS_HPP #define BOOST_RANGE_STRING_COLLECTION_TRAITS_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/type_traits/is_array.hpp> #include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/is_pointer.hpp> #include <boost/type_traits/is_pointer.hpp>
#include <boost/mpl/eval_if.hpp> #include <boost/mpl/eval_if.hpp>
@@ -74,13 +73,13 @@ namespace boost {
struct collection_traits struct collection_traits
{ {
private: private:
typedef BOOST_STRING_TYPENAME ::boost::mpl::eval_if< typedef typename ::boost::mpl::eval_if<
::boost::algorithm::detail::is_pair<T>, ::boost::algorithm::detail::is_pair<T>,
detail::pair_container_traits_selector<T>, detail::pair_container_traits_selector<T>,
BOOST_STRING_TYPENAME ::boost::mpl::eval_if< typename ::boost::mpl::eval_if<
::boost::is_array<T>, ::boost::is_array<T>,
detail::array_container_traits_selector<T>, detail::array_container_traits_selector<T>,
BOOST_STRING_TYPENAME ::boost::mpl::eval_if< typename ::boost::mpl::eval_if<
::boost::is_pointer<T>, ::boost::is_pointer<T>,
detail::pointer_container_traits_selector<T>, detail::pointer_container_traits_selector<T>,
detail::default_container_traits_selector<T> detail::default_container_traits_selector<T>
@@ -91,22 +90,22 @@ namespace boost {
//! Function type //! Function type
typedef container_helper_type function_type; typedef container_helper_type function_type;
//! Value type //! Value type
typedef BOOST_STRING_TYPENAME typedef typename
container_helper_type::value_type value_type; container_helper_type::value_type value_type;
//! Size type //! Size type
typedef BOOST_STRING_TYPENAME typedef typename
container_helper_type::size_type size_type; container_helper_type::size_type size_type;
//! Iterator type //! Iterator type
typedef BOOST_STRING_TYPENAME typedef typename
container_helper_type::iterator iterator; container_helper_type::iterator iterator;
//! Const iterator type //! Const iterator type
typedef BOOST_STRING_TYPENAME typedef typename
container_helper_type::const_iterator const_iterator; container_helper_type::const_iterator const_iterator;
//! Result iterator type ( iterator of const_iterator, depending on the constness of the container ) //! Result iterator type ( iterator of const_iterator, depending on the constness of the container )
typedef BOOST_STRING_TYPENAME typedef typename
container_helper_type::result_iterator result_iterator; container_helper_type::result_iterator result_iterator;
//! Difference type //! Difference type
typedef BOOST_STRING_TYPENAME typedef typename
container_helper_type::difference_type difference_type; container_helper_type::difference_type difference_type;
}; // 'collection_traits' }; // 'collection_traits'
@@ -120,7 +119,7 @@ namespace boost {
template< typename C > template< typename C >
struct value_type_of struct value_type_of
{ {
typedef BOOST_STRING_TYPENAME collection_traits<C>::value_type type; typedef typename collection_traits<C>::value_type type;
}; };
//! Container difference trait //! Container difference trait
@@ -130,7 +129,7 @@ namespace boost {
template< typename C > template< typename C >
struct difference_type_of struct difference_type_of
{ {
typedef BOOST_STRING_TYPENAME collection_traits<C>::difference_type type; typedef typename collection_traits<C>::difference_type type;
}; };
//! Container iterator trait //! Container iterator trait
@@ -140,7 +139,7 @@ namespace boost {
template< typename C > template< typename C >
struct iterator_of struct iterator_of
{ {
typedef BOOST_STRING_TYPENAME collection_traits<C>::iterator type; typedef typename collection_traits<C>::iterator type;
}; };
//! Container const_iterator trait //! Container const_iterator trait
@@ -150,7 +149,7 @@ namespace boost {
template< typename C > template< typename C >
struct const_iterator_of struct const_iterator_of
{ {
typedef BOOST_STRING_TYPENAME collection_traits<C>::const_iterator type; typedef typename collection_traits<C>::const_iterator type;
}; };
@@ -162,7 +161,7 @@ namespace boost {
template< typename C > template< typename C >
struct result_iterator_of struct result_iterator_of
{ {
typedef BOOST_STRING_TYPENAME collection_traits<C>::result_iterator type; typedef typename collection_traits<C>::result_iterator type;
}; };
// collection_traits related functions -----------------------------------------// // collection_traits related functions -----------------------------------------//
@@ -172,7 +171,7 @@ namespace boost {
Get the size of the container. Uses collection_traits. Get the size of the container. Uses collection_traits.
*/ */
template< typename C > template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::size_type inline typename collection_traits<C>::size_type
size( const C& c ) size( const C& c )
{ {
return collection_traits<C>::function_type::size( c ); return collection_traits<C>::function_type::size( c );
@@ -195,7 +194,7 @@ namespace boost {
Get the begin iterator of the container. Uses collection_traits. Get the begin iterator of the container. Uses collection_traits.
*/ */
template< typename C > template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::iterator inline typename collection_traits<C>::iterator
begin( C& c ) begin( C& c )
{ {
return collection_traits<C>::function_type::begin( c ); return collection_traits<C>::function_type::begin( c );
@@ -206,7 +205,7 @@ namespace boost {
\overload \overload
*/ */
template< typename C > template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::const_iterator inline typename collection_traits<C>::const_iterator
begin( const C& c ) begin( const C& c )
{ {
return collection_traits<C>::function_type::begin( c ); return collection_traits<C>::function_type::begin( c );
@@ -217,7 +216,7 @@ namespace boost {
Get the begin iterator of the container. Uses collection_traits. Get the begin iterator of the container. Uses collection_traits.
*/ */
template< typename C > template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::iterator inline typename collection_traits<C>::iterator
end( C& c ) end( C& c )
{ {
return collection_traits<C>::function_type::end( c ); return collection_traits<C>::function_type::end( c );
@@ -228,7 +227,7 @@ namespace boost {
\overload \overload
*/ */
template< typename C > template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::const_iterator inline typename collection_traits<C>::const_iterator
end( const C& c ) end( const C& c )
{ {
return collection_traits<C>::function_type::end( c ); return collection_traits<C>::function_type::end( c );
@@ -241,7 +240,7 @@ namespace boost {
\overload \overload
*/ */
template< typename C > template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::result_iterator inline typename collection_traits<C>::result_iterator
begin( C& c ) begin( C& c )
{ {
return collection_traits<C>::function_type::begin( c ); return collection_traits<C>::function_type::begin( c );
@@ -252,7 +251,7 @@ namespace boost {
\overload \overload
*/ */
template< typename C > template< typename C >
inline BOOST_STRING_TYPENAME collection_traits<C>::result_iterator inline typename collection_traits<C>::result_iterator
end( C& c ) end( C& c )
{ {
return collection_traits<C>::function_type::end( c ); return collection_traits<C>::function_type::end( c );

View File

@@ -10,7 +10,6 @@
#ifndef BOOST_RANGE_STRING_DETAIL_COLLECTION_TRAITS_HPP #ifndef BOOST_RANGE_STRING_DETAIL_COLLECTION_TRAITS_HPP
#define BOOST_RANGE_STRING_DETAIL_COLLECTION_TRAITS_HPP #define BOOST_RANGE_STRING_DETAIL_COLLECTION_TRAITS_HPP
#include <boost/algorithm/string/config.hpp>
#include <cstddef> #include <cstddef>
#include <string> #include <string>
#include <boost/type_traits/is_array.hpp> #include <boost/type_traits/is_array.hpp>
@@ -24,7 +23,6 @@
#include <boost/mpl/vector.hpp> #include <boost/mpl/vector.hpp>
#include <boost/mpl/fold.hpp> #include <boost/mpl/fold.hpp>
#include <boost/detail/iterator.hpp> #include <boost/detail/iterator.hpp>
#include <boost/algorithm/string/yes_no_type.hpp>
// Container traits implementation --------------------------------------------------------- // Container traits implementation ---------------------------------------------------------
@@ -41,16 +39,16 @@ namespace boost {
template< typename ContainerT > template< typename ContainerT >
struct default_container_traits struct default_container_traits
{ {
typedef BOOST_STRING_TYPENAME ContainerT::value_type value_type; typedef typename ContainerT::value_type value_type;
typedef BOOST_STRING_TYPENAME ContainerT::iterator iterator; typedef typename ContainerT::iterator iterator;
typedef BOOST_STRING_TYPENAME ContainerT::const_iterator const_iterator; typedef typename ContainerT::const_iterator const_iterator;
typedef BOOST_STRING_TYPENAME typedef typename
::boost::mpl::if_< ::boost::is_const<ContainerT>, ::boost::mpl::if_< ::boost::is_const<ContainerT>,
const_iterator, const_iterator,
iterator iterator
>::type result_iterator; >::type result_iterator;
typedef BOOST_STRING_TYPENAME ContainerT::difference_type difference_type; typedef typename ContainerT::difference_type difference_type;
typedef BOOST_STRING_TYPENAME ContainerT::size_type size_type; typedef typename ContainerT::size_type size_type;
// static operations // static operations
template< typename C > template< typename C >
@@ -117,6 +115,9 @@ namespace boost {
// Pair container traits --------------------------------------------------------------------- // Pair container traits ---------------------------------------------------------------------
typedef double yes_type;
typedef char no_type;
// pair selector // pair selector
template< typename T, typename U > template< typename T, typename U >
yes_type is_pair_impl( const std::pair<T,U>* ); yes_type is_pair_impl( const std::pair<T,U>* );
@@ -135,12 +136,12 @@ namespace boost {
template< typename PairT > template< typename PairT >
struct pair_container_traits struct pair_container_traits
{ {
typedef BOOST_STRING_TYPENAME PairT::first_type element_type; typedef typename PairT::first_type element_type;
typedef BOOST_STRING_TYPENAME ::boost::detail:: typedef typename ::boost::detail::
iterator_traits<element_type>::value_type value_type; iterator_traits<element_type>::value_type value_type;
typedef std::size_t size_type; typedef std::size_t size_type;
typedef BOOST_STRING_TYPENAME ::boost::detail:: typedef typename ::boost::detail::
iterator_traits<element_type>::difference_type difference_type; iterator_traits<element_type>::difference_type difference_type;
typedef element_type iterator; typedef element_type iterator;
@@ -221,7 +222,7 @@ namespace boost {
template< typename TraitsT > template< typename TraitsT >
struct array_length struct array_length
{ {
typedef BOOST_STRING_TYPENAME typedef typename
TraitsT::size_type size_type; TraitsT::size_type size_type;
BOOST_STATIC_CONSTANT( BOOST_STATIC_CONSTANT(
@@ -249,7 +250,7 @@ namespace boost {
template< typename TraitsT > template< typename TraitsT >
struct array_length struct array_length
{ {
typedef BOOST_STRING_TYPENAME typedef typename
TraitsT::size_type size_type; TraitsT::size_type size_type;
template< typename A > template< typename A >
@@ -276,7 +277,7 @@ namespace boost {
template< typename TraitsT > template< typename TraitsT >
struct array_length struct array_length
{ {
typedef BOOST_STRING_TYPENAME typedef typename
TraitsT::size_type size_type; TraitsT::size_type size_type;
template< typename A > template< typename A >
@@ -304,18 +305,18 @@ namespace boost {
typedef array_traits<T> traits_type; typedef array_traits<T> traits_type;
public: public:
typedef BOOST_STRING_TYPENAME typedef typename
traits_type::value_type value_type; traits_type::value_type value_type;
typedef BOOST_STRING_TYPENAME typedef typename
traits_type::iterator iterator; traits_type::iterator iterator;
typedef BOOST_STRING_TYPENAME typedef typename
traits_type::const_iterator const_iterator; traits_type::const_iterator const_iterator;
typedef BOOST_STRING_TYPENAME typedef typename
traits_type::size_type size_type; traits_type::size_type size_type;
typedef BOOST_STRING_TYPENAME typedef typename
traits_type::difference_type difference_type; traits_type::difference_type difference_type;
typedef BOOST_STRING_TYPENAME typedef typename
::boost::mpl::if_< ::boost::is_const<T>, ::boost::mpl::if_< ::boost::is_const<T>,
const_iterator, const_iterator,
iterator iterator
@@ -323,9 +324,9 @@ namespace boost {
private: private:
// resolve array size // resolve array size
typedef BOOST_STRING_TYPENAME typedef typename
::boost::remove_cv<value_type>::type char_type; ::boost::remove_cv<value_type>::type char_type;
typedef BOOST_STRING_TYPENAME typedef typename
array_length_selector<char_type>:: array_length_selector<char_type>::
BOOST_NESTED_TEMPLATE array_length<traits_type> array_length_type; BOOST_NESTED_TEMPLATE array_length<traits_type> array_length_type;
@@ -401,10 +402,10 @@ namespace boost {
template<typename T> template<typename T>
struct pointer_container_traits struct pointer_container_traits
{ {
typedef BOOST_STRING_TYPENAME typedef typename
::boost::remove_pointer<T>::type value_type; ::boost::remove_pointer<T>::type value_type;
typedef BOOST_STRING_TYPENAME typedef typename
::boost::remove_cv<value_type>::type char_type; ::boost::remove_cv<value_type>::type char_type;
typedef ::std::char_traits<char_type> char_traits; typedef ::std::char_traits<char_type> char_traits;
@@ -413,7 +414,7 @@ namespace boost {
typedef std::ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef std::size_t size_type; typedef std::size_t size_type;
typedef BOOST_STRING_TYPENAME typedef typename
::boost::mpl::if_< ::boost::is_const<T>, ::boost::mpl::if_< ::boost::is_const<T>,
const_iterator, const_iterator,
iterator iterator