mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
remove unused boost files (~520)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39941 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3d373d9135
commit
a9322bc2cf
@ -1,437 +0,0 @@
|
||||
/* The following code declares class array,
|
||||
* an STL container (as wrapper) for arrays of constant size.
|
||||
*
|
||||
* See
|
||||
* http://www.boost.org/libs/array/
|
||||
* for documentation.
|
||||
*
|
||||
* The original author site is at: http://www.josuttis.com/
|
||||
*
|
||||
* (C) Copyright Nicolai M. Josuttis 2001.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility.
|
||||
* 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group.
|
||||
* See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168
|
||||
* Eventually, we should remove "assign" which is now a synonym for "fill" (Marshall Clow)
|
||||
* 10 Mar 2010 - added workaround for SUNCC and !STLPort [trac #3893] (Marshall Clow)
|
||||
* 29 Jan 2004 - c_array() added, BOOST_NO_PRIVATE_IN_AGGREGATE removed (Nico Josuttis)
|
||||
* 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries.
|
||||
* 05 Aug 2001 - minor update (Nico Josuttis)
|
||||
* 20 Jan 2001 - STLport fix (Beman Dawes)
|
||||
* 29 Sep 2000 - Initial Revision (Nico Josuttis)
|
||||
*
|
||||
* Jan 29, 2004
|
||||
*/
|
||||
#ifndef BOOST_ARRAY_HPP
|
||||
#define BOOST_ARRAY_HPP
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe
|
||||
# pragma warning(disable:4510) // boost::array<T,N>' : default constructor could not be generated
|
||||
# pragma warning(disable:4610) // warning C4610: class 'boost::array<T,N>' can never be instantiated - user defined constructor required
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
|
||||
// Handles broken standard libraries better than <iterator>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
// FIXES for broken compilers
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T, std::size_t N>
|
||||
class array {
|
||||
public:
|
||||
T elems[N]; // fixed-size array of elements of type T
|
||||
|
||||
public:
|
||||
// type definitions
|
||||
typedef T value_type;
|
||||
typedef T* iterator;
|
||||
typedef const T* const_iterator;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
// iterator support
|
||||
iterator begin() { return elems; }
|
||||
const_iterator begin() const { return elems; }
|
||||
const_iterator cbegin() const { return elems; }
|
||||
|
||||
iterator end() { return elems+N; }
|
||||
const_iterator end() const { return elems+N; }
|
||||
const_iterator cend() const { return elems+N; }
|
||||
|
||||
// reverse iterator support
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310)
|
||||
// workaround for broken reverse_iterator in VC7
|
||||
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator,
|
||||
reference, iterator, reference> > reverse_iterator;
|
||||
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
|
||||
const_reference, iterator, reference> > const_reverse_iterator;
|
||||
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
|
||||
value_type, reference, iterator, difference_type> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
|
||||
value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
|
||||
#else
|
||||
// workaround for broken reverse_iterator implementations
|
||||
typedef std::reverse_iterator<iterator,T> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
|
||||
#endif
|
||||
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
const_reverse_iterator crbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
const_reverse_iterator crend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
// operator[]
|
||||
reference operator[](size_type i)
|
||||
{
|
||||
BOOST_ASSERT( i < N && "out of range" );
|
||||
return elems[i];
|
||||
}
|
||||
|
||||
const_reference operator[](size_type i) const
|
||||
{
|
||||
BOOST_ASSERT( i < N && "out of range" );
|
||||
return elems[i];
|
||||
}
|
||||
|
||||
// at() with range check
|
||||
reference at(size_type i) { rangecheck(i); return elems[i]; }
|
||||
const_reference at(size_type i) const { rangecheck(i); return elems[i]; }
|
||||
|
||||
// front() and back()
|
||||
reference front()
|
||||
{
|
||||
return elems[0];
|
||||
}
|
||||
|
||||
const_reference front() const
|
||||
{
|
||||
return elems[0];
|
||||
}
|
||||
|
||||
reference back()
|
||||
{
|
||||
return elems[N-1];
|
||||
}
|
||||
|
||||
const_reference back() const
|
||||
{
|
||||
return elems[N-1];
|
||||
}
|
||||
|
||||
// size is constant
|
||||
static size_type size() { return N; }
|
||||
static bool empty() { return false; }
|
||||
static size_type max_size() { return N; }
|
||||
enum { static_size = N };
|
||||
|
||||
// swap (note: linear complexity)
|
||||
void swap (array<T,N>& y) {
|
||||
for (size_type i = 0; i < N; ++i)
|
||||
boost::swap(elems[i],y.elems[i]);
|
||||
}
|
||||
|
||||
// direct access to data (read-only)
|
||||
const T* data() const { return elems; }
|
||||
T* data() { return elems; }
|
||||
|
||||
// use array as C array (direct read/write access to data)
|
||||
T* c_array() { return elems; }
|
||||
|
||||
// assignment with type conversion
|
||||
template <typename T2>
|
||||
array<T,N>& operator= (const array<T2,N>& rhs) {
|
||||
std::copy(rhs.begin(),rhs.end(), begin());
|
||||
return *this;
|
||||
}
|
||||
|
||||
// assign one value to all elements
|
||||
void assign (const T& value) { fill ( value ); } // A synonym for fill
|
||||
void fill (const T& value)
|
||||
{
|
||||
std::fill_n(begin(),size(),value);
|
||||
}
|
||||
|
||||
// check range (may be private because it is static)
|
||||
static void rangecheck (size_type i) {
|
||||
if (i >= size()) {
|
||||
std::out_of_range e("array<>: index out of range");
|
||||
boost::throw_exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
template< class T >
|
||||
class array< T, 0 > {
|
||||
|
||||
public:
|
||||
// type definitions
|
||||
typedef T value_type;
|
||||
typedef T* iterator;
|
||||
typedef const T* const_iterator;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
// iterator support
|
||||
iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); }
|
||||
const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
|
||||
const_iterator cbegin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
|
||||
|
||||
iterator end() { return begin(); }
|
||||
const_iterator end() const { return begin(); }
|
||||
const_iterator cend() const { return cbegin(); }
|
||||
|
||||
// reverse iterator support
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310)
|
||||
// workaround for broken reverse_iterator in VC7
|
||||
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator,
|
||||
reference, iterator, reference> > reverse_iterator;
|
||||
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
|
||||
const_reference, iterator, reference> > const_reverse_iterator;
|
||||
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
|
||||
value_type, reference, iterator, difference_type> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
|
||||
value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
|
||||
#else
|
||||
// workaround for broken reverse_iterator implementations
|
||||
typedef std::reverse_iterator<iterator,T> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
|
||||
#endif
|
||||
|
||||
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
const_reverse_iterator crbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
const_reverse_iterator crend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
// operator[]
|
||||
reference operator[](size_type /*i*/)
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
const_reference operator[](size_type /*i*/) const
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
// at() with range check
|
||||
reference at(size_type /*i*/) { return failed_rangecheck(); }
|
||||
const_reference at(size_type /*i*/) const { return failed_rangecheck(); }
|
||||
|
||||
// front() and back()
|
||||
reference front()
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
const_reference front() const
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
reference back()
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
const_reference back() const
|
||||
{
|
||||
return failed_rangecheck();
|
||||
}
|
||||
|
||||
// size is constant
|
||||
static size_type size() { return 0; }
|
||||
static bool empty() { return true; }
|
||||
static size_type max_size() { return 0; }
|
||||
enum { static_size = 0 };
|
||||
|
||||
void swap (array<T,0>& /*y*/) {
|
||||
}
|
||||
|
||||
// direct access to data (read-only)
|
||||
const T* data() const { return 0; }
|
||||
T* data() { return 0; }
|
||||
|
||||
// use array as C array (direct read/write access to data)
|
||||
T* c_array() { return 0; }
|
||||
|
||||
// assignment with type conversion
|
||||
template <typename T2>
|
||||
array<T,0>& operator= (const array<T2,0>& ) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
// assign one value to all elements
|
||||
void assign (const T& value) { fill ( value ); }
|
||||
void fill (const T& ) {}
|
||||
|
||||
// check range (may be private because it is static)
|
||||
static reference failed_rangecheck () {
|
||||
std::out_of_range e("attempt to access element of an empty array");
|
||||
boost::throw_exception(e);
|
||||
#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__))
|
||||
//
|
||||
// We need to return something here to keep
|
||||
// some compilers happy: however we will never
|
||||
// actually get here....
|
||||
//
|
||||
static T placeholder;
|
||||
return placeholder;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// comparisons
|
||||
template<class T, std::size_t N>
|
||||
bool operator== (const array<T,N>& x, const array<T,N>& y) {
|
||||
return std::equal(x.begin(), x.end(), y.begin());
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator< (const array<T,N>& x, const array<T,N>& y) {
|
||||
return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator!= (const array<T,N>& x, const array<T,N>& y) {
|
||||
return !(x==y);
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator> (const array<T,N>& x, const array<T,N>& y) {
|
||||
return y<x;
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator<= (const array<T,N>& x, const array<T,N>& y) {
|
||||
return !(y<x);
|
||||
}
|
||||
template<class T, std::size_t N>
|
||||
bool operator>= (const array<T,N>& x, const array<T,N>& y) {
|
||||
return !(x<y);
|
||||
}
|
||||
|
||||
// global swap()
|
||||
template<class T, std::size_t N>
|
||||
inline void swap (array<T,N>& x, array<T,N>& y) {
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
// Trac ticket #4757; the Sun Solaris compiler can't handle
|
||||
// syntax like 'T(&get_c_array(boost::array<T,N>& arg))[N]'
|
||||
//
|
||||
// We can't just use this for all compilers, because the
|
||||
// borland compilers can't handle this form.
|
||||
namespace detail {
|
||||
template <typename T, std::size_t N> struct c_array
|
||||
{
|
||||
typedef T type[N];
|
||||
};
|
||||
}
|
||||
|
||||
// Specific for boost::array: simply returns its elems data member.
|
||||
template <typename T, std::size_t N>
|
||||
typename detail::c_array<T,N>::type& get_c_array(boost::array<T,N>& arg)
|
||||
{
|
||||
return arg.elems;
|
||||
}
|
||||
|
||||
// Specific for boost::array: simply returns its elems data member.
|
||||
template <typename T, std::size_t N>
|
||||
typename const detail::c_array<T,N>::type& get_c_array(const boost::array<T,N>& arg)
|
||||
{
|
||||
return arg.elems;
|
||||
}
|
||||
#else
|
||||
// Specific for boost::array: simply returns its elems data member.
|
||||
template <typename T, std::size_t N>
|
||||
T(&get_c_array(boost::array<T,N>& arg))[N]
|
||||
{
|
||||
return arg.elems;
|
||||
}
|
||||
|
||||
// Const version.
|
||||
template <typename T, std::size_t N>
|
||||
const T(&get_c_array(const boost::array<T,N>& arg))[N]
|
||||
{
|
||||
return arg.elems;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// Overload for std::array, assuming that std::array will have
|
||||
// explicit conversion functions as discussed at the WG21 meeting
|
||||
// in Summit, March 2009.
|
||||
template <typename T, std::size_t N>
|
||||
T(&get_c_array(std::array<T,N>& arg))[N]
|
||||
{
|
||||
return static_cast<T(&)[N]>(arg);
|
||||
}
|
||||
|
||||
// Const version.
|
||||
template <typename T, std::size_t N>
|
||||
const T(&get_c_array(const std::array<T,N>& arg))[N]
|
||||
{
|
||||
return static_cast<T(&)[N]>(arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif /*BOOST_ARRAY_HPP*/
|
@ -1,74 +0,0 @@
|
||||
#ifndef BOOST_BIND_APPLY_HPP_INCLUDED
|
||||
#define BOOST_BIND_APPLY_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// apply.hpp
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class R> struct apply
|
||||
{
|
||||
typedef R result_type;
|
||||
|
||||
template<class F> result_type operator()(F & f) const
|
||||
{
|
||||
return f();
|
||||
}
|
||||
|
||||
template<class F, class A1> result_type operator()(F & f, A1 & a1) const
|
||||
{
|
||||
return f(a1);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2> result_type operator()(F & f, A1 & a1, A2 & a2) const
|
||||
{
|
||||
return f(a1, a2);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3) const
|
||||
{
|
||||
return f(a1, a2, a3);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
|
||||
{
|
||||
return f(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_BIND_APPLY_HPP_INCLUDED
|
@ -1,187 +0,0 @@
|
||||
#ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
|
||||
#define BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// make_adaptable.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace _bi
|
||||
{
|
||||
|
||||
template<class R, class F> class af0
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
explicit af0(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
return f_();
|
||||
}
|
||||
|
||||
result_type operator()() const
|
||||
{
|
||||
return f_();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class R, class A1, class F> class af1
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef A1 argument_type;
|
||||
typedef A1 arg1_type;
|
||||
|
||||
explicit af1(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1)
|
||||
{
|
||||
return f_(a1);
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1) const
|
||||
{
|
||||
return f_(a1);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class R, class A1, class A2, class F> class af2
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef A1 first_argument_type;
|
||||
typedef A2 second_argument_type;
|
||||
typedef A1 arg1_type;
|
||||
typedef A2 arg2_type;
|
||||
|
||||
explicit af2(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1, A2 a2)
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1, A2 a2) const
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class R, class A1, class A2, class A3, class F> class af3
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef A1 arg1_type;
|
||||
typedef A2 arg2_type;
|
||||
typedef A3 arg3_type;
|
||||
|
||||
explicit af3(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1, A2 a2, A3 a3)
|
||||
{
|
||||
return f_(a1, a2, a3);
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
return f_(a1, a2, a3);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class R, class A1, class A2, class A3, class A4, class F> class af4
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef A1 arg1_type;
|
||||
typedef A2 arg2_type;
|
||||
typedef A3 arg3_type;
|
||||
typedef A4 arg4_type;
|
||||
|
||||
explicit af4(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4)
|
||||
{
|
||||
return f_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
} // namespace _bi
|
||||
|
||||
template<class R, class F> _bi::af0<R, F> make_adaptable(F f)
|
||||
{
|
||||
return _bi::af0<R, F>(f);
|
||||
}
|
||||
|
||||
template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f)
|
||||
{
|
||||
return _bi::af1<R, A1, F>(f);
|
||||
}
|
||||
|
||||
template<class R, class A1, class A2, class F> _bi::af2<R, A1, A2, F> make_adaptable(F f)
|
||||
{
|
||||
return _bi::af2<R, A1, A2, F>(f);
|
||||
}
|
||||
|
||||
template<class R, class A1, class A2, class A3, class F> _bi::af3<R, A1, A2, A3, F> make_adaptable(F f)
|
||||
{
|
||||
return _bi::af3<R, A1, A2, A3, F>(f);
|
||||
}
|
||||
|
||||
template<class R, class A1, class A2, class A3, class A4, class F> _bi::af4<R, A1, A2, A3, A4, F> make_adaptable(F f)
|
||||
{
|
||||
return _bi::af4<R, A1, A2, A3, A4, F>(f);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
|
@ -1,304 +0,0 @@
|
||||
#ifndef BOOST_BIND_PROTECT_HPP_INCLUDED
|
||||
#define BOOST_BIND_PROTECT_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// protect.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2009 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace _bi
|
||||
{
|
||||
|
||||
template<class F> class protected_bind_t
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename F::result_type result_type;
|
||||
|
||||
explicit protected_bind_t(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
return f_();
|
||||
}
|
||||
|
||||
result_type operator()() const
|
||||
{
|
||||
return f_();
|
||||
}
|
||||
|
||||
template<class A1> result_type operator()(A1 & a1)
|
||||
{
|
||||
return f_(a1);
|
||||
}
|
||||
|
||||
template<class A1> result_type operator()(A1 & a1) const
|
||||
{
|
||||
return f_(a1);
|
||||
}
|
||||
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
|
||||
template<class A1> result_type operator()(const A1 & a1)
|
||||
{
|
||||
return f_(a1);
|
||||
}
|
||||
|
||||
template<class A1> result_type operator()(const A1 & a1) const
|
||||
{
|
||||
return f_(a1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2)
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2) const
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2)
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2) const
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2)
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2) const
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3)
|
||||
{
|
||||
return f_(a1, a2, a3);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const
|
||||
{
|
||||
return f_(a1, a2, a3);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
|
||||
template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3)
|
||||
{
|
||||
return f_(a1, a2, a3);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const
|
||||
{
|
||||
return f_(a1, a2, a3);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4)
|
||||
{
|
||||
return f_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
|
||||
template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4)
|
||||
{
|
||||
return f_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
&& !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
} // namespace _bi
|
||||
|
||||
template<class F> _bi::protected_bind_t<F> protect(F f)
|
||||
{
|
||||
return _bi::protected_bind_t<F>(f);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_BIND_PROTECT_HPP_INCLUDED
|
@ -1,107 +0,0 @@
|
||||
// boost cast.hpp header file ----------------------------------------------//
|
||||
|
||||
// (C) Copyright Kevlin Henney and Dave Abrahams 1999.
|
||||
// Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/conversion for Documentation.
|
||||
|
||||
// Revision History
|
||||
// 23 JUn 05 numeric_cast removed and redirected to the new verion (Fernando Cacciola)
|
||||
// 02 Apr 01 Removed BOOST_NO_LIMITS workarounds and included
|
||||
// <boost/limits.hpp> instead (the workaround did not
|
||||
// actually compile when BOOST_NO_LIMITS was defined in
|
||||
// any case, so we loose nothing). (John Maddock)
|
||||
// 21 Jan 01 Undid a bug I introduced yesterday. numeric_cast<> never
|
||||
// worked with stock GCC; trying to get it to do that broke
|
||||
// vc-stlport.
|
||||
// 20 Jan 01 Moved BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS to config.hpp.
|
||||
// Removed unused BOOST_EXPLICIT_TARGET macro. Moved
|
||||
// boost::detail::type to boost/type.hpp. Made it compile with
|
||||
// stock gcc again (Dave Abrahams)
|
||||
// 29 Nov 00 Remove nested namespace cast, cleanup spacing before Formal
|
||||
// Review (Beman Dawes)
|
||||
// 19 Oct 00 Fix numeric_cast for floating-point types (Dave Abrahams)
|
||||
// 15 Jul 00 Suppress numeric_cast warnings for GCC, Borland and MSVC
|
||||
// (Dave Abrahams)
|
||||
// 30 Jun 00 More MSVC6 wordarounds. See comments below. (Dave Abrahams)
|
||||
// 28 Jun 00 Removed implicit_cast<>. See comment below. (Beman Dawes)
|
||||
// 27 Jun 00 More MSVC6 workarounds
|
||||
// 15 Jun 00 Add workarounds for MSVC6
|
||||
// 2 Feb 00 Remove bad_numeric_cast ";" syntax error (Doncho Angelov)
|
||||
// 26 Jan 00 Add missing throw() to bad_numeric_cast::what(0 (Adam Levar)
|
||||
// 29 Dec 99 Change using declarations so usages in other namespaces work
|
||||
// correctly (Dave Abrahams)
|
||||
// 23 Sep 99 Change polymorphic_downcast assert to also detect M.I. errors
|
||||
// as suggested Darin Adler and improved by Valentin Bonnard.
|
||||
// 2 Sep 99 Remove controversial asserts, simplify, rename.
|
||||
// 30 Aug 99 Move to cast.hpp, replace value_cast with numeric_cast,
|
||||
// place in nested namespace.
|
||||
// 3 Aug 99 Initial version
|
||||
|
||||
#ifndef BOOST_CAST_HPP
|
||||
#define BOOST_CAST_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/assert.hpp>
|
||||
# include <typeinfo>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/limits.hpp>
|
||||
# include <boost/detail/select_type.hpp>
|
||||
|
||||
// It has been demonstrated numerous times that MSVC 6.0 fails silently at link
|
||||
// time if you use a template function which has template parameters that don't
|
||||
// appear in the function's argument list.
|
||||
//
|
||||
// TODO: Add this to config.hpp?
|
||||
# if defined(BOOST_MSVC) && BOOST_MSVC < 1300
|
||||
# define BOOST_EXPLICIT_DEFAULT_TARGET , ::boost::type<Target>* = 0
|
||||
# else
|
||||
# define BOOST_EXPLICIT_DEFAULT_TARGET
|
||||
# endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// See the documentation for descriptions of how to choose between
|
||||
// static_cast<>, dynamic_cast<>, polymorphic_cast<> and polymorphic_downcast<>
|
||||
|
||||
// polymorphic_cast --------------------------------------------------------//
|
||||
|
||||
// Runtime checked polymorphic downcasts and crosscasts.
|
||||
// Suggested in The C++ Programming Language, 3rd Ed, Bjarne Stroustrup,
|
||||
// section 15.8 exercise 1, page 425.
|
||||
|
||||
template <class Target, class Source>
|
||||
inline Target polymorphic_cast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET)
|
||||
{
|
||||
Target tmp = dynamic_cast<Target>(x);
|
||||
if ( tmp == 0 ) throw std::bad_cast();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
// polymorphic_downcast ----------------------------------------------------//
|
||||
|
||||
// BOOST_ASSERT() checked polymorphic downcast. Crosscasts prohibited.
|
||||
|
||||
// WARNING: Because this cast uses BOOST_ASSERT(), it violates
|
||||
// the One Definition Rule if used in multiple translation units
|
||||
// where BOOST_DISABLE_ASSERTS, BOOST_ENABLE_ASSERT_HANDLER
|
||||
// NDEBUG are defined inconsistently.
|
||||
|
||||
// Contributed by Dave Abrahams
|
||||
|
||||
template <class Target, class Source>
|
||||
inline Target polymorphic_downcast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET)
|
||||
{
|
||||
BOOST_ASSERT( dynamic_cast<Target>(x) == x ); // detect logic error
|
||||
return static_cast<Target>(x);
|
||||
}
|
||||
|
||||
# undef BOOST_EXPLICIT_DEFAULT_TARGET
|
||||
|
||||
} // namespace boost
|
||||
|
||||
# include <boost/numeric/conversion/cast.hpp>
|
||||
|
||||
#endif // BOOST_CAST_HPP
|
@ -1,24 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/utility for most recent version including documentation.
|
||||
|
||||
// See boost/detail/compressed_pair.hpp and boost/detail/ob_compressed_pair.hpp
|
||||
// for full copyright notices.
|
||||
|
||||
#ifndef BOOST_COMPRESSED_PAIR_HPP
|
||||
#define BOOST_COMPRESSED_PAIR_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
#include <boost/detail/ob_compressed_pair.hpp>
|
||||
#else
|
||||
#include <boost/detail/compressed_pair.hpp>
|
||||
#endif
|
||||
|
||||
#endif // BOOST_COMPRESSED_PAIR_HPP
|
@ -1,669 +0,0 @@
|
||||
//
|
||||
// (C) Copyright Jeremy Siek 2000.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// 17 July 2001: Added const to some member functions. (Jeremy Siek)
|
||||
// 05 May 2001: Removed static dummy_cons object. (Jeremy Siek)
|
||||
|
||||
// See http://www.boost.org/libs/concept_check for documentation.
|
||||
|
||||
#ifndef BOOST_CONCEPT_ARCHETYPES_HPP
|
||||
#define BOOST_CONCEPT_ARCHETYPES_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace boost {
|
||||
|
||||
//===========================================================================
|
||||
// Basic Archetype Classes
|
||||
|
||||
namespace detail {
|
||||
class dummy_constructor { };
|
||||
}
|
||||
|
||||
// A type that models no concept. The template parameter
|
||||
// is only there so that null_archetype types can be created
|
||||
// that have different type.
|
||||
template <class T = int>
|
||||
class null_archetype {
|
||||
private:
|
||||
null_archetype() { }
|
||||
null_archetype(const null_archetype&) { }
|
||||
null_archetype& operator=(const null_archetype&) { return *this; }
|
||||
public:
|
||||
null_archetype(detail::dummy_constructor) { }
|
||||
#ifndef __MWERKS__
|
||||
template <class TT>
|
||||
friend void dummy_friend(); // just to avoid warnings
|
||||
#endif
|
||||
};
|
||||
|
||||
// This is a helper class that provides a way to get a reference to
|
||||
// an object. The get() function will never be called at run-time
|
||||
// (nothing in this file will) so this seemingly very bad function
|
||||
// is really quite innocent. The name of this class needs to be
|
||||
// changed.
|
||||
template <class T>
|
||||
class static_object
|
||||
{
|
||||
public:
|
||||
static T& get()
|
||||
{
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
return *reinterpret_cast<T*>(0);
|
||||
#else
|
||||
static char d[sizeof(T)];
|
||||
return *reinterpret_cast<T*>(d);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <class Base = null_archetype<> >
|
||||
class default_constructible_archetype : public Base {
|
||||
public:
|
||||
default_constructible_archetype()
|
||||
: Base(static_object<detail::dummy_constructor>::get()) { }
|
||||
default_constructible_archetype(detail::dummy_constructor x) : Base(x) { }
|
||||
};
|
||||
|
||||
template <class Base = null_archetype<> >
|
||||
class assignable_archetype : public Base {
|
||||
assignable_archetype() { }
|
||||
assignable_archetype(const assignable_archetype&) { }
|
||||
public:
|
||||
assignable_archetype& operator=(const assignable_archetype&) {
|
||||
return *this;
|
||||
}
|
||||
assignable_archetype(detail::dummy_constructor x) : Base(x) { }
|
||||
};
|
||||
|
||||
template <class Base = null_archetype<> >
|
||||
class copy_constructible_archetype : public Base {
|
||||
public:
|
||||
copy_constructible_archetype()
|
||||
: Base(static_object<detail::dummy_constructor>::get()) { }
|
||||
copy_constructible_archetype(const copy_constructible_archetype&)
|
||||
: Base(static_object<detail::dummy_constructor>::get()) { }
|
||||
copy_constructible_archetype(detail::dummy_constructor x) : Base(x) { }
|
||||
};
|
||||
|
||||
template <class Base = null_archetype<> >
|
||||
class sgi_assignable_archetype : public Base {
|
||||
public:
|
||||
sgi_assignable_archetype(const sgi_assignable_archetype&)
|
||||
: Base(static_object<detail::dummy_constructor>::get()) { }
|
||||
sgi_assignable_archetype& operator=(const sgi_assignable_archetype&) {
|
||||
return *this;
|
||||
}
|
||||
sgi_assignable_archetype(const detail::dummy_constructor& x) : Base(x) { }
|
||||
};
|
||||
|
||||
struct default_archetype_base {
|
||||
default_archetype_base(detail::dummy_constructor) { }
|
||||
};
|
||||
|
||||
// Careful, don't use same type for T and Base. That results in the
|
||||
// conversion operator being invalid. Since T is often
|
||||
// null_archetype, can't use null_archetype for Base.
|
||||
template <class T, class Base = default_archetype_base>
|
||||
class convertible_to_archetype : public Base {
|
||||
private:
|
||||
convertible_to_archetype() { }
|
||||
convertible_to_archetype(const convertible_to_archetype& ) { }
|
||||
convertible_to_archetype& operator=(const convertible_to_archetype&)
|
||||
{ return *this; }
|
||||
public:
|
||||
convertible_to_archetype(detail::dummy_constructor x) : Base(x) { }
|
||||
operator const T&() const { return static_object<T>::get(); }
|
||||
};
|
||||
|
||||
template <class T, class Base = default_archetype_base>
|
||||
class convertible_from_archetype : public Base {
|
||||
private:
|
||||
convertible_from_archetype() { }
|
||||
convertible_from_archetype(const convertible_from_archetype& ) { }
|
||||
convertible_from_archetype& operator=(const convertible_from_archetype&)
|
||||
{ return *this; }
|
||||
public:
|
||||
convertible_from_archetype(detail::dummy_constructor x) : Base(x) { }
|
||||
convertible_from_archetype(const T&) { }
|
||||
convertible_from_archetype& operator=(const T&)
|
||||
{ return *this; }
|
||||
};
|
||||
|
||||
class boolean_archetype {
|
||||
public:
|
||||
boolean_archetype(const boolean_archetype&) { }
|
||||
operator bool() const { return true; }
|
||||
boolean_archetype(detail::dummy_constructor) { }
|
||||
private:
|
||||
boolean_archetype() { }
|
||||
boolean_archetype& operator=(const boolean_archetype&) { return *this; }
|
||||
};
|
||||
|
||||
template <class Base = null_archetype<> >
|
||||
class equality_comparable_archetype : public Base {
|
||||
public:
|
||||
equality_comparable_archetype(detail::dummy_constructor x) : Base(x) { }
|
||||
};
|
||||
template <class Base>
|
||||
boolean_archetype
|
||||
operator==(const equality_comparable_archetype<Base>&,
|
||||
const equality_comparable_archetype<Base>&)
|
||||
{
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get());
|
||||
}
|
||||
template <class Base>
|
||||
boolean_archetype
|
||||
operator!=(const equality_comparable_archetype<Base>&,
|
||||
const equality_comparable_archetype<Base>&)
|
||||
{
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get());
|
||||
}
|
||||
|
||||
|
||||
template <class Base = null_archetype<> >
|
||||
class equality_comparable2_first_archetype : public Base {
|
||||
public:
|
||||
equality_comparable2_first_archetype(detail::dummy_constructor x)
|
||||
: Base(x) { }
|
||||
};
|
||||
template <class Base = null_archetype<> >
|
||||
class equality_comparable2_second_archetype : public Base {
|
||||
public:
|
||||
equality_comparable2_second_archetype(detail::dummy_constructor x)
|
||||
: Base(x) { }
|
||||
};
|
||||
template <class Base1, class Base2>
|
||||
boolean_archetype
|
||||
operator==(const equality_comparable2_first_archetype<Base1>&,
|
||||
const equality_comparable2_second_archetype<Base2>&)
|
||||
{
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get());
|
||||
}
|
||||
template <class Base1, class Base2>
|
||||
boolean_archetype
|
||||
operator!=(const equality_comparable2_first_archetype<Base1>&,
|
||||
const equality_comparable2_second_archetype<Base2>&)
|
||||
{
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get());
|
||||
}
|
||||
|
||||
|
||||
template <class Base = null_archetype<> >
|
||||
class less_than_comparable_archetype : public Base {
|
||||
public:
|
||||
less_than_comparable_archetype(detail::dummy_constructor x) : Base(x) { }
|
||||
};
|
||||
template <class Base>
|
||||
boolean_archetype
|
||||
operator<(const less_than_comparable_archetype<Base>&,
|
||||
const less_than_comparable_archetype<Base>&)
|
||||
{
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <class Base = null_archetype<> >
|
||||
class comparable_archetype : public Base {
|
||||
public:
|
||||
comparable_archetype(detail::dummy_constructor x) : Base(x) { }
|
||||
};
|
||||
template <class Base>
|
||||
boolean_archetype
|
||||
operator<(const comparable_archetype<Base>&,
|
||||
const comparable_archetype<Base>&)
|
||||
{
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get());
|
||||
}
|
||||
template <class Base>
|
||||
boolean_archetype
|
||||
operator<=(const comparable_archetype<Base>&,
|
||||
const comparable_archetype<Base>&)
|
||||
{
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get());
|
||||
}
|
||||
template <class Base>
|
||||
boolean_archetype
|
||||
operator>(const comparable_archetype<Base>&,
|
||||
const comparable_archetype<Base>&)
|
||||
{
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get());
|
||||
}
|
||||
template <class Base>
|
||||
boolean_archetype
|
||||
operator>=(const comparable_archetype<Base>&,
|
||||
const comparable_archetype<Base>&)
|
||||
{
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get());
|
||||
}
|
||||
|
||||
|
||||
// The purpose of the optags is so that one can specify
|
||||
// exactly which types the operator< is defined between.
|
||||
// This is useful for allowing the operations:
|
||||
//
|
||||
// A a; B b;
|
||||
// a < b
|
||||
// b < a
|
||||
//
|
||||
// without also allowing the combinations:
|
||||
//
|
||||
// a < a
|
||||
// b < b
|
||||
//
|
||||
struct optag1 { };
|
||||
struct optag2 { };
|
||||
struct optag3 { };
|
||||
|
||||
#define BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(OP, NAME) \
|
||||
template <class Base = null_archetype<>, class Tag = optag1 > \
|
||||
class NAME##_first_archetype : public Base { \
|
||||
public: \
|
||||
NAME##_first_archetype(detail::dummy_constructor x) : Base(x) { } \
|
||||
}; \
|
||||
\
|
||||
template <class Base = null_archetype<>, class Tag = optag1 > \
|
||||
class NAME##_second_archetype : public Base { \
|
||||
public: \
|
||||
NAME##_second_archetype(detail::dummy_constructor x) : Base(x) { } \
|
||||
}; \
|
||||
\
|
||||
template <class BaseFirst, class BaseSecond, class Tag> \
|
||||
boolean_archetype \
|
||||
operator OP (const NAME##_first_archetype<BaseFirst, Tag>&, \
|
||||
const NAME##_second_archetype<BaseSecond, Tag>&) \
|
||||
{ \
|
||||
return boolean_archetype(static_object<detail::dummy_constructor>::get()); \
|
||||
}
|
||||
|
||||
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(==, equal_op)
|
||||
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(!=, not_equal_op)
|
||||
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(<, less_than_op)
|
||||
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(<=, less_equal_op)
|
||||
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(>, greater_than_op)
|
||||
BOOST_DEFINE_BINARY_PREDICATE_ARCHETYPE(>=, greater_equal_op)
|
||||
|
||||
#define BOOST_DEFINE_OPERATOR_ARCHETYPE(OP, NAME) \
|
||||
template <class Base = null_archetype<> > \
|
||||
class NAME##_archetype : public Base { \
|
||||
public: \
|
||||
NAME##_archetype(detail::dummy_constructor x) : Base(x) { } \
|
||||
NAME##_archetype(const NAME##_archetype&) \
|
||||
: Base(static_object<detail::dummy_constructor>::get()) { } \
|
||||
NAME##_archetype& operator=(const NAME##_archetype&) { return *this; } \
|
||||
}; \
|
||||
template <class Base> \
|
||||
NAME##_archetype<Base> \
|
||||
operator OP (const NAME##_archetype<Base>&,\
|
||||
const NAME##_archetype<Base>&) \
|
||||
{ \
|
||||
return \
|
||||
NAME##_archetype<Base>(static_object<detail::dummy_constructor>::get()); \
|
||||
}
|
||||
|
||||
BOOST_DEFINE_OPERATOR_ARCHETYPE(+, addable)
|
||||
BOOST_DEFINE_OPERATOR_ARCHETYPE(-, subtractable)
|
||||
BOOST_DEFINE_OPERATOR_ARCHETYPE(*, multipliable)
|
||||
BOOST_DEFINE_OPERATOR_ARCHETYPE(/, dividable)
|
||||
BOOST_DEFINE_OPERATOR_ARCHETYPE(%, modable)
|
||||
|
||||
// As is, these are useless because of the return type.
|
||||
// Need to invent a better way...
|
||||
#define BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(OP, NAME) \
|
||||
template <class Return, class Base = null_archetype<> > \
|
||||
class NAME##_first_archetype : public Base { \
|
||||
public: \
|
||||
NAME##_first_archetype(detail::dummy_constructor x) : Base(x) { } \
|
||||
}; \
|
||||
\
|
||||
template <class Return, class Base = null_archetype<> > \
|
||||
class NAME##_second_archetype : public Base { \
|
||||
public: \
|
||||
NAME##_second_archetype(detail::dummy_constructor x) : Base(x) { } \
|
||||
}; \
|
||||
\
|
||||
template <class Return, class BaseFirst, class BaseSecond> \
|
||||
Return \
|
||||
operator OP (const NAME##_first_archetype<Return, BaseFirst>&, \
|
||||
const NAME##_second_archetype<Return, BaseSecond>&) \
|
||||
{ \
|
||||
return Return(static_object<detail::dummy_constructor>::get()); \
|
||||
}
|
||||
|
||||
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(+, plus_op)
|
||||
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(*, time_op)
|
||||
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(/, divide_op)
|
||||
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(-, subtract_op)
|
||||
BOOST_DEFINE_BINARY_OPERATOR_ARCHETYPE(%, mod_op)
|
||||
|
||||
//===========================================================================
|
||||
// Function Object Archetype Classes
|
||||
|
||||
template <class Return>
|
||||
class generator_archetype {
|
||||
public:
|
||||
const Return& operator()() {
|
||||
return static_object<Return>::get();
|
||||
}
|
||||
};
|
||||
|
||||
class void_generator_archetype {
|
||||
public:
|
||||
void operator()() { }
|
||||
};
|
||||
|
||||
template <class Arg, class Return>
|
||||
class unary_function_archetype {
|
||||
private:
|
||||
unary_function_archetype() { }
|
||||
public:
|
||||
unary_function_archetype(detail::dummy_constructor) { }
|
||||
const Return& operator()(const Arg&) const {
|
||||
return static_object<Return>::get();
|
||||
}
|
||||
};
|
||||
|
||||
template <class Arg1, class Arg2, class Return>
|
||||
class binary_function_archetype {
|
||||
private:
|
||||
binary_function_archetype() { }
|
||||
public:
|
||||
binary_function_archetype(detail::dummy_constructor) { }
|
||||
const Return& operator()(const Arg1&, const Arg2&) const {
|
||||
return static_object<Return>::get();
|
||||
}
|
||||
};
|
||||
|
||||
template <class Arg>
|
||||
class unary_predicate_archetype {
|
||||
typedef boolean_archetype Return;
|
||||
unary_predicate_archetype() { }
|
||||
public:
|
||||
unary_predicate_archetype(detail::dummy_constructor) { }
|
||||
const Return& operator()(const Arg&) const {
|
||||
return static_object<Return>::get();
|
||||
}
|
||||
};
|
||||
|
||||
template <class Arg1, class Arg2, class Base = null_archetype<> >
|
||||
class binary_predicate_archetype {
|
||||
typedef boolean_archetype Return;
|
||||
binary_predicate_archetype() { }
|
||||
public:
|
||||
binary_predicate_archetype(detail::dummy_constructor) { }
|
||||
const Return& operator()(const Arg1&, const Arg2&) const {
|
||||
return static_object<Return>::get();
|
||||
}
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
// Iterator Archetype Classes
|
||||
|
||||
template <class T, int I = 0>
|
||||
class input_iterator_archetype
|
||||
{
|
||||
private:
|
||||
typedef input_iterator_archetype self;
|
||||
public:
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
struct reference {
|
||||
operator const value_type&() const { return static_object<T>::get(); }
|
||||
};
|
||||
typedef const T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return reference(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class input_iterator_archetype_no_proxy
|
||||
{
|
||||
private:
|
||||
typedef input_iterator_archetype_no_proxy self;
|
||||
public:
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
typedef const T& reference;
|
||||
typedef const T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return static_object<T>::get(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct output_proxy {
|
||||
output_proxy& operator=(const T&) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class output_iterator_archetype
|
||||
{
|
||||
public:
|
||||
typedef output_iterator_archetype self;
|
||||
public:
|
||||
typedef std::output_iterator_tag iterator_category;
|
||||
typedef output_proxy<T> value_type;
|
||||
typedef output_proxy<T> reference;
|
||||
typedef void pointer;
|
||||
typedef void difference_type;
|
||||
output_iterator_archetype(detail::dummy_constructor) { }
|
||||
output_iterator_archetype(const self&) { }
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return output_proxy<T>(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
private:
|
||||
output_iterator_archetype() { }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class input_output_iterator_archetype
|
||||
{
|
||||
private:
|
||||
typedef input_output_iterator_archetype self;
|
||||
struct in_out_tag : public std::input_iterator_tag, public std::output_iterator_tag { };
|
||||
public:
|
||||
typedef in_out_tag iterator_category;
|
||||
typedef T value_type;
|
||||
struct reference {
|
||||
reference& operator=(const T&) { return *this; }
|
||||
operator value_type() { return static_object<T>::get(); }
|
||||
};
|
||||
typedef const T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
input_output_iterator_archetype() { }
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return reference(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class forward_iterator_archetype
|
||||
{
|
||||
public:
|
||||
typedef forward_iterator_archetype self;
|
||||
public:
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
typedef const T& reference;
|
||||
typedef T const* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
forward_iterator_archetype() { }
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return static_object<T>::get(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class mutable_forward_iterator_archetype
|
||||
{
|
||||
public:
|
||||
typedef mutable_forward_iterator_archetype self;
|
||||
public:
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
mutable_forward_iterator_archetype() { }
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return static_object<T>::get(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class bidirectional_iterator_archetype
|
||||
{
|
||||
public:
|
||||
typedef bidirectional_iterator_archetype self;
|
||||
public:
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
typedef const T& reference;
|
||||
typedef T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
bidirectional_iterator_archetype() { }
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return static_object<T>::get(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
self& operator--() { return *this; }
|
||||
self operator--(int) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class mutable_bidirectional_iterator_archetype
|
||||
{
|
||||
public:
|
||||
typedef mutable_bidirectional_iterator_archetype self;
|
||||
public:
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
mutable_bidirectional_iterator_archetype() { }
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return static_object<T>::get(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
self& operator--() { return *this; }
|
||||
self operator--(int) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class random_access_iterator_archetype
|
||||
{
|
||||
public:
|
||||
typedef random_access_iterator_archetype self;
|
||||
public:
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
typedef const T& reference;
|
||||
typedef T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
random_access_iterator_archetype() { }
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return static_object<T>::get(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
self& operator--() { return *this; }
|
||||
self operator--(int) { return *this; }
|
||||
reference operator[](difference_type) const
|
||||
{ return static_object<T>::get(); }
|
||||
self& operator+=(difference_type) { return *this; }
|
||||
self& operator-=(difference_type) { return *this; }
|
||||
difference_type operator-(const self&) const
|
||||
{ return difference_type(); }
|
||||
self operator+(difference_type) const { return *this; }
|
||||
self operator-(difference_type) const { return *this; }
|
||||
bool operator<(const self&) const { return true; }
|
||||
bool operator<=(const self&) const { return true; }
|
||||
bool operator>(const self&) const { return true; }
|
||||
bool operator>=(const self&) const { return true; }
|
||||
};
|
||||
template <class T>
|
||||
random_access_iterator_archetype<T>
|
||||
operator+(typename random_access_iterator_archetype<T>::difference_type,
|
||||
const random_access_iterator_archetype<T>& x)
|
||||
{ return x; }
|
||||
|
||||
|
||||
template <class T>
|
||||
class mutable_random_access_iterator_archetype
|
||||
{
|
||||
public:
|
||||
typedef mutable_random_access_iterator_archetype self;
|
||||
public:
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
mutable_random_access_iterator_archetype() { }
|
||||
self& operator=(const self&) { return *this; }
|
||||
bool operator==(const self&) const { return true; }
|
||||
bool operator!=(const self&) const { return true; }
|
||||
reference operator*() const { return static_object<T>::get(); }
|
||||
self& operator++() { return *this; }
|
||||
self operator++(int) { return *this; }
|
||||
self& operator--() { return *this; }
|
||||
self operator--(int) { return *this; }
|
||||
reference operator[](difference_type) const
|
||||
{ return static_object<T>::get(); }
|
||||
self& operator+=(difference_type) { return *this; }
|
||||
self& operator-=(difference_type) { return *this; }
|
||||
difference_type operator-(const self&) const
|
||||
{ return difference_type(); }
|
||||
self operator+(difference_type) const { return *this; }
|
||||
self operator-(difference_type) const { return *this; }
|
||||
bool operator<(const self&) const { return true; }
|
||||
bool operator<=(const self&) const { return true; }
|
||||
bool operator>(const self&) const { return true; }
|
||||
bool operator>=(const self&) const { return true; }
|
||||
};
|
||||
template <class T>
|
||||
mutable_random_access_iterator_archetype<T>
|
||||
operator+
|
||||
(typename mutable_random_access_iterator_archetype<T>::difference_type,
|
||||
const mutable_random_access_iterator_archetype<T>& x)
|
||||
{ return x; }
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_CONCEPT_ARCHETYPES_H
|
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
||||
// boost/cstdlib.hpp header ------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2001. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/utility/cstdlib.html for documentation.
|
||||
|
||||
// Revision History
|
||||
// 26 Feb 01 Initial version (Beman Dawes)
|
||||
|
||||
#ifndef BOOST_CSTDLIB_HPP
|
||||
#define BOOST_CSTDLIB_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// The intent is to propose the following for addition to namespace std
|
||||
// in the C++ Standard Library, and to then deprecate EXIT_SUCCESS and
|
||||
// EXIT_FAILURE. As an implementation detail, this header defines the
|
||||
// new constants in terms of EXIT_SUCCESS and EXIT_FAILURE. In a new
|
||||
// standard, the constants would be implementation-defined, although it
|
||||
// might be worthwhile to "suggest" (which a standard is allowed to do)
|
||||
// values of 0 and 1 respectively.
|
||||
|
||||
// Rationale for having multiple failure values: some environments may
|
||||
// wish to distinguish between different classes of errors.
|
||||
// Rationale for choice of values: programs often use values < 100 for
|
||||
// their own error reporting. Values > 255 are sometimes reserved for
|
||||
// system detected errors. 200/201 were suggested to minimize conflict.
|
||||
|
||||
const int exit_success = EXIT_SUCCESS; // implementation-defined value
|
||||
const int exit_failure = EXIT_FAILURE; // implementation-defined value
|
||||
const int exit_exception_failure = 200; // otherwise uncaught exception
|
||||
const int exit_test_failure = 201; // report_error or
|
||||
// report_critical_error called.
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,82 +0,0 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1996
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ALGORITHM_HPP
|
||||
# define BOOST_ALGORITHM_HPP
|
||||
# include <boost/detail/iterator.hpp>
|
||||
// Algorithms on sequences
|
||||
//
|
||||
// The functions in this file have not yet gone through formal
|
||||
// review, and are subject to change. This is a work in progress.
|
||||
// They have been checked into the detail directory because
|
||||
// there are some graph algorithms that use these functions.
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/algorithm/copy.hpp>
|
||||
#include <boost/range/algorithm/equal.hpp>
|
||||
#include <boost/range/algorithm/sort.hpp>
|
||||
#include <boost/range/algorithm/stable_sort.hpp>
|
||||
#include <boost/range/algorithm/find_if.hpp>
|
||||
#include <boost/range/algorithm/count.hpp>
|
||||
#include <boost/range/algorithm/count_if.hpp>
|
||||
#include <boost/range/algorithm_ext/is_sorted.hpp>
|
||||
#include <boost/range/algorithm_ext/iota.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename InputIterator, typename Predicate>
|
||||
bool any_if(InputIterator first, InputIterator last, Predicate p)
|
||||
{
|
||||
return std::find_if(first, last, p) != last;
|
||||
}
|
||||
|
||||
template <typename Container, typename Predicate>
|
||||
bool any_if(const Container& c, Predicate p)
|
||||
{
|
||||
return any_if(boost::begin(c), boost::end(c), p);
|
||||
}
|
||||
|
||||
template <typename InputIterator, typename T>
|
||||
bool container_contains(InputIterator first, InputIterator last, T value)
|
||||
{
|
||||
return std::find(first, last, value) != last;
|
||||
}
|
||||
template <typename Container, typename T>
|
||||
bool container_contains(const Container& c, const T& value)
|
||||
{
|
||||
return container_contains(boost::begin(c), boost::end(c), value);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ALGORITHM_HPP
|
@ -1,212 +0,0 @@
|
||||
/* Copyright 2003-2009 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See Boost website at http://www.boost.org/
|
||||
*/
|
||||
|
||||
#ifndef BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP
|
||||
#define BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/aux_/msvc_never_true.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* Allocator adaption layer. Some stdlibs provide allocators without rebind
|
||||
* and template ctors. These facilities are simulated with the external
|
||||
* template class rebind_to and the aid of partial_std_allocator_wrapper.
|
||||
*/
|
||||
|
||||
namespace allocator{
|
||||
|
||||
/* partial_std_allocator_wrapper inherits the functionality of a std
|
||||
* allocator while providing a templatized ctor and other bits missing
|
||||
* in some stdlib implementation or another.
|
||||
*/
|
||||
|
||||
template<typename Type>
|
||||
class partial_std_allocator_wrapper:public std::allocator<Type>
|
||||
{
|
||||
public:
|
||||
/* Oddly enough, STLport does not define std::allocator<void>::value_type
|
||||
* when configured to work without partial template specialization.
|
||||
* No harm in supplying the definition here unconditionally.
|
||||
*/
|
||||
|
||||
typedef Type value_type;
|
||||
|
||||
partial_std_allocator_wrapper(){};
|
||||
|
||||
template<typename Other>
|
||||
partial_std_allocator_wrapper(const partial_std_allocator_wrapper<Other>&){}
|
||||
|
||||
partial_std_allocator_wrapper(const std::allocator<Type>& x):
|
||||
std::allocator<Type>(x)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(BOOST_DINKUMWARE_STDLIB)
|
||||
/* Dinkumware guys didn't provide a means to call allocate() without
|
||||
* supplying a hint, in disagreement with the standard.
|
||||
*/
|
||||
|
||||
Type* allocate(std::size_t n,const void* hint=0)
|
||||
{
|
||||
std::allocator<Type>& a=*this;
|
||||
return a.allocate(n,hint);
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
/* Detects whether a given allocator belongs to a defective stdlib not
|
||||
* having the required member templates.
|
||||
* Note that it does not suffice to check the Boost.Config stdlib
|
||||
* macros, as the user might have passed a custom, compliant allocator.
|
||||
* The checks also considers partial_std_allocator_wrapper to be
|
||||
* a standard defective allocator.
|
||||
*/
|
||||
|
||||
#if defined(BOOST_NO_STD_ALLOCATOR)&&\
|
||||
(defined(BOOST_HAS_PARTIAL_STD_ALLOCATOR)||defined(BOOST_DINKUMWARE_STDLIB))
|
||||
|
||||
template<typename Allocator>
|
||||
struct is_partial_std_allocator
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value=
|
||||
(is_same<
|
||||
std::allocator<BOOST_DEDUCED_TYPENAME Allocator::value_type>,
|
||||
Allocator
|
||||
>::value)||
|
||||
(is_same<
|
||||
partial_std_allocator_wrapper<
|
||||
BOOST_DEDUCED_TYPENAME Allocator::value_type>,
|
||||
Allocator
|
||||
>::value));
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template<typename Allocator>
|
||||
struct is_partial_std_allocator
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool,value=false);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* rebind operations for defective std allocators */
|
||||
|
||||
template<typename Allocator,typename Type>
|
||||
struct partial_std_allocator_rebind_to
|
||||
{
|
||||
typedef partial_std_allocator_wrapper<Type> type;
|
||||
};
|
||||
|
||||
/* rebind operation in all other cases */
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,<1300)
|
||||
/* Workaround for a problem in MSVC with dependent template typedefs
|
||||
* when doing rebinding of allocators.
|
||||
* Modeled after <boost/mpl/aux_/msvc_dtw.hpp> (thanks, Aleksey!)
|
||||
*/
|
||||
|
||||
template<typename Allocator>
|
||||
struct rebinder
|
||||
{
|
||||
template<bool> struct fake_allocator:Allocator{};
|
||||
template<> struct fake_allocator<true>
|
||||
{
|
||||
template<typename Type> struct rebind{};
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
struct result:
|
||||
fake_allocator<mpl::aux::msvc_never_true<Allocator>::value>::
|
||||
template rebind<Type>
|
||||
{
|
||||
};
|
||||
};
|
||||
#else
|
||||
template<typename Allocator>
|
||||
struct rebinder
|
||||
{
|
||||
template<typename Type>
|
||||
struct result
|
||||
{
|
||||
typedef typename Allocator::BOOST_NESTED_TEMPLATE
|
||||
rebind<Type>::other other;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename Allocator,typename Type>
|
||||
struct compliant_allocator_rebind_to
|
||||
{
|
||||
typedef typename rebinder<Allocator>::
|
||||
BOOST_NESTED_TEMPLATE result<Type>::other type;
|
||||
};
|
||||
|
||||
/* rebind front-end */
|
||||
|
||||
template<typename Allocator,typename Type>
|
||||
struct rebind_to:
|
||||
mpl::eval_if_c<
|
||||
is_partial_std_allocator<Allocator>::value,
|
||||
partial_std_allocator_rebind_to<Allocator,Type>,
|
||||
compliant_allocator_rebind_to<Allocator,Type>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
/* allocator-independent versions of construct and destroy */
|
||||
|
||||
template<typename Type>
|
||||
void construct(void* p,const Type& t)
|
||||
{
|
||||
new (p) Type(t);
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
|
||||
/* MSVC++ issues spurious warnings about unreferencend formal parameters
|
||||
* in destroy<Type> when Type is a class with trivial dtor.
|
||||
*/
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100)
|
||||
#endif
|
||||
|
||||
template<typename Type>
|
||||
void destroy(const Type* p)
|
||||
{
|
||||
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590))
|
||||
const_cast<Type*>(p)->~Type();
|
||||
#else
|
||||
p->~Type();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
} /* namespace boost::detail::allocator */
|
||||
|
||||
} /* namespace boost::detail */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
@ -1,21 +0,0 @@
|
||||
#ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/atomic_count.hpp - thread/SMP safe reference counter
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/smart_ptr/detail/atomic_count.hpp>
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
|
@ -1,216 +0,0 @@
|
||||
// Copyright (c) 2000 David Abrahams.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Copyright (c) 1994
|
||||
// Hewlett-Packard Company
|
||||
//
|
||||
// Permission to use, copy, modify, distribute and sell this software
|
||||
// and its documentation for any purpose is hereby granted without fee,
|
||||
// provided that the above copyright notice appear in all copies and
|
||||
// that both that copyright notice and this permission notice appear
|
||||
// in supporting documentation. Hewlett-Packard Company makes no
|
||||
// representations about the suitability of this software for any
|
||||
// purpose. It is provided "as is" without express or implied warranty.
|
||||
//
|
||||
// Copyright (c) 1996
|
||||
// Silicon Graphics Computer Systems, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, distribute and sell this software
|
||||
// and its documentation for any purpose is hereby granted without fee,
|
||||
// provided that the above copyright notice appear in all copies and
|
||||
// that both that copyright notice and this permission notice appear
|
||||
// in supporting documentation. Silicon Graphics makes no
|
||||
// representations about the suitability of this software for any
|
||||
// purpose. It is provided "as is" without express or implied warranty.
|
||||
//
|
||||
#ifndef BINARY_SEARCH_DWA_122600_H_
|
||||
# define BINARY_SEARCH_DWA_122600_H_
|
||||
|
||||
# include <boost/detail/iterator.hpp>
|
||||
# include <utility>
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
template <class ForwardIter, class Tp>
|
||||
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
|
||||
const Tp& val)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (*middle < val) {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
else
|
||||
len = half;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp, class Compare>
|
||||
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
|
||||
const Tp& val, Compare comp)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (comp(*middle, val)) {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
else
|
||||
len = half;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp>
|
||||
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
|
||||
const Tp& val)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (val < *middle)
|
||||
len = half;
|
||||
else {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp, class Compare>
|
||||
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
|
||||
const Tp& val, Compare comp)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (comp(val, *middle))
|
||||
len = half;
|
||||
else {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp>
|
||||
std::pair<ForwardIter, ForwardIter>
|
||||
equal_range(ForwardIter first, ForwardIter last, const Tp& val)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle, left, right;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (*middle < val) {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
else if (val < *middle)
|
||||
len = half;
|
||||
else {
|
||||
left = boost::detail::lower_bound(first, middle, val);
|
||||
std::advance(first, len);
|
||||
right = boost::detail::upper_bound(++middle, first, val);
|
||||
return std::pair<ForwardIter, ForwardIter>(left, right);
|
||||
}
|
||||
}
|
||||
return std::pair<ForwardIter, ForwardIter>(first, first);
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp, class Compare>
|
||||
std::pair<ForwardIter, ForwardIter>
|
||||
equal_range(ForwardIter first, ForwardIter last, const Tp& val,
|
||||
Compare comp)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle, left, right;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (comp(*middle, val)) {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
else if (comp(val, *middle))
|
||||
len = half;
|
||||
else {
|
||||
left = boost::detail::lower_bound(first, middle, val, comp);
|
||||
std::advance(first, len);
|
||||
right = boost::detail::upper_bound(++middle, first, val, comp);
|
||||
return std::pair<ForwardIter, ForwardIter>(left, right);
|
||||
}
|
||||
}
|
||||
return std::pair<ForwardIter, ForwardIter>(first, first);
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp>
|
||||
bool binary_search(ForwardIter first, ForwardIter last,
|
||||
const Tp& val) {
|
||||
ForwardIter i = boost::detail::lower_bound(first, last, val);
|
||||
return i != last && !(val < *i);
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp, class Compare>
|
||||
bool binary_search(ForwardIter first, ForwardIter last,
|
||||
const Tp& val,
|
||||
Compare comp) {
|
||||
ForwardIter i = boost::detail::lower_bound(first, last, val, comp);
|
||||
return i != last && !comp(val, *i);
|
||||
}
|
||||
|
||||
}} // namespace boost::detail
|
||||
|
||||
#endif // BINARY_SEARCH_DWA_122600_H_
|
@ -1,146 +0,0 @@
|
||||
// boost/catch_exceptions.hpp -----------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 1995-2001. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for documentation.
|
||||
|
||||
// Revision History
|
||||
// 13 Jun 01 report_exception() made inline. (John Maddock, Jesse Jones)
|
||||
// 26 Feb 01 Numerous changes suggested during formal review. (Beman)
|
||||
// 25 Jan 01 catch_exceptions.hpp code factored out of cpp_main.cpp.
|
||||
// 22 Jan 01 Remove test_tools dependencies to reduce coupling.
|
||||
// 5 Nov 00 Initial boost version (Beman Dawes)
|
||||
|
||||
#ifndef BOOST_CATCH_EXCEPTIONS_HPP
|
||||
#define BOOST_CATCH_EXCEPTIONS_HPP
|
||||
|
||||
// header dependencies are deliberately restricted to the standard library
|
||||
// to reduce coupling to other boost libraries.
|
||||
#include <string> // for string
|
||||
#include <new> // for bad_alloc
|
||||
#include <typeinfo> // for bad_cast, bad_typeid
|
||||
#include <exception> // for exception, bad_exception
|
||||
#include <stdexcept> // for std exception hierarchy
|
||||
#include <boost/cstdlib.hpp> // for exit codes
|
||||
# if __GNUC__ != 2 || __GNUC_MINOR__ > 96
|
||||
# include <ostream> // for ostream
|
||||
# else
|
||||
# include <iostream> // workaround GNU missing ostream header
|
||||
# endif
|
||||
|
||||
# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551)
|
||||
# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
|
||||
# endif
|
||||
|
||||
#if defined(MPW_CPLUS) && (MPW_CPLUS <= 0x890)
|
||||
# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
|
||||
namespace std { class bad_typeid { }; }
|
||||
# endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// A separate reporting function was requested during formal review.
|
||||
inline void report_exception( std::ostream & os,
|
||||
const char * name, const char * info )
|
||||
{ os << "\n** uncaught exception: " << name << " " << info << std::endl; }
|
||||
}
|
||||
|
||||
// catch_exceptions ------------------------------------------------------//
|
||||
|
||||
template< class Generator > // Generator is function object returning int
|
||||
int catch_exceptions( Generator function_object,
|
||||
std::ostream & out, std::ostream & err )
|
||||
{
|
||||
int result = 0; // quiet compiler warnings
|
||||
bool exception_thrown = true; // avoid setting result for each excptn type
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
result = function_object();
|
||||
exception_thrown = false;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
// As a result of hard experience with strangely interleaved output
|
||||
// under some compilers, there is a lot of use of endl in the code below
|
||||
// where a simple '\n' might appear to do.
|
||||
|
||||
// The rules for catch & arguments are a bit different from function
|
||||
// arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't
|
||||
// required, but it doesn't hurt and some programmers ask for it.
|
||||
|
||||
catch ( const char * ex )
|
||||
{ detail::report_exception( out, "", ex ); }
|
||||
catch ( const std::string & ex )
|
||||
{ detail::report_exception( out, "", ex.c_str() ); }
|
||||
|
||||
// std:: exceptions
|
||||
catch ( const std::bad_alloc & ex )
|
||||
{ detail::report_exception( out, "std::bad_alloc:", ex.what() ); }
|
||||
|
||||
# ifndef BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
|
||||
catch ( const std::bad_cast & ex )
|
||||
{ detail::report_exception( out, "std::bad_cast:", ex.what() ); }
|
||||
catch ( const std::bad_typeid & ex )
|
||||
{ detail::report_exception( out, "std::bad_typeid:", ex.what() ); }
|
||||
# else
|
||||
catch ( const std::bad_cast & )
|
||||
{ detail::report_exception( out, "std::bad_cast", "" ); }
|
||||
catch ( const std::bad_typeid & )
|
||||
{ detail::report_exception( out, "std::bad_typeid", "" ); }
|
||||
# endif
|
||||
|
||||
catch ( const std::bad_exception & ex )
|
||||
{ detail::report_exception( out, "std::bad_exception:", ex.what() ); }
|
||||
catch ( const std::domain_error & ex )
|
||||
{ detail::report_exception( out, "std::domain_error:", ex.what() ); }
|
||||
catch ( const std::invalid_argument & ex )
|
||||
{ detail::report_exception( out, "std::invalid_argument:", ex.what() ); }
|
||||
catch ( const std::length_error & ex )
|
||||
{ detail::report_exception( out, "std::length_error:", ex.what() ); }
|
||||
catch ( const std::out_of_range & ex )
|
||||
{ detail::report_exception( out, "std::out_of_range:", ex.what() ); }
|
||||
catch ( const std::range_error & ex )
|
||||
{ detail::report_exception( out, "std::range_error:", ex.what() ); }
|
||||
catch ( const std::overflow_error & ex )
|
||||
{ detail::report_exception( out, "std::overflow_error:", ex.what() ); }
|
||||
catch ( const std::underflow_error & ex )
|
||||
{ detail::report_exception( out, "std::underflow_error:", ex.what() ); }
|
||||
catch ( const std::logic_error & ex )
|
||||
{ detail::report_exception( out, "std::logic_error:", ex.what() ); }
|
||||
catch ( const std::runtime_error & ex )
|
||||
{ detail::report_exception( out, "std::runtime_error:", ex.what() ); }
|
||||
catch ( const std::exception & ex )
|
||||
{ detail::report_exception( out, "std::exception:", ex.what() ); }
|
||||
|
||||
catch ( ... )
|
||||
{ detail::report_exception( out, "unknown exception", "" ); }
|
||||
#endif // BOOST_NO_EXCEPTIONS
|
||||
|
||||
if ( exception_thrown ) result = boost::exit_exception_failure;
|
||||
|
||||
if ( result != 0 && result != exit_success )
|
||||
{
|
||||
out << std::endl << "**** returning with error code "
|
||||
<< result << std::endl;
|
||||
err
|
||||
<< "********** errors detected; see stdout for details ***********"
|
||||
<< std::endl;
|
||||
}
|
||||
#if !defined(BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE)
|
||||
else { out << std::flush << "no errors detected" << std::endl; }
|
||||
#endif
|
||||
return result;
|
||||
} // catch_exceptions
|
||||
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_CATCH_EXCEPTIONS_HPP
|
||||
|
@ -1,443 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/utility for most recent version including documentation.
|
||||
|
||||
// compressed_pair: pair that "compresses" empty members
|
||||
// (see libs/utility/compressed_pair.htm)
|
||||
//
|
||||
// JM changes 25 Jan 2004:
|
||||
// For the case where T1 == T2 and both are empty, then first() and second()
|
||||
// should return different objects.
|
||||
// JM changes 25 Jan 2000:
|
||||
// Removed default arguments from compressed_pair_switch to get
|
||||
// C++ Builder 4 to accept them
|
||||
// rewriten swap to get gcc and C++ builder to compile.
|
||||
// added partial specialisations for case T1 == T2 to avoid duplicate constructor defs.
|
||||
|
||||
#ifndef BOOST_DETAIL_COMPRESSED_PAIR_HPP
|
||||
#define BOOST_DETAIL_COMPRESSED_PAIR_HPP
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/is_empty.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4512)
|
||||
#endif
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair;
|
||||
|
||||
|
||||
// compressed_pair
|
||||
|
||||
namespace details
|
||||
{
|
||||
// JM altered 26 Jan 2000:
|
||||
template <class T1, class T2, bool IsSame, bool FirstEmpty, bool SecondEmpty>
|
||||
struct compressed_pair_switch;
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, false, false, false>
|
||||
{static const int value = 0;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, false, true, true>
|
||||
{static const int value = 3;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, false, true, false>
|
||||
{static const int value = 1;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, false, false, true>
|
||||
{static const int value = 2;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, true, true, true>
|
||||
{static const int value = 4;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, true, false, false>
|
||||
{static const int value = 5;};
|
||||
|
||||
template <class T1, class T2, int Version> class compressed_pair_imp;
|
||||
|
||||
#ifdef __GNUC__
|
||||
// workaround for GCC (JM):
|
||||
using std::swap;
|
||||
#endif
|
||||
//
|
||||
// can't call unqualified swap from within classname::swap
|
||||
// as Koenig lookup rules will find only the classname::swap
|
||||
// member function not the global declaration, so use cp_swap
|
||||
// as a forwarding function (JM):
|
||||
template <typename T>
|
||||
inline void cp_swap(T& t1, T& t2)
|
||||
{
|
||||
#ifndef __GNUC__
|
||||
using std::swap;
|
||||
#endif
|
||||
swap(t1, t2);
|
||||
}
|
||||
|
||||
// 0 derive from neither
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 0>
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_(x), second_(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_(x) {}
|
||||
|
||||
compressed_pair_imp(second_param_type y)
|
||||
: second_(y) {}
|
||||
|
||||
first_reference first() {return first_;}
|
||||
first_const_reference first() const {return first_;}
|
||||
|
||||
second_reference second() {return second_;}
|
||||
second_const_reference second() const {return second_;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1, T2>& y)
|
||||
{
|
||||
cp_swap(first_, y.first());
|
||||
cp_swap(second_, y.second());
|
||||
}
|
||||
private:
|
||||
first_type first_;
|
||||
second_type second_;
|
||||
};
|
||||
|
||||
// 1 derive from T1
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 1>
|
||||
: protected ::boost::remove_cv<T1>::type
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_type(x), second_(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_type(x) {}
|
||||
|
||||
compressed_pair_imp(second_param_type y)
|
||||
: second_(y) {}
|
||||
|
||||
first_reference first() {return *this;}
|
||||
first_const_reference first() const {return *this;}
|
||||
|
||||
second_reference second() {return second_;}
|
||||
second_const_reference second() const {return second_;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1,T2>& y)
|
||||
{
|
||||
// no need to swap empty base class:
|
||||
cp_swap(second_, y.second());
|
||||
}
|
||||
private:
|
||||
second_type second_;
|
||||
};
|
||||
|
||||
// 2 derive from T2
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 2>
|
||||
: protected ::boost::remove_cv<T2>::type
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: second_type(y), first_(x) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_(x) {}
|
||||
|
||||
compressed_pair_imp(second_param_type y)
|
||||
: second_type(y) {}
|
||||
|
||||
first_reference first() {return first_;}
|
||||
first_const_reference first() const {return first_;}
|
||||
|
||||
second_reference second() {return *this;}
|
||||
second_const_reference second() const {return *this;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1,T2>& y)
|
||||
{
|
||||
// no need to swap empty base class:
|
||||
cp_swap(first_, y.first());
|
||||
}
|
||||
|
||||
private:
|
||||
first_type first_;
|
||||
};
|
||||
|
||||
// 3 derive from T1 and T2
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 3>
|
||||
: protected ::boost::remove_cv<T1>::type,
|
||||
protected ::boost::remove_cv<T2>::type
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_type(x), second_type(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_type(x) {}
|
||||
|
||||
compressed_pair_imp(second_param_type y)
|
||||
: second_type(y) {}
|
||||
|
||||
first_reference first() {return *this;}
|
||||
first_const_reference first() const {return *this;}
|
||||
|
||||
second_reference second() {return *this;}
|
||||
second_const_reference second() const {return *this;}
|
||||
//
|
||||
// no need to swap empty bases:
|
||||
void swap(::boost::compressed_pair<T1,T2>&) {}
|
||||
};
|
||||
|
||||
// JM
|
||||
// 4 T1 == T2, T1 and T2 both empty
|
||||
// Originally this did not store an instance of T2 at all
|
||||
// but that led to problems beause it meant &x.first() == &x.second()
|
||||
// which is not true for any other kind of pair, so now we store an instance
|
||||
// of T2 just in case the user is relying on first() and second() returning
|
||||
// different objects (albeit both empty).
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 4>
|
||||
: protected ::boost::remove_cv<T1>::type
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_type(x), m_second(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_type(x), m_second(x) {}
|
||||
|
||||
first_reference first() {return *this;}
|
||||
first_const_reference first() const {return *this;}
|
||||
|
||||
second_reference second() {return m_second;}
|
||||
second_const_reference second() const {return m_second;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1,T2>&) {}
|
||||
private:
|
||||
T2 m_second;
|
||||
};
|
||||
|
||||
// 5 T1 == T2 and are not empty: //JM
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 5>
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_(x), second_(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_(x), second_(x) {}
|
||||
|
||||
first_reference first() {return first_;}
|
||||
first_const_reference first() const {return first_;}
|
||||
|
||||
second_reference second() {return second_;}
|
||||
second_const_reference second() const {return second_;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1, T2>& y)
|
||||
{
|
||||
cp_swap(first_, y.first());
|
||||
cp_swap(second_, y.second());
|
||||
}
|
||||
private:
|
||||
first_type first_;
|
||||
second_type second_;
|
||||
};
|
||||
|
||||
} // details
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair
|
||||
: private ::boost::details::compressed_pair_imp<T1, T2,
|
||||
::boost::details::compressed_pair_switch<
|
||||
T1,
|
||||
T2,
|
||||
::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
|
||||
::boost::is_empty<T1>::value,
|
||||
::boost::is_empty<T2>::value>::value>
|
||||
{
|
||||
private:
|
||||
typedef details::compressed_pair_imp<T1, T2,
|
||||
::boost::details::compressed_pair_switch<
|
||||
T1,
|
||||
T2,
|
||||
::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
|
||||
::boost::is_empty<T1>::value,
|
||||
::boost::is_empty<T2>::value>::value> base;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair() : base() {}
|
||||
compressed_pair(first_param_type x, second_param_type y) : base(x, y) {}
|
||||
explicit compressed_pair(first_param_type x) : base(x) {}
|
||||
explicit compressed_pair(second_param_type y) : base(y) {}
|
||||
|
||||
first_reference first() {return base::first();}
|
||||
first_const_reference first() const {return base::first();}
|
||||
|
||||
second_reference second() {return base::second();}
|
||||
second_const_reference second() const {return base::second();}
|
||||
|
||||
void swap(compressed_pair& y) { base::swap(y); }
|
||||
};
|
||||
|
||||
// JM
|
||||
// Partial specialisation for case where T1 == T2:
|
||||
//
|
||||
template <class T>
|
||||
class compressed_pair<T, T>
|
||||
: private details::compressed_pair_imp<T, T,
|
||||
::boost::details::compressed_pair_switch<
|
||||
T,
|
||||
T,
|
||||
::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
|
||||
::boost::is_empty<T>::value,
|
||||
::boost::is_empty<T>::value>::value>
|
||||
{
|
||||
private:
|
||||
typedef details::compressed_pair_imp<T, T,
|
||||
::boost::details::compressed_pair_switch<
|
||||
T,
|
||||
T,
|
||||
::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
|
||||
::boost::is_empty<T>::value,
|
||||
::boost::is_empty<T>::value>::value> base;
|
||||
public:
|
||||
typedef T first_type;
|
||||
typedef T second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair() : base() {}
|
||||
compressed_pair(first_param_type x, second_param_type y) : base(x, y) {}
|
||||
#if !(defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530))
|
||||
explicit
|
||||
#endif
|
||||
compressed_pair(first_param_type x) : base(x) {}
|
||||
|
||||
first_reference first() {return base::first();}
|
||||
first_const_reference first() const {return base::first();}
|
||||
|
||||
second_reference second() {return base::second();}
|
||||
second_const_reference second() const {return base::second();}
|
||||
|
||||
void swap(::boost::compressed_pair<T,T>& y) { base::swap(y); }
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
inline
|
||||
void
|
||||
swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP
|
||||
|
@ -1,229 +0,0 @@
|
||||
// -----------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek
|
||||
// Copyright (c) 2003-2006, 2008 Gennaro Prota
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// -----------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_DETAIL_DYNAMIC_BITSET_HPP
|
||||
#define BOOST_DETAIL_DYNAMIC_BITSET_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/detail/workaround.hpp"
|
||||
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
namespace dynamic_bitset_impl {
|
||||
|
||||
// Gives (read-)access to the object representation
|
||||
// of an object of type T (3.9p4). CANNOT be used
|
||||
// on a base sub-object
|
||||
//
|
||||
template <typename T>
|
||||
inline const unsigned char * object_representation (T* p)
|
||||
{
|
||||
return static_cast<const unsigned char *>(static_cast<const void *>(p));
|
||||
}
|
||||
|
||||
template<typename T, int amount, int width /* = default */>
|
||||
struct shifter
|
||||
{
|
||||
static void left_shift(T & v) {
|
||||
amount >= width ? (v = 0)
|
||||
: (v >>= BOOST_DYNAMIC_BITSET_WRAP_CONSTANT(amount));
|
||||
}
|
||||
};
|
||||
|
||||
// ------- count function implementation --------------
|
||||
|
||||
typedef unsigned char byte_type;
|
||||
|
||||
// These two entities
|
||||
//
|
||||
// enum mode { access_by_bytes, access_by_blocks };
|
||||
// template <mode> struct mode_to_type {};
|
||||
//
|
||||
// were removed, since the regression logs (as of 24 Aug 2008)
|
||||
// showed that several compilers had troubles with recognizing
|
||||
//
|
||||
// const mode m = access_by_bytes
|
||||
//
|
||||
// as a constant expression
|
||||
//
|
||||
// * So, we'll use bool, instead of enum *.
|
||||
//
|
||||
template <bool value>
|
||||
struct value_to_type
|
||||
{
|
||||
value_to_type() {}
|
||||
};
|
||||
const bool access_by_bytes = true;
|
||||
const bool access_by_blocks = false;
|
||||
|
||||
|
||||
// the table: wrapped in a class template, so
|
||||
// that it is only instantiated if/when needed
|
||||
//
|
||||
template <bool dummy_name = true>
|
||||
struct count_table { static const byte_type table[]; };
|
||||
|
||||
template <>
|
||||
struct count_table<false> { /* no table */ };
|
||||
|
||||
|
||||
const unsigned int table_width = 8;
|
||||
template <bool b>
|
||||
const byte_type count_table<b>::table[] =
|
||||
{
|
||||
// Automatically generated by GPTableGen.exe v.1.0
|
||||
//
|
||||
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
|
||||
};
|
||||
|
||||
|
||||
// overload for access by bytes
|
||||
//
|
||||
|
||||
template <typename Iterator>
|
||||
inline std::size_t do_count(Iterator first, std::size_t length,
|
||||
int /*dummy param*/,
|
||||
value_to_type<access_by_bytes>* )
|
||||
{
|
||||
std::size_t num = 0;
|
||||
if (length)
|
||||
{
|
||||
const byte_type * p = object_representation(&*first);
|
||||
length *= sizeof(*first);
|
||||
|
||||
do {
|
||||
num += count_table<>::table[*p];
|
||||
++p;
|
||||
--length;
|
||||
|
||||
} while (length);
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
// overload for access by blocks
|
||||
//
|
||||
template <typename Iterator, typename ValueType>
|
||||
inline std::size_t do_count(Iterator first, std::size_t length, ValueType,
|
||||
value_to_type<access_by_blocks>*)
|
||||
{
|
||||
std::size_t num = 0;
|
||||
while (length){
|
||||
|
||||
ValueType value = *first;
|
||||
while (value) {
|
||||
num += count_table<>::table[value & ((1u<<table_width) - 1)];
|
||||
value >>= table_width;
|
||||
}
|
||||
|
||||
++first;
|
||||
--length;
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
|
||||
|
||||
// Some library implementations simply return a dummy
|
||||
// value such as
|
||||
//
|
||||
// size_type(-1) / sizeof(T)
|
||||
//
|
||||
// from vector<>::max_size. This tries to get more
|
||||
// meaningful info.
|
||||
//
|
||||
template <typename T>
|
||||
typename T::size_type vector_max_size_workaround(const T & v) {
|
||||
|
||||
typedef typename T::allocator_type allocator_type;
|
||||
|
||||
const typename allocator_type::size_type alloc_max =
|
||||
v.get_allocator().max_size();
|
||||
const typename T::size_type container_max = v.max_size();
|
||||
|
||||
return alloc_max < container_max?
|
||||
alloc_max :
|
||||
container_max;
|
||||
}
|
||||
|
||||
// for static_asserts
|
||||
template <typename T>
|
||||
struct allowed_block_type {
|
||||
enum { value = T(-1) > 0 }; // ensure T has no sign
|
||||
};
|
||||
|
||||
template <>
|
||||
struct allowed_block_type<bool> {
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct is_numeric {
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
# define BOOST_dynamic_bitset_is_numeric(x) \
|
||||
template<> \
|
||||
struct is_numeric< x > { \
|
||||
enum { value = true }; \
|
||||
} /**/
|
||||
|
||||
BOOST_dynamic_bitset_is_numeric(bool);
|
||||
BOOST_dynamic_bitset_is_numeric(char);
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
BOOST_dynamic_bitset_is_numeric(wchar_t);
|
||||
#endif
|
||||
|
||||
BOOST_dynamic_bitset_is_numeric(signed char);
|
||||
BOOST_dynamic_bitset_is_numeric(short int);
|
||||
BOOST_dynamic_bitset_is_numeric(int);
|
||||
BOOST_dynamic_bitset_is_numeric(long int);
|
||||
|
||||
BOOST_dynamic_bitset_is_numeric(unsigned char);
|
||||
BOOST_dynamic_bitset_is_numeric(unsigned short);
|
||||
BOOST_dynamic_bitset_is_numeric(unsigned int);
|
||||
BOOST_dynamic_bitset_is_numeric(unsigned long);
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
BOOST_dynamic_bitset_is_numeric(::boost::long_long_type);
|
||||
BOOST_dynamic_bitset_is_numeric(::boost::ulong_long_type);
|
||||
#endif
|
||||
|
||||
// intentionally omitted
|
||||
//BOOST_dynamic_bitset_is_numeric(float);
|
||||
//BOOST_dynamic_bitset_is_numeric(double);
|
||||
//BOOST_dynamic_bitset_is_numeric(long double);
|
||||
|
||||
#undef BOOST_dynamic_bitset_is_numeric
|
||||
|
||||
} // dynamic_bitset_impl
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
|
@ -1,29 +0,0 @@
|
||||
|
||||
// (C) Copyright Matthias Troyerk 2006.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/has_trivial_constructor.hpp>
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
/// type trait to check for a default constructor
|
||||
///
|
||||
/// The default implementation just checks for a trivial constructor.
|
||||
/// Using some compiler magic it might be possible to provide a better default
|
||||
|
||||
template <class T>
|
||||
struct has_default_constructor
|
||||
: public has_trivial_constructor<T>
|
||||
{};
|
||||
|
||||
} } // namespace boost::detail
|
||||
|
||||
|
||||
#endif // BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
|
@ -1,89 +0,0 @@
|
||||
// boost/identifier.hpp ----------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2006
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See documentation at http://www.boost.org/libs/utility
|
||||
|
||||
#ifndef BOOST_IDENTIFIER_HPP
|
||||
#define BOOST_IDENTIFIER_HPP
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
// class template identifier ---------------------------------------------//
|
||||
|
||||
// Always used as a base class so that different instantiations result in
|
||||
// different class types even if instantiated with the same value type T.
|
||||
|
||||
// Expected usage is that T is often an integer type, best passed by
|
||||
// value. There is no reason why T can't be a possibly larger class such as
|
||||
// std::string, best passed by const reference.
|
||||
|
||||
// This implementation uses pass by value, based on expected common uses.
|
||||
|
||||
template <typename T, typename D>
|
||||
class identifier
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
const value_type value() const { return m_value; }
|
||||
void assign( value_type v ) { m_value = v; }
|
||||
|
||||
bool operator==( const D & rhs ) const { return m_value == rhs.m_value; }
|
||||
bool operator!=( const D & rhs ) const { return m_value != rhs.m_value; }
|
||||
bool operator< ( const D & rhs ) const { return m_value < rhs.m_value; }
|
||||
bool operator<=( const D & rhs ) const { return m_value <= rhs.m_value; }
|
||||
bool operator> ( const D & rhs ) const { return m_value > rhs.m_value; }
|
||||
bool operator>=( const D & rhs ) const { return m_value >= rhs.m_value; }
|
||||
|
||||
typedef void (*unspecified_bool_type)(D); // without the D, unspecified_bool_type
|
||||
static void unspecified_bool_true(D){} // conversion allows relational operators
|
||||
// between different identifier types
|
||||
|
||||
operator unspecified_bool_type() const { return m_value == value_type() ? 0 : unspecified_bool_true; }
|
||||
bool operator!() const { return m_value == value_type(); }
|
||||
|
||||
// constructors are protected so that class can only be used as a base class
|
||||
protected:
|
||||
identifier() {}
|
||||
explicit identifier( value_type v ) : m_value(v) {}
|
||||
|
||||
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 1300 == VC++ 7.0 bug workaround
|
||||
private:
|
||||
#endif
|
||||
T m_value;
|
||||
};
|
||||
|
||||
//#ifndef BOOST_NO_SFINAE
|
||||
|
||||
// template <class Ostream, class Id>
|
||||
// typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >,
|
||||
// Ostream & >::type operator<<( Ostream & os, const Id & id )
|
||||
// {
|
||||
// return os << id.value();
|
||||
// }
|
||||
|
||||
// template <class Istream, class Id>
|
||||
// typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >,
|
||||
// Istream & >::type operator>>( Istream & is, Id & id )
|
||||
// {
|
||||
// typename Id::value_type v;
|
||||
// is >> v;
|
||||
// id.value( v );
|
||||
// return is;
|
||||
// }
|
||||
//#endif
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_IDENTIFIER_HPP
|
@ -1,134 +0,0 @@
|
||||
// Copyright David Abrahams 2004. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef IS_INCREMENTABLE_DWA200415_HPP
|
||||
# define IS_INCREMENTABLE_DWA200415_HPP
|
||||
|
||||
# include <boost/type_traits/detail/template_arity_spec.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/mpl/aux_/lambda_support.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
|
||||
// Must be the last include
|
||||
# include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// is_incrementable<T> metafunction
|
||||
//
|
||||
// Requires: Given x of type T&, if the expression ++x is well-formed
|
||||
// it must have complete type; otherwise, it must neither be ambiguous
|
||||
// nor violate access.
|
||||
|
||||
// This namespace ensures that ADL doesn't mess things up.
|
||||
namespace is_incrementable_
|
||||
{
|
||||
// a type returned from operator++ when no increment is found in the
|
||||
// type's own namespace
|
||||
struct tag {};
|
||||
|
||||
// any soaks up implicit conversions and makes the following
|
||||
// operator++ less-preferred than any other such operator that
|
||||
// might be found via ADL.
|
||||
struct any { template <class T> any(T const&); };
|
||||
|
||||
// This is a last-resort operator++ for when none other is found
|
||||
# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
|
||||
|
||||
}
|
||||
|
||||
namespace is_incrementable_2
|
||||
{
|
||||
is_incrementable_::tag operator++(is_incrementable_::any const&);
|
||||
is_incrementable_::tag operator++(is_incrementable_::any const&,int);
|
||||
}
|
||||
using namespace is_incrementable_2;
|
||||
|
||||
namespace is_incrementable_
|
||||
{
|
||||
|
||||
# else
|
||||
|
||||
tag operator++(any const&);
|
||||
tag operator++(any const&,int);
|
||||
|
||||
# endif
|
||||
|
||||
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|
||||
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
# define BOOST_comma(a,b) (a)
|
||||
# else
|
||||
// In case an operator++ is found that returns void, we'll use ++x,0
|
||||
tag operator,(tag,int);
|
||||
# define BOOST_comma(a,b) (a,b)
|
||||
# endif
|
||||
|
||||
# if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4913) // Warning about operator,
|
||||
# endif
|
||||
|
||||
// two check overloads help us identify which operator++ was picked
|
||||
char (& check_(tag) )[2];
|
||||
|
||||
template <class T>
|
||||
char check_(T const&);
|
||||
|
||||
|
||||
template <class T>
|
||||
struct impl
|
||||
{
|
||||
static typename boost::remove_cv<T>::type& x;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool
|
||||
, value = sizeof(is_incrementable_::check_(BOOST_comma(++x,0))) == 1
|
||||
);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct postfix_impl
|
||||
{
|
||||
static typename boost::remove_cv<T>::type& x;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool
|
||||
, value = sizeof(is_incrementable_::check_(BOOST_comma(x++,0))) == 1
|
||||
);
|
||||
};
|
||||
|
||||
# if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
# endif
|
||||
|
||||
}
|
||||
|
||||
# undef BOOST_comma
|
||||
|
||||
template<typename T>
|
||||
struct is_incrementable
|
||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
{
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_postfix_incrementable
|
||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
{
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl<T>::value)
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_incrementable)
|
||||
BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
# include <boost/type_traits/detail/bool_trait_undef.hpp>
|
||||
|
||||
#endif // IS_INCREMENTABLE_DWA200415_HPP
|
@ -1,61 +0,0 @@
|
||||
// Copyright David Abrahams 2005. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
||||
# define BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
|
||||
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
|
||||
template <class X_> \
|
||||
struct is_##name \
|
||||
{ \
|
||||
typedef char yes; \
|
||||
typedef char (&no)[2]; \
|
||||
\
|
||||
static typename add_reference<X_>::type dummy; \
|
||||
\
|
||||
struct helpers \
|
||||
{ \
|
||||
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \
|
||||
static yes test( \
|
||||
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \
|
||||
); \
|
||||
\
|
||||
template <class U> \
|
||||
static no test(U&, ...); \
|
||||
}; \
|
||||
\
|
||||
BOOST_STATIC_CONSTANT( \
|
||||
bool, value \
|
||||
= !is_reference<X_>::value \
|
||||
& (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \
|
||||
\
|
||||
typedef mpl::bool_<value> type; \
|
||||
};
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
|
||||
template <class T> \
|
||||
struct is_##name : mpl::false_ \
|
||||
{ \
|
||||
}; \
|
||||
\
|
||||
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \
|
||||
struct is_##name< \
|
||||
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \
|
||||
> \
|
||||
: mpl::true_ \
|
||||
{ \
|
||||
};
|
||||
|
||||
# endif
|
||||
|
||||
#endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
@ -1,22 +0,0 @@
|
||||
#ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/lightweight_mutex.hpp - lightweight mutex
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <boost/smart_ptr/detail/lightweight_mutex.hpp>
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
|
@ -1,143 +0,0 @@
|
||||
#ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/lightweight_test.hpp - lightweight test library
|
||||
//
|
||||
// Copyright (c) 2002, 2009 Peter Dimov
|
||||
// Copyright (2) Beman Dawes 2010, 2011
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// BOOST_TEST(expression)
|
||||
// BOOST_ERROR(message)
|
||||
// BOOST_TEST_EQ(expr1, expr2)
|
||||
//
|
||||
// int boost::report_errors()
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
// IDE's like Visual Studio perform better if output goes to std::cout or
|
||||
// some other stream, so allow user to configure output stream:
|
||||
#ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
# define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
struct report_errors_reminder
|
||||
{
|
||||
bool called_report_errors_function;
|
||||
report_errors_reminder() : called_report_errors_function(false) {}
|
||||
~report_errors_reminder()
|
||||
{
|
||||
BOOST_ASSERT(called_report_errors_function); // verify report_errors() was called
|
||||
}
|
||||
};
|
||||
|
||||
inline report_errors_reminder& report_errors_remind()
|
||||
{
|
||||
static report_errors_reminder r;
|
||||
return r;
|
||||
}
|
||||
|
||||
inline int & test_errors()
|
||||
{
|
||||
static int x = 0;
|
||||
report_errors_remind();
|
||||
return x;
|
||||
}
|
||||
|
||||
inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr << "' failed in function '"
|
||||
<< function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
inline void error_impl(char const * msg, char const * file, int line, char const * function)
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): " << msg << " in function '"
|
||||
<< function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, T const & t, U const & u )
|
||||
{
|
||||
if( t == u )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << t << "' != '" << u << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, class U> inline void test_ne_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, T const & t, U const & u )
|
||||
{
|
||||
if( t != u )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " != " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << t << "' == '" << u << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
inline int report_errors()
|
||||
{
|
||||
detail::report_errors_remind().called_report_errors_function = true;
|
||||
|
||||
int errors = detail::test_errors();
|
||||
|
||||
if( errors == 0 )
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< "No errors detected." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
|
||||
#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
|
||||
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
@ -1,135 +0,0 @@
|
||||
#ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
// boost/detail/lightweight_thread.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <memory>
|
||||
#include <cerrno>
|
||||
|
||||
// pthread_create, pthread_join
|
||||
|
||||
#if defined( BOOST_HAS_PTHREADS )
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
|
||||
typedef HANDLE pthread_t;
|
||||
|
||||
int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg )
|
||||
{
|
||||
HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 );
|
||||
|
||||
if( h != 0 )
|
||||
{
|
||||
*thread = h;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EAGAIN;
|
||||
}
|
||||
}
|
||||
|
||||
int pthread_join( pthread_t thread, void ** /*value_ptr*/ )
|
||||
{
|
||||
::WaitForSingleObject( thread, INFINITE );
|
||||
::CloseHandle( thread );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// template<class F> int lw_thread_create( pthread_t & pt, F f );
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class lw_abstract_thread
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~lw_abstract_thread() {}
|
||||
virtual void run() = 0;
|
||||
};
|
||||
|
||||
#if defined( BOOST_HAS_PTHREADS )
|
||||
|
||||
extern "C" void * lw_thread_routine( void * pv )
|
||||
{
|
||||
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
|
||||
|
||||
pt->run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
unsigned __stdcall lw_thread_routine( void * pv )
|
||||
{
|
||||
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
|
||||
|
||||
pt->run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class F> class lw_thread_impl: public lw_abstract_thread
|
||||
{
|
||||
public:
|
||||
|
||||
explicit lw_thread_impl( F f ): f_( f )
|
||||
{
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
f_();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class F> int lw_thread_create( pthread_t & pt, F f )
|
||||
{
|
||||
std::auto_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) );
|
||||
|
||||
int r = pthread_create( &pt, 0, lw_thread_routine, p.get() );
|
||||
|
||||
if( r == 0 )
|
||||
{
|
||||
p.release();
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
|
@ -1,177 +0,0 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Revision History:
|
||||
|
||||
// 04 Oct 2001 David Abrahams
|
||||
// Changed name of "bind" to "select" to avoid problems with MSVC.
|
||||
|
||||
#ifndef BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
||||
#define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
||||
|
||||
#include <boost/type_traits/conversion_traits.hpp>
|
||||
#include <boost/type_traits/composite_traits.hpp> // for is_reference
|
||||
#if defined(__BORLANDC__)
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
|
||||
struct default_argument { };
|
||||
|
||||
struct dummy_default_gen {
|
||||
template <class Base, class Traits>
|
||||
struct select {
|
||||
typedef default_argument type;
|
||||
};
|
||||
};
|
||||
|
||||
// This class template is a workaround for MSVC.
|
||||
template <class Gen> struct default_generator {
|
||||
typedef detail::dummy_default_gen type;
|
||||
};
|
||||
|
||||
template <class T> struct is_default {
|
||||
enum { value = false };
|
||||
typedef type_traits::no_type type;
|
||||
};
|
||||
template <> struct is_default<default_argument> {
|
||||
enum { value = true };
|
||||
typedef type_traits::yes_type type;
|
||||
};
|
||||
|
||||
struct choose_default {
|
||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||
struct select {
|
||||
typedef typename default_generator<DefaultGen>::type Gen;
|
||||
typedef typename Gen::template select<Base,Traits>::type type;
|
||||
};
|
||||
};
|
||||
struct choose_arg {
|
||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||
struct select {
|
||||
typedef Arg type;
|
||||
};
|
||||
};
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
template <class UseDefault>
|
||||
struct choose_arg_or_default { typedef choose_arg type; };
|
||||
template <>
|
||||
struct choose_arg_or_default<type_traits::yes_type> {
|
||||
typedef choose_default type;
|
||||
};
|
||||
#else
|
||||
template <bool UseDefault>
|
||||
struct choose_arg_or_default { typedef choose_arg type; };
|
||||
template <>
|
||||
struct choose_arg_or_default<true> {
|
||||
typedef choose_default type;
|
||||
};
|
||||
#endif
|
||||
|
||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||
class resolve_default {
|
||||
#if defined(__BORLANDC__)
|
||||
typedef typename choose_arg_or_default<typename is_default<Arg>::type>::type Selector;
|
||||
#else
|
||||
// This usually works for Borland, but I'm seeing weird errors in
|
||||
// iterator_adaptor_test.cpp when using this method.
|
||||
enum { is_def = is_default<Arg>::value };
|
||||
typedef typename choose_arg_or_default<is_def>::type Selector;
|
||||
#endif
|
||||
public:
|
||||
typedef typename Selector
|
||||
::template select<Arg, DefaultGen, Base, Traits>::type type;
|
||||
};
|
||||
|
||||
// To differentiate an unnamed parameter from a traits generator
|
||||
// we use is_convertible<X, iter_traits_gen_base>.
|
||||
struct named_template_param_base { };
|
||||
|
||||
template <class X>
|
||||
struct is_named_param_list {
|
||||
enum { value = is_convertible<X, named_template_param_base>::value };
|
||||
};
|
||||
|
||||
struct choose_named_params {
|
||||
template <class Prev> struct select { typedef Prev type; };
|
||||
};
|
||||
struct choose_default_arg {
|
||||
template <class Prev> struct select {
|
||||
typedef detail::default_argument type;
|
||||
};
|
||||
};
|
||||
|
||||
template <bool Named> struct choose_default_dispatch_;
|
||||
template <> struct choose_default_dispatch_<true> {
|
||||
typedef choose_named_params type;
|
||||
};
|
||||
template <> struct choose_default_dispatch_<false> {
|
||||
typedef choose_default_arg type;
|
||||
};
|
||||
// The use of inheritance here is a Solaris Forte 6 workaround.
|
||||
template <bool Named> struct choose_default_dispatch
|
||||
: public choose_default_dispatch_<Named> { };
|
||||
|
||||
template <class PreviousArg>
|
||||
struct choose_default_argument {
|
||||
enum { is_named = is_named_param_list<PreviousArg>::value };
|
||||
typedef typename choose_default_dispatch<is_named>::type Selector;
|
||||
typedef typename Selector::template select<PreviousArg>::type type;
|
||||
};
|
||||
|
||||
// This macro assumes that there is a class named default_##TYPE
|
||||
// defined before the application of the macro. This class should
|
||||
// have a single member class template named "select" with two
|
||||
// template parameters: the type of the class being created (e.g.,
|
||||
// the iterator_adaptor type when creating iterator adaptors) and
|
||||
// a traits class. The select class should have a single typedef
|
||||
// named "type" that produces the default for TYPE. See
|
||||
// boost/iterator_adaptors.hpp for an example usage. Also,
|
||||
// applications of this macro must be placed in namespace
|
||||
// boost::detail.
|
||||
|
||||
#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \
|
||||
struct get_##TYPE##_from_named { \
|
||||
template <class Base, class NamedParams, class Traits> \
|
||||
struct select { \
|
||||
typedef typename NamedParams::traits NamedTraits; \
|
||||
typedef typename NamedTraits::TYPE TYPE; \
|
||||
typedef typename resolve_default<TYPE, \
|
||||
default_##TYPE, Base, NamedTraits>::type type; \
|
||||
}; \
|
||||
}; \
|
||||
struct pass_thru_##TYPE { \
|
||||
template <class Base, class Arg, class Traits> struct select { \
|
||||
typedef typename resolve_default<Arg, \
|
||||
default_##TYPE, Base, Traits>::type type; \
|
||||
};\
|
||||
}; \
|
||||
template <int NamedParam> \
|
||||
struct get_##TYPE##_dispatch { }; \
|
||||
template <> struct get_##TYPE##_dispatch<1> { \
|
||||
typedef get_##TYPE##_from_named type; \
|
||||
}; \
|
||||
template <> struct get_##TYPE##_dispatch<0> { \
|
||||
typedef pass_thru_##TYPE type; \
|
||||
}; \
|
||||
template <class Base, class X, class Traits> \
|
||||
class get_##TYPE { \
|
||||
enum { is_named = is_named_param_list<X>::value }; \
|
||||
typedef typename get_##TYPE##_dispatch<is_named>::type Selector; \
|
||||
public: \
|
||||
typedef typename Selector::template select<Base, X, Traits>::type type; \
|
||||
}; \
|
||||
template <> struct default_generator<default_##TYPE> { \
|
||||
typedef default_##TYPE type; \
|
||||
}
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
@ -1,28 +0,0 @@
|
||||
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
|
||||
//
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_DETAIL_NONE_T_17SEP2003_HPP
|
||||
#define BOOST_DETAIL_NONE_T_17SEP2003_HPP
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct none_helper{};
|
||||
|
||||
typedef int none_helper::*none_t ;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
@ -1,191 +0,0 @@
|
||||
// (C) Copyright David Abrahams 2001, Howard Hinnant 2001.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Template class numeric_traits<Number> --
|
||||
//
|
||||
// Supplies:
|
||||
//
|
||||
// typedef difference_type -- a type used to represent the difference
|
||||
// between any two values of Number.
|
||||
//
|
||||
// Support:
|
||||
// 1. Not all specializations are supplied
|
||||
//
|
||||
// 2. Use of specializations that are not supplied will cause a
|
||||
// compile-time error
|
||||
//
|
||||
// 3. Users are free to specialize numeric_traits for any type.
|
||||
//
|
||||
// 4. Right now, specializations are only supplied for integer types.
|
||||
//
|
||||
// 5. On implementations which do not supply compile-time constants in
|
||||
// std::numeric_limits<>, only specializations for built-in integer types
|
||||
// are supplied.
|
||||
//
|
||||
// 6. Handling of numbers whose range of representation is at least as
|
||||
// great as boost::intmax_t can cause some differences to be
|
||||
// unrepresentable in difference_type:
|
||||
//
|
||||
// Number difference_type
|
||||
// ------ ---------------
|
||||
// signed Number
|
||||
// unsigned intmax_t
|
||||
//
|
||||
// template <class Number> typename numeric_traits<Number>::difference_type
|
||||
// numeric_distance(Number x, Number y)
|
||||
// computes (y - x), attempting to avoid overflows.
|
||||
//
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// Revision History
|
||||
// 11 Feb 2001 - Use BOOST_STATIC_CONSTANT (David Abrahams)
|
||||
// 11 Feb 2001 - Rolled back ineffective Borland-specific code
|
||||
// (David Abrahams)
|
||||
// 10 Feb 2001 - Rolled in supposed Borland fixes from John Maddock, but
|
||||
// not seeing any improvement yet (David Abrahams)
|
||||
// 06 Feb 2001 - Factored if_true out into boost/detail/select_type.hpp
|
||||
// (David Abrahams)
|
||||
// 23 Jan 2001 - Fixed logic of difference_type selection, which was
|
||||
// completely wack. In the process, added digit_traits<>
|
||||
// to compute the number of digits in intmax_t even when
|
||||
// not supplied by numeric_limits<>. (David Abrahams)
|
||||
// 21 Jan 2001 - Created (David Abrahams)
|
||||
|
||||
#ifndef BOOST_NUMERIC_TRAITS_HPP_DWA20001901
|
||||
# define BOOST_NUMERIC_TRAITS_HPP_DWA20001901
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/cstdint.hpp>
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/type_traits.hpp>
|
||||
# include <boost/detail/select_type.hpp>
|
||||
# include <boost/limits.hpp>
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// Template class is_signed -- determine whether a numeric type is signed
|
||||
// Requires that T is constructable from the literals -1 and 0. Compile-time
|
||||
// error results if that requirement is not met (and thus signedness is not
|
||||
// likely to have meaning for that type).
|
||||
template <class Number>
|
||||
struct is_signed
|
||||
{
|
||||
#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0)));
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<Number>::is_signed);
|
||||
#endif
|
||||
};
|
||||
|
||||
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
// digit_traits - compute the number of digits in a built-in integer
|
||||
// type. Needed for implementations on which numeric_limits is not specialized
|
||||
// for intmax_t (e.g. VC6).
|
||||
template <bool is_specialized> struct digit_traits_select;
|
||||
|
||||
// numeric_limits is specialized; just select that version of digits
|
||||
template <> struct digit_traits_select<true>
|
||||
{
|
||||
template <class T> struct traits
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, digits = std::numeric_limits<T>::digits);
|
||||
};
|
||||
};
|
||||
|
||||
// numeric_limits is not specialized; compute digits from sizeof(T)
|
||||
template <> struct digit_traits_select<false>
|
||||
{
|
||||
template <class T> struct traits
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, digits = (
|
||||
sizeof(T) * std::numeric_limits<unsigned char>::digits
|
||||
- (is_signed<T>::value ? 1 : 0))
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
// here's the "usable" template
|
||||
template <class T> struct digit_traits
|
||||
{
|
||||
typedef digit_traits_select<
|
||||
::std::numeric_limits<T>::is_specialized> selector;
|
||||
typedef typename selector::template traits<T> traits;
|
||||
BOOST_STATIC_CONSTANT(int, digits = traits::digits);
|
||||
};
|
||||
#endif
|
||||
|
||||
// Template class integer_traits<Integer> -- traits of various integer types
|
||||
// This should probably be rolled into boost::integer_traits one day, but I
|
||||
// need it to work without <limits>
|
||||
template <class Integer>
|
||||
struct integer_traits
|
||||
{
|
||||
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
private:
|
||||
typedef Integer integer_type;
|
||||
typedef std::numeric_limits<integer_type> x;
|
||||
# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
// for some reason, MSVC asserts when it shouldn't unless we make these
|
||||
// local definitions
|
||||
BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer);
|
||||
BOOST_STATIC_CONSTANT(bool, is_specialized = x::is_specialized);
|
||||
|
||||
BOOST_STATIC_ASSERT(is_integer);
|
||||
BOOST_STATIC_ASSERT(is_specialized);
|
||||
# endif
|
||||
public:
|
||||
typedef typename
|
||||
if_true<(int(x::is_signed)
|
||||
&& (!int(x::is_bounded)
|
||||
// digits is the number of no-sign bits
|
||||
|| (int(x::digits) + 1 >= digit_traits<boost::intmax_t>::digits)))>::template then<
|
||||
Integer,
|
||||
|
||||
typename if_true<(int(x::digits) + 1 < digit_traits<signed int>::digits)>::template then<
|
||||
signed int,
|
||||
|
||||
typename if_true<(int(x::digits) + 1 < digit_traits<signed long>::digits)>::template then<
|
||||
signed long,
|
||||
|
||||
// else
|
||||
intmax_t
|
||||
>::type>::type>::type difference_type;
|
||||
#else
|
||||
BOOST_STATIC_ASSERT(boost::is_integral<Integer>::value);
|
||||
|
||||
typedef typename
|
||||
if_true<(sizeof(Integer) >= sizeof(intmax_t))>::template then<
|
||||
|
||||
typename if_true<(is_signed<Integer>::value)>::template then<
|
||||
Integer,
|
||||
intmax_t
|
||||
>::type,
|
||||
|
||||
typename if_true<(sizeof(Integer) < sizeof(std::ptrdiff_t))>::template then<
|
||||
std::ptrdiff_t,
|
||||
intmax_t
|
||||
>::type
|
||||
>::type difference_type;
|
||||
# endif
|
||||
};
|
||||
|
||||
// Right now, only supports integers, but should be expanded.
|
||||
template <class Number>
|
||||
struct numeric_traits
|
||||
{
|
||||
typedef typename integer_traits<Number>::difference_type difference_type;
|
||||
};
|
||||
|
||||
template <class Number>
|
||||
typename numeric_traits<Number>::difference_type numeric_distance(Number x, Number y)
|
||||
{
|
||||
typedef typename numeric_traits<Number>::difference_type difference_type;
|
||||
return difference_type(y) - difference_type(x);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif // BOOST_NUMERIC_TRAITS_HPP_DWA20001901
|
@ -1,510 +0,0 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/utility for most recent version including documentation.
|
||||
// see libs/utility/compressed_pair.hpp
|
||||
//
|
||||
/* Release notes:
|
||||
20 Jan 2001:
|
||||
Fixed obvious bugs (David Abrahams)
|
||||
07 Oct 2000:
|
||||
Added better single argument constructor support.
|
||||
03 Oct 2000:
|
||||
Added VC6 support (JM).
|
||||
23rd July 2000:
|
||||
Additional comments added. (JM)
|
||||
Jan 2000:
|
||||
Original version: this version crippled for use with crippled compilers
|
||||
- John Maddock Jan 2000.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_OB_COMPRESSED_PAIR_HPP
|
||||
#define BOOST_OB_COMPRESSED_PAIR_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#ifndef BOOST_OBJECT_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/object_traits.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_SAME_TRAITS_HPP
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_CALL_TRAITS_HPP
|
||||
#include <boost/call_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#ifdef BOOST_MSVC6_MEMBER_TEMPLATES
|
||||
//
|
||||
// use member templates to emulate
|
||||
// partial specialisation. Note that due to
|
||||
// problems with overload resolution with VC6
|
||||
// each of the compressed_pair versions that follow
|
||||
// have one template single-argument constructor
|
||||
// in place of two specific constructors:
|
||||
//
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair;
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <class A, class T1, class T2>
|
||||
struct best_conversion_traits
|
||||
{
|
||||
typedef char one;
|
||||
typedef char (&two)[2];
|
||||
static A a;
|
||||
static one test(T1);
|
||||
static two test(T2);
|
||||
|
||||
enum { value = sizeof(test(a)) };
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct init_one;
|
||||
|
||||
template <>
|
||||
struct init_one<1>
|
||||
{
|
||||
template <class A, class T1, class T2>
|
||||
static void init(const A& a, T1* p1, T2*)
|
||||
{
|
||||
*p1 = a;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct init_one<2>
|
||||
{
|
||||
template <class A, class T1, class T2>
|
||||
static void init(const A& a, T1*, T2* p2)
|
||||
{
|
||||
*p2 = a;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// T1 != T2, both non-empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_0
|
||||
{
|
||||
private:
|
||||
T1 _first;
|
||||
T2 _second;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_0() : _first(), _second() {}
|
||||
compressed_pair_0(first_param_type x, second_param_type y) : _first(x), _second(y) {}
|
||||
template <class A>
|
||||
explicit compressed_pair_0(const A& val)
|
||||
{
|
||||
init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, &_second);
|
||||
}
|
||||
compressed_pair_0(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: _first(x.first()), _second(x.second()) {}
|
||||
|
||||
#if 0
|
||||
compressed_pair_0& operator=(const compressed_pair_0& x) {
|
||||
cout << "assigning compressed pair 0" << endl;
|
||||
_first = x._first;
|
||||
_second = x._second;
|
||||
cout << "finished assigning compressed pair 0" << endl;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
first_reference first() { return _first; }
|
||||
first_const_reference first() const { return _first; }
|
||||
|
||||
second_reference second() { return _second; }
|
||||
second_const_reference second() const { return _second; }
|
||||
|
||||
void swap(compressed_pair_0& y)
|
||||
{
|
||||
using std::swap;
|
||||
swap(_first, y._first);
|
||||
swap(_second, y._second);
|
||||
}
|
||||
};
|
||||
|
||||
// T1 != T2, T2 empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_1 : T2
|
||||
{
|
||||
private:
|
||||
T1 _first;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_1() : T2(), _first() {}
|
||||
compressed_pair_1(first_param_type x, second_param_type y) : T2(y), _first(x) {}
|
||||
|
||||
template <class A>
|
||||
explicit compressed_pair_1(const A& val)
|
||||
{
|
||||
init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, static_cast<T2*>(this));
|
||||
}
|
||||
|
||||
compressed_pair_1(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: T2(x.second()), _first(x.first()) {}
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
// Total weirdness. If the assignment to _first is moved after
|
||||
// the call to the inherited operator=, then this breaks graph/test/graph.cpp
|
||||
// by way of iterator_adaptor.
|
||||
compressed_pair_1& operator=(const compressed_pair_1& x) {
|
||||
_first = x._first;
|
||||
T2::operator=(x);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
first_reference first() { return _first; }
|
||||
first_const_reference first() const { return _first; }
|
||||
|
||||
second_reference second() { return *this; }
|
||||
second_const_reference second() const { return *this; }
|
||||
|
||||
void swap(compressed_pair_1& y)
|
||||
{
|
||||
// no need to swap empty base class:
|
||||
using std::swap;
|
||||
swap(_first, y._first);
|
||||
}
|
||||
};
|
||||
|
||||
// T1 != T2, T1 empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_2 : T1
|
||||
{
|
||||
private:
|
||||
T2 _second;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_2() : T1(), _second() {}
|
||||
compressed_pair_2(first_param_type x, second_param_type y) : T1(x), _second(y) {}
|
||||
template <class A>
|
||||
explicit compressed_pair_2(const A& val)
|
||||
{
|
||||
init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), &_second);
|
||||
}
|
||||
compressed_pair_2(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: T1(x.first()), _second(x.second()) {}
|
||||
|
||||
#if 0
|
||||
compressed_pair_2& operator=(const compressed_pair_2& x) {
|
||||
cout << "assigning compressed pair 2" << endl;
|
||||
T1::operator=(x);
|
||||
_second = x._second;
|
||||
cout << "finished assigning compressed pair 2" << endl;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
first_reference first() { return *this; }
|
||||
first_const_reference first() const { return *this; }
|
||||
|
||||
second_reference second() { return _second; }
|
||||
second_const_reference second() const { return _second; }
|
||||
|
||||
void swap(compressed_pair_2& y)
|
||||
{
|
||||
// no need to swap empty base class:
|
||||
using std::swap;
|
||||
swap(_second, y._second);
|
||||
}
|
||||
};
|
||||
|
||||
// T1 != T2, both empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_3 : T1, T2
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_3() : T1(), T2() {}
|
||||
compressed_pair_3(first_param_type x, second_param_type y) : T1(x), T2(y) {}
|
||||
template <class A>
|
||||
explicit compressed_pair_3(const A& val)
|
||||
{
|
||||
init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), static_cast<T2*>(this));
|
||||
}
|
||||
compressed_pair_3(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: T1(x.first()), T2(x.second()) {}
|
||||
|
||||
first_reference first() { return *this; }
|
||||
first_const_reference first() const { return *this; }
|
||||
|
||||
second_reference second() { return *this; }
|
||||
second_const_reference second() const { return *this; }
|
||||
|
||||
void swap(compressed_pair_3& y)
|
||||
{
|
||||
// no need to swap empty base classes:
|
||||
}
|
||||
};
|
||||
|
||||
// T1 == T2, and empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_4 : T1
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_4() : T1() {}
|
||||
compressed_pair_4(first_param_type x, second_param_type y) : T1(x), m_second(y) {}
|
||||
// only one single argument constructor since T1 == T2
|
||||
explicit compressed_pair_4(first_param_type x) : T1(x), m_second(x) {}
|
||||
compressed_pair_4(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: T1(x.first()), m_second(x.second()) {}
|
||||
|
||||
first_reference first() { return *this; }
|
||||
first_const_reference first() const { return *this; }
|
||||
|
||||
second_reference second() { return m_second; }
|
||||
second_const_reference second() const { return m_second; }
|
||||
|
||||
void swap(compressed_pair_4& y)
|
||||
{
|
||||
// no need to swap empty base classes:
|
||||
}
|
||||
private:
|
||||
T2 m_second;
|
||||
};
|
||||
|
||||
// T1 == T2, not empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_5
|
||||
{
|
||||
private:
|
||||
T1 _first;
|
||||
T2 _second;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_5() : _first(), _second() {}
|
||||
compressed_pair_5(first_param_type x, second_param_type y) : _first(x), _second(y) {}
|
||||
// only one single argument constructor since T1 == T2
|
||||
explicit compressed_pair_5(first_param_type x) : _first(x), _second(x) {}
|
||||
compressed_pair_5(const ::boost::compressed_pair<T1,T2>& c)
|
||||
: _first(c.first()), _second(c.second()) {}
|
||||
|
||||
first_reference first() { return _first; }
|
||||
first_const_reference first() const { return _first; }
|
||||
|
||||
second_reference second() { return _second; }
|
||||
second_const_reference second() const { return _second; }
|
||||
|
||||
void swap(compressed_pair_5& y)
|
||||
{
|
||||
using std::swap;
|
||||
swap(_first, y._first);
|
||||
swap(_second, y._second);
|
||||
}
|
||||
};
|
||||
|
||||
template <bool e1, bool e2, bool same>
|
||||
struct compressed_pair_chooser
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_0<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<false, true, false>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_1<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<true, false, false>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_2<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<true, true, false>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_3<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<true, true, true>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_4<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<false, false, true>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_5<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_traits
|
||||
{
|
||||
private:
|
||||
typedef compressed_pair_chooser<is_empty<T1>::value, is_empty<T2>::value, is_same<T1,T2>::value> chooser;
|
||||
typedef typename chooser::template rebind<T1, T2> bound_type;
|
||||
public:
|
||||
typedef typename bound_type::type type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair : public detail::compressed_pair_traits<T1, T2>::type
|
||||
{
|
||||
private:
|
||||
typedef typename detail::compressed_pair_traits<T1, T2>::type base_type;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair() : base_type() {}
|
||||
compressed_pair(first_param_type x, second_param_type y) : base_type(x, y) {}
|
||||
template <class A>
|
||||
explicit compressed_pair(const A& x) : base_type(x){}
|
||||
|
||||
first_reference first() { return base_type::first(); }
|
||||
first_const_reference first() const { return base_type::first(); }
|
||||
|
||||
second_reference second() { return base_type::second(); }
|
||||
second_const_reference second() const { return base_type::second(); }
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
#else
|
||||
// no partial specialisation, no member templates:
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair
|
||||
{
|
||||
private:
|
||||
T1 _first;
|
||||
T2 _second;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair() : _first(), _second() {}
|
||||
compressed_pair(first_param_type x, second_param_type y) : _first(x), _second(y) {}
|
||||
explicit compressed_pair(first_param_type x) : _first(x), _second() {}
|
||||
// can't define this in case T1 == T2:
|
||||
// explicit compressed_pair(second_param_type y) : _first(), _second(y) {}
|
||||
|
||||
first_reference first() { return _first; }
|
||||
first_const_reference first() const { return _first; }
|
||||
|
||||
second_reference second() { return _second; }
|
||||
second_const_reference second() const { return _second; }
|
||||
|
||||
void swap(compressed_pair& y)
|
||||
{
|
||||
using std::swap;
|
||||
swap(_first, y._first);
|
||||
swap(_second, y._second);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_OB_COMPRESSED_PAIR_HPP
|
||||
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
#ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/quick_allocator.hpp
|
||||
//
|
||||
// Copyright (c) 2003 David Abrahams
|
||||
// Copyright (c) 2003 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <boost/smart_ptr/detail/quick_allocator.hpp>
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
|
@ -1,56 +0,0 @@
|
||||
// scoped_enum_emulation.hpp ---------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes, 2009
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
|
||||
// scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS
|
||||
// macro is used to detect feature support.
|
||||
//
|
||||
// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
|
||||
// description of the scoped enum feature. Note that the committee changed the name
|
||||
// from strongly typed enum to scoped enum.
|
||||
//
|
||||
// Caution: only the syntax is emulated; the semantics are not emulated and
|
||||
// the syntax emulation doesn't include being able to specify the underlying
|
||||
// representation type.
|
||||
//
|
||||
// The emulation is via struct rather than namespace to allow use within classes.
|
||||
// Thanks to Andrey Semashev for pointing that out.
|
||||
//
|
||||
// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,
|
||||
// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente
|
||||
// Botet, and Daniel James.
|
||||
//
|
||||
// Sample usage:
|
||||
//
|
||||
// BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END
|
||||
// ...
|
||||
// BOOST_SCOPED_ENUM(algae) sample( algae::red );
|
||||
// void foo( BOOST_SCOPED_ENUM(algae) color );
|
||||
// ...
|
||||
// sample = algae::green;
|
||||
// foo( algae::cyan );
|
||||
|
||||
#ifndef BOOST_SCOPED_ENUM_EMULATION_HPP
|
||||
#define BOOST_SCOPED_ENUM_EMULATION_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_SCOPED_ENUMS
|
||||
|
||||
# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type
|
||||
# define BOOST_SCOPED_ENUM_END };
|
||||
# define BOOST_SCOPED_ENUM(name) name::enum_type
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_SCOPED_ENUM_START(name) enum class name
|
||||
# define BOOST_SCOPED_ENUM_END
|
||||
# define BOOST_SCOPED_ENUM(name) name
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPED_ENUM_EMULATION_HPP
|
@ -1,36 +0,0 @@
|
||||
// (C) Copyright David Abrahams 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// Revision History
|
||||
// 09 Feb 01 Applied John Maddock's Borland patch Moving <true>
|
||||
// specialization to unspecialized template (David Abrahams)
|
||||
// 06 Feb 01 Created (David Abrahams)
|
||||
|
||||
#ifndef SELECT_TYPE_DWA20010206_HPP
|
||||
# define SELECT_TYPE_DWA20010206_HPP
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// Template class if_true -- select among 2 types based on a bool constant expression
|
||||
// Usage:
|
||||
// typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
|
||||
|
||||
// HP aCC cannot deal with missing names for template value parameters
|
||||
template <bool b> struct if_true
|
||||
{
|
||||
template <class T, class F>
|
||||
struct then { typedef T type; };
|
||||
};
|
||||
|
||||
template <>
|
||||
struct if_true<false>
|
||||
{
|
||||
template <class T, class F>
|
||||
struct then { typedef F type; };
|
||||
};
|
||||
}}
|
||||
#endif // SELECT_TYPE_DWA20010206_HPP
|
@ -1,74 +0,0 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost detail/templated_streams.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2003
|
||||
// Eric Friedman
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_DETAIL_TEMPLATED_STREAMS_HPP
|
||||
#define BOOST_DETAIL_TEMPLATED_STREAMS_HPP
|
||||
|
||||
#include "boost/config.hpp"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// (detail) BOOST_TEMPLATED_STREAM_* macros
|
||||
//
|
||||
// Provides workaround platforms without stream class templates.
|
||||
//
|
||||
|
||||
#if !defined(BOOST_NO_STD_LOCALE)
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) \
|
||||
template < typename E , typename T >
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) \
|
||||
template < typename E , typename T , typename A >
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ARGS(E,T) \
|
||||
typename E , typename T
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) \
|
||||
typename E , typename T , typename A
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_COMMA ,
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ELEM(E) E
|
||||
#define BOOST_TEMPLATED_STREAM_TRAITS(T) T
|
||||
#define BOOST_TEMPLATED_STREAM_ALLOC(A) A
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM(X,E,T) \
|
||||
BOOST_JOIN(std::basic_,X)< E , T >
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
|
||||
BOOST_JOIN(std::basic_,X)< E , T , A >
|
||||
|
||||
#else // defined(BOOST_NO_STD_LOCALE)
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ARGS(E,T) /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_COMMA /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ELEM(E) char
|
||||
#define BOOST_TEMPLATED_STREAM_TRAITS(T) std::char_traits<char>
|
||||
#define BOOST_TEMPLATED_STREAM_ALLOC(A) std::allocator<char>
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM(X,E,T) \
|
||||
std::X
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
|
||||
std::X
|
||||
|
||||
#endif // BOOST_NO_STD_LOCALE
|
||||
|
||||
#endif // BOOST_DETAIL_TEMPLATED_STREAMS_HPP
|
@ -1,190 +0,0 @@
|
||||
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
|
||||
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UTF8_CODECVT_FACET_HPP
|
||||
#define BOOST_UTF8_CODECVT_FACET_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// utf8_codecvt_facet.hpp
|
||||
|
||||
// This header defines class utf8_codecvt_facet, derived fro
|
||||
// std::codecvt<wchar_t, char>, which can be used to convert utf8 data in
|
||||
// files into wchar_t strings in the application.
|
||||
//
|
||||
// The header is NOT STANDALONE, and is not to be included by the USER.
|
||||
// There are at least two libraries which want to use this functionality, and
|
||||
// we want to avoid code duplication. It would be possible to create utf8
|
||||
// library, but:
|
||||
// - this requires review process first
|
||||
// - in the case, when linking the a library which uses utf8
|
||||
// (say 'program_options'), user should also link to the utf8 library.
|
||||
// This seems inconvenient, and asking a user to link to an unrevieved
|
||||
// library is strange.
|
||||
// Until the above points are fixed, a library which wants to use utf8 must:
|
||||
// - include this header from one of it's headers or sources
|
||||
// - include the corresponding .cpp file from one of the sources
|
||||
// - before including either file, the library must define
|
||||
// - BOOST_UTF8_BEGIN_NAMESPACE to the namespace declaration that must be used
|
||||
// - BOOST_UTF8_END_NAMESPACE to the code to close the previous namespace
|
||||
// - declaration.
|
||||
// - BOOST_UTF8_DECL -- to the code which must be used for all 'exportable'
|
||||
// symbols.
|
||||
//
|
||||
// For example, program_options library might contain:
|
||||
// #define BOOST_UTF8_BEGIN_NAMESPACE <backslash character>
|
||||
// namespace boost { namespace program_options {
|
||||
// #define BOOST_UTF8_END_NAMESPACE }}
|
||||
// #define BOOST_UTF8_DECL BOOST_PROGRAM_OPTIONS_DECL
|
||||
// #include "../../detail/utf8/utf8_codecvt.cpp"
|
||||
//
|
||||
// Essentially, each library will have its own copy of utf8 code, in
|
||||
// different namespaces.
|
||||
|
||||
// Note:(Robert Ramey). I have made the following alterations in the original
|
||||
// code.
|
||||
// a) Rendered utf8_codecvt<wchar_t, char> with using templates
|
||||
// b) Move longer functions outside class definition to prevent inlining
|
||||
// and make code smaller
|
||||
// c) added on a derived class to permit translation to/from current
|
||||
// locale to utf8
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as text - note these ar templated on the basic
|
||||
// stream templates to accommodate wide (and other?) kind of characters
|
||||
//
|
||||
// note the fact that on libraries without wide characters, ostream is
|
||||
// is not a specialization of basic_ostream which in fact is not defined
|
||||
// in such cases. So we can't use basic_ostream<OStream::char_type> but rather
|
||||
// use two template parameters
|
||||
//
|
||||
// utf8_codecvt_facet
|
||||
// This is an implementation of a std::codecvt facet for translating
|
||||
// from UTF-8 externally to UCS-4. Note that this is not tied to
|
||||
// any specific types in order to allow customization on platforms
|
||||
// where wchar_t is not big enough.
|
||||
//
|
||||
// NOTES: The current implementation jumps through some unpleasant hoops in
|
||||
// order to deal with signed character types. As a std::codecvt_base::result,
|
||||
// it is necessary for the ExternType to be convertible to unsigned char.
|
||||
// I chose not to tie the extern_type explicitly to char. But if any combination
|
||||
// of types other than <wchar_t,char_t> is used, then std::codecvt must be
|
||||
// specialized on those types for this to work.
|
||||
|
||||
#include <locale>
|
||||
#include <cwchar> // for mbstate_t
|
||||
#include <cstddef> // for std::size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std {
|
||||
using ::mbstate_t;
|
||||
using ::size_t;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
|
||||
#define BOOST_CODECVT_DO_LENGTH_CONST const
|
||||
#else
|
||||
#define BOOST_CODECVT_DO_LENGTH_CONST
|
||||
#endif
|
||||
|
||||
// maximum lenght of a multibyte string
|
||||
#define MB_LENGTH_MAX 8
|
||||
|
||||
BOOST_UTF8_BEGIN_NAMESPACE
|
||||
|
||||
struct BOOST_UTF8_DECL utf8_codecvt_facet :
|
||||
public std::codecvt<wchar_t, char, std::mbstate_t>
|
||||
{
|
||||
public:
|
||||
explicit utf8_codecvt_facet(std::size_t no_locale_manage=0)
|
||||
: std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
|
||||
{}
|
||||
protected:
|
||||
virtual std::codecvt_base::result do_in(
|
||||
std::mbstate_t& state,
|
||||
const char * from,
|
||||
const char * from_end,
|
||||
const char * & from_next,
|
||||
wchar_t * to,
|
||||
wchar_t * to_end,
|
||||
wchar_t*& to_next
|
||||
) const;
|
||||
|
||||
virtual std::codecvt_base::result do_out(
|
||||
std::mbstate_t & state, const wchar_t * from,
|
||||
const wchar_t * from_end, const wchar_t* & from_next,
|
||||
char * to, char * to_end, char * & to_next
|
||||
) const;
|
||||
|
||||
bool invalid_continuing_octet(unsigned char octet_1) const {
|
||||
return (octet_1 < 0x80|| 0xbf< octet_1);
|
||||
}
|
||||
|
||||
bool invalid_leading_octet(unsigned char octet_1) const {
|
||||
return (0x7f < octet_1 && octet_1 < 0xc0) ||
|
||||
(octet_1 > 0xfd);
|
||||
}
|
||||
|
||||
// continuing octets = octets except for the leading octet
|
||||
static unsigned int get_cont_octet_count(unsigned char lead_octet) {
|
||||
return get_octet_count(lead_octet) - 1;
|
||||
}
|
||||
|
||||
static unsigned int get_octet_count(unsigned char lead_octet);
|
||||
|
||||
// How many "continuing octets" will be needed for this word
|
||||
// == total octets - 1.
|
||||
int get_cont_octet_out_count(wchar_t word) const ;
|
||||
|
||||
virtual bool do_always_noconv() const throw() { return false; }
|
||||
|
||||
// UTF-8 isn't really stateful since we rewind on partial conversions
|
||||
virtual std::codecvt_base::result do_unshift(
|
||||
std::mbstate_t&,
|
||||
char * from,
|
||||
char * /*to*/,
|
||||
char * & next
|
||||
) const
|
||||
{
|
||||
next = from;
|
||||
return ok;
|
||||
}
|
||||
|
||||
virtual int do_encoding() const throw() {
|
||||
const int variable_byte_external_encoding=0;
|
||||
return variable_byte_external_encoding;
|
||||
}
|
||||
|
||||
// How many char objects can I process to get <= max_limit
|
||||
// wchar_t objects?
|
||||
virtual int do_length(
|
||||
BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
|
||||
const char * from,
|
||||
const char * from_end,
|
||||
std::size_t max_limit
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
|
||||
) const throw();
|
||||
#else
|
||||
) const;
|
||||
#endif
|
||||
|
||||
// Largest possible value do_length(state,from,from_end,1) could return.
|
||||
virtual int do_max_length() const throw () {
|
||||
return 6; // largest UTF-8 encoding of a UCS-4 character
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_UTF8_END_NAMESPACE
|
||||
|
||||
#endif // BOOST_UTF8_CODECVT_FACET_HPP
|
@ -1,36 +0,0 @@
|
||||
//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593
|
||||
#define UUID_316FDA946C0D11DEA9CBAE5255D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/exception/error_info.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/exception/info_tuple.hpp>
|
||||
#include <boost/exception/errinfo_api_function.hpp>
|
||||
#include <boost/exception/errinfo_at_line.hpp>
|
||||
#include <boost/exception/errinfo_errno.hpp>
|
||||
#include <boost/exception/errinfo_file_handle.hpp>
|
||||
#include <boost/exception/errinfo_file_name.hpp>
|
||||
#include <boost/exception/errinfo_file_open_mode.hpp>
|
||||
#include <boost/exception/errinfo_type_info_name.hpp>
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <boost/exception/errinfo_nested_exception.hpp>
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_7E83C166200811DE885E826156D89593
|
||||
#define UUID_7E83C166200811DE885E826156D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class E>
|
||||
inline
|
||||
E *
|
||||
current_exception_cast()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
E & e )
|
||||
{
|
||||
return &e;
|
||||
}
|
||||
catch(
|
||||
...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,75 +0,0 @@
|
||||
//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_CE6983AC753411DDA764247956D89593
|
||||
#define UUID_CE6983AC753411DDA764247956D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class
|
||||
error_info_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual std::string tag_typeid_name() const = 0;
|
||||
virtual std::string value_as_string() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
~error_info_base() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class Tag,class T>
|
||||
class
|
||||
error_info:
|
||||
public exception_detail::error_info_base
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
|
||||
error_info( value_type const & value );
|
||||
~error_info() throw();
|
||||
|
||||
value_type const &
|
||||
value() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
value_type &
|
||||
value()
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::string tag_typeid_name() const;
|
||||
std::string value_as_string() const;
|
||||
|
||||
value_type value_;
|
||||
};
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,503 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_618474C2DE1511DEB74A388C56D89593
|
||||
#define UUID_618474C2DE1511DEB74A388C56D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
#error This header requires exception handling to be enabled.
|
||||
#endif
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <boost/exception/detail/clone_current_exception.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdexcept>
|
||||
#include <new>
|
||||
#include <ios>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
class exception_ptr;
|
||||
BOOST_ATTRIBUTE_NORETURN void rethrow_exception( exception_ptr const & );
|
||||
exception_ptr current_exception();
|
||||
|
||||
class
|
||||
exception_ptr
|
||||
{
|
||||
typedef boost::shared_ptr<exception_detail::clone_base const> impl;
|
||||
impl ptr_;
|
||||
friend void rethrow_exception( exception_ptr const & );
|
||||
typedef exception_detail::clone_base const * (impl::*unspecified_bool_type)() const;
|
||||
public:
|
||||
exception_ptr()
|
||||
{
|
||||
}
|
||||
explicit
|
||||
exception_ptr( impl const & ptr ):
|
||||
ptr_(ptr)
|
||||
{
|
||||
}
|
||||
bool
|
||||
operator==( exception_ptr const & other ) const
|
||||
{
|
||||
return ptr_==other.ptr_;
|
||||
}
|
||||
bool
|
||||
operator!=( exception_ptr const & other ) const
|
||||
{
|
||||
return ptr_!=other.ptr_;
|
||||
}
|
||||
operator unspecified_bool_type() const
|
||||
{
|
||||
return ptr_?&impl::get:0;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
exception_ptr
|
||||
copy_exception( T const & e )
|
||||
{
|
||||
try
|
||||
{
|
||||
throw enable_current_exception(e);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
return current_exception();
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_RTTI
|
||||
typedef error_info<struct tag_original_exception_type,std::type_info const *> original_exception_type;
|
||||
|
||||
inline
|
||||
std::string
|
||||
to_string( original_exception_type const & x )
|
||||
{
|
||||
return x.value()->name();
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
struct
|
||||
bad_alloc_:
|
||||
boost::exception,
|
||||
std::bad_alloc
|
||||
{
|
||||
~bad_alloc_() throw() { }
|
||||
};
|
||||
|
||||
struct
|
||||
bad_exception_:
|
||||
boost::exception,
|
||||
std::bad_exception
|
||||
{
|
||||
~bad_exception_() throw() { }
|
||||
};
|
||||
|
||||
template <class Exception>
|
||||
exception_ptr
|
||||
get_static_exception_object()
|
||||
{
|
||||
Exception ba;
|
||||
exception_detail::clone_impl<Exception> c(ba);
|
||||
c <<
|
||||
throw_function(BOOST_CURRENT_FUNCTION) <<
|
||||
throw_file(__FILE__) <<
|
||||
throw_line(__LINE__);
|
||||
static exception_ptr ep(shared_ptr<exception_detail::clone_base const>(new exception_detail::clone_impl<Exception>(c)));
|
||||
return ep;
|
||||
}
|
||||
|
||||
template <class Exception>
|
||||
struct
|
||||
exception_ptr_static_exception_object
|
||||
{
|
||||
static exception_ptr const e;
|
||||
};
|
||||
|
||||
template <class Exception>
|
||||
exception_ptr const
|
||||
exception_ptr_static_exception_object<Exception>::
|
||||
e = get_static_exception_object<Exception>();
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class
|
||||
unknown_exception:
|
||||
public boost::exception,
|
||||
public std::exception
|
||||
{
|
||||
public:
|
||||
|
||||
unknown_exception()
|
||||
{
|
||||
}
|
||||
|
||||
explicit
|
||||
unknown_exception( std::exception const & e )
|
||||
{
|
||||
add_original_type(e);
|
||||
}
|
||||
|
||||
explicit
|
||||
unknown_exception( boost::exception const & e ):
|
||||
boost::exception(e)
|
||||
{
|
||||
add_original_type(e);
|
||||
}
|
||||
|
||||
~unknown_exception() throw()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template <class E>
|
||||
void
|
||||
add_original_type( E const & e )
|
||||
{
|
||||
#ifndef BOOST_NO_RTTI
|
||||
(*this) << original_exception_type(&typeid(e));
|
||||
#endif
|
||||
}
|
||||
};
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class T>
|
||||
class
|
||||
current_exception_std_exception_wrapper:
|
||||
public T,
|
||||
public boost::exception
|
||||
{
|
||||
public:
|
||||
|
||||
explicit
|
||||
current_exception_std_exception_wrapper( T const & e1 ):
|
||||
T(e1)
|
||||
{
|
||||
add_original_type(e1);
|
||||
}
|
||||
|
||||
current_exception_std_exception_wrapper( T const & e1, boost::exception const & e2 ):
|
||||
T(e1),
|
||||
boost::exception(e2)
|
||||
{
|
||||
add_original_type(e1);
|
||||
}
|
||||
|
||||
~current_exception_std_exception_wrapper() throw()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template <class E>
|
||||
void
|
||||
add_original_type( E const & e )
|
||||
{
|
||||
#ifndef BOOST_NO_RTTI
|
||||
(*this) << original_exception_type(&typeid(e));
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_RTTI
|
||||
template <class T>
|
||||
boost::exception const *
|
||||
get_boost_exception( T const * )
|
||||
{
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
return &x;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
template <class T>
|
||||
boost::exception const *
|
||||
get_boost_exception( T const * x )
|
||||
{
|
||||
return dynamic_cast<boost::exception const *>(x);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
exception_ptr
|
||||
current_exception_std_exception( T const & e1 )
|
||||
{
|
||||
if( boost::exception const * e2 = get_boost_exception(&e1) )
|
||||
return boost::copy_exception(current_exception_std_exception_wrapper<T>(e1,*e2));
|
||||
else
|
||||
return boost::copy_exception(current_exception_std_exception_wrapper<T>(e1));
|
||||
}
|
||||
|
||||
inline
|
||||
exception_ptr
|
||||
current_exception_unknown_exception()
|
||||
{
|
||||
return boost::copy_exception(unknown_exception());
|
||||
}
|
||||
|
||||
inline
|
||||
exception_ptr
|
||||
current_exception_unknown_boost_exception( boost::exception const & e )
|
||||
{
|
||||
return boost::copy_exception(unknown_exception(e));
|
||||
}
|
||||
|
||||
inline
|
||||
exception_ptr
|
||||
current_exception_unknown_std_exception( std::exception const & e )
|
||||
{
|
||||
if( boost::exception const * be = get_boost_exception(&e) )
|
||||
return current_exception_unknown_boost_exception(*be);
|
||||
else
|
||||
return boost::copy_exception(unknown_exception(e));
|
||||
}
|
||||
|
||||
inline
|
||||
exception_ptr
|
||||
current_exception_impl()
|
||||
{
|
||||
exception_detail::clone_base const * e=0;
|
||||
switch(
|
||||
exception_detail::clone_current_exception(e) )
|
||||
{
|
||||
case exception_detail::clone_current_exception_result::
|
||||
success:
|
||||
{
|
||||
BOOST_ASSERT(e!=0);
|
||||
return exception_ptr(shared_ptr<exception_detail::clone_base const>(e));
|
||||
}
|
||||
case exception_detail::clone_current_exception_result::
|
||||
bad_alloc:
|
||||
{
|
||||
BOOST_ASSERT(!e);
|
||||
return exception_detail::exception_ptr_static_exception_object<bad_alloc_>::e;
|
||||
}
|
||||
case exception_detail::clone_current_exception_result::
|
||||
bad_exception:
|
||||
{
|
||||
BOOST_ASSERT(!e);
|
||||
return exception_detail::exception_ptr_static_exception_object<bad_exception_>::e;
|
||||
}
|
||||
default:
|
||||
BOOST_ASSERT(0);
|
||||
case exception_detail::clone_current_exception_result::
|
||||
not_supported:
|
||||
{
|
||||
BOOST_ASSERT(!e);
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
exception_detail::clone_base & e )
|
||||
{
|
||||
return exception_ptr(shared_ptr<exception_detail::clone_base const>(e.clone()));
|
||||
}
|
||||
catch(
|
||||
std::domain_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::invalid_argument & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::length_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::out_of_range & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::logic_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::range_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::overflow_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::underflow_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::ios_base::failure & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::runtime_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::bad_alloc & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
#ifndef BOOST_NO_TYPEID
|
||||
catch(
|
||||
std::bad_cast & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::bad_typeid & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
#endif
|
||||
catch(
|
||||
std::bad_exception & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::exception & e )
|
||||
{
|
||||
return exception_detail::current_exception_unknown_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
boost::exception & e )
|
||||
{
|
||||
return exception_detail::current_exception_unknown_boost_exception(e);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
return exception_detail::current_exception_unknown_exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
exception_ptr
|
||||
current_exception()
|
||||
{
|
||||
exception_ptr ret;
|
||||
try
|
||||
{
|
||||
ret=exception_detail::current_exception_impl();
|
||||
}
|
||||
catch(
|
||||
std::bad_alloc & )
|
||||
{
|
||||
ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_alloc_>::e;
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_exception_>::e;
|
||||
}
|
||||
BOOST_ASSERT(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOST_ATTRIBUTE_NORETURN
|
||||
inline
|
||||
void
|
||||
rethrow_exception( exception_ptr const & p )
|
||||
{
|
||||
BOOST_ASSERT(p);
|
||||
p.ptr_->rethrow();
|
||||
BOOST_ASSERT(0);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
inline
|
||||
std::string
|
||||
diagnostic_information( exception_ptr const & p )
|
||||
{
|
||||
if( p )
|
||||
try
|
||||
{
|
||||
rethrow_exception(p);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
return current_exception_diagnostic_information();
|
||||
}
|
||||
return "<empty>";
|
||||
}
|
||||
|
||||
inline
|
||||
std::string
|
||||
to_string( exception_ptr const & p )
|
||||
{
|
||||
std::string s='\n'+diagnostic_information(p);
|
||||
std::string padding(" ");
|
||||
std::string r;
|
||||
bool f=false;
|
||||
for( std::string::const_iterator i=s.begin(),e=s.end(); i!=e; ++i )
|
||||
{
|
||||
if( f )
|
||||
r+=padding;
|
||||
char c=*i;
|
||||
r+=c;
|
||||
f=(c=='\n');
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,60 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_898984B4076411DD973EDFA055D89593
|
||||
#define UUID_898984B4076411DD973EDFA055D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
to_string_detail
|
||||
{
|
||||
struct
|
||||
partial_ordering_helper1
|
||||
{
|
||||
template <class CharT,class Traits>
|
||||
partial_ordering_helper1( std::basic_ostream<CharT,Traits> & );
|
||||
};
|
||||
|
||||
struct
|
||||
partial_ordering_helper2
|
||||
{
|
||||
template <class T>
|
||||
partial_ordering_helper2( T const & );
|
||||
};
|
||||
|
||||
char operator<<( partial_ordering_helper1, partial_ordering_helper2 );
|
||||
|
||||
template <class T,class CharT,class Traits>
|
||||
struct
|
||||
is_output_streamable_impl
|
||||
{
|
||||
static std::basic_ostream<CharT,Traits> & f();
|
||||
static T const & g();
|
||||
enum e { value=1!=(sizeof(f()<<g())) };
|
||||
};
|
||||
}
|
||||
|
||||
template <class T, class CharT=char, class Traits=std::char_traits<CharT> >
|
||||
struct
|
||||
is_output_streamable
|
||||
{
|
||||
enum e { value=to_string_detail::is_output_streamable_impl<T,CharT,Traits>::value };
|
||||
};
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,50 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593
|
||||
#define UUID_6F463AC838DF11DDA3E6909F56D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class T>
|
||||
inline
|
||||
std::string
|
||||
object_hex_dump( T const & x, std::size_t max_size=16 )
|
||||
{
|
||||
std::ostringstream s;
|
||||
s << "type: " << type_name<T>() << ", size: " << sizeof(T) << ", dump: ";
|
||||
std::size_t n=sizeof(T)>max_size?max_size:sizeof(T);
|
||||
s.fill('0');
|
||||
s.width(2);
|
||||
unsigned char const * b=reinterpret_cast<unsigned char const *>(&x);
|
||||
s << std::setw(2) << std::hex << (unsigned int)*b;
|
||||
for( unsigned char const * e=b+n; ++b!=e; )
|
||||
s << " " << std::setw(2) << std::hex << (unsigned int)*b;
|
||||
return s.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,83 +0,0 @@
|
||||
//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_C3E1741C754311DDB2834CCA55D89593
|
||||
#define UUID_C3E1741C754311DDB2834CCA55D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#ifndef BOOST_NO_TYPEID
|
||||
#include <boost/units/detail/utility.hpp>
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class T>
|
||||
inline
|
||||
std::string
|
||||
tag_type_name()
|
||||
{
|
||||
#ifdef BOOST_NO_TYPEID
|
||||
return BOOST_CURRENT_FUNCTION;
|
||||
#else
|
||||
return units::detail::demangle(typeid(T*).name());
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
std::string
|
||||
type_name()
|
||||
{
|
||||
#ifdef BOOST_NO_TYPEID
|
||||
return BOOST_CURRENT_FUNCTION;
|
||||
#else
|
||||
return units::detail::demangle(typeid(T).name());
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
struct
|
||||
type_info_
|
||||
{
|
||||
detail::sp_typeinfo const * type_;
|
||||
|
||||
explicit
|
||||
type_info_( detail::sp_typeinfo const & type ):
|
||||
type_(&type)
|
||||
{
|
||||
}
|
||||
|
||||
friend
|
||||
bool
|
||||
operator<( type_info_ const & a, type_info_ const & b )
|
||||
{
|
||||
return 0!=(a.type_->before(*b.type_));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T))
|
||||
|
||||
#ifndef BOOST_NO_RTTI
|
||||
#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,200 +0,0 @@
|
||||
//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_0552D49838DD11DD90146B8956D89593
|
||||
#define UUID_0552D49838DD11DD90146B8956D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#ifndef BOOST_NO_RTTI
|
||||
#include <boost/units/detail/utility.hpp>
|
||||
#endif
|
||||
#include <exception>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <boost/exception/current_exception_cast.hpp>
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
std::string diagnostic_information_impl( boost::exception const *, std::exception const *, bool );
|
||||
}
|
||||
|
||||
inline
|
||||
std::string
|
||||
current_exception_diagnostic_information()
|
||||
{
|
||||
boost::exception const * be=current_exception_cast<boost::exception const>();
|
||||
std::exception const * se=current_exception_cast<std::exception const>();
|
||||
if( be || se )
|
||||
return exception_detail::diagnostic_information_impl(be,se,true);
|
||||
else
|
||||
return "No diagnostic information available.";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
inline
|
||||
exception const *
|
||||
get_boost_exception( exception const * e )
|
||||
{
|
||||
return e;
|
||||
}
|
||||
|
||||
inline
|
||||
exception const *
|
||||
get_boost_exception( ... )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline
|
||||
std::exception const *
|
||||
get_std_exception( std::exception const * e )
|
||||
{
|
||||
return e;
|
||||
}
|
||||
|
||||
inline
|
||||
std::exception const *
|
||||
get_std_exception( ... )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline
|
||||
char const *
|
||||
get_diagnostic_information( exception const & x, char const * header )
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
error_info_container * c=x.data_.get();
|
||||
if( !c )
|
||||
x.data_.adopt(c=new exception_detail::error_info_container_impl);
|
||||
char const * di=c->diagnostic_information(header);
|
||||
BOOST_ASSERT(di!=0);
|
||||
return di;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
inline
|
||||
std::string
|
||||
diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what )
|
||||
{
|
||||
if( !be && !se )
|
||||
return "Unknown exception.";
|
||||
#ifndef BOOST_NO_RTTI
|
||||
if( !be )
|
||||
be=dynamic_cast<boost::exception const *>(se);
|
||||
if( !se )
|
||||
se=dynamic_cast<std::exception const *>(be);
|
||||
#endif
|
||||
char const * wh=0;
|
||||
if( with_what && se )
|
||||
{
|
||||
wh=se->what();
|
||||
if( be && exception_detail::get_diagnostic_information(*be,0)==wh )
|
||||
return wh;
|
||||
}
|
||||
std::ostringstream tmp;
|
||||
if( be )
|
||||
{
|
||||
char const * const * f=get_error_info<throw_file>(*be);
|
||||
int const * l=get_error_info<throw_line>(*be);
|
||||
char const * const * fn=get_error_info<throw_function>(*be);
|
||||
if( !f && !l && !fn )
|
||||
tmp << "Throw location unknown (consider using BOOST_THROW_EXCEPTION)\n";
|
||||
else
|
||||
{
|
||||
if( f )
|
||||
{
|
||||
tmp << *f;
|
||||
if( int const * l=get_error_info<throw_line>(*be) )
|
||||
tmp << '(' << *l << "): ";
|
||||
}
|
||||
tmp << "Throw in function ";
|
||||
if( char const * const * fn=get_error_info<throw_function>(*be) )
|
||||
tmp << *fn;
|
||||
else
|
||||
tmp << "(unknown)";
|
||||
tmp << '\n';
|
||||
}
|
||||
}
|
||||
#ifndef BOOST_NO_RTTI
|
||||
tmp << std::string("Dynamic exception type: ") <<
|
||||
units::detail::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n';
|
||||
#endif
|
||||
if( with_what && se )
|
||||
tmp << "std::exception::what: " << wh << '\n';
|
||||
if( be )
|
||||
if( char const * s=exception_detail::get_diagnostic_information(*be,tmp.str().c_str()) )
|
||||
if( *s )
|
||||
return s;
|
||||
return tmp.str();
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::string
|
||||
diagnostic_information( T const & e )
|
||||
{
|
||||
return exception_detail::diagnostic_information_impl(exception_detail::get_boost_exception(&e),exception_detail::get_std_exception(&e),true);
|
||||
}
|
||||
|
||||
inline
|
||||
char const *
|
||||
diagnostic_information_what( exception const & e ) throw()
|
||||
{
|
||||
char const * w=0;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
(void) exception_detail::diagnostic_information_impl(&e,0,false);
|
||||
if( char const * di=exception_detail::get_diagnostic_information(e,0) )
|
||||
return di;
|
||||
else
|
||||
return "Failed to produce boost::diagnostic_information_what()";
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
}
|
||||
#endif
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
@ -1,6 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
@ -1,22 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_DDFBB4546C1211DEA4659E9055D89593
|
||||
#define UUID_DDFBB4546C1211DEA4659E9055D89593
|
||||
|
||||
#include "boost/exception/error_info.hpp"
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
//Usage hint:
|
||||
//if( api_function(....)!=0 )
|
||||
// BOOST_THROW_EXCEPTION(
|
||||
// failure() <<
|
||||
// errinfo_api_function("api_function") );
|
||||
typedef error_info<struct errinfo_api_function_,char const *> errinfo_api_function;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,18 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_E7255CE26C1211DE85800C9155D89593
|
||||
#define UUID_E7255CE26C1211DE85800C9155D89593
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
//Use with parsing errors exceptions, for example in a XML file parser.
|
||||
typedef error_info<struct errinfo_at_line_,int> errinfo_at_line;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,44 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
|
||||
#define UUID_F0EE17BE6C1211DE87FF459155D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include "boost/exception/info.hpp"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
typedef error_info<struct errinfo_errno_,int> errinfo_errno;
|
||||
|
||||
//Usage hint:
|
||||
//if( c_function(....)!=0 )
|
||||
// BOOST_THROW_EXCEPTION(
|
||||
// failure() <<
|
||||
// errinfo_errno(errno) <<
|
||||
// errinfo_api_function("c_function") );
|
||||
inline
|
||||
std::string
|
||||
to_string( errinfo_errno const & e )
|
||||
{
|
||||
std::ostringstream tmp;
|
||||
int v=e.value();
|
||||
tmp << v << ", \"" << strerror(v) << "\"";
|
||||
return tmp.str();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,20 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_F79E6EE26C1211DEB26E929155D89593
|
||||
#define UUID_F79E6EE26C1211DEB26E929155D89593
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class> class weak_ptr;
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
typedef error_info<struct errinfo_file_handle_,weak_ptr<FILE> > errinfo_file_handle;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,26 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_FEE5120A6C1211DE94E8BC9155D89593
|
||||
#define UUID_FEE5120A6C1211DE94E8BC9155D89593
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
//Usage hint:
|
||||
//FILE * f=fopen(name,mode);
|
||||
//if( !f )
|
||||
// BOOST_THROW_EXCEPTION(
|
||||
// file_open_error() <<
|
||||
// errinfo_file_name(name) <<
|
||||
// errinfo_file_open_mode(mode) );
|
||||
typedef error_info<struct errinfo_file_name_,std::string> errinfo_file_name;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,26 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_056F1F266C1311DE8E74299255D89593
|
||||
#define UUID_056F1F266C1311DE8E74299255D89593
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
//Usage hint:
|
||||
//FILE * f=fopen(name,mode);
|
||||
//if( !f )
|
||||
// BOOST_THROW_EXCEPTION(
|
||||
// file_open_error() <<
|
||||
// errinfo_file_name(name) <<
|
||||
// errinfo_file_open_mode(mode) );
|
||||
typedef error_info<struct errinfo_file_open_mode_,std::string> errinfo_file_open_mode;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,18 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_45CC9A82B77511DEB330FC4956D89593
|
||||
#define UUID_45CC9A82B77511DEB330FC4956D89593
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace exception_detail { class clone_base; }
|
||||
template <class Tag,class T> class error_info;
|
||||
class exception_ptr;
|
||||
typedef error_info<struct errinfo_nested_exception_,exception_ptr> errinfo_nested_exception;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,23 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_0E11109E6C1311DEB7EA649255D89593
|
||||
#define UUID_0E11109E6C1311DEB7EA649255D89593
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
//Usage hint:
|
||||
//BOOST_THROW_EXCEPTION(
|
||||
// bad_type() <<
|
||||
// errinfo_type_info_name(typeid(x).name()) );
|
||||
typedef error_info<struct errinfo_type_info_name_,std::string> errinfo_type_info_name;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
namespace boost { template <class Tag,class T> class error_info; }
|
@ -1,130 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_1A590226753311DD9E4CCF6156D89593
|
||||
#define UUID_1A590226753311DD9E4CCF6156D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/detail/error_info_impl.hpp>
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class ErrorInfo>
|
||||
struct
|
||||
get_info
|
||||
{
|
||||
static
|
||||
typename ErrorInfo::value_type *
|
||||
get( exception const & x )
|
||||
{
|
||||
if( exception_detail::error_info_container * c=x.data_.get() )
|
||||
if( shared_ptr<exception_detail::error_info_base> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) )
|
||||
{
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo *>(eib.get()) );
|
||||
#endif
|
||||
ErrorInfo * w = static_cast<ErrorInfo *>(eib.get());
|
||||
return &w->value();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
get_info<throw_function>
|
||||
{
|
||||
static
|
||||
char const * *
|
||||
get( exception const & x )
|
||||
{
|
||||
return x.throw_function_ ? &x.throw_function_ : 0;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
get_info<throw_file>
|
||||
{
|
||||
static
|
||||
char const * *
|
||||
get( exception const & x )
|
||||
{
|
||||
return x.throw_file_ ? &x.throw_file_ : 0;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
get_info<throw_line>
|
||||
{
|
||||
static
|
||||
int *
|
||||
get( exception const & x )
|
||||
{
|
||||
return x.throw_line_!=-1 ? &x.throw_line_ : 0;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T,class R>
|
||||
struct
|
||||
get_error_info_return_type
|
||||
{
|
||||
typedef R * type;
|
||||
};
|
||||
|
||||
template <class T,class R>
|
||||
struct
|
||||
get_error_info_return_type<T const,R>
|
||||
{
|
||||
typedef R const * type;
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_RTTI
|
||||
template <class ErrorInfo>
|
||||
inline
|
||||
typename ErrorInfo::value_type const *
|
||||
get_error_info( boost::exception const & x )
|
||||
{
|
||||
return exception_detail::get_info<ErrorInfo>::get(x);
|
||||
}
|
||||
template <class ErrorInfo>
|
||||
inline
|
||||
typename ErrorInfo::value_type *
|
||||
get_error_info( boost::exception & x )
|
||||
{
|
||||
return exception_detail::get_info<ErrorInfo>::get(x);
|
||||
}
|
||||
#else
|
||||
template <class ErrorInfo,class E>
|
||||
inline
|
||||
typename exception_detail::get_error_info_return_type<E,typename ErrorInfo::value_type>::type
|
||||
get_error_info( E & some_exception )
|
||||
{
|
||||
if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
|
||||
return exception_detail::get_info<ErrorInfo>::get(*x);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,199 +0,0 @@
|
||||
//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_8D22C4CA9CC811DCAA9133D256D89593
|
||||
#define UUID_8D22C4CA9CC811DCAA9133D256D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/to_string_stub.hpp>
|
||||
#include <boost/exception/detail/error_info_impl.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <map>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
typename enable_if<has_to_string<T>,std::string>::type
|
||||
to_string( error_info<Tag,T> const & x )
|
||||
{
|
||||
return to_string(x.value());
|
||||
}
|
||||
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
error_info<Tag,T>::
|
||||
error_info( value_type const & value ):
|
||||
value_(value)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
error_info<Tag,T>::
|
||||
~error_info() throw()
|
||||
{
|
||||
}
|
||||
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
std::string
|
||||
error_info<Tag,T>::
|
||||
tag_typeid_name() const
|
||||
{
|
||||
return tag_type_name<Tag>();
|
||||
}
|
||||
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
std::string
|
||||
error_info<Tag,T>::
|
||||
value_as_string() const
|
||||
{
|
||||
return to_string_stub(*this);
|
||||
}
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class
|
||||
error_info_container_impl:
|
||||
public error_info_container
|
||||
{
|
||||
public:
|
||||
|
||||
error_info_container_impl():
|
||||
count_(0)
|
||||
{
|
||||
}
|
||||
|
||||
~error_info_container_impl() throw()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
set( shared_ptr<error_info_base> const & x, type_info_ const & typeid_ )
|
||||
{
|
||||
BOOST_ASSERT(x);
|
||||
info_[typeid_] = x;
|
||||
diagnostic_info_str_.clear();
|
||||
}
|
||||
|
||||
shared_ptr<error_info_base>
|
||||
get( type_info_ const & ti ) const
|
||||
{
|
||||
error_info_map::const_iterator i=info_.find(ti);
|
||||
if( info_.end()!=i )
|
||||
{
|
||||
shared_ptr<error_info_base> const & p = i->second;
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ );
|
||||
#endif
|
||||
return p;
|
||||
}
|
||||
return shared_ptr<error_info_base>();
|
||||
}
|
||||
|
||||
char const *
|
||||
diagnostic_information( char const * header ) const
|
||||
{
|
||||
if( header )
|
||||
{
|
||||
std::ostringstream tmp;
|
||||
tmp << header;
|
||||
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
|
||||
{
|
||||
error_info_base const & x = *i->second;
|
||||
tmp << '[' << x.tag_typeid_name() << "] = " << x.value_as_string() << '\n';
|
||||
}
|
||||
tmp.str().swap(diagnostic_info_str_);
|
||||
}
|
||||
return diagnostic_info_str_.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
friend class boost::exception;
|
||||
|
||||
typedef std::map< type_info_, shared_ptr<error_info_base> > error_info_map;
|
||||
error_info_map info_;
|
||||
mutable std::string diagnostic_info_str_;
|
||||
mutable int count_;
|
||||
|
||||
error_info_container_impl( error_info_container_impl const & );
|
||||
error_info_container_impl & operator=( error_info_container const & );
|
||||
|
||||
void
|
||||
add_ref() const
|
||||
{
|
||||
++count_;
|
||||
}
|
||||
|
||||
bool
|
||||
release() const
|
||||
{
|
||||
if( --count_ )
|
||||
return false;
|
||||
else
|
||||
{
|
||||
delete this;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
refcount_ptr<error_info_container>
|
||||
clone() const
|
||||
{
|
||||
refcount_ptr<error_info_container> p;
|
||||
error_info_container_impl * c=new error_info_container_impl;
|
||||
p.adopt(c);
|
||||
c->info_ = info_;
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
inline
|
||||
E const &
|
||||
set_info( E const & x, error_info<Tag,T> const & v )
|
||||
{
|
||||
typedef error_info<Tag,T> error_info_tag_t;
|
||||
shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );
|
||||
exception_detail::error_info_container * c=x.data_.get();
|
||||
if( !c )
|
||||
x.data_.adopt(c=new exception_detail::error_info_container_impl);
|
||||
c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
|
||||
return x;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
derives_boost_exception
|
||||
{
|
||||
enum e { value = (sizeof(dispatch_boost_exception((T*)0))==sizeof(large_size)) };
|
||||
};
|
||||
}
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
inline
|
||||
typename enable_if<exception_detail::derives_boost_exception<E>,E const &>::type
|
||||
operator<<( E const & x, error_info<Tag,T> const & v )
|
||||
{
|
||||
return exception_detail::set_info(x,v);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,76 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_63EE924290FB11DC87BB856555D89593
|
||||
#define UUID_63EE924290FB11DC87BB856555D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <
|
||||
class E,
|
||||
class Tag1,class T1,
|
||||
class Tag2,class T2 >
|
||||
inline
|
||||
E const &
|
||||
operator<<(
|
||||
E const & x,
|
||||
tuple<
|
||||
error_info<Tag1,T1>,
|
||||
error_info<Tag2,T2> > const & v )
|
||||
{
|
||||
return x << v.template get<0>() << v.template get<1>();
|
||||
}
|
||||
|
||||
template <
|
||||
class E,
|
||||
class Tag1,class T1,
|
||||
class Tag2,class T2,
|
||||
class Tag3,class T3 >
|
||||
inline
|
||||
E const &
|
||||
operator<<(
|
||||
E const & x,
|
||||
tuple<
|
||||
error_info<Tag1,T1>,
|
||||
error_info<Tag2,T2>,
|
||||
error_info<Tag3,T3> > const & v )
|
||||
{
|
||||
return x << v.template get<0>() << v.template get<1>() << v.template get<2>();
|
||||
}
|
||||
|
||||
template <
|
||||
class E,
|
||||
class Tag1,class T1,
|
||||
class Tag2,class T2,
|
||||
class Tag3,class T3,
|
||||
class Tag4,class T4 >
|
||||
inline
|
||||
E const &
|
||||
operator<<(
|
||||
E const & x,
|
||||
tuple<
|
||||
error_info<Tag1,T1>,
|
||||
error_info<Tag2,T2>,
|
||||
error_info<Tag3,T3>,
|
||||
error_info<Tag4,T4> > const & v )
|
||||
{
|
||||
return x << v.template get<0>() << v.template get<1>() << v.template get<2>() << v.template get<3>();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,83 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_7E48761AD92811DC9011477D56D89593
|
||||
#define UUID_7E48761AD92811DC9011477D56D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/exception/detail/is_output_streamable.hpp>
|
||||
#include <sstream>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
to_string_detail
|
||||
{
|
||||
template <class T>
|
||||
typename disable_if<is_output_streamable<T>,char>::type to_string( T const & );
|
||||
|
||||
template <class,bool IsOutputStreamable>
|
||||
struct has_to_string_impl;
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
has_to_string_impl<T,true>
|
||||
{
|
||||
enum e { value=1 };
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
has_to_string_impl<T,false>
|
||||
{
|
||||
static T const & f();
|
||||
enum e { value=1!=sizeof(to_string(f())) };
|
||||
};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
typename enable_if<is_output_streamable<T>,std::string>::type
|
||||
to_string( T const & x )
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << x;
|
||||
return out.str();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
has_to_string
|
||||
{
|
||||
enum e { value=to_string_detail::has_to_string_impl<T,is_output_streamable<T>::value>::value };
|
||||
};
|
||||
|
||||
template <class T,class U>
|
||||
inline
|
||||
std::string
|
||||
to_string( std::pair<T,U> const & x )
|
||||
{
|
||||
return std::string("(") + to_string(x.first) + ',' + to_string(x.second) + ')';
|
||||
}
|
||||
|
||||
inline
|
||||
std::string
|
||||
to_string( std::exception const & x )
|
||||
{
|
||||
return x.what();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,109 +0,0 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_E788439ED9F011DCB181F25B55D89593
|
||||
#define UUID_E788439ED9F011DCB181F25B55D89593
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/to_string.hpp>
|
||||
#include <boost/exception/detail/object_hex_dump.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <bool ToStringAvailable>
|
||||
struct
|
||||
to_string_dispatcher
|
||||
{
|
||||
template <class T,class Stub>
|
||||
static
|
||||
std::string
|
||||
convert( T const & x, Stub )
|
||||
{
|
||||
return to_string(x);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct
|
||||
to_string_dispatcher<false>
|
||||
{
|
||||
template <class T,class Stub>
|
||||
static
|
||||
std::string
|
||||
convert( T const & x, Stub s )
|
||||
{
|
||||
return s(x);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static
|
||||
std::string
|
||||
convert( T const & x, std::string s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static
|
||||
std::string
|
||||
convert( T const & x, char const * s )
|
||||
{
|
||||
BOOST_ASSERT(s!=0);
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
namespace
|
||||
to_string_dispatch
|
||||
{
|
||||
template <class T,class Stub>
|
||||
inline
|
||||
std::string
|
||||
dispatch( T const & x, Stub s )
|
||||
{
|
||||
return to_string_dispatcher<has_to_string<T>::value>::convert(x,s);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
std::string
|
||||
string_stub_dump( T const & x )
|
||||
{
|
||||
return "[ " + exception_detail::object_hex_dump(x) + " ]";
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
std::string
|
||||
to_string_stub( T const & x )
|
||||
{
|
||||
return exception_detail::to_string_dispatch::dispatch(x,&exception_detail::string_stub_dump<T>);
|
||||
}
|
||||
|
||||
template <class T,class Stub>
|
||||
inline
|
||||
std::string
|
||||
to_string_stub( T const & x, Stub s )
|
||||
{
|
||||
return exception_detail::to_string_dispatch::dispatch(x,s);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,56 +0,0 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Revision History:
|
||||
|
||||
// 27 Feb 2001 Jeremy Siek
|
||||
// Initial checkin.
|
||||
|
||||
#ifndef BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
|
||||
#define BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class UnaryFunction>
|
||||
class function_output_iterator {
|
||||
typedef function_output_iterator self;
|
||||
public:
|
||||
typedef std::output_iterator_tag iterator_category;
|
||||
typedef void value_type;
|
||||
typedef void difference_type;
|
||||
typedef void pointer;
|
||||
typedef void reference;
|
||||
|
||||
explicit function_output_iterator() {}
|
||||
|
||||
explicit function_output_iterator(const UnaryFunction& f)
|
||||
: m_f(f) {}
|
||||
|
||||
struct output_proxy {
|
||||
output_proxy(UnaryFunction& f) : m_f(f) { }
|
||||
template <class T> output_proxy& operator=(const T& value) {
|
||||
m_f(value);
|
||||
return *this;
|
||||
}
|
||||
UnaryFunction& m_f;
|
||||
};
|
||||
output_proxy operator*() { return output_proxy(m_f); }
|
||||
self& operator++() { return *this; }
|
||||
self& operator++(int) { return *this; }
|
||||
private:
|
||||
UnaryFunction m_f;
|
||||
};
|
||||
|
||||
template <class UnaryFunction>
|
||||
inline function_output_iterator<UnaryFunction>
|
||||
make_function_output_iterator(const UnaryFunction& f = UnaryFunction()) {
|
||||
return function_output_iterator<UnaryFunction>(f);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
|
@ -1,19 +0,0 @@
|
||||
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Forwarding header for container_fwd.hpp's new location.
|
||||
// This header is deprecated, I'll be adding a warning in a future release,
|
||||
// then converting it to an error and finally removing this header completely.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP)
|
||||
#define BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/functional/hash/hash_fwd.hpp>
|
||||
|
@ -1,80 +0,0 @@
|
||||
// (C) Copyright Jens Maurer 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Revision History:
|
||||
|
||||
// 15 Nov 2001 Jens Maurer
|
||||
// created.
|
||||
|
||||
// See http://www.boost.org/libs/utility/iterator_adaptors.htm for documentation.
|
||||
|
||||
#ifndef BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP
|
||||
#define BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP
|
||||
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class Generator>
|
||||
class generator_iterator
|
||||
: public iterator_facade<
|
||||
generator_iterator<Generator>
|
||||
, typename Generator::result_type
|
||||
, single_pass_traversal_tag
|
||||
, typename Generator::result_type const&
|
||||
>
|
||||
{
|
||||
typedef iterator_facade<
|
||||
generator_iterator<Generator>
|
||||
, typename Generator::result_type
|
||||
, single_pass_traversal_tag
|
||||
, typename Generator::result_type const&
|
||||
> super_t;
|
||||
|
||||
public:
|
||||
generator_iterator() {}
|
||||
generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {}
|
||||
|
||||
void increment()
|
||||
{
|
||||
m_value = (*m_g)();
|
||||
}
|
||||
|
||||
const typename Generator::result_type&
|
||||
dereference() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
bool equal(generator_iterator const& y) const
|
||||
{
|
||||
return this->m_g == y.m_g && this->m_value == y.m_value;
|
||||
}
|
||||
|
||||
private:
|
||||
Generator* m_g;
|
||||
typename Generator::result_type m_value;
|
||||
};
|
||||
|
||||
template<class Generator>
|
||||
struct generator_iterator_generator
|
||||
{
|
||||
typedef generator_iterator<Generator> type;
|
||||
};
|
||||
|
||||
template <class Generator>
|
||||
inline generator_iterator<Generator>
|
||||
make_generator_iterator(Generator & gen)
|
||||
{
|
||||
typedef generator_iterator<Generator> result_t;
|
||||
return result_t(&gen);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP
|
||||
|
@ -1,43 +0,0 @@
|
||||
#ifndef INDIRECT_REFERENCE_DWA200415_HPP
|
||||
# define INDIRECT_REFERENCE_DWA200415_HPP
|
||||
|
||||
//
|
||||
// Copyright David Abrahams 2004. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// typename indirect_reference<P>::type provides the type of *p.
|
||||
//
|
||||
// http://www.boost.org/libs/iterator/doc/pointee.html
|
||||
//
|
||||
|
||||
# include <boost/detail/is_incrementable.hpp>
|
||||
# include <boost/iterator/iterator_traits.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/pointee.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class P>
|
||||
struct smart_ptr_reference
|
||||
{
|
||||
typedef typename boost::pointee<P>::type& type;
|
||||
};
|
||||
}
|
||||
|
||||
template <class P>
|
||||
struct indirect_reference
|
||||
: mpl::eval_if<
|
||||
detail::is_incrementable<P>
|
||||
, iterator_reference<P>
|
||||
, detail::smart_ptr_reference<P>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // INDIRECT_REFERENCE_DWA200415_HPP
|
@ -1,126 +0,0 @@
|
||||
// Boost integer/integer_mask.hpp header file ------------------------------//
|
||||
|
||||
// (C) Copyright Daryle Walker 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_INTEGER_INTEGER_MASK_HPP
|
||||
#define BOOST_INTEGER_INTEGER_MASK_HPP
|
||||
|
||||
#include <boost/integer_fwd.hpp> // self include
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
|
||||
#include <boost/integer.hpp> // for boost::uint_t
|
||||
|
||||
#include <climits> // for UCHAR_MAX, etc.
|
||||
#include <cstddef> // for std::size_t
|
||||
|
||||
#include <boost/limits.hpp> // for std::numeric_limits
|
||||
|
||||
//
|
||||
// We simply cannot include this header on gcc without getting copious warnings of the kind:
|
||||
//
|
||||
// boost/integer/integer_mask.hpp:93:35: warning: use of C99 long long integer constant
|
||||
//
|
||||
// And yet there is no other reasonable implementation, so we declare this a system header
|
||||
// to suppress these warnings.
|
||||
//
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
|
||||
// Specified single-bit mask class declaration -----------------------------//
|
||||
// (Lowest bit starts counting at 0.)
|
||||
|
||||
template < std::size_t Bit >
|
||||
struct high_bit_mask_t
|
||||
{
|
||||
typedef typename uint_t<(Bit + 1)>::least least;
|
||||
typedef typename uint_t<(Bit + 1)>::fast fast;
|
||||
|
||||
BOOST_STATIC_CONSTANT( least, high_bit = (least( 1u ) << Bit) );
|
||||
BOOST_STATIC_CONSTANT( fast, high_bit_fast = (fast( 1u ) << Bit) );
|
||||
|
||||
BOOST_STATIC_CONSTANT( std::size_t, bit_position = Bit );
|
||||
|
||||
}; // boost::high_bit_mask_t
|
||||
|
||||
|
||||
// Specified bit-block mask class declaration ------------------------------//
|
||||
// Makes masks for the lowest N bits
|
||||
// (Specializations are needed when N fills up a type.)
|
||||
|
||||
template < std::size_t Bits >
|
||||
struct low_bits_mask_t
|
||||
{
|
||||
typedef typename uint_t<Bits>::least least;
|
||||
typedef typename uint_t<Bits>::fast fast;
|
||||
|
||||
BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) );
|
||||
BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) );
|
||||
|
||||
BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits );
|
||||
|
||||
}; // boost::low_bits_mask_t
|
||||
|
||||
|
||||
#define BOOST_LOW_BITS_MASK_SPECIALIZE( Type ) \
|
||||
template < > struct low_bits_mask_t< std::numeric_limits<Type>::digits > { \
|
||||
typedef std::numeric_limits<Type> limits_type; \
|
||||
typedef uint_t<limits_type::digits>::least least; \
|
||||
typedef uint_t<limits_type::digits>::fast fast; \
|
||||
BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) ); \
|
||||
BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); \
|
||||
BOOST_STATIC_CONSTANT( std::size_t, bit_count = limits_type::digits ); \
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4245) // 'initializing' : conversion from 'int' to 'const boost::low_bits_mask_t<8>::least', signed/unsigned mismatch
|
||||
#endif
|
||||
|
||||
BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned char );
|
||||
|
||||
#if USHRT_MAX > UCHAR_MAX
|
||||
BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned short );
|
||||
#endif
|
||||
|
||||
#if UINT_MAX > USHRT_MAX
|
||||
BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned int );
|
||||
#endif
|
||||
|
||||
#if ULONG_MAX > UINT_MAX
|
||||
BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long );
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
#if ((defined(ULLONG_MAX) && (ULLONG_MAX > ULONG_MAX)) ||\
|
||||
(defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX > ULONG_MAX)) ||\
|
||||
(defined(ULONGLONG_MAX) && (ULONGLONG_MAX > ULONG_MAX)) ||\
|
||||
(defined(_ULLONG_MAX) && (_ULLONG_MAX > ULONG_MAX)))
|
||||
BOOST_LOW_BITS_MASK_SPECIALIZE( boost::ulong_long_type );
|
||||
#endif
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
#if 18446744073709551615ui64 > ULONG_MAX
|
||||
BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned __int64 );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#undef BOOST_LOW_BITS_MASK_SPECIALIZE
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_INTEGER_INTEGER_MASK_HPP
|
@ -1,51 +0,0 @@
|
||||
// Boost integer/static_min_max.hpp header file ----------------------------//
|
||||
|
||||
// (C) Copyright Daryle Walker 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_INTEGER_STATIC_MIN_MAX_HPP
|
||||
#define BOOST_INTEGER_STATIC_MIN_MAX_HPP
|
||||
|
||||
#include <boost/integer_fwd.hpp> // self include
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// Compile-time extrema class declarations ---------------------------------//
|
||||
// Get the minimum or maximum of two values, signed or unsigned.
|
||||
|
||||
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
|
||||
struct static_signed_min
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 > Value2) ? Value2 : Value1 );
|
||||
};
|
||||
|
||||
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
|
||||
struct static_signed_max
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 < Value2) ? Value2 : Value1 );
|
||||
};
|
||||
|
||||
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
|
||||
struct static_unsigned_min
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value
|
||||
= (Value1 > Value2) ? Value2 : Value1 );
|
||||
};
|
||||
|
||||
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
|
||||
struct static_unsigned_max
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value
|
||||
= (Value1 < Value2) ? Value2 : Value1 );
|
||||
};
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_INTEGER_STATIC_MIN_MAX_HPP
|
@ -1,215 +0,0 @@
|
||||
// Copyright David Abrahams 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef COUNTING_ITERATOR_DWA200348_HPP
|
||||
# define COUNTING_ITERATOR_DWA200348_HPP
|
||||
|
||||
# include <boost/iterator/iterator_adaptor.hpp>
|
||||
# include <boost/detail/numeric_traits.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/identity.hpp>
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <
|
||||
class Incrementable
|
||||
, class CategoryOrTraversal
|
||||
, class Difference
|
||||
>
|
||||
class counting_iterator;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// Try to detect numeric types at compile time in ways compatible
|
||||
// with the limitations of the compiler and library.
|
||||
template <class T>
|
||||
struct is_numeric_impl
|
||||
{
|
||||
// For a while, this wasn't true, but we rely on it below. This is a regression assert.
|
||||
BOOST_STATIC_ASSERT(::boost::is_integral<char>::value);
|
||||
|
||||
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<T>::is_specialized);
|
||||
|
||||
# else
|
||||
|
||||
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value = (
|
||||
boost::is_convertible<int,T>::value
|
||||
&& boost::is_convertible<T,int>::value
|
||||
));
|
||||
# else
|
||||
BOOST_STATIC_CONSTANT(bool, value = ::boost::is_arithmetic<T>::value);
|
||||
# endif
|
||||
|
||||
# endif
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_numeric
|
||||
: mpl::bool_<(::boost::detail::is_numeric_impl<T>::value)>
|
||||
{};
|
||||
|
||||
# if defined(BOOST_HAS_LONG_LONG)
|
||||
template <>
|
||||
struct is_numeric< ::boost::long_long_type>
|
||||
: mpl::true_ {};
|
||||
|
||||
template <>
|
||||
struct is_numeric< ::boost::ulong_long_type>
|
||||
: mpl::true_ {};
|
||||
# endif
|
||||
|
||||
// Some compilers fail to have a numeric_limits specialization
|
||||
template <>
|
||||
struct is_numeric<wchar_t>
|
||||
: mpl::true_ {};
|
||||
|
||||
template <class T>
|
||||
struct numeric_difference
|
||||
{
|
||||
typedef typename boost::detail::numeric_traits<T>::difference_type type;
|
||||
};
|
||||
|
||||
BOOST_STATIC_ASSERT(is_numeric<int>::value);
|
||||
|
||||
template <class Incrementable, class CategoryOrTraversal, class Difference>
|
||||
struct counting_iterator_base
|
||||
{
|
||||
typedef typename detail::ia_dflt_help<
|
||||
CategoryOrTraversal
|
||||
, mpl::eval_if<
|
||||
is_numeric<Incrementable>
|
||||
, mpl::identity<random_access_traversal_tag>
|
||||
, iterator_traversal<Incrementable>
|
||||
>
|
||||
>::type traversal;
|
||||
|
||||
typedef typename detail::ia_dflt_help<
|
||||
Difference
|
||||
, mpl::eval_if<
|
||||
is_numeric<Incrementable>
|
||||
, numeric_difference<Incrementable>
|
||||
, iterator_difference<Incrementable>
|
||||
>
|
||||
>::type difference;
|
||||
|
||||
typedef iterator_adaptor<
|
||||
counting_iterator<Incrementable, CategoryOrTraversal, Difference> // self
|
||||
, Incrementable // Base
|
||||
, Incrementable // Value
|
||||
# ifndef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||
const // MSVC won't strip this. Instead we enable Thomas'
|
||||
// criterion (see boost/iterator/detail/facade_iterator_category.hpp)
|
||||
# endif
|
||||
, traversal
|
||||
, Incrementable const& // reference
|
||||
, difference
|
||||
> type;
|
||||
};
|
||||
|
||||
// Template class distance_policy_select -- choose a policy for computing the
|
||||
// distance between counting_iterators at compile-time based on whether or not
|
||||
// the iterator wraps an integer or an iterator, using "poor man's partial
|
||||
// specialization".
|
||||
|
||||
template <bool is_integer> struct distance_policy_select;
|
||||
|
||||
// A policy for wrapped iterators
|
||||
template <class Difference, class Incrementable1, class Incrementable2>
|
||||
struct iterator_distance
|
||||
{
|
||||
static Difference distance(Incrementable1 x, Incrementable2 y)
|
||||
{
|
||||
return y - x;
|
||||
}
|
||||
};
|
||||
|
||||
// A policy for wrapped numbers
|
||||
template <class Difference, class Incrementable1, class Incrementable2>
|
||||
struct number_distance
|
||||
{
|
||||
static Difference distance(Incrementable1 x, Incrementable2 y)
|
||||
{
|
||||
return numeric_distance(x, y);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <
|
||||
class Incrementable
|
||||
, class CategoryOrTraversal = use_default
|
||||
, class Difference = use_default
|
||||
>
|
||||
class counting_iterator
|
||||
: public detail::counting_iterator_base<
|
||||
Incrementable, CategoryOrTraversal, Difference
|
||||
>::type
|
||||
{
|
||||
typedef typename detail::counting_iterator_base<
|
||||
Incrementable, CategoryOrTraversal, Difference
|
||||
>::type super_t;
|
||||
|
||||
friend class iterator_core_access;
|
||||
|
||||
public:
|
||||
typedef typename super_t::difference_type difference_type;
|
||||
|
||||
counting_iterator() { }
|
||||
|
||||
counting_iterator(counting_iterator const& rhs) : super_t(rhs.base()) {}
|
||||
|
||||
counting_iterator(Incrementable x)
|
||||
: super_t(x)
|
||||
{
|
||||
}
|
||||
|
||||
# if 0
|
||||
template<class OtherIncrementable>
|
||||
counting_iterator(
|
||||
counting_iterator<OtherIncrementable, CategoryOrTraversal, Difference> const& t
|
||||
, typename enable_if_convertible<OtherIncrementable, Incrementable>::type* = 0
|
||||
)
|
||||
: super_t(t.base())
|
||||
{}
|
||||
# endif
|
||||
|
||||
private:
|
||||
|
||||
typename super_t::reference dereference() const
|
||||
{
|
||||
return this->base_reference();
|
||||
}
|
||||
|
||||
template <class OtherIncrementable>
|
||||
difference_type
|
||||
distance_to(counting_iterator<OtherIncrementable, CategoryOrTraversal, Difference> const& y) const
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
detail::is_numeric<Incrementable>
|
||||
, detail::number_distance<difference_type, Incrementable, OtherIncrementable>
|
||||
, detail::iterator_distance<difference_type, Incrementable, OtherIncrementable>
|
||||
>::type d;
|
||||
|
||||
return d::distance(this->base(), y.base());
|
||||
}
|
||||
};
|
||||
|
||||
// Manufacture a counting iterator for an arbitrary incrementable type
|
||||
template <class Incrementable>
|
||||
inline counting_iterator<Incrementable>
|
||||
make_counting_iterator(Incrementable x)
|
||||
{
|
||||
typedef counting_iterator<Incrementable> result_t;
|
||||
return result_t(x);
|
||||
}
|
||||
|
||||
|
||||
} // namespace boost::iterator
|
||||
|
||||
#endif // COUNTING_ITERATOR_DWA200348_HPP
|
@ -1,19 +0,0 @@
|
||||
// Copyright David Abrahams 2003. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef ANY_CONVERSION_EATER_DWA20031117_HPP
|
||||
# define ANY_CONVERSION_EATER_DWA20031117_HPP
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// This type can be used in traits to "eat" up the one user-defined
|
||||
// implicit conversion allowed.
|
||||
struct any_conversion_eater
|
||||
{
|
||||
template <class T>
|
||||
any_conversion_eater(T const&);
|
||||
};
|
||||
|
||||
}} // namespace boost::detail
|
||||
|
||||
#endif // ANY_CONVERSION_EATER_DWA20031117_HPP
|
@ -1,135 +0,0 @@
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// (C) Copyright Thomas Witt 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_FILTER_ITERATOR_23022003THW_HPP
|
||||
#define BOOST_FILTER_ITERATOR_23022003THW_HPP
|
||||
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class Predicate, class Iterator>
|
||||
class filter_iterator;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class Predicate, class Iterator>
|
||||
struct filter_iterator_base
|
||||
{
|
||||
typedef iterator_adaptor<
|
||||
filter_iterator<Predicate, Iterator>
|
||||
, Iterator
|
||||
, use_default
|
||||
, typename mpl::if_<
|
||||
is_convertible<
|
||||
typename iterator_traversal<Iterator>::type
|
||||
, random_access_traversal_tag
|
||||
>
|
||||
, bidirectional_traversal_tag
|
||||
, use_default
|
||||
>::type
|
||||
> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <class Predicate, class Iterator>
|
||||
class filter_iterator
|
||||
: public detail::filter_iterator_base<Predicate, Iterator>::type
|
||||
{
|
||||
typedef typename detail::filter_iterator_base<
|
||||
Predicate, Iterator
|
||||
>::type super_t;
|
||||
|
||||
friend class iterator_core_access;
|
||||
|
||||
public:
|
||||
filter_iterator() { }
|
||||
|
||||
filter_iterator(Predicate f, Iterator x, Iterator end_ = Iterator())
|
||||
: super_t(x), m_predicate(f), m_end(end_)
|
||||
{
|
||||
satisfy_predicate();
|
||||
}
|
||||
|
||||
filter_iterator(Iterator x, Iterator end_ = Iterator())
|
||||
: super_t(x), m_predicate(), m_end(end_)
|
||||
{
|
||||
// Pro8 is a little too aggressive about instantiating the
|
||||
// body of this function.
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
// Don't allow use of this constructor if Predicate is a
|
||||
// function pointer type, since it will be 0.
|
||||
BOOST_STATIC_ASSERT(is_class<Predicate>::value);
|
||||
#endif
|
||||
satisfy_predicate();
|
||||
}
|
||||
|
||||
template<class OtherIterator>
|
||||
filter_iterator(
|
||||
filter_iterator<Predicate, OtherIterator> const& t
|
||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
|
||||
)
|
||||
: super_t(t.base()), m_predicate(t.predicate()), m_end(t.end()) {}
|
||||
|
||||
Predicate predicate() const { return m_predicate; }
|
||||
|
||||
Iterator end() const { return m_end; }
|
||||
|
||||
private:
|
||||
void increment()
|
||||
{
|
||||
++(this->base_reference());
|
||||
satisfy_predicate();
|
||||
}
|
||||
|
||||
void decrement()
|
||||
{
|
||||
while(!this->m_predicate(*--(this->base_reference()))){};
|
||||
}
|
||||
|
||||
void satisfy_predicate()
|
||||
{
|
||||
while (this->base() != this->m_end && !this->m_predicate(*this->base()))
|
||||
++(this->base_reference());
|
||||
}
|
||||
|
||||
// Probably should be the initial base class so it can be
|
||||
// optimized away via EBO if it is an empty class.
|
||||
Predicate m_predicate;
|
||||
Iterator m_end;
|
||||
};
|
||||
|
||||
template <class Predicate, class Iterator>
|
||||
filter_iterator<Predicate,Iterator>
|
||||
make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator())
|
||||
{
|
||||
return filter_iterator<Predicate,Iterator>(f,x,end);
|
||||
}
|
||||
|
||||
template <class Predicate, class Iterator>
|
||||
filter_iterator<Predicate,Iterator>
|
||||
make_filter_iterator(
|
||||
typename iterators::enable_if<
|
||||
is_class<Predicate>
|
||||
, Iterator
|
||||
>::type x
|
||||
, Iterator end = Iterator()
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
, Predicate* = 0
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return filter_iterator<Predicate,Iterator>(x,end);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_FILTER_ITERATOR_23022003THW_HPP
|
@ -1,139 +0,0 @@
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// (C) Copyright Thomas Witt 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_INDIRECT_ITERATOR_23022003THW_HPP
|
||||
#define BOOST_INDIRECT_ITERATOR_23022003THW_HPP
|
||||
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
#include <boost/pointee.hpp>
|
||||
#include <boost/indirect_reference.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <boost/detail/indirect_traits.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
|
||||
#ifdef BOOST_MPL_CFG_NO_HAS_XXX
|
||||
# include <boost/shared_ptr.hpp>
|
||||
# include <boost/scoped_ptr.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <memory>
|
||||
#endif
|
||||
|
||||
#include <boost/iterator/detail/config_def.hpp> // must be last #include
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class Iter, class Value, class Category, class Reference, class Difference>
|
||||
class indirect_iterator;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class Iter, class Value, class Category, class Reference, class Difference>
|
||||
struct indirect_base
|
||||
{
|
||||
typedef typename iterator_traits<Iter>::value_type dereferenceable;
|
||||
|
||||
typedef iterator_adaptor<
|
||||
indirect_iterator<Iter, Value, Category, Reference, Difference>
|
||||
, Iter
|
||||
, typename ia_dflt_help<
|
||||
Value, pointee<dereferenceable>
|
||||
>::type
|
||||
, Category
|
||||
, typename ia_dflt_help<
|
||||
Reference
|
||||
, mpl::eval_if<
|
||||
is_same<Value,use_default>
|
||||
, indirect_reference<dereferenceable>
|
||||
, add_reference<Value>
|
||||
>
|
||||
>::type
|
||||
, Difference
|
||||
> type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct indirect_base<int, int, int, int, int> {};
|
||||
} // namespace detail
|
||||
|
||||
|
||||
template <
|
||||
class Iterator
|
||||
, class Value = use_default
|
||||
, class Category = use_default
|
||||
, class Reference = use_default
|
||||
, class Difference = use_default
|
||||
>
|
||||
class indirect_iterator
|
||||
: public detail::indirect_base<
|
||||
Iterator, Value, Category, Reference, Difference
|
||||
>::type
|
||||
{
|
||||
typedef typename detail::indirect_base<
|
||||
Iterator, Value, Category, Reference, Difference
|
||||
>::type super_t;
|
||||
|
||||
friend class iterator_core_access;
|
||||
|
||||
public:
|
||||
indirect_iterator() {}
|
||||
|
||||
indirect_iterator(Iterator iter)
|
||||
: super_t(iter) {}
|
||||
|
||||
template <
|
||||
class Iterator2, class Value2, class Category2
|
||||
, class Reference2, class Difference2
|
||||
>
|
||||
indirect_iterator(
|
||||
indirect_iterator<
|
||||
Iterator2, Value2, Category2, Reference2, Difference2
|
||||
> const& y
|
||||
, typename enable_if_convertible<Iterator2, Iterator>::type* = 0
|
||||
)
|
||||
: super_t(y.base())
|
||||
{}
|
||||
|
||||
private:
|
||||
typename super_t::reference dereference() const
|
||||
{
|
||||
# if BOOST_WORKAROUND(__BORLANDC__, < 0x5A0 )
|
||||
return const_cast<super_t::reference>(**this->base());
|
||||
# else
|
||||
return **this->base();
|
||||
# endif
|
||||
}
|
||||
};
|
||||
|
||||
template <class Iter>
|
||||
inline
|
||||
indirect_iterator<Iter> make_indirect_iterator(Iter x)
|
||||
{
|
||||
return indirect_iterator<Iter>(x);
|
||||
}
|
||||
|
||||
template <class Traits, class Iter>
|
||||
inline
|
||||
indirect_iterator<Iter,Traits> make_indirect_iterator(Iter x, Traits* = 0)
|
||||
{
|
||||
return indirect_iterator<Iter, Traits>(x);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/iterator/detail/config_undef.hpp>
|
||||
|
||||
#endif // BOOST_INDIRECT_ITERATOR_23022003THW_HPP
|
@ -1,150 +0,0 @@
|
||||
// Copyright David Abrahams 2003. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef IS_LVALUE_ITERATOR_DWA2003112_HPP
|
||||
# define IS_LVALUE_ITERATOR_DWA2003112_HPP
|
||||
|
||||
#include <boost/iterator.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <boost/iterator/detail/any_conversion_eater.hpp>
|
||||
|
||||
// should be the last #includes
|
||||
#include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||
#include <boost/iterator/detail/config_def.hpp>
|
||||
|
||||
#ifndef BOOST_NO_IS_CONVERTIBLE
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||
// Calling lvalue_preserver( <expression>, 0 ) returns a reference
|
||||
// to the expression's result if <expression> is an lvalue, or
|
||||
// not_an_lvalue() otherwise.
|
||||
struct not_an_lvalue {};
|
||||
|
||||
template <class T>
|
||||
T& lvalue_preserver(T&, int);
|
||||
|
||||
template <class U>
|
||||
not_an_lvalue lvalue_preserver(U const&, ...);
|
||||
|
||||
# define BOOST_LVALUE_PRESERVER(expr) detail::lvalue_preserver(expr,0)
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_LVALUE_PRESERVER(expr) expr
|
||||
|
||||
#endif
|
||||
|
||||
// Guts of is_lvalue_iterator. Value is the iterator's value_type
|
||||
// and the result is computed in the nested rebind template.
|
||||
template <class Value>
|
||||
struct is_lvalue_iterator_impl
|
||||
{
|
||||
// Eat implicit conversions so we don't report true for things
|
||||
// convertible to Value const&
|
||||
struct conversion_eater
|
||||
{
|
||||
conversion_eater(Value&);
|
||||
};
|
||||
|
||||
static char tester(conversion_eater, int);
|
||||
static char (& tester(any_conversion_eater, ...) )[2];
|
||||
|
||||
template <class It>
|
||||
struct rebind
|
||||
{
|
||||
static It& x;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool
|
||||
, value = (
|
||||
sizeof(
|
||||
is_lvalue_iterator_impl<Value>::tester(
|
||||
BOOST_LVALUE_PRESERVER(*x), 0
|
||||
)
|
||||
) == 1
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
#undef BOOST_LVALUE_PRESERVER
|
||||
|
||||
//
|
||||
// void specializations to handle std input and output iterators
|
||||
//
|
||||
template <>
|
||||
struct is_lvalue_iterator_impl<void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : boost::mpl::false_
|
||||
{};
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <>
|
||||
struct is_lvalue_iterator_impl<const void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : boost::mpl::false_
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_lvalue_iterator_impl<volatile void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : boost::mpl::false_
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_lvalue_iterator_impl<const volatile void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : boost::mpl::false_
|
||||
{};
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// This level of dispatching is required for Borland. We might save
|
||||
// an instantiation by removing it for others.
|
||||
//
|
||||
template <class It>
|
||||
struct is_readable_lvalue_iterator_impl
|
||||
: is_lvalue_iterator_impl<
|
||||
BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<It>::value_type const
|
||||
>::template rebind<It>
|
||||
{};
|
||||
|
||||
template <class It>
|
||||
struct is_non_const_lvalue_iterator_impl
|
||||
: is_lvalue_iterator_impl<
|
||||
BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<It>::value_type
|
||||
>::template rebind<It>
|
||||
{};
|
||||
} // namespace detail
|
||||
|
||||
// Define the trait with full mpl lambda capability and various broken
|
||||
// compiler workarounds
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
|
||||
is_lvalue_iterator,T,::boost::detail::is_readable_lvalue_iterator_impl<T>::value)
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
|
||||
is_non_const_lvalue_iterator,T,::boost::detail::is_non_const_lvalue_iterator_impl<T>::value)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/iterator/detail/config_undef.hpp>
|
||||
#include <boost/type_traits/detail/bool_trait_undef.hpp>
|
||||
|
||||
#endif // IS_LVALUE_ITERATOR_DWA2003112_HPP
|
@ -1,108 +0,0 @@
|
||||
// Copyright David Abrahams 2003. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef IS_READABLE_ITERATOR_DWA2003112_HPP
|
||||
# define IS_READABLE_ITERATOR_DWA2003112_HPP
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||
#include <boost/iterator/detail/any_conversion_eater.hpp>
|
||||
|
||||
// should be the last #include
|
||||
#include <boost/iterator/detail/config_def.hpp>
|
||||
|
||||
#ifndef BOOST_NO_IS_CONVERTIBLE
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// Guts of is_readable_iterator. Value is the iterator's value_type
|
||||
// and the result is computed in the nested rebind template.
|
||||
template <class Value>
|
||||
struct is_readable_iterator_impl
|
||||
{
|
||||
static char tester(Value&, int);
|
||||
static char (& tester(any_conversion_eater, ...) )[2];
|
||||
|
||||
template <class It>
|
||||
struct rebind
|
||||
{
|
||||
static It& x;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool
|
||||
, value = (
|
||||
sizeof(
|
||||
is_readable_iterator_impl<Value>::tester(*x, 1)
|
||||
) == 1
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
#undef BOOST_READABLE_PRESERVER
|
||||
|
||||
//
|
||||
// void specializations to handle std input and output iterators
|
||||
//
|
||||
template <>
|
||||
struct is_readable_iterator_impl<void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : boost::mpl::false_
|
||||
{};
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <>
|
||||
struct is_readable_iterator_impl<const void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : boost::mpl::false_
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_readable_iterator_impl<volatile void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : boost::mpl::false_
|
||||
{};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_readable_iterator_impl<const volatile void>
|
||||
{
|
||||
template <class It>
|
||||
struct rebind : boost::mpl::false_
|
||||
{};
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// This level of dispatching is required for Borland. We might save
|
||||
// an instantiation by removing it for others.
|
||||
//
|
||||
template <class It>
|
||||
struct is_readable_iterator_impl2
|
||||
: is_readable_iterator_impl<
|
||||
BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<It>::value_type const
|
||||
>::template rebind<It>
|
||||
{};
|
||||
} // namespace detail
|
||||
|
||||
// Define the trait with full mpl lambda capability and various broken
|
||||
// compiler workarounds
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
|
||||
is_readable_iterator,T,::boost::detail::is_readable_iterator_impl2<T>::value)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/iterator/detail/config_undef.hpp>
|
||||
|
||||
#endif // IS_READABLE_ITERATOR_DWA2003112_HPP
|
@ -1,515 +0,0 @@
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_ITERATOR_ARCHETYPES_HPP
|
||||
#define BOOST_ITERATOR_ARCHETYPES_HPP
|
||||
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
|
||||
#include <boost/iterator/detail/facade_iterator_category.hpp>
|
||||
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
#include <boost/concept_archetype.hpp>
|
||||
|
||||
#include <boost/mpl/aux_/msvc_eti_base.hpp>
|
||||
#include <boost/mpl/bitand.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class Value, class AccessCategory>
|
||||
struct access_archetype;
|
||||
|
||||
template <class Derived, class Value, class AccessCategory, class TraversalCategory>
|
||||
struct traversal_archetype;
|
||||
|
||||
namespace iterator_archetypes
|
||||
{
|
||||
enum {
|
||||
readable_iterator_bit = 1
|
||||
, writable_iterator_bit = 2
|
||||
, swappable_iterator_bit = 4
|
||||
, lvalue_iterator_bit = 8
|
||||
};
|
||||
|
||||
// Not quite tags, since dispatching wouldn't work.
|
||||
typedef mpl::int_<readable_iterator_bit>::type readable_iterator_t;
|
||||
typedef mpl::int_<writable_iterator_bit>::type writable_iterator_t;
|
||||
|
||||
typedef mpl::int_<
|
||||
(readable_iterator_bit|writable_iterator_bit)
|
||||
>::type readable_writable_iterator_t;
|
||||
|
||||
typedef mpl::int_<
|
||||
(readable_iterator_bit|lvalue_iterator_bit)
|
||||
>::type readable_lvalue_iterator_t;
|
||||
|
||||
typedef mpl::int_<
|
||||
(lvalue_iterator_bit|writable_iterator_bit)
|
||||
>::type writable_lvalue_iterator_t;
|
||||
|
||||
typedef mpl::int_<swappable_iterator_bit>::type swappable_iterator_t;
|
||||
typedef mpl::int_<lvalue_iterator_bit>::type lvalue_iterator_t;
|
||||
|
||||
template <class Derived, class Base>
|
||||
struct has_access
|
||||
: mpl::equal_to<
|
||||
mpl::bitand_<Derived,Base>
|
||||
, Base
|
||||
>
|
||||
{};
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class T>
|
||||
struct assign_proxy
|
||||
{
|
||||
assign_proxy& operator=(T) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct read_proxy
|
||||
{
|
||||
operator T() { return static_object<T>::get(); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct read_write_proxy
|
||||
: read_proxy<T> // Use to inherit from assign_proxy, but that doesn't work. -JGS
|
||||
{
|
||||
read_write_proxy& operator=(T) { return *this; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct arrow_proxy
|
||||
{
|
||||
T const* operator->() const { return 0; }
|
||||
};
|
||||
|
||||
struct no_operator_brackets {};
|
||||
|
||||
template <class ValueType>
|
||||
struct readable_operator_brackets
|
||||
{
|
||||
read_proxy<ValueType> operator[](std::ptrdiff_t n) const { return read_proxy<ValueType>(); }
|
||||
};
|
||||
|
||||
template <class ValueType>
|
||||
struct writable_operator_brackets
|
||||
{
|
||||
read_write_proxy<ValueType> operator[](std::ptrdiff_t n) const { return read_write_proxy<ValueType>(); }
|
||||
};
|
||||
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct operator_brackets
|
||||
: mpl::aux::msvc_eti_base<
|
||||
typename mpl::eval_if<
|
||||
is_convertible<TraversalCategory, random_access_traversal_tag>
|
||||
, mpl::eval_if<
|
||||
iterator_archetypes::has_access<
|
||||
AccessCategory
|
||||
, iterator_archetypes::writable_iterator_t
|
||||
>
|
||||
, mpl::identity<writable_operator_brackets<Value> >
|
||||
, mpl::if_<
|
||||
iterator_archetypes::has_access<
|
||||
AccessCategory
|
||||
, iterator_archetypes::readable_iterator_t
|
||||
>
|
||||
, readable_operator_brackets<Value>
|
||||
, no_operator_brackets
|
||||
>
|
||||
>
|
||||
, mpl::identity<no_operator_brackets>
|
||||
>::type
|
||||
>::type
|
||||
{};
|
||||
|
||||
template <class TraversalCategory>
|
||||
struct traversal_archetype_impl
|
||||
{
|
||||
template <class Derived,class Value> struct archetype;
|
||||
};
|
||||
|
||||
// Constructor argument for those iterators that
|
||||
// are not default constructible
|
||||
struct ctor_arg {};
|
||||
|
||||
template <class Derived, class Value, class TraversalCategory>
|
||||
struct traversal_archetype_
|
||||
: mpl::aux::msvc_eti_base<
|
||||
typename traversal_archetype_impl<TraversalCategory>::template archetype<Derived,Value>
|
||||
>::type
|
||||
{
|
||||
typedef typename
|
||||
traversal_archetype_impl<TraversalCategory>::template archetype<Derived,Value>
|
||||
base;
|
||||
|
||||
traversal_archetype_() {}
|
||||
|
||||
traversal_archetype_(ctor_arg arg)
|
||||
: base(arg)
|
||||
{}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct traversal_archetype_impl<incrementable_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
{
|
||||
explicit archetype(ctor_arg) {}
|
||||
|
||||
struct bogus { }; // This use to be void, but that causes trouble for iterator_facade. Need more research. -JGS
|
||||
typedef bogus difference_type;
|
||||
|
||||
Derived& operator++() { return (Derived&)static_object<Derived>::get(); }
|
||||
Derived operator++(int) const { return (Derived&)static_object<Derived>::get(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct traversal_archetype_impl<single_pass_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
: public equality_comparable< traversal_archetype_<Derived, Value, single_pass_traversal_tag> >,
|
||||
public traversal_archetype_<Derived, Value, incrementable_traversal_tag>
|
||||
{
|
||||
explicit archetype(ctor_arg arg)
|
||||
: traversal_archetype_<Derived, Value, incrementable_traversal_tag>(arg)
|
||||
{}
|
||||
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
};
|
||||
};
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator==(traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&) { return true; }
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
// doesn't seem to pick up != from equality_comparable
|
||||
template <class Derived, class Value>
|
||||
bool operator!=(traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, single_pass_traversal_tag> const&) { return true; }
|
||||
#endif
|
||||
template <>
|
||||
struct traversal_archetype_impl<forward_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
: public traversal_archetype_<Derived, Value, single_pass_traversal_tag>
|
||||
{
|
||||
archetype()
|
||||
: traversal_archetype_<Derived, Value, single_pass_traversal_tag>(ctor_arg())
|
||||
{}
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct traversal_archetype_impl<bidirectional_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
: public traversal_archetype_<Derived, Value, forward_traversal_tag>
|
||||
{
|
||||
Derived& operator--() { return static_object<Derived>::get(); }
|
||||
Derived operator--(int) const { return static_object<Derived>::get(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct traversal_archetype_impl<random_access_traversal_tag>
|
||||
{
|
||||
template<class Derived, class Value>
|
||||
struct archetype
|
||||
: public traversal_archetype_<Derived, Value, bidirectional_traversal_tag>
|
||||
{
|
||||
Derived& operator+=(std::ptrdiff_t) { return static_object<Derived>::get(); }
|
||||
Derived& operator-=(std::ptrdiff_t) { return static_object<Derived>::get(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <class Derived, class Value>
|
||||
Derived& operator+(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
std::ptrdiff_t) { return static_object<Derived>::get(); }
|
||||
|
||||
template <class Derived, class Value>
|
||||
Derived& operator+(std::ptrdiff_t,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return static_object<Derived>::get(); }
|
||||
|
||||
template <class Derived, class Value>
|
||||
Derived& operator-(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
std::ptrdiff_t)
|
||||
{ return static_object<Derived>::get(); }
|
||||
|
||||
template <class Derived, class Value>
|
||||
std::ptrdiff_t operator-(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return 0; }
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator<(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return true; }
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator>(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return true; }
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator<=(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return true; }
|
||||
|
||||
template <class Derived, class Value>
|
||||
bool operator>=(traversal_archetype_<Derived, Value, random_access_traversal_tag> const&,
|
||||
traversal_archetype_<Derived, Value, random_access_traversal_tag> const&)
|
||||
{ return true; }
|
||||
|
||||
struct bogus_type;
|
||||
|
||||
template <class Value>
|
||||
struct convertible_type
|
||||
: mpl::if_< is_const<Value>,
|
||||
typename remove_const<Value>::type,
|
||||
bogus_type >
|
||||
{};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
template <class> struct undefined;
|
||||
|
||||
template <class AccessCategory>
|
||||
struct iterator_access_archetype_impl
|
||||
{
|
||||
template <class Value> struct archetype;
|
||||
};
|
||||
|
||||
template <class Value, class AccessCategory>
|
||||
struct iterator_access_archetype
|
||||
: mpl::aux::msvc_eti_base<
|
||||
typename iterator_access_archetype_impl<
|
||||
AccessCategory
|
||||
>::template archetype<Value>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<
|
||||
iterator_archetypes::readable_iterator_t
|
||||
>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
{
|
||||
typedef typename remove_cv<Value>::type value_type;
|
||||
typedef Value reference;
|
||||
typedef Value* pointer;
|
||||
|
||||
value_type operator*() const { return static_object<value_type>::get(); }
|
||||
|
||||
detail::arrow_proxy<Value> operator->() const { return detail::arrow_proxy<Value>(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<
|
||||
iterator_archetypes::writable_iterator_t
|
||||
>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
{
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
BOOST_STATIC_ASSERT(!is_const<Value>::value);
|
||||
# endif
|
||||
typedef void value_type;
|
||||
typedef void reference;
|
||||
typedef void pointer;
|
||||
|
||||
detail::assign_proxy<Value> operator*() const { return detail::assign_proxy<Value>(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<
|
||||
iterator_archetypes::readable_writable_iterator_t
|
||||
>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
: public virtual iterator_access_archetype<
|
||||
Value, iterator_archetypes::readable_iterator_t
|
||||
>
|
||||
{
|
||||
typedef detail::read_write_proxy<Value> reference;
|
||||
|
||||
detail::read_write_proxy<Value> operator*() const { return detail::read_write_proxy<Value>(); }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<iterator_archetypes::readable_lvalue_iterator_t>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
: public virtual iterator_access_archetype<
|
||||
Value, iterator_archetypes::readable_iterator_t
|
||||
>
|
||||
{
|
||||
typedef Value& reference;
|
||||
|
||||
Value& operator*() const { return static_object<Value>::get(); }
|
||||
Value* operator->() const { return 0; }
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct iterator_access_archetype_impl<iterator_archetypes::writable_lvalue_iterator_t>
|
||||
{
|
||||
template <class Value>
|
||||
struct archetype
|
||||
: public virtual iterator_access_archetype<
|
||||
Value, iterator_archetypes::readable_lvalue_iterator_t
|
||||
>
|
||||
{
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
BOOST_STATIC_ASSERT((!is_const<Value>::value));
|
||||
# endif
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct iterator_archetype;
|
||||
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct traversal_archetype_base
|
||||
: detail::operator_brackets<
|
||||
typename remove_cv<Value>::type
|
||||
, AccessCategory
|
||||
, TraversalCategory
|
||||
>
|
||||
, detail::traversal_archetype_<
|
||||
iterator_archetype<Value, AccessCategory, TraversalCategory>
|
||||
, Value
|
||||
, TraversalCategory
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct iterator_archetype_base
|
||||
: iterator_access_archetype<Value, AccessCategory>
|
||||
, traversal_archetype_base<Value, AccessCategory, TraversalCategory>
|
||||
{
|
||||
typedef iterator_access_archetype<Value, AccessCategory> access;
|
||||
|
||||
typedef typename detail::facade_iterator_category<
|
||||
TraversalCategory
|
||||
, typename mpl::eval_if<
|
||||
iterator_archetypes::has_access<
|
||||
AccessCategory, iterator_archetypes::writable_iterator_t
|
||||
>
|
||||
, remove_const<Value>
|
||||
, add_const<Value>
|
||||
>::type
|
||||
, typename access::reference
|
||||
>::type iterator_category;
|
||||
|
||||
// Needed for some broken libraries (see below)
|
||||
typedef boost::iterator<
|
||||
iterator_category
|
||||
, Value
|
||||
, typename traversal_archetype_base<
|
||||
Value, AccessCategory, TraversalCategory
|
||||
>::difference_type
|
||||
, typename access::pointer
|
||||
, typename access::reference
|
||||
> workaround_iterator_base;
|
||||
};
|
||||
}
|
||||
|
||||
template <class Value, class AccessCategory, class TraversalCategory>
|
||||
struct iterator_archetype
|
||||
: public detail::iterator_archetype_base<Value, AccessCategory, TraversalCategory>
|
||||
|
||||
// These broken libraries require derivation from std::iterator
|
||||
// (or related magic) in order to handle iter_swap and other
|
||||
// iterator operations
|
||||
# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, < 310) \
|
||||
|| BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(0x20101))
|
||||
, public detail::iterator_archetype_base<
|
||||
Value, AccessCategory, TraversalCategory
|
||||
>::workaround_iterator_base
|
||||
# endif
|
||||
{
|
||||
// Derivation from std::iterator above caused references to nested
|
||||
// types to be ambiguous, so now we have to redeclare them all
|
||||
// here.
|
||||
# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, < 310) \
|
||||
|| BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(0x20101))
|
||||
|
||||
typedef detail::iterator_archetype_base<
|
||||
Value,AccessCategory,TraversalCategory
|
||||
> base;
|
||||
|
||||
typedef typename base::value_type value_type;
|
||||
typedef typename base::reference reference;
|
||||
typedef typename base::pointer pointer;
|
||||
typedef typename base::difference_type difference_type;
|
||||
typedef typename base::iterator_category iterator_category;
|
||||
# endif
|
||||
|
||||
iterator_archetype() { }
|
||||
iterator_archetype(iterator_archetype const& x)
|
||||
: detail::iterator_archetype_base<
|
||||
Value
|
||||
, AccessCategory
|
||||
, TraversalCategory
|
||||
>(x)
|
||||
{}
|
||||
|
||||
iterator_archetype& operator=(iterator_archetype const&)
|
||||
{ return *this; }
|
||||
|
||||
# if 0
|
||||
// Optional conversion from mutable
|
||||
iterator_archetype(
|
||||
iterator_archetype<
|
||||
typename detail::convertible_type<Value>::type
|
||||
, AccessCategory
|
||||
, TraversalCategory> const&
|
||||
);
|
||||
# endif
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_ITERATOR_ARCHETYPES_HPP
|
@ -1,284 +0,0 @@
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_ITERATOR_CONCEPTS_HPP
|
||||
#define BOOST_ITERATOR_CONCEPTS_HPP
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
// Use boost::detail::iterator_traits to work around some MSVC/Dinkumware problems.
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
// Use boost/limits to work around missing limits headers on some compilers
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/concept/detail/concept_def.hpp>
|
||||
|
||||
namespace boost_concepts
|
||||
{
|
||||
// Used a different namespace here (instead of "boost") so that the
|
||||
// concept descriptions do not take for granted the names in
|
||||
// namespace boost.
|
||||
|
||||
//===========================================================================
|
||||
// Iterator Access Concepts
|
||||
|
||||
BOOST_concept(ReadableIterator,(Iterator))
|
||||
: boost::Assignable<Iterator>
|
||||
, boost::CopyConstructible<Iterator>
|
||||
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference reference;
|
||||
|
||||
BOOST_CONCEPT_USAGE(ReadableIterator)
|
||||
{
|
||||
|
||||
value_type v = *i;
|
||||
boost::ignore_unused_variable_warning(v);
|
||||
}
|
||||
private:
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
template <
|
||||
typename Iterator
|
||||
, typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
|
||||
>
|
||||
struct WritableIterator
|
||||
: boost::CopyConstructible<Iterator>
|
||||
{
|
||||
BOOST_CONCEPT_USAGE(WritableIterator)
|
||||
{
|
||||
*i = v;
|
||||
}
|
||||
private:
|
||||
ValueType v;
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
template <
|
||||
typename Iterator
|
||||
, typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type
|
||||
>
|
||||
struct WritableIteratorConcept : WritableIterator<Iterator,ValueType> {};
|
||||
|
||||
BOOST_concept(SwappableIterator,(Iterator))
|
||||
{
|
||||
BOOST_CONCEPT_USAGE(SwappableIterator)
|
||||
{
|
||||
std::iter_swap(i1, i2);
|
||||
}
|
||||
private:
|
||||
Iterator i1;
|
||||
Iterator i2;
|
||||
};
|
||||
|
||||
BOOST_concept(LvalueIterator,(Iterator))
|
||||
{
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type;
|
||||
|
||||
BOOST_CONCEPT_USAGE(LvalueIterator)
|
||||
{
|
||||
value_type& r = const_cast<value_type&>(*i);
|
||||
boost::ignore_unused_variable_warning(r);
|
||||
}
|
||||
private:
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Iterator Traversal Concepts
|
||||
|
||||
BOOST_concept(IncrementableIterator,(Iterator))
|
||||
: boost::Assignable<Iterator>
|
||||
, boost::CopyConstructible<Iterator>
|
||||
{
|
||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
||||
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
traversal_category
|
||||
, boost::incrementable_traversal_tag
|
||||
>));
|
||||
|
||||
BOOST_CONCEPT_USAGE(IncrementableIterator)
|
||||
{
|
||||
++i;
|
||||
(void)i++;
|
||||
}
|
||||
private:
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
BOOST_concept(SinglePassIterator,(Iterator))
|
||||
: IncrementableIterator<Iterator>
|
||||
, boost::EqualityComparable<Iterator>
|
||||
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
BOOST_DEDUCED_TYPENAME SinglePassIterator::traversal_category
|
||||
, boost::single_pass_traversal_tag
|
||||
> ));
|
||||
};
|
||||
|
||||
BOOST_concept(ForwardTraversal,(Iterator))
|
||||
: SinglePassIterator<Iterator>
|
||||
, boost::DefaultConstructible<Iterator>
|
||||
{
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type;
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_integral<difference_type>));
|
||||
BOOST_MPL_ASSERT_RELATION(std::numeric_limits<difference_type>::is_signed, ==, true);
|
||||
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
BOOST_DEDUCED_TYPENAME ForwardTraversal::traversal_category
|
||||
, boost::forward_traversal_tag
|
||||
> ));
|
||||
};
|
||||
|
||||
BOOST_concept(BidirectionalTraversal,(Iterator))
|
||||
: ForwardTraversal<Iterator>
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
BOOST_DEDUCED_TYPENAME BidirectionalTraversal::traversal_category
|
||||
, boost::bidirectional_traversal_tag
|
||||
> ));
|
||||
|
||||
BOOST_CONCEPT_USAGE(BidirectionalTraversal)
|
||||
{
|
||||
--i;
|
||||
(void)i--;
|
||||
}
|
||||
private:
|
||||
Iterator i;
|
||||
};
|
||||
|
||||
BOOST_concept(RandomAccessTraversal,(Iterator))
|
||||
: BidirectionalTraversal<Iterator>
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
BOOST_DEDUCED_TYPENAME RandomAccessTraversal::traversal_category
|
||||
, boost::random_access_traversal_tag
|
||||
> ));
|
||||
|
||||
BOOST_CONCEPT_USAGE(RandomAccessTraversal)
|
||||
{
|
||||
i += n;
|
||||
i = i + n;
|
||||
i = n + i;
|
||||
i -= n;
|
||||
i = i - n;
|
||||
n = i - j;
|
||||
}
|
||||
|
||||
private:
|
||||
typename BidirectionalTraversal<Iterator>::difference_type n;
|
||||
Iterator i, j;
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
// Iterator Interoperability
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename Iterator1, typename Iterator2>
|
||||
void interop_single_pass_constraints(Iterator1 const& i1, Iterator2 const& i2)
|
||||
{
|
||||
bool b;
|
||||
b = i1 == i2;
|
||||
b = i1 != i2;
|
||||
|
||||
b = i2 == i1;
|
||||
b = i2 != i1;
|
||||
boost::ignore_unused_variable_warning(b);
|
||||
}
|
||||
|
||||
template <typename Iterator1, typename Iterator2>
|
||||
void interop_rand_access_constraints(
|
||||
Iterator1 const& i1, Iterator2 const& i2,
|
||||
boost::random_access_traversal_tag, boost::random_access_traversal_tag)
|
||||
{
|
||||
bool b;
|
||||
typename boost::detail::iterator_traits<Iterator2>::difference_type n;
|
||||
b = i1 < i2;
|
||||
b = i1 <= i2;
|
||||
b = i1 > i2;
|
||||
b = i1 >= i2;
|
||||
n = i1 - i2;
|
||||
|
||||
b = i2 < i1;
|
||||
b = i2 <= i1;
|
||||
b = i2 > i1;
|
||||
b = i2 >= i1;
|
||||
n = i2 - i1;
|
||||
boost::ignore_unused_variable_warning(b);
|
||||
boost::ignore_unused_variable_warning(n);
|
||||
}
|
||||
|
||||
template <typename Iterator1, typename Iterator2>
|
||||
void interop_rand_access_constraints(
|
||||
Iterator1 const&, Iterator2 const&,
|
||||
boost::single_pass_traversal_tag, boost::single_pass_traversal_tag)
|
||||
{ }
|
||||
|
||||
} // namespace detail
|
||||
|
||||
BOOST_concept(InteroperableIterator,(Iterator)(ConstIterator))
|
||||
{
|
||||
private:
|
||||
typedef typename boost::detail::pure_traversal_tag<
|
||||
typename boost::iterator_traversal<
|
||||
Iterator
|
||||
>::type
|
||||
>::type traversal_category;
|
||||
|
||||
typedef typename boost::detail::pure_traversal_tag<
|
||||
typename boost::iterator_traversal<
|
||||
ConstIterator
|
||||
>::type
|
||||
>::type const_traversal_category;
|
||||
|
||||
public:
|
||||
BOOST_CONCEPT_ASSERT((SinglePassIterator<Iterator>));
|
||||
BOOST_CONCEPT_ASSERT((SinglePassIterator<ConstIterator>));
|
||||
|
||||
BOOST_CONCEPT_USAGE(InteroperableIterator)
|
||||
{
|
||||
detail::interop_single_pass_constraints(i, ci);
|
||||
detail::interop_rand_access_constraints(i, ci, traversal_category(), const_traversal_category());
|
||||
|
||||
ci = i;
|
||||
}
|
||||
|
||||
private:
|
||||
Iterator i;
|
||||
ConstIterator ci;
|
||||
};
|
||||
|
||||
} // namespace boost_concepts
|
||||
|
||||
#include <boost/concept/detail/concept_undef.hpp>
|
||||
|
||||
#endif // BOOST_ITERATOR_CONCEPTS_HPP
|
@ -1,264 +0,0 @@
|
||||
#ifndef BOOST_NEW_ITERATOR_TESTS_HPP
|
||||
# define BOOST_NEW_ITERATOR_TESTS_HPP
|
||||
|
||||
//
|
||||
// Copyright (c) David Abrahams 2001.
|
||||
// Copyright (c) Jeremy Siek 2001-2003.
|
||||
// Copyright (c) Thomas Witt 2002.
|
||||
//
|
||||
// Use, modification and distribution is subject to the
|
||||
// Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// This is meant to be the beginnings of a comprehensive, generic
|
||||
// test suite for STL concepts such as iterators and containers.
|
||||
//
|
||||
// Revision History:
|
||||
// 28 Oct 2002 Started update for new iterator categories
|
||||
// (Jeremy Siek)
|
||||
// 28 Apr 2002 Fixed input iterator requirements.
|
||||
// For a == b a++ == b++ is no longer required.
|
||||
// See 24.1.1/3 for details.
|
||||
// (Thomas Witt)
|
||||
// 08 Feb 2001 Fixed bidirectional iterator test so that
|
||||
// --i is no longer a precondition.
|
||||
// (Jeremy Siek)
|
||||
// 04 Feb 2001 Added lvalue test, corrected preconditions
|
||||
// (David Abrahams)
|
||||
|
||||
# include <iterator>
|
||||
# include <boost/type_traits.hpp>
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/concept_archetype.hpp> // for detail::dummy_constructor
|
||||
# include <boost/detail/iterator.hpp>
|
||||
# include <boost/pending/iterator_tests.hpp>
|
||||
# include <boost/iterator/is_readable_iterator.hpp>
|
||||
# include <boost/iterator/is_lvalue_iterator.hpp>
|
||||
|
||||
# include <boost/iterator/detail/config_def.hpp>
|
||||
# include <boost/detail/is_incrementable.hpp>
|
||||
# include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
|
||||
// Do separate tests for *i++ so we can treat, e.g., smart pointers,
|
||||
// as readable and/or writable iterators.
|
||||
template <class Iterator, class T>
|
||||
void readable_iterator_traversal_test(Iterator i1, T v, mpl::true_)
|
||||
{
|
||||
T v2(*i1++);
|
||||
BOOST_TEST(v == v2);
|
||||
}
|
||||
|
||||
template <class Iterator, class T>
|
||||
void readable_iterator_traversal_test(const Iterator i1, T v, mpl::false_)
|
||||
{}
|
||||
|
||||
template <class Iterator, class T>
|
||||
void writable_iterator_traversal_test(Iterator i1, T v, mpl::true_)
|
||||
{
|
||||
++i1; // we just wrote into that position
|
||||
*i1++ = v;
|
||||
Iterator x(i1++);
|
||||
(void)x;
|
||||
}
|
||||
|
||||
template <class Iterator, class T>
|
||||
void writable_iterator_traversal_test(const Iterator i1, T v, mpl::false_)
|
||||
{}
|
||||
|
||||
|
||||
// Preconditions: *i == v
|
||||
template <class Iterator, class T>
|
||||
void readable_iterator_test(const Iterator i1, T v)
|
||||
{
|
||||
Iterator i2(i1); // Copy Constructible
|
||||
typedef typename detail::iterator_traits<Iterator>::reference ref_t;
|
||||
ref_t r1 = *i1;
|
||||
ref_t r2 = *i2;
|
||||
T v1 = r1;
|
||||
T v2 = r2;
|
||||
BOOST_TEST(v1 == v);
|
||||
BOOST_TEST(v2 == v);
|
||||
|
||||
# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
readable_iterator_traversal_test(i1, v, detail::is_postfix_incrementable<Iterator>());
|
||||
|
||||
// I think we don't really need this as it checks the same things as
|
||||
// the above code.
|
||||
BOOST_STATIC_ASSERT(is_readable_iterator<Iterator>::value);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <class Iterator, class T>
|
||||
void writable_iterator_test(Iterator i, T v, T v2)
|
||||
{
|
||||
Iterator i2(i); // Copy Constructible
|
||||
*i2 = v;
|
||||
|
||||
# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
writable_iterator_traversal_test(
|
||||
i, v2, mpl::and_<
|
||||
detail::is_incrementable<Iterator>
|
||||
, detail::is_postfix_incrementable<Iterator>
|
||||
>());
|
||||
# endif
|
||||
}
|
||||
|
||||
template <class Iterator>
|
||||
void swappable_iterator_test(Iterator i, Iterator j)
|
||||
{
|
||||
Iterator i2(i), j2(j);
|
||||
typename detail::iterator_traits<Iterator>::value_type bi = *i, bj = *j;
|
||||
iter_swap(i2, j2);
|
||||
typename detail::iterator_traits<Iterator>::value_type ai = *i, aj = *j;
|
||||
BOOST_TEST(bi == aj && bj == ai);
|
||||
}
|
||||
|
||||
template <class Iterator, class T>
|
||||
void constant_lvalue_iterator_test(Iterator i, T v1)
|
||||
{
|
||||
Iterator i2(i);
|
||||
typedef typename detail::iterator_traits<Iterator>::value_type value_type;
|
||||
typedef typename detail::iterator_traits<Iterator>::reference reference;
|
||||
BOOST_STATIC_ASSERT((is_same<const value_type&, reference>::value));
|
||||
const T& v2 = *i2;
|
||||
BOOST_TEST(v1 == v2);
|
||||
# ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||
BOOST_STATIC_ASSERT(is_lvalue_iterator<Iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!is_non_const_lvalue_iterator<Iterator>::value);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <class Iterator, class T>
|
||||
void non_const_lvalue_iterator_test(Iterator i, T v1, T v2)
|
||||
{
|
||||
Iterator i2(i);
|
||||
typedef typename detail::iterator_traits<Iterator>::value_type value_type;
|
||||
typedef typename detail::iterator_traits<Iterator>::reference reference;
|
||||
BOOST_STATIC_ASSERT((is_same<value_type&, reference>::value));
|
||||
T& v3 = *i2;
|
||||
BOOST_TEST(v1 == v3);
|
||||
|
||||
// A non-const lvalue iterator is not neccessarily writable, but we
|
||||
// are assuming the value_type is assignable here
|
||||
*i = v2;
|
||||
|
||||
T& v4 = *i2;
|
||||
BOOST_TEST(v2 == v4);
|
||||
# ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||
BOOST_STATIC_ASSERT(is_lvalue_iterator<Iterator>::value);
|
||||
BOOST_STATIC_ASSERT(is_non_const_lvalue_iterator<Iterator>::value);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <class Iterator, class T>
|
||||
void forward_readable_iterator_test(Iterator i, Iterator j, T val1, T val2)
|
||||
{
|
||||
Iterator i2;
|
||||
Iterator i3(i);
|
||||
i2 = i;
|
||||
BOOST_TEST(i2 == i3);
|
||||
BOOST_TEST(i != j);
|
||||
BOOST_TEST(i2 != j);
|
||||
readable_iterator_test(i, val1);
|
||||
readable_iterator_test(i2, val1);
|
||||
readable_iterator_test(i3, val1);
|
||||
|
||||
BOOST_TEST(i == i2++);
|
||||
BOOST_TEST(i != ++i3);
|
||||
|
||||
readable_iterator_test(i2, val2);
|
||||
readable_iterator_test(i3, val2);
|
||||
|
||||
readable_iterator_test(i, val1);
|
||||
}
|
||||
|
||||
template <class Iterator, class T>
|
||||
void forward_swappable_iterator_test(Iterator i, Iterator j, T val1, T val2)
|
||||
{
|
||||
forward_readable_iterator_test(i, j, val1, val2);
|
||||
Iterator i2 = i;
|
||||
++i2;
|
||||
swappable_iterator_test(i, i2);
|
||||
}
|
||||
|
||||
// bidirectional
|
||||
// Preconditions: *i == v1, *++i == v2
|
||||
template <class Iterator, class T>
|
||||
void bidirectional_readable_iterator_test(Iterator i, T v1, T v2)
|
||||
{
|
||||
Iterator j(i);
|
||||
++j;
|
||||
forward_readable_iterator_test(i, j, v1, v2);
|
||||
++i;
|
||||
|
||||
Iterator i1 = i, i2 = i;
|
||||
|
||||
BOOST_TEST(i == i1--);
|
||||
BOOST_TEST(i != --i2);
|
||||
|
||||
readable_iterator_test(i, v2);
|
||||
readable_iterator_test(i1, v1);
|
||||
readable_iterator_test(i2, v1);
|
||||
|
||||
--i;
|
||||
BOOST_TEST(i == i1);
|
||||
BOOST_TEST(i == i2);
|
||||
++i1;
|
||||
++i2;
|
||||
|
||||
readable_iterator_test(i, v1);
|
||||
readable_iterator_test(i1, v2);
|
||||
readable_iterator_test(i2, v2);
|
||||
}
|
||||
|
||||
// random access
|
||||
// Preconditions: [i,i+N) is a valid range
|
||||
template <class Iterator, class TrueVals>
|
||||
void random_access_readable_iterator_test(Iterator i, int N, TrueVals vals)
|
||||
{
|
||||
bidirectional_readable_iterator_test(i, vals[0], vals[1]);
|
||||
const Iterator j = i;
|
||||
int c;
|
||||
|
||||
for (c = 0; c < N-1; ++c)
|
||||
{
|
||||
BOOST_TEST(i == j + c);
|
||||
BOOST_TEST(*i == vals[c]);
|
||||
typename detail::iterator_traits<Iterator>::value_type x = j[c];
|
||||
BOOST_TEST(*i == x);
|
||||
BOOST_TEST(*i == *(j + c));
|
||||
BOOST_TEST(*i == *(c + j));
|
||||
++i;
|
||||
BOOST_TEST(i > j);
|
||||
BOOST_TEST(i >= j);
|
||||
BOOST_TEST(j <= i);
|
||||
BOOST_TEST(j < i);
|
||||
}
|
||||
|
||||
Iterator k = j + N - 1;
|
||||
for (c = 0; c < N-1; ++c)
|
||||
{
|
||||
BOOST_TEST(i == k - c);
|
||||
BOOST_TEST(*i == vals[N - 1 - c]);
|
||||
typename detail::iterator_traits<Iterator>::value_type x = j[N - 1 - c];
|
||||
BOOST_TEST(*i == x);
|
||||
Iterator q = k - c;
|
||||
BOOST_TEST(*i == *q);
|
||||
BOOST_TEST(i > j);
|
||||
BOOST_TEST(i >= j);
|
||||
BOOST_TEST(j <= i);
|
||||
BOOST_TEST(j < i);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
# include <boost/iterator/detail/config_undef.hpp>
|
||||
|
||||
#endif // BOOST_NEW_ITERATOR_TESTS_HPP
|
@ -1,72 +0,0 @@
|
||||
// (C) Copyright Toon Knapen 2001.
|
||||
// (C) Copyright David Abrahams 2003.
|
||||
// (C) Copyright Roland Richter 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PERMUTATION_ITERATOR_HPP
|
||||
#define BOOST_PERMUTATION_ITERATOR_HPP
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template< class ElementIterator
|
||||
, class IndexIterator>
|
||||
class permutation_iterator
|
||||
: public iterator_adaptor<
|
||||
permutation_iterator<ElementIterator, IndexIterator>
|
||||
, IndexIterator, typename detail::iterator_traits<ElementIterator>::value_type
|
||||
, use_default, typename detail::iterator_traits<ElementIterator>::reference>
|
||||
{
|
||||
typedef iterator_adaptor<
|
||||
permutation_iterator<ElementIterator, IndexIterator>
|
||||
, IndexIterator, typename detail::iterator_traits<ElementIterator>::value_type
|
||||
, use_default, typename detail::iterator_traits<ElementIterator>::reference> super_t;
|
||||
|
||||
friend class iterator_core_access;
|
||||
|
||||
public:
|
||||
permutation_iterator() : m_elt_iter() {}
|
||||
|
||||
explicit permutation_iterator(ElementIterator x, IndexIterator y)
|
||||
: super_t(y), m_elt_iter(x) {}
|
||||
|
||||
template<class OtherElementIterator, class OtherIndexIterator>
|
||||
permutation_iterator(
|
||||
permutation_iterator<OtherElementIterator, OtherIndexIterator> const& r
|
||||
, typename enable_if_convertible<OtherElementIterator, ElementIterator>::type* = 0
|
||||
, typename enable_if_convertible<OtherIndexIterator, IndexIterator>::type* = 0
|
||||
)
|
||||
: super_t(r.base()), m_elt_iter(r.m_elt_iter)
|
||||
{}
|
||||
|
||||
private:
|
||||
typename super_t::reference dereference() const
|
||||
{ return *(m_elt_iter + *this->base()); }
|
||||
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
template <class,class> friend class permutation_iterator;
|
||||
#else
|
||||
public:
|
||||
#endif
|
||||
ElementIterator m_elt_iter;
|
||||
};
|
||||
|
||||
|
||||
template <class ElementIterator, class IndexIterator>
|
||||
permutation_iterator<ElementIterator, IndexIterator>
|
||||
make_permutation_iterator( ElementIterator e, IndexIterator i )
|
||||
{
|
||||
return permutation_iterator<ElementIterator, IndexIterator>( e, i );
|
||||
}
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
@ -1,69 +0,0 @@
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// (C) Copyright Thomas Witt 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
||||
#define BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
||||
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
template <class Iterator>
|
||||
class reverse_iterator
|
||||
: public iterator_adaptor< reverse_iterator<Iterator>, Iterator >
|
||||
{
|
||||
typedef iterator_adaptor< reverse_iterator<Iterator>, Iterator > super_t;
|
||||
|
||||
friend class iterator_core_access;
|
||||
|
||||
public:
|
||||
reverse_iterator() {}
|
||||
|
||||
explicit reverse_iterator(Iterator x)
|
||||
: super_t(x) {}
|
||||
|
||||
template<class OtherIterator>
|
||||
reverse_iterator(
|
||||
reverse_iterator<OtherIterator> const& r
|
||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
|
||||
)
|
||||
: super_t(r.base())
|
||||
{}
|
||||
|
||||
private:
|
||||
typename super_t::reference dereference() const { return *boost::prior(this->base()); }
|
||||
|
||||
void increment() { --this->base_reference(); }
|
||||
void decrement() { ++this->base_reference(); }
|
||||
|
||||
void advance(typename super_t::difference_type n)
|
||||
{
|
||||
this->base_reference() += -n;
|
||||
}
|
||||
|
||||
template <class OtherIterator>
|
||||
typename super_t::difference_type
|
||||
distance_to(reverse_iterator<OtherIterator> const& y) const
|
||||
{
|
||||
return this->base_reference() - y.base();
|
||||
}
|
||||
};
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
reverse_iterator<BidirectionalIterator> make_reverse_iterator(BidirectionalIterator x)
|
||||
{
|
||||
return reverse_iterator<BidirectionalIterator>(x);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REVERSE_ITERATOR_23022003THW_HPP
|
@ -1,172 +0,0 @@
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// (C) Copyright Thomas Witt 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
|
||||
#define BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
|
||||
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/iterator/detail/enable_if.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/function_traits.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
||||
# include <boost/type_traits/is_base_and_derived.hpp>
|
||||
|
||||
#endif
|
||||
#include <boost/iterator/detail/config_def.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class UnaryFunction, class Iterator, class Reference = use_default, class Value = use_default>
|
||||
class transform_iterator;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// Compute the iterator_adaptor instantiation to be used for transform_iterator
|
||||
template <class UnaryFunc, class Iterator, class Reference, class Value>
|
||||
struct transform_iterator_base
|
||||
{
|
||||
private:
|
||||
// By default, dereferencing the iterator yields the same as
|
||||
// the function.
|
||||
typedef typename ia_dflt_help<
|
||||
Reference
|
||||
, result_of<UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
|
||||
>::type reference;
|
||||
|
||||
// To get the default for Value: remove any reference on the
|
||||
// result type, but retain any constness to signal
|
||||
// non-writability. Note that if we adopt Thomas' suggestion
|
||||
// to key non-writability *only* on the Reference argument,
|
||||
// we'd need to strip constness here as well.
|
||||
typedef typename ia_dflt_help<
|
||||
Value
|
||||
, remove_reference<reference>
|
||||
>::type cv_value_type;
|
||||
|
||||
public:
|
||||
typedef iterator_adaptor<
|
||||
transform_iterator<UnaryFunc, Iterator, Reference, Value>
|
||||
, Iterator
|
||||
, cv_value_type
|
||||
, use_default // Leave the traversal category alone
|
||||
, reference
|
||||
> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <class UnaryFunc, class Iterator, class Reference, class Value>
|
||||
class transform_iterator
|
||||
: public boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
|
||||
{
|
||||
typedef typename
|
||||
boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type
|
||||
super_t;
|
||||
|
||||
friend class iterator_core_access;
|
||||
|
||||
public:
|
||||
transform_iterator() { }
|
||||
|
||||
transform_iterator(Iterator const& x, UnaryFunc f)
|
||||
: super_t(x), m_f(f) { }
|
||||
|
||||
explicit transform_iterator(Iterator const& x)
|
||||
: super_t(x)
|
||||
{
|
||||
// Pro8 is a little too aggressive about instantiating the
|
||||
// body of this function.
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
// don't provide this constructor if UnaryFunc is a
|
||||
// function pointer type, since it will be 0. Too dangerous.
|
||||
BOOST_STATIC_ASSERT(is_class<UnaryFunc>::value);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <
|
||||
class OtherUnaryFunction
|
||||
, class OtherIterator
|
||||
, class OtherReference
|
||||
, class OtherValue>
|
||||
transform_iterator(
|
||||
transform_iterator<OtherUnaryFunction, OtherIterator, OtherReference, OtherValue> const& t
|
||||
, typename enable_if_convertible<OtherIterator, Iterator>::type* = 0
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
, typename enable_if_convertible<OtherUnaryFunction, UnaryFunc>::type* = 0
|
||||
#endif
|
||||
)
|
||||
: super_t(t.base()), m_f(t.functor())
|
||||
{}
|
||||
|
||||
UnaryFunc functor() const
|
||||
{ return m_f; }
|
||||
|
||||
private:
|
||||
typename super_t::reference dereference() const
|
||||
{ return m_f(*this->base()); }
|
||||
|
||||
// Probably should be the initial base class so it can be
|
||||
// optimized away via EBO if it is an empty class.
|
||||
UnaryFunc m_f;
|
||||
};
|
||||
|
||||
template <class UnaryFunc, class Iterator>
|
||||
transform_iterator<UnaryFunc, Iterator>
|
||||
make_transform_iterator(Iterator it, UnaryFunc fun)
|
||||
{
|
||||
return transform_iterator<UnaryFunc, Iterator>(it, fun);
|
||||
}
|
||||
|
||||
// Version which allows explicit specification of the UnaryFunc
|
||||
// type.
|
||||
//
|
||||
// This generator is not provided if UnaryFunc is a function
|
||||
// pointer type, because it's too dangerous: the default-constructed
|
||||
// function pointer in the iterator be 0, leading to a runtime
|
||||
// crash.
|
||||
template <class UnaryFunc, class Iterator>
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
typename mpl::if_<
|
||||
#else
|
||||
typename iterators::enable_if<
|
||||
#endif
|
||||
is_class<UnaryFunc> // We should probably find a cheaper test than is_class<>
|
||||
, transform_iterator<UnaryFunc, Iterator>
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
, int[3]
|
||||
#endif
|
||||
>::type
|
||||
make_transform_iterator(Iterator it)
|
||||
{
|
||||
return transform_iterator<UnaryFunc, Iterator>(it, UnaryFunc());
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
template <class Return, class Argument, class Iterator>
|
||||
transform_iterator< Return (*)(Argument), Iterator, Return>
|
||||
make_transform_iterator(Iterator it, Return (*fun)(Argument))
|
||||
{
|
||||
return transform_iterator<Return (*)(Argument), Iterator, Return>(it, fun);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/iterator/detail/config_undef.hpp>
|
||||
|
||||
#endif // BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
|
@ -1,585 +0,0 @@
|
||||
// Copyright David Abrahams and Thomas Becker 2000-2006. Distributed
|
||||
// under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_ZIP_ITERATOR_TMB_07_13_2003_HPP_
|
||||
# define BOOST_ZIP_ITERATOR_TMB_07_13_2003_HPP_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp> // for enable_if_convertible
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <boost/iterator/detail/minimum_category.hpp>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/lambda.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
// Zip iterator forward declaration for zip_iterator_base
|
||||
template<typename IteratorTuple>
|
||||
class zip_iterator;
|
||||
|
||||
// One important design goal of the zip_iterator is to isolate all
|
||||
// functionality whose implementation relies on the current tuple
|
||||
// implementation. This goal has been achieved as follows: Inside
|
||||
// the namespace detail there is a namespace tuple_impl_specific.
|
||||
// This namespace encapsulates all functionality that is specific
|
||||
// to the current Boost tuple implementation. More precisely, the
|
||||
// namespace tuple_impl_specific provides the following tuple
|
||||
// algorithms and meta-algorithms for the current Boost tuple
|
||||
// implementation:
|
||||
//
|
||||
// tuple_meta_transform
|
||||
// tuple_meta_accumulate
|
||||
// tuple_transform
|
||||
// tuple_for_each
|
||||
//
|
||||
// If the tuple implementation changes, all that needs to be
|
||||
// replaced is the implementation of these four (meta-)algorithms.
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// Functors to be used with tuple algorithms
|
||||
//
|
||||
template<typename DiffType>
|
||||
class advance_iterator
|
||||
{
|
||||
public:
|
||||
advance_iterator(DiffType step) : m_step(step) {}
|
||||
|
||||
template<typename Iterator>
|
||||
void operator()(Iterator& it) const
|
||||
{ it += m_step; }
|
||||
|
||||
private:
|
||||
DiffType m_step;
|
||||
};
|
||||
//
|
||||
struct increment_iterator
|
||||
{
|
||||
template<typename Iterator>
|
||||
void operator()(Iterator& it)
|
||||
{ ++it; }
|
||||
};
|
||||
//
|
||||
struct decrement_iterator
|
||||
{
|
||||
template<typename Iterator>
|
||||
void operator()(Iterator& it)
|
||||
{ --it; }
|
||||
};
|
||||
//
|
||||
struct dereference_iterator
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
iterator_traits<Iterator>::reference
|
||||
type;
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
typename apply<Iterator>::type operator()(Iterator const& it)
|
||||
{ return *it; }
|
||||
};
|
||||
|
||||
|
||||
// The namespace tuple_impl_specific provides two meta-
|
||||
// algorithms and two algorithms for tuples.
|
||||
//
|
||||
namespace tuple_impl_specific
|
||||
{
|
||||
// Meta-transform algorithm for tuples
|
||||
//
|
||||
template<typename Tuple, class UnaryMetaFun>
|
||||
struct tuple_meta_transform;
|
||||
|
||||
template<typename Tuple, class UnaryMetaFun>
|
||||
struct tuple_meta_transform_impl
|
||||
{
|
||||
typedef tuples::cons<
|
||||
typename mpl::apply1<
|
||||
typename mpl::lambda<UnaryMetaFun>::type
|
||||
, typename Tuple::head_type
|
||||
>::type
|
||||
, typename tuple_meta_transform<
|
||||
typename Tuple::tail_type
|
||||
, UnaryMetaFun
|
||||
>::type
|
||||
> type;
|
||||
};
|
||||
|
||||
template<typename Tuple, class UnaryMetaFun>
|
||||
struct tuple_meta_transform
|
||||
: mpl::eval_if<
|
||||
boost::is_same<Tuple, tuples::null_type>
|
||||
, mpl::identity<tuples::null_type>
|
||||
, tuple_meta_transform_impl<Tuple, UnaryMetaFun>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
// Meta-accumulate algorithm for tuples. Note: The template
|
||||
// parameter StartType corresponds to the initial value in
|
||||
// ordinary accumulation.
|
||||
//
|
||||
template<class Tuple, class BinaryMetaFun, class StartType>
|
||||
struct tuple_meta_accumulate;
|
||||
|
||||
template<
|
||||
typename Tuple
|
||||
, class BinaryMetaFun
|
||||
, typename StartType
|
||||
>
|
||||
struct tuple_meta_accumulate_impl
|
||||
{
|
||||
typedef typename mpl::apply2<
|
||||
typename mpl::lambda<BinaryMetaFun>::type
|
||||
, typename Tuple::head_type
|
||||
, typename tuple_meta_accumulate<
|
||||
typename Tuple::tail_type
|
||||
, BinaryMetaFun
|
||||
, StartType
|
||||
>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename Tuple
|
||||
, class BinaryMetaFun
|
||||
, typename StartType
|
||||
>
|
||||
struct tuple_meta_accumulate
|
||||
: mpl::eval_if<
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
mpl::or_<
|
||||
#endif
|
||||
boost::is_same<Tuple, tuples::null_type>
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
, boost::is_same<Tuple,int>
|
||||
>
|
||||
#endif
|
||||
, mpl::identity<StartType>
|
||||
, tuple_meta_accumulate_impl<
|
||||
Tuple
|
||||
, BinaryMetaFun
|
||||
, StartType
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
|
||||
|| ( \
|
||||
BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, != 0) && defined(_MSC_VER) \
|
||||
)
|
||||
// Not sure why intel's partial ordering fails in this case, but I'm
|
||||
// assuming int's an MSVC bug-compatibility feature.
|
||||
|
||||
# define BOOST_TUPLE_ALGO_DISPATCH
|
||||
# define BOOST_TUPLE_ALGO(algo) algo##_impl
|
||||
# define BOOST_TUPLE_ALGO_TERMINATOR , int
|
||||
# define BOOST_TUPLE_ALGO_RECURSE , ...
|
||||
#else
|
||||
# define BOOST_TUPLE_ALGO(algo) algo
|
||||
# define BOOST_TUPLE_ALGO_TERMINATOR
|
||||
# define BOOST_TUPLE_ALGO_RECURSE
|
||||
#endif
|
||||
|
||||
// transform algorithm for tuples. The template parameter Fun
|
||||
// must be a unary functor which is also a unary metafunction
|
||||
// class that computes its return type based on its argument
|
||||
// type. For example:
|
||||
//
|
||||
// struct to_ptr
|
||||
// {
|
||||
// template <class Arg>
|
||||
// struct apply
|
||||
// {
|
||||
// typedef Arg* type;
|
||||
// }
|
||||
//
|
||||
// template <class Arg>
|
||||
// Arg* operator()(Arg x);
|
||||
// };
|
||||
template<typename Fun>
|
||||
tuples::null_type BOOST_TUPLE_ALGO(tuple_transform)
|
||||
(tuples::null_type const&, Fun BOOST_TUPLE_ALGO_TERMINATOR)
|
||||
{ return tuples::null_type(); }
|
||||
|
||||
template<typename Tuple, typename Fun>
|
||||
typename tuple_meta_transform<
|
||||
Tuple
|
||||
, Fun
|
||||
>::type
|
||||
|
||||
BOOST_TUPLE_ALGO(tuple_transform)(
|
||||
const Tuple& t,
|
||||
Fun f
|
||||
BOOST_TUPLE_ALGO_RECURSE
|
||||
)
|
||||
{
|
||||
typedef typename tuple_meta_transform<
|
||||
BOOST_DEDUCED_TYPENAME Tuple::tail_type
|
||||
, Fun
|
||||
>::type transformed_tail_type;
|
||||
|
||||
return tuples::cons<
|
||||
BOOST_DEDUCED_TYPENAME mpl::apply1<
|
||||
Fun, BOOST_DEDUCED_TYPENAME Tuple::head_type
|
||||
>::type
|
||||
, transformed_tail_type
|
||||
>(
|
||||
f(boost::tuples::get<0>(t)), tuple_transform(t.get_tail(), f)
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_TUPLE_ALGO_DISPATCH
|
||||
template<typename Tuple, typename Fun>
|
||||
typename tuple_meta_transform<
|
||||
Tuple
|
||||
, Fun
|
||||
>::type
|
||||
|
||||
tuple_transform(
|
||||
const Tuple& t,
|
||||
Fun f
|
||||
)
|
||||
{
|
||||
return tuple_transform_impl(t, f, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
// for_each algorithm for tuples.
|
||||
//
|
||||
template<typename Fun>
|
||||
Fun BOOST_TUPLE_ALGO(tuple_for_each)(
|
||||
tuples::null_type
|
||||
, Fun f BOOST_TUPLE_ALGO_TERMINATOR
|
||||
)
|
||||
{ return f; }
|
||||
|
||||
|
||||
template<typename Tuple, typename Fun>
|
||||
Fun BOOST_TUPLE_ALGO(tuple_for_each)(
|
||||
Tuple& t
|
||||
, Fun f BOOST_TUPLE_ALGO_RECURSE)
|
||||
{
|
||||
f( t.get_head() );
|
||||
return tuple_for_each(t.get_tail(), f);
|
||||
}
|
||||
|
||||
#ifdef BOOST_TUPLE_ALGO_DISPATCH
|
||||
template<typename Tuple, typename Fun>
|
||||
Fun
|
||||
tuple_for_each(
|
||||
Tuple& t,
|
||||
Fun f
|
||||
)
|
||||
{
|
||||
return tuple_for_each_impl(t, f, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Equality of tuples. NOTE: "==" for tuples currently (7/2003)
|
||||
// has problems under some compilers, so I just do my own.
|
||||
// No point in bringing in a bunch of #ifdefs here. This is
|
||||
// going to go away with the next tuple implementation anyway.
|
||||
//
|
||||
inline bool tuple_equal(tuples::null_type, tuples::null_type)
|
||||
{ return true; }
|
||||
|
||||
template<typename Tuple1, typename Tuple2>
|
||||
bool tuple_equal(
|
||||
Tuple1 const& t1,
|
||||
Tuple2 const& t2
|
||||
)
|
||||
{
|
||||
return t1.get_head() == t2.get_head() &&
|
||||
tuple_equal(t1.get_tail(), t2.get_tail());
|
||||
}
|
||||
}
|
||||
//
|
||||
// end namespace tuple_impl_specific
|
||||
|
||||
template<typename Iterator>
|
||||
struct iterator_reference
|
||||
{
|
||||
typedef typename iterator_traits<Iterator>::reference type;
|
||||
};
|
||||
|
||||
#ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
|
||||
// Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work
|
||||
// out well. Instantiating the nested apply template also
|
||||
// requires instantiating iterator_traits on the
|
||||
// placeholder. Instead we just specialize it as a metafunction
|
||||
// class.
|
||||
template<>
|
||||
struct iterator_reference<mpl::_1>
|
||||
{
|
||||
template <class T>
|
||||
struct apply : iterator_reference<T> {};
|
||||
};
|
||||
#endif
|
||||
|
||||
// Metafunction to obtain the type of the tuple whose element types
|
||||
// are the reference types of an iterator tuple.
|
||||
//
|
||||
template<typename IteratorTuple>
|
||||
struct tuple_of_references
|
||||
: tuple_impl_specific::tuple_meta_transform<
|
||||
IteratorTuple,
|
||||
iterator_reference<mpl::_1>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
// Metafunction to obtain the minimal traversal tag in a tuple
|
||||
// of iterators.
|
||||
//
|
||||
template<typename IteratorTuple>
|
||||
struct minimum_traversal_category_in_iterator_tuple
|
||||
{
|
||||
typedef typename tuple_impl_specific::tuple_meta_transform<
|
||||
IteratorTuple
|
||||
, pure_traversal_tag<iterator_traversal<> >
|
||||
>::type tuple_of_traversal_tags;
|
||||
|
||||
typedef typename tuple_impl_specific::tuple_meta_accumulate<
|
||||
tuple_of_traversal_tags
|
||||
, minimum_category<>
|
||||
, random_access_traversal_tag
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround
|
||||
template <>
|
||||
struct minimum_traversal_category_in_iterator_tuple<int>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
#endif
|
||||
|
||||
// We need to call tuple_meta_accumulate with mpl::and_ as the
|
||||
// accumulating functor. To this end, we need to wrap it into
|
||||
// a struct that has exactly two arguments (that is, template
|
||||
// parameters) and not five, like mpl::and_ does.
|
||||
//
|
||||
template<typename Arg1, typename Arg2>
|
||||
struct and_with_two_args
|
||||
: mpl::and_<Arg1, Arg2>
|
||||
{
|
||||
};
|
||||
|
||||
# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
|
||||
// Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work
|
||||
// out well. In this case I think it's an MPL bug
|
||||
template<>
|
||||
struct and_with_two_args<mpl::_1,mpl::_2>
|
||||
{
|
||||
template <class A1, class A2>
|
||||
struct apply : mpl::and_<A1,A2>
|
||||
{};
|
||||
};
|
||||
# endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Class zip_iterator_base
|
||||
//
|
||||
// Builds and exposes the iterator facade type from which the zip
|
||||
// iterator will be derived.
|
||||
//
|
||||
template<typename IteratorTuple>
|
||||
struct zip_iterator_base
|
||||
{
|
||||
private:
|
||||
// Reference type is the type of the tuple obtained from the
|
||||
// iterators' reference types.
|
||||
typedef typename
|
||||
detail::tuple_of_references<IteratorTuple>::type reference;
|
||||
|
||||
// Value type is the same as reference type.
|
||||
typedef reference value_type;
|
||||
|
||||
// Difference type is the first iterator's difference type
|
||||
typedef typename iterator_traits<
|
||||
typename tuples::element<0, IteratorTuple>::type
|
||||
>::difference_type difference_type;
|
||||
|
||||
// Traversal catetgory is the minimum traversal category in the
|
||||
// iterator tuple.
|
||||
typedef typename
|
||||
detail::minimum_traversal_category_in_iterator_tuple<
|
||||
IteratorTuple
|
||||
>::type traversal_category;
|
||||
public:
|
||||
|
||||
// The iterator facade type from which the zip iterator will
|
||||
// be derived.
|
||||
typedef iterator_facade<
|
||||
zip_iterator<IteratorTuple>,
|
||||
value_type,
|
||||
traversal_category,
|
||||
reference,
|
||||
difference_type
|
||||
> type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct zip_iterator_base<int>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// zip_iterator class definition
|
||||
//
|
||||
template<typename IteratorTuple>
|
||||
class zip_iterator :
|
||||
public detail::zip_iterator_base<IteratorTuple>::type
|
||||
{
|
||||
|
||||
// Typedef super_t as our base class.
|
||||
typedef typename
|
||||
detail::zip_iterator_base<IteratorTuple>::type super_t;
|
||||
|
||||
// iterator_core_access is the iterator's best friend.
|
||||
friend class iterator_core_access;
|
||||
|
||||
public:
|
||||
|
||||
// Construction
|
||||
// ============
|
||||
|
||||
// Default constructor
|
||||
zip_iterator() { }
|
||||
|
||||
// Constructor from iterator tuple
|
||||
zip_iterator(IteratorTuple iterator_tuple)
|
||||
: m_iterator_tuple(iterator_tuple)
|
||||
{ }
|
||||
|
||||
// Copy constructor
|
||||
template<typename OtherIteratorTuple>
|
||||
zip_iterator(
|
||||
const zip_iterator<OtherIteratorTuple>& other,
|
||||
typename enable_if_convertible<
|
||||
OtherIteratorTuple,
|
||||
IteratorTuple
|
||||
>::type* = 0
|
||||
) : m_iterator_tuple(other.get_iterator_tuple())
|
||||
{}
|
||||
|
||||
// Get method for the iterator tuple.
|
||||
const IteratorTuple& get_iterator_tuple() const
|
||||
{ return m_iterator_tuple; }
|
||||
|
||||
private:
|
||||
|
||||
// Implementation of Iterator Operations
|
||||
// =====================================
|
||||
|
||||
// Dereferencing returns a tuple built from the dereferenced
|
||||
// iterators in the iterator tuple.
|
||||
typename super_t::reference dereference() const
|
||||
{
|
||||
return detail::tuple_impl_specific::tuple_transform(
|
||||
get_iterator_tuple(),
|
||||
detail::dereference_iterator()
|
||||
);
|
||||
}
|
||||
|
||||
// Two zip iterators are equal if all iterators in the iterator
|
||||
// tuple are equal. NOTE: It should be possible to implement this
|
||||
// as
|
||||
//
|
||||
// return get_iterator_tuple() == other.get_iterator_tuple();
|
||||
//
|
||||
// but equality of tuples currently (7/2003) does not compile
|
||||
// under several compilers. No point in bringing in a bunch
|
||||
// of #ifdefs here.
|
||||
//
|
||||
template<typename OtherIteratorTuple>
|
||||
bool equal(const zip_iterator<OtherIteratorTuple>& other) const
|
||||
{
|
||||
return detail::tuple_impl_specific::tuple_equal(
|
||||
get_iterator_tuple(),
|
||||
other.get_iterator_tuple()
|
||||
);
|
||||
}
|
||||
|
||||
// Advancing a zip iterator means to advance all iterators in the
|
||||
// iterator tuple.
|
||||
void advance(typename super_t::difference_type n)
|
||||
{
|
||||
detail::tuple_impl_specific::tuple_for_each(
|
||||
m_iterator_tuple,
|
||||
detail::advance_iterator<BOOST_DEDUCED_TYPENAME super_t::difference_type>(n)
|
||||
);
|
||||
}
|
||||
// Incrementing a zip iterator means to increment all iterators in
|
||||
// the iterator tuple.
|
||||
void increment()
|
||||
{
|
||||
detail::tuple_impl_specific::tuple_for_each(
|
||||
m_iterator_tuple,
|
||||
detail::increment_iterator()
|
||||
);
|
||||
}
|
||||
|
||||
// Decrementing a zip iterator means to decrement all iterators in
|
||||
// the iterator tuple.
|
||||
void decrement()
|
||||
{
|
||||
detail::tuple_impl_specific::tuple_for_each(
|
||||
m_iterator_tuple,
|
||||
detail::decrement_iterator()
|
||||
);
|
||||
}
|
||||
|
||||
// Distance is calculated using the first iterator in the tuple.
|
||||
template<typename OtherIteratorTuple>
|
||||
typename super_t::difference_type distance_to(
|
||||
const zip_iterator<OtherIteratorTuple>& other
|
||||
) const
|
||||
{
|
||||
return boost::tuples::get<0>(other.get_iterator_tuple()) -
|
||||
boost::tuples::get<0>(this->get_iterator_tuple());
|
||||
}
|
||||
|
||||
// Data Members
|
||||
// ============
|
||||
|
||||
// The iterator tuple.
|
||||
IteratorTuple m_iterator_tuple;
|
||||
|
||||
};
|
||||
|
||||
// Make function for zip iterator
|
||||
//
|
||||
template<typename IteratorTuple>
|
||||
zip_iterator<IteratorTuple>
|
||||
make_zip_iterator(IteratorTuple t)
|
||||
{ return zip_iterator<IteratorTuple>(t); }
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,13 +0,0 @@
|
||||
// Copyright David Abrahams 2004. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See www.boost.org/libs/iterator for documentation.
|
||||
|
||||
#ifndef ITERATOR_ADAPTORS_DWA2004725_HPP
|
||||
# define ITERATOR_ADAPTORS_DWA2004725_HPP
|
||||
|
||||
#define BOOST_ITERATOR_ADAPTORS_VERSION 0x0200
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
#endif // ITERATOR_ADAPTORS_DWA2004725_HPP
|
@ -1,40 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_O1_SIZE_HPP_INCLUDED
|
||||
#define BOOST_MPL_O1_SIZE_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: O1_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/O1_size_fwd.hpp>
|
||||
#include <boost/mpl/sequence_tag.hpp>
|
||||
#include <boost/mpl/aux_/O1_size_impl.hpp>
|
||||
#include <boost/mpl/aux_/na_spec.hpp>
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// returns sequence size if it's an O(1) operation; otherwise returns -1
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
|
||||
>
|
||||
struct O1_size
|
||||
: O1_size_impl< typename sequence_tag<Sequence>::type >
|
||||
::template apply< Sequence >
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1, O1_size, (Sequence))
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC(1, O1_size)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_O1_SIZE_HPP_INCLUDED
|
@ -1,39 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_ACCUMULATE_HPP_INCLUDED
|
||||
#define BOOST_MPL_ACCUMULATE_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
// Copyright David Abrahams 2001-2002
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: accumulate.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <boost/mpl/aux_/na_spec.hpp>
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(State)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(ForwardOp)
|
||||
>
|
||||
struct accumulate
|
||||
: fold<Sequence,State,ForwardOp>
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,accumulate,(Sequence,State,ForwardOp))
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC(3, accumulate)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_ACCUMULATE_HPP_INCLUDED
|
@ -1,21 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_ALIAS_HPP_INCLUDED
|
||||
#define BOOST_MPL_ALIAS_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: alias.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
namespace {
|
||||
namespace mpl = boost::mpl;
|
||||
}
|
||||
|
||||
#endif // BOOST_MPL_ALIAS_HPP_INCLUDED
|
@ -1,25 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_ARITHMETIC_HPP_INCLUDED
|
||||
#define BOOST_MPL_ARITHMETIC_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: arithmetic.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/plus.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/times.hpp>
|
||||
#include <boost/mpl/divides.hpp>
|
||||
#include <boost/mpl/modulus.hpp>
|
||||
#include <boost/mpl/negate.hpp>
|
||||
#include <boost/mpl/multiplies.hpp> // deprecated
|
||||
|
||||
#endif // BOOST_MPL_ARITHMETIC_HPP_INCLUDED
|
@ -1,38 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AS_SEQUENCE_HPP_INCLUDED
|
||||
#define BOOST_MPL_AS_SEQUENCE_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2002-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: as_sequence.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
#include <boost/mpl/single_view.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/aux_/na_spec.hpp>
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(T)
|
||||
>
|
||||
struct as_sequence
|
||||
: if_< is_sequence<T>, T, single_view<T> >
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,as_sequence,(T))
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC_NO_ETI(1, as_sequence)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AS_SEQUENCE_HPP_INCLUDED
|
@ -1,87 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_O1_SIZE_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_O1_SIZE_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: O1_size_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/O1_size_fwd.hpp>
|
||||
#include <boost/mpl/long.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/aux_/has_size.hpp>
|
||||
#include <boost/mpl/aux_/config/forwarding.hpp>
|
||||
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// default implementation - returns 'Sequence::size' if sequence has a 'size'
|
||||
// member, and -1 otherwise; conrete sequences might override it by
|
||||
// specializing either the 'O1_size_impl' or the primary 'O1_size' template
|
||||
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|
||||
&& !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
|
||||
namespace aux {
|
||||
template< typename Sequence > struct O1_size_impl
|
||||
: Sequence::size
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
template< typename Tag >
|
||||
struct O1_size_impl
|
||||
{
|
||||
template< typename Sequence > struct apply
|
||||
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
|
||||
: if_<
|
||||
aux::has_size<Sequence>
|
||||
, aux::O1_size_impl<Sequence>
|
||||
, long_<-1>
|
||||
>::type
|
||||
{
|
||||
#else
|
||||
{
|
||||
typedef typename if_<
|
||||
aux::has_size<Sequence>
|
||||
, aux::O1_size_impl<Sequence>
|
||||
, long_<-1>
|
||||
>::type type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(long, value =
|
||||
(if_<
|
||||
aux::has_size<Sequence>
|
||||
, aux::O1_size_impl<Sequence>
|
||||
, long_<-1>
|
||||
>::type::value)
|
||||
);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
# else // BOOST_MSVC
|
||||
|
||||
template< typename Tag >
|
||||
struct O1_size_impl
|
||||
{
|
||||
template< typename Sequence > struct apply
|
||||
: long_<-1>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
# endif
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_O1_SIZE_IMPL_HPP_INCLUDED
|
@ -1,35 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_APPLY_1ST_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_APPLY_1ST_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2002-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: apply_1st.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/apply.hpp>
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
struct apply_1st
|
||||
{
|
||||
template< typename Pair, typename T > struct apply
|
||||
: apply2<
|
||||
typename Pair::first
|
||||
, typename Pair::second
|
||||
, T
|
||||
>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_APPLY_1ST_HPP_INCLUDED
|
@ -1,43 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_BACK_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_BACK_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: back_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
#include <boost/mpl/next_prior.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// default implementation, requires at least bi-directional iterators;
|
||||
// conrete sequences might override it by specializing either the
|
||||
// 'back_impl' or the primary 'back' template
|
||||
|
||||
template< typename Tag >
|
||||
struct back_impl
|
||||
{
|
||||
template< typename Sequence > struct apply
|
||||
{
|
||||
typedef typename end<Sequence>::type end_;
|
||||
typedef typename prior<end_>::type last_;
|
||||
typedef typename deref<last_>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1, back_impl)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_BACK_IMPL_HPP_INCLUDED
|
@ -1,21 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_BASIC_BIND_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_BASIC_BIND_HPP_INCLUDED
|
||||
|
||||
// Copyright Peter Dimov 2001
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: basic_bind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#define BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT
|
||||
#include <boost/mpl/bind.hpp>
|
||||
|
||||
#endif // BOOST_MPL_AUX_BASIC_BIND_HPP_INCLUDED
|
@ -1,35 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_CLEAR_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_CLEAR_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: clear_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/clear_fwd.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
#include <boost/mpl/aux_/config/eti.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// no default implementation; the definition is needed to make MSVC happy
|
||||
|
||||
template< typename Tag >
|
||||
struct clear_impl
|
||||
{
|
||||
template< typename Sequence > struct apply;
|
||||
};
|
||||
|
||||
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1, clear_impl)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_CLEAR_IMPL_HPP_INCLUDED
|
@ -1,35 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_CONFIG_DEPENDENT_NTTP_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_CONFIG_DEPENDENT_NTTP_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2002-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: dependent_nttp.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/aux_/config/gcc.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
// GCC and EDG-based compilers incorrectly reject the following code:
|
||||
// template< typename T, T n > struct a;
|
||||
// template< typename T > struct b;
|
||||
// template< typename T, T n > struct b< a<T,n> > {};
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) \
|
||||
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
|
||||
&& ( BOOST_WORKAROUND(__EDG_VERSION__, BOOST_TESTED_AT(300)) \
|
||||
|| BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0302)) \
|
||||
)
|
||||
|
||||
# define BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MPL_AUX_CONFIG_DEPENDENT_NTTP_HPP_INCLUDED
|
@ -1,33 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_CONFIG_OPERATORS_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_CONFIG_OPERATORS_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2003-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: operators.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/aux_/config/gcc.hpp>
|
||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING) \
|
||||
&& ( BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|
||||
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|
||||
|| BOOST_WORKAROUND(__EDG_VERSION__, <= 245) \
|
||||
|| BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, <= 0x0295) \
|
||||
|| BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \
|
||||
)
|
||||
|
||||
# define BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MPL_AUX_CONFIG_OPERATORS_HPP_INCLUDED
|
@ -1,61 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_CONTAINS_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_CONTAINS_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Eric Friedman 2002
|
||||
// Copyright Aleksey Gurtovoy 2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: contains_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/contains_fwd.hpp>
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
#include <boost/mpl/aux_/config/forwarding.hpp>
|
||||
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template< typename Tag >
|
||||
struct contains_impl
|
||||
{
|
||||
template< typename Sequence, typename T > struct apply
|
||||
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
|
||||
: not_< is_same<
|
||||
typename find<Sequence,T>::type
|
||||
, typename end<Sequence>::type
|
||||
> >
|
||||
{
|
||||
#else
|
||||
{
|
||||
typedef not_< is_same<
|
||||
typename find<Sequence,T>::type
|
||||
, typename end<Sequence>::type
|
||||
> > type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(not_< is_same<
|
||||
typename find<Sequence,T>::type
|
||||
, typename end<Sequence>::type
|
||||
> >::value)
|
||||
);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(2,contains_impl)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_CONTAINS_IMPL_HPP_INCLUDED
|
@ -1,44 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_COUNT_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_COUNT_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: count_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/count_fwd.hpp>
|
||||
#include <boost/mpl/count_if.hpp>
|
||||
#include <boost/mpl/same_as.hpp>
|
||||
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template< typename Tag > struct count_impl
|
||||
{
|
||||
template< typename Sequence, typename T > struct apply
|
||||
#if BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x561))
|
||||
{
|
||||
typedef typename count_if< Sequence,same_as<T> >::type type;
|
||||
BOOST_STATIC_CONSTANT(int, value = BOOST_MPL_AUX_VALUE_WKND(type)::value);
|
||||
#else
|
||||
: count_if< Sequence,same_as<T> >
|
||||
{
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(2,count_impl)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_COUNT_IMPL_HPP_INCLUDED
|
@ -1,43 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_EMPTY_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_EMPTY_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: empty_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/empty_fwd.hpp>
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// default implementation; conrete sequences might override it by
|
||||
// specializing either the 'empty_impl' or the primary 'empty' template
|
||||
|
||||
template< typename Tag >
|
||||
struct empty_impl
|
||||
{
|
||||
template< typename Sequence > struct apply
|
||||
: is_same<
|
||||
typename begin<Sequence>::type
|
||||
, typename end<Sequence>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1,empty_impl)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_EMPTY_IMPL_HPP_INCLUDED
|
@ -1,69 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_ERASE_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_ERASE_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: erase_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/clear.hpp>
|
||||
#include <boost/mpl/push_front.hpp>
|
||||
#include <boost/mpl/reverse_fold.hpp>
|
||||
#include <boost/mpl/iterator_range.hpp>
|
||||
#include <boost/mpl/next.hpp>
|
||||
#include <boost/mpl/aux_/na.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
// default implementation; conrete sequences might override it by
|
||||
// specializing either the 'erase_impl' or the primary 'erase' template
|
||||
|
||||
template< typename Tag >
|
||||
struct erase_impl
|
||||
{
|
||||
template<
|
||||
typename Sequence
|
||||
, typename First
|
||||
, typename Last
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
typedef typename if_na< Last,typename next<First>::type >::type last_;
|
||||
|
||||
// 1st half: [begin, first)
|
||||
typedef iterator_range<
|
||||
typename begin<Sequence>::type
|
||||
, First
|
||||
> first_half_;
|
||||
|
||||
// 2nd half: [last, end) ... that is, [last + 1, end)
|
||||
typedef iterator_range<
|
||||
last_
|
||||
, typename end<Sequence>::type
|
||||
> second_half_;
|
||||
|
||||
typedef typename reverse_fold<
|
||||
second_half_
|
||||
, typename clear<Sequence>::type
|
||||
, push_front<_,_>
|
||||
>::type half_sequence_;
|
||||
|
||||
typedef typename reverse_fold<
|
||||
first_half_
|
||||
, half_sequence_
|
||||
, push_front<_,_>
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_ERASE_IMPL_HPP_INCLUDED
|
@ -1,32 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_ERASE_KEY_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_ERASE_KEY_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: erase_key_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/erase_key_fwd.hpp>
|
||||
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template< typename Tag >
|
||||
struct erase_key_impl
|
||||
{
|
||||
template< typename Sequence, typename Key > struct apply;
|
||||
};
|
||||
|
||||
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(2, erase_key_impl)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_ERASE_KEY_IMPL_HPP_INCLUDED
|
@ -1,140 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_FILTER_ITER_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_FILTER_ITER_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: filter_iter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/find_if.hpp>
|
||||
#include <boost/mpl/iterator_range.hpp>
|
||||
#include <boost/mpl/iterator_tags.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mpl/aux_/lambda_spec.hpp>
|
||||
#include <boost/mpl/aux_/config/ctps.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
namespace aux {
|
||||
|
||||
template<
|
||||
typename Iterator
|
||||
, typename LastIterator
|
||||
, typename Predicate
|
||||
>
|
||||
struct filter_iter;
|
||||
|
||||
template<
|
||||
typename Iterator
|
||||
, typename LastIterator
|
||||
, typename Predicate
|
||||
>
|
||||
struct next_filter_iter
|
||||
{
|
||||
typedef typename find_if<
|
||||
iterator_range<Iterator,LastIterator>
|
||||
, Predicate
|
||||
>::type base_iter_;
|
||||
|
||||
typedef filter_iter<base_iter_,LastIterator,Predicate> type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template<
|
||||
typename Iterator
|
||||
, typename LastIterator
|
||||
, typename Predicate
|
||||
>
|
||||
struct filter_iter
|
||||
{
|
||||
typedef Iterator base;
|
||||
typedef forward_iterator_tag category;
|
||||
typedef typename aux::next_filter_iter<
|
||||
typename mpl::next<base>::type
|
||||
, LastIterator
|
||||
, Predicate
|
||||
>::type next;
|
||||
|
||||
typedef typename deref<base>::type type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename LastIterator
|
||||
, typename Predicate
|
||||
>
|
||||
struct filter_iter< LastIterator,LastIterator,Predicate >
|
||||
{
|
||||
typedef LastIterator base;
|
||||
typedef forward_iterator_tag category;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template< bool >
|
||||
struct filter_iter_impl
|
||||
{
|
||||
template<
|
||||
typename Iterator
|
||||
, typename LastIterator
|
||||
, typename Predicate
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef Iterator base;
|
||||
typedef forward_iterator_tag category;
|
||||
typedef typename next_filter_iter<
|
||||
typename mpl::next<Iterator>::type
|
||||
, LastIterator
|
||||
, Predicate
|
||||
>::type next;
|
||||
|
||||
typedef typename deref<base>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct filter_iter_impl< true >
|
||||
{
|
||||
template<
|
||||
typename Iterator
|
||||
, typename LastIterator
|
||||
, typename Predicate
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef Iterator base;
|
||||
typedef forward_iterator_tag category;
|
||||
};
|
||||
};
|
||||
|
||||
template<
|
||||
typename Iterator
|
||||
, typename LastIterator
|
||||
, typename Predicate
|
||||
>
|
||||
struct filter_iter
|
||||
: filter_iter_impl<
|
||||
::boost::is_same<Iterator,LastIterator>::value
|
||||
>::template result_< Iterator,LastIterator,Predicate >
|
||||
{
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
} // namespace aux
|
||||
|
||||
BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::filter_iter)
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_FILTER_ITER_HPP_INCLUDED
|
@ -1,31 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_FIND_IF_PRED_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_FIND_IF_PRED_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
// Copyright Eric Friedman 2002
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
#include <boost/mpl/aux_/iter_apply.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
template< typename Predicate >
|
||||
struct find_if_pred
|
||||
{
|
||||
template< typename Iterator >
|
||||
struct apply
|
||||
{
|
||||
typedef not_< aux::iter_apply1<Predicate,Iterator> > type;
|
||||
};
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_FIND_IF_PRED_HPP_INCLUDED
|
@ -1,43 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_FOLD_IMPL_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_FOLD_IMPL_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: fold_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
# include <boost/mpl/next_prior.hpp>
|
||||
# include <boost/mpl/apply.hpp>
|
||||
# include <boost/mpl/deref.hpp>
|
||||
# include <boost/mpl/aux_/config/ctps.hpp>
|
||||
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/aux_/config/use_preprocessed.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
|
||||
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
|
||||
|
||||
# define BOOST_MPL_PREPROCESSED_HEADER fold_impl.hpp
|
||||
# include <boost/mpl/aux_/include_preprocessed.hpp>
|
||||
|
||||
#else
|
||||
|
||||
# define AUX778076_FOLD_IMPL_OP(iter) typename deref<iter>::type
|
||||
# define AUX778076_FOLD_IMPL_NAME_PREFIX fold
|
||||
# include <boost/mpl/aux_/fold_impl_body.hpp>
|
||||
|
||||
#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
#endif // BOOST_MPL_AUX_FOLD_IMPL_HPP_INCLUDED
|
@ -1,365 +0,0 @@
|
||||
|
||||
// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
|
||||
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: fold_impl_body.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
# include <boost/mpl/limits/unrolling.hpp>
|
||||
# include <boost/mpl/aux_/preprocessor/repeat.hpp>
|
||||
# include <boost/mpl/aux_/config/workaround.hpp>
|
||||
# include <boost/mpl/aux_/config/ctps.hpp>
|
||||
# include <boost/mpl/aux_/nttp_decl.hpp>
|
||||
# include <boost/mpl/aux_/config/eti.hpp>
|
||||
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/dec.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
|
||||
// local macros, #undef-ined at the end of the header
|
||||
|
||||
# define AUX778076_ITER_FOLD_STEP(unused, i, unused2) \
|
||||
typedef typename apply2< \
|
||||
ForwardOp \
|
||||
, BOOST_PP_CAT(state,i) \
|
||||
, AUX778076_FOLD_IMPL_OP(BOOST_PP_CAT(iter,i)) \
|
||||
>::type BOOST_PP_CAT(state,BOOST_PP_INC(i)); \
|
||||
typedef typename mpl::next<BOOST_PP_CAT(iter,i)>::type \
|
||||
BOOST_PP_CAT(iter,BOOST_PP_INC(i)); \
|
||||
/**/
|
||||
|
||||
# define AUX778076_FOLD_IMPL_NAME \
|
||||
BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_impl) \
|
||||
/**/
|
||||
|
||||
# define AUX778076_FOLD_CHUNK_NAME \
|
||||
BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_chunk) \
|
||||
/**/
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
/// forward declaration
|
||||
template<
|
||||
BOOST_MPL_AUX_NTTP_DECL(int, N)
|
||||
, typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct AUX778076_FOLD_IMPL_NAME;
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
# if !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,(0, BOOST_MPL_LIMIT_UNROLLING, <boost/mpl/aux_/fold_impl_body.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
// implementation for N that exceeds BOOST_MPL_LIMIT_UNROLLING
|
||||
template<
|
||||
BOOST_MPL_AUX_NTTP_DECL(int, N)
|
||||
, typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct AUX778076_FOLD_IMPL_NAME
|
||||
{
|
||||
typedef AUX778076_FOLD_IMPL_NAME<
|
||||
BOOST_MPL_LIMIT_UNROLLING
|
||||
, First
|
||||
, Last
|
||||
, State
|
||||
, ForwardOp
|
||||
> chunk_;
|
||||
|
||||
typedef AUX778076_FOLD_IMPL_NAME<
|
||||
( (N - BOOST_MPL_LIMIT_UNROLLING) < 0 ? 0 : N - BOOST_MPL_LIMIT_UNROLLING )
|
||||
, typename chunk_::iterator
|
||||
, Last
|
||||
, typename chunk_::state
|
||||
, ForwardOp
|
||||
> res_;
|
||||
|
||||
typedef typename res_::state state;
|
||||
typedef typename res_::iterator iterator;
|
||||
};
|
||||
|
||||
// fallback implementation for sequences of unknown size
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct AUX778076_FOLD_IMPL_NAME<-1,First,Last,State,ForwardOp>
|
||||
: AUX778076_FOLD_IMPL_NAME<
|
||||
-1
|
||||
, typename mpl::next<First>::type
|
||||
, Last
|
||||
, typename apply2<ForwardOp,State,AUX778076_FOLD_IMPL_OP(First)>::type
|
||||
, ForwardOp
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct AUX778076_FOLD_IMPL_NAME<-1,Last,Last,State,ForwardOp>
|
||||
{
|
||||
typedef State state;
|
||||
typedef Last iterator;
|
||||
};
|
||||
|
||||
# else // BOOST_WORKAROUND(__BORLANDC__, < 0x600)
|
||||
|
||||
// Borland have some serious problems with the unrolled version, so
|
||||
// we always use a basic implementation
|
||||
template<
|
||||
BOOST_MPL_AUX_NTTP_DECL(int, N)
|
||||
, typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct AUX778076_FOLD_IMPL_NAME
|
||||
{
|
||||
typedef AUX778076_FOLD_IMPL_NAME<
|
||||
-1
|
||||
, typename mpl::next<First>::type
|
||||
, Last
|
||||
, typename apply2<ForwardOp,State,AUX778076_FOLD_IMPL_OP(First)>::type
|
||||
, ForwardOp
|
||||
> res_;
|
||||
|
||||
typedef typename res_::state state;
|
||||
typedef typename res_::iterator iterator;
|
||||
typedef state type;
|
||||
};
|
||||
|
||||
template<
|
||||
BOOST_MPL_AUX_NTTP_DECL(int, N)
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct AUX778076_FOLD_IMPL_NAME<N,Last,Last,State,ForwardOp >
|
||||
{
|
||||
typedef State state;
|
||||
typedef Last iterator;
|
||||
typedef state type;
|
||||
};
|
||||
|
||||
# endif // BOOST_WORKAROUND(__BORLANDC__, < 0x600)
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
|
||||
struct AUX778076_FOLD_CHUNK_NAME;
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3,(0, BOOST_MPL_LIMIT_UNROLLING, <boost/mpl/aux_/fold_impl_body.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
// implementation for N that exceeds BOOST_MPL_LIMIT_UNROLLING
|
||||
template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
|
||||
struct AUX778076_FOLD_CHUNK_NAME
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef AUX778076_FOLD_IMPL_NAME<
|
||||
BOOST_MPL_LIMIT_UNROLLING
|
||||
, First
|
||||
, Last
|
||||
, State
|
||||
, ForwardOp
|
||||
> chunk_;
|
||||
|
||||
typedef AUX778076_FOLD_IMPL_NAME<
|
||||
( (N - BOOST_MPL_LIMIT_UNROLLING) < 0 ? 0 : N - BOOST_MPL_LIMIT_UNROLLING )
|
||||
, typename chunk_::iterator
|
||||
, Last
|
||||
, typename chunk_::state
|
||||
, ForwardOp
|
||||
> res_;
|
||||
|
||||
typedef typename res_::state state;
|
||||
typedef typename res_::iterator iterator;
|
||||
};
|
||||
};
|
||||
|
||||
// fallback implementation for sequences of unknown size
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_step);
|
||||
|
||||
template<
|
||||
typename Last
|
||||
, typename State
|
||||
>
|
||||
struct BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_null_step)
|
||||
{
|
||||
typedef Last iterator;
|
||||
typedef State state;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct AUX778076_FOLD_CHUNK_NAME<-1>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef typename if_<
|
||||
typename is_same<First,Last>::type
|
||||
, BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_null_step)<Last,State>
|
||||
, BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_step)<First,Last,State,ForwardOp>
|
||||
>::type res_;
|
||||
|
||||
typedef typename res_::state state;
|
||||
typedef typename res_::iterator iterator;
|
||||
};
|
||||
|
||||
#if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
|
||||
/// ETI workaround
|
||||
template<> struct result_<int,int,int,int>
|
||||
{
|
||||
typedef int state;
|
||||
typedef int iterator;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct BOOST_PP_CAT(AUX778076_FOLD_IMPL_NAME_PREFIX,_step)
|
||||
{
|
||||
// can't inherit here - it breaks MSVC 7.0
|
||||
typedef AUX778076_FOLD_CHUNK_NAME<-1>::template result_<
|
||||
typename mpl::next<First>::type
|
||||
, Last
|
||||
, typename apply2<ForwardOp,State,AUX778076_FOLD_IMPL_OP(First)>::type
|
||||
, ForwardOp
|
||||
> chunk_;
|
||||
|
||||
typedef typename chunk_::state state;
|
||||
typedef typename chunk_::iterator iterator;
|
||||
};
|
||||
|
||||
template<
|
||||
BOOST_MPL_AUX_NTTP_DECL(int, N)
|
||||
, typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct AUX778076_FOLD_IMPL_NAME
|
||||
: AUX778076_FOLD_CHUNK_NAME<N>
|
||||
::template result_<First,Last,State,ForwardOp>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
}}}
|
||||
|
||||
# undef AUX778076_FOLD_IMPL_NAME
|
||||
# undef AUX778076_FOLD_CHUNK_NAME
|
||||
# undef AUX778076_ITER_FOLD_STEP
|
||||
|
||||
#undef AUX778076_FOLD_IMPL_OP
|
||||
#undef AUX778076_FOLD_IMPL_NAME_PREFIX
|
||||
|
||||
///// iteration
|
||||
|
||||
#else
|
||||
|
||||
# define n_ BOOST_PP_FRAME_ITERATION(1)
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct AUX778076_FOLD_IMPL_NAME<n_,First,Last,State,ForwardOp>
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State state0;
|
||||
|
||||
BOOST_MPL_PP_REPEAT(n_, AUX778076_ITER_FOLD_STEP, unused)
|
||||
|
||||
typedef BOOST_PP_CAT(state,n_) state;
|
||||
typedef BOOST_PP_CAT(iter,n_) iterator;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template<> struct AUX778076_FOLD_CHUNK_NAME<n_>
|
||||
{
|
||||
template<
|
||||
typename First
|
||||
, typename Last
|
||||
, typename State
|
||||
, typename ForwardOp
|
||||
>
|
||||
struct result_
|
||||
{
|
||||
typedef First iter0;
|
||||
typedef State state0;
|
||||
|
||||
BOOST_MPL_PP_REPEAT(n_, AUX778076_ITER_FOLD_STEP, unused)
|
||||
|
||||
typedef BOOST_PP_CAT(state,n_) state;
|
||||
typedef BOOST_PP_CAT(iter,n_) iterator;
|
||||
};
|
||||
|
||||
#if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
|
||||
/// ETI workaround
|
||||
template<> struct result_<int,int,int,int>
|
||||
{
|
||||
typedef int state;
|
||||
typedef int iterator;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
# undef n_
|
||||
|
||||
#endif // BOOST_PP_IS_ITERATING
|
@ -1,37 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_FOLD_OP_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_FOLD_OP_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: fold_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/apply.hpp>
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
// hand-written version is more efficient than bind/lambda expression
|
||||
template< typename Op >
|
||||
struct fold_op
|
||||
{
|
||||
template< typename T1, typename T2 > struct apply
|
||||
{
|
||||
typedef typename apply2<
|
||||
Op
|
||||
, T1
|
||||
, typename T2::type
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_FOLD_OP_HPP_INCLUDED
|
@ -1,37 +0,0 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_FOLD_PRED_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_FOLD_PRED_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2001-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: fold_pred.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
|
||||
// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
|
||||
// $Revision: 49267 $
|
||||
|
||||
#include <boost/mpl/same_as.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
template< typename Last >
|
||||
struct fold_pred
|
||||
{
|
||||
template<
|
||||
typename State
|
||||
, typename Iterator
|
||||
>
|
||||
struct apply
|
||||
: not_same_as<Last>::template apply<Iterator>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif // BOOST_MPL_AUX_FOLD_PRED_HPP_INCLUDED
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user