Compare commits

..

11 Commits

Author SHA1 Message Date
940b612e80 Branch for working on the documentation tools documentation.
[SVN r68640]
2011-02-04 21:18:24 +00:00
96c78123f0 [boost][range] - Fixed erroneous change by 'Wash' the size() function is intended to be for Random Access Ranges only to be in keeping with the other Boost.Range size() functions.
[SVN r68177]
2011-01-16 00:05:12 +00:00
868858b844 Fixed ambiguity issues when compiling with C++0x support enabled.
[SVN r68155]
2011-01-14 17:37:59 +00:00
367582d0f4 Removed the use of __gnu_cxx::is_sorted from Boost.Graph as it's lolnonportable,
implemented a version of the algorithm as a replacement,



[SVN r68144]
2011-01-14 03:02:47 +00:00
2da424d940 [boost][range] - Improved the tests by implementing outside of the boost namespace to better simulate real world usage.
[SVN r67602]
2011-01-03 01:33:04 +00:00
a5d94bbe21 [boost][range] - Make the type_erased adaptor test compatible with more compilers and reduce the time of test compilation/execution to avoid timeouts on the Intel compilers.
[SVN r67601]
2011-01-03 00:38:52 +00:00
716cf7795e [boost][range] - Fixed defect where BOOST_TEST_MESSAGE was being undefined as a side-effect by the boost/range/detail/any_iterator_buffer.hpp header file
[SVN r67542]
2011-01-01 16:51:31 +00:00
55fd3ca5b2 [boost][range] - Updated begin/end to be protected against accidental ADL to improve compatibility with C++0x. Added any_range which adds type erasure support. Added a type_erased adaptor to utilise the any_range. Implemented the any_iterator using a small buffer optimization to avoid heap usage.
[SVN r67541]
2011-01-01 16:46:32 +00:00
c506d2537f [boost][range] - Trac item 4226 - Implemented a safe_bool utility class that is intended to be refactored into a core area. Integrated this into iterator_range.
[SVN r67463]
2010-12-26 23:14:08 +00:00
efb7b50a8a [boost][range] - Improved the implementation of strided range to eliminate requirements for boost::size(rng) to be a valid expression. Each traversal category of strided_iterator is now individually implemented.
[SVN r67461]
2010-12-26 20:33:33 +00:00
fd63de33e9 [boost][range] - Correctly attribute the test case kindly contributed by Michel Morin.
[SVN r67453]
2010-12-26 14:15:23 +00:00
6 changed files with 98 additions and 112 deletions

View File

@ -15,7 +15,7 @@
# pragma once
#endif
#if _MSC_VER == 1300 // experiment
#if defined(_MSC_VER) && (_MSC_VER == 1300)
#include <boost/range/detail/collection_traits.hpp>
#include <boost/range/iterator_range.hpp>
@ -28,6 +28,6 @@
#include <boost/range/iterator_range.hpp>
#include <boost/range/sub_range.hpp>
#endif // _MSC_VER == 1300 // experiment
#endif // _MSC_VER == 1300
#endif

View File

@ -1,3 +1,4 @@
// Copyright Bryce Lelbach 2010
// Copyright Neil Groves 2009. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -14,45 +15,26 @@
#include <boost/range/end.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/value_type.hpp>
#include <boost/detail/is_sorted.hpp>
#include <algorithm>
namespace boost
{
namespace range_detail
{
template<class ForwardIterator>
inline bool is_sorted(ForwardIterator first, ForwardIterator last)
{
for (ForwardIterator next = first; first != last && ++next != last; ++first)
if (*next < *first)
return false;
return true;
}
template<class ForwardIterator, class BinaryPredicate>
inline bool is_sorted(ForwardIterator first, ForwardIterator last, BinaryPredicate pred)
{
for (ForwardIterator next = first; first != last && ++next != last; ++first)
if (pred(*next, *first))
return false;
return true;
}
}
namespace range
{
/// \brief template function count
/// \brief template function is_sorted
///
/// range-based version of the count std algorithm
/// range-based version of the is_sorted std algorithm
///
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
template<class SinglePassRange>
inline bool is_sorted(const SinglePassRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept<BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type>));
return range_detail::is_sorted(boost::begin(rng), boost::end(rng));
BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept<BOOST_DEDUCED_TYPENAME
range_value<const SinglePassRange>::type>));
return ::boost::detail::is_sorted(boost::begin(rng), boost::end(rng));
}
/// \overload
@ -60,12 +42,16 @@ template<class SinglePassRange, class BinaryPredicate>
inline bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate, BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type, BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type>));
return range_detail::is_sorted(boost::begin(rng), boost::end(rng), pred);
BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type,
BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type>));
return ::boost::detail::is_sorted(boost::begin(rng), boost::end(rng), pred);
}
} // namespace range
using range::is_sorted;
using range::is_sorted;
} // namespace boost
#endif // include guard

View File

@ -25,7 +25,7 @@
#include <boost/detail/workaround.hpp>
#include <cstring>
#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_CWCHAR
#include <cwchar>
#endif
@ -38,41 +38,41 @@ namespace boost
return strlen( s );
}
#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_CWCHAR
inline std::size_t length( const wchar_t* s )
{
return wcslen( s );
}
#endif
#endif
//
// Remark: the compiler cannot choose between T* and T[sz]
// overloads, so we must put the T* internal to the
// unconstrained version.
//
//
inline bool is_char_ptr( char* )
{
return true;
}
inline bool is_char_ptr( const char* )
{
return true;
}
#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_CWCHAR
inline bool is_char_ptr( wchar_t* )
{
return true;
}
inline bool is_char_ptr( const wchar_t* )
{
return true;
}
#endif
template< class T >
inline long is_char_ptr( T /* r */ )
{
@ -80,30 +80,30 @@ namespace boost
}
template< class T >
inline iterator_range<T*>
inline iterator_range<T*>
make_range( T* const r, bool )
{
return iterator_range<T*>( r, r + length(r) );
}
template< class T >
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<T>::type>
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<T>::type>
make_range( T& r, long )
{
return boost::make_iterator_range( r );
}
}
template< class Range >
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<Range>::type>
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<Range>::type>
as_literal( Range& r )
{
return range_detail::make_range( r, range_detail::is_char_ptr(r) );
}
template< class Range >
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type>
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type>
as_literal( const Range& r )
{
return range_detail::make_range( r, range_detail::is_char_ptr(r) );
@ -112,9 +112,9 @@ namespace boost
template< class Char, std::size_t sz >
inline iterator_range<Char*> as_literal( Char (&arr)[sz] )
{
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
}
template< class Char, std::size_t sz >
inline iterator_range<const Char*> as_literal( const Char (&arr)[sz] )
{

View File

@ -21,13 +21,13 @@
#include <wchar.h>
#endif
namespace boost
namespace boost
{
namespace range_detail
{
template <typename T>
inline void boost_range_silence_warning( const T& ) { }
/////////////////////////////////////////////////////////////////////
// end() help
/////////////////////////////////////////////////////////////////////
@ -36,7 +36,7 @@ namespace boost
{
return s + strlen( s );
}
#ifndef BOOST_NO_CWCHAR
inline const wchar_t* str_end( const wchar_t* s, const wchar_t* )
{
@ -51,7 +51,7 @@ namespace boost
;
return s;
}
#endif
#endif
template< class Char >
inline Char* str_end( Char* s )
@ -64,7 +64,7 @@ namespace boost
{
return boost_range_array + sz;
}
template< class T, std::size_t sz >
inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] )
{
@ -74,7 +74,7 @@ namespace boost
/////////////////////////////////////////////////////////////////////
// size() help
/////////////////////////////////////////////////////////////////////
template< class Char >
inline std::size_t str_size( const Char* const& s )
{
@ -96,7 +96,7 @@ namespace boost
}
} // namespace 'range_detail'
} // namespace 'boost'

View File

@ -25,46 +25,46 @@
namespace boost
{
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
namespace range_detail_vc7_1
{
template< typename C, typename Sig = void(C) >
struct range_iterator
{
typedef BOOST_RANGE_DEDUCED_TYPENAME
mpl::eval_if_c< is_const<C>::value,
range_const_iterator< typename remove_const<C>::type >,
range_mutable_iterator<C> >::type type;
};
template< typename C, typename T >
struct range_iterator< C, void(T[]) >
{
typedef T* type;
};
}
#endif
namespace range_detail_vc7_1
{
template< typename C, typename Sig = void(C) >
struct range_iterator
{
typedef BOOST_RANGE_DEDUCED_TYPENAME
mpl::eval_if_c< is_const<C>::value,
range_const_iterator< typename remove_const<C>::type >,
range_mutable_iterator<C> >::type type;
};
template< typename C, typename T >
struct range_iterator< C, void(T[]) >
{
typedef T* type;
};
}
#endif
template< typename C >
struct range_iterator
{
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
typedef BOOST_RANGE_DEDUCED_TYPENAME
range_detail_vc7_1::range_iterator<C>::type type;
#else
typedef BOOST_RANGE_DEDUCED_TYPENAME
range_detail_vc7_1::range_iterator<C>::type type;
#else
typedef BOOST_RANGE_DEDUCED_TYPENAME
mpl::eval_if_c< is_const<C>::value,
typedef BOOST_RANGE_DEDUCED_TYPENAME
mpl::eval_if_c< is_const<C>::value,
range_const_iterator< typename remove_const<C>::type >,
range_mutable_iterator<C> >::type type;
#endif
#endif
};
} // namespace boost
//#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

View File

@ -12,7 +12,7 @@
#ifndef BOOST_RANGE_SUB_RANGE_HPP
#define BOOST_RANGE_SUB_RANGE_HPP
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
#pragma warning( push )
#pragma warning( disable : 4996 )
#endif
@ -30,9 +30,9 @@
namespace boost
{
template< class ForwardRange >
class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type >
template< class ForwardRange >
class sub_range : public iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type >
{
typedef BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type iterator_t;
typedef iterator_range< iterator_t > base;
@ -53,40 +53,40 @@ namespace boost
reference >::type const_reference;
public:
sub_range() : base()
{ }
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500) )
sub_range( const sub_range& r )
: base( static_cast<const base&>( r ) )
sub_range() : base()
{ }
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500) )
sub_range( const sub_range& r )
: base( static_cast<const base&>( r ) )
{ }
#endif
template< class ForwardRange2 >
sub_range( ForwardRange2& r ) :
sub_range( ForwardRange2& r ) :
#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 800 )
base( impl::adl_begin( r ), impl::adl_end( r ) )
#else
base( r )
#endif
{ }
template< class ForwardRange2 >
sub_range( const ForwardRange2& r ) :
#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 800 )
base( impl::adl_begin( r ), impl::adl_end( r ) )
#else
base( r )
#endif
{ }
template< class ForwardRange2 >
sub_range( const ForwardRange2& r ) :
#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 800 )
base( impl::adl_begin( r ), impl::adl_end( r ) )
#else
base( r )
#endif
#endif
{ }
template< class Iter >
sub_range( Iter first, Iter last ) :
base( first, last )
{ }
template< class ForwardRange2 >
sub_range& operator=( ForwardRange2& r )
{
@ -99,23 +99,23 @@ namespace boost
{
base::operator=( r );
return *this;
}
}
sub_range& operator=( const sub_range& r )
{
base::operator=( static_cast<const base&>(r) );
return *this;
return *this;
}
public:
iterator begin() { return base::begin(); }
const_iterator begin() const { return base::begin(); }
iterator end() { return base::end(); }
const_iterator end() const { return base::end(); }
difference_type size() const { return base::size(); }
difference_type size() const { return base::size(); }
public: // convenience
reference front()
{
@ -173,7 +173,7 @@ namespace boost
} // namespace 'boost'
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
#pragma warning( pop )
#endif