--- /dev/null
+// See http://www.boost.org/libs/any for Documentation.
+
+#ifndef BOOST_ANY_INCLUDED
+#define BOOST_ANY_INCLUDED
+
+// what: variant type boost::any
+// who: contributed by Kevlin Henney,
+// with features contributed and bugs found by
+// Ed Brey, Mark Rodgers, Peter Dimov, and James Curran
+// when: July 2001
+// where: tested with BCC 5.5, MSVC 6.0, and g++ 2.95
+
+#include <algorithm>
+#include <typeinfo>
+
+#include "boost/config.hpp"
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/static_assert.hpp>
+
+namespace boost
+{
+ class any
+ {
+ public: // structors
+
+ any()
+ : content(0)
+ {
+ }
+
+ template<typename ValueType>
+ any(const ValueType & value)
+ : content(new holder<ValueType>(value))
+ {
+ }
+
+ any(const any & other)
+ : content(other.content ? other.content->clone() : 0)
+ {
+ }
+
+ ~any()
+ {
+ delete content;
+ }
+
+ public: // modifiers
+
+ any & swap(any & rhs)
+ {
+ std::swap(content, rhs.content);
+ return *this;
+ }
+
+ template<typename ValueType>
+ any & operator=(const ValueType & rhs)
+ {
+ any(rhs).swap(*this);
+ return *this;
+ }
+
+ any & operator=(const any & rhs)
+ {
+ any(rhs).swap(*this);
+ return *this;
+ }
+
+ public: // queries
+
+ bool empty() const
+ {
+ return !content;
+ }
+
+ const std::type_info & type() const
+ {
+ return content ? content->type() : typeid(void);
+ }
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+ private: // types
+#else
+ public: // types (public so any_cast can be non-friend)
+#endif
+
+ class placeholder
+ {
+ public: // structors
+
+ virtual ~placeholder()
+ {
+ }
+
+ public: // queries
+
+ virtual const std::type_info & type() const = 0;
+
+ virtual placeholder * clone() const = 0;
+
+ };
+
+ template<typename ValueType>
+ class holder : public placeholder
+ {
+ public: // structors
+
+ holder(const ValueType & value)
+ : held(value)
+ {
+ }
+
+ public: // queries
+
+ virtual const std::type_info & type() const
+ {
+ return typeid(ValueType);
+ }
+
+ virtual placeholder * clone() const
+ {
+ return new holder(held);
+ }
+
+ public: // representation
+
+ ValueType held;
+
+ };
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+
+ private: // representation
+
+ template<typename ValueType>
+ friend ValueType * any_cast(any *);
+
+ template<typename ValueType>
+ friend ValueType * unsafe_any_cast(any *);
+
+#else
+
+ public: // representation (public so any_cast can be non-friend)
+
+#endif
+
+ placeholder * content;
+
+ };
+
+ class bad_any_cast : public std::bad_cast
+ {
+ public:
+ virtual const char * what() const throw()
+ {
+ return "boost::bad_any_cast: "
+ "failed conversion using boost::any_cast";
+ }
+ };
+
+ template<typename ValueType>
+ ValueType * any_cast(any * operand)
+ {
+ return operand && operand->type() == typeid(ValueType)
+ ? &static_cast<any::holder<ValueType> *>(operand->content)->held
+ : 0;
+ }
+
+ template<typename ValueType>
+ const ValueType * any_cast(const any * operand)
+ {
+ return any_cast<ValueType>(const_cast<any *>(operand));
+ }
+
+ template<typename ValueType>
+ ValueType any_cast(const any & operand)
+ {
+ typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // If 'nonref' is still reference type, it means the user has not
+ // specialized 'remove_reference'.
+
+ // Please use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION macro
+ // to generate specialization of remove_reference for your class
+ // See type traits library documentation for details
+ BOOST_STATIC_ASSERT(!is_reference<nonref>::value);
+#endif
+
+ const nonref * result = any_cast<nonref>(&operand);
+ if(!result)
+ boost::throw_exception(bad_any_cast());
+ return *result;
+ }
+
+ template<typename ValueType>
+ ValueType any_cast(any & operand)
+ {
+ typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // The comment in the above version of 'any_cast' explains when this
+ // assert is fired and what to do.
+ BOOST_STATIC_ASSERT(!is_reference<nonref>::value);
+#endif
+
+ nonref * result = any_cast<nonref>(&operand);
+ if(!result)
+ boost::throw_exception(bad_any_cast());
+ return *result;
+ }
+
+ // Note: The "unsafe" versions of any_cast are not part of the
+ // public interface and may be removed at any time. They are
+ // required where we know what type is stored in the any and can't
+ // use typeid() comparison, e.g., when our types may travel across
+ // different shared libraries.
+ template<typename ValueType>
+ ValueType * unsafe_any_cast(any * operand)
+ {
+ return &static_cast<any::holder<ValueType> *>(operand->content)->held;
+ }
+
+ template<typename ValueType>
+ const ValueType * unsafe_any_cast(const any * operand)
+ {
+ return any_cast<ValueType>(const_cast<any *>(operand));
+ }
+}
+
+// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
+//
+// 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)
+
+#endif
--- /dev/null
+/* The following code declares class array,
+ * an STL container (as wrapper) for arrays of constant size.
+ *
+ * See
+ * http://www.josuttis.com/cppcode
+ * for details and the latest version.
+ * See
+ * http://www.boost.org/libs/array for Documentation.
+ * for documentation.
+ *
+ * (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)
+ *
+ * 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 <cstddef>
+#include <stdexcept>
+#include <boost/assert.hpp>
+
+// Handles broken standard libraries better than <iterator>
+#include <boost/detail/iterator.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; }
+ iterator end() { return elems+N; }
+ const_iterator end() 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;
+#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());
+ }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() 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) {
+ std::swap_ranges(begin(),end(),y.begin());
+ }
+
+ // direct access to data (read-only)
+ const T* data() const { 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)
+ {
+ std::fill_n(begin(),size(),value);
+ }
+
+ // check range (may be private because it is static)
+ static void rangecheck (size_type i) {
+ if (i >= size()) {
+ throw std::range_error("array<>: index out of range");
+ }
+ }
+
+ };
+
+ // 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);
+ }
+
+} /* namespace boost */
+
+#endif /*BOOST_ARRAY_HPP*/
--- /dev/null
+// Boost.Assign library
+//
+// Copyright Thorsten Ottosen 2003-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)
+//
+// For more information, see http://www.boost.org/libs/assign/
+//
+
+
+#ifndef BOOST_ASSIGN_HPP
+#define BOOST_ASSIGN_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/assign/std.hpp>
+#include <boost/assign/list_of.hpp>
+#include <boost/assign/list_inserter.hpp>
+#include <boost/assign/assignment_exception.hpp>
+
+#endif
--- /dev/null
+#ifndef BOOST_BIND_HPP_INCLUDED
+#define BOOST_BIND_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// bind.hpp - binds function objects to arguments
+//
+// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2001 David Abrahams
+// Copyright (c) 2005 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)
+//
+// See http://www.boost.org/libs/bind/bind.html for documentation.
+//
+
+#include <boost/config.hpp>
+#include <boost/ref.hpp>
+#include <boost/mem_fn.hpp>
+#include <boost/type.hpp>
+#include <boost/bind/arg.hpp>
+#include <boost/detail/workaround.hpp>
+
+// Borland-specific bug, visit_each() silently fails to produce code
+
+#if defined(__BORLANDC__)
+# define BOOST_BIND_VISIT_EACH boost::visit_each
+#else
+# define BOOST_BIND_VISIT_EACH visit_each
+#endif
+
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4512) // assignment operator could not be generated
+#endif
+
+namespace boost
+{
+
+namespace _bi // implementation details
+{
+
+// result_traits
+
+template<class R, class F> struct result_traits
+{
+ typedef R type;
+};
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+
+struct unspecified {};
+
+template<class F> struct result_traits<unspecified, F>
+{
+ typedef typename F::result_type type;
+};
+
+template<class F> struct result_traits< unspecified, reference_wrapper<F> >
+{
+ typedef typename F::result_type type;
+};
+
+#endif
+
+// ref_compare
+
+template<class T> bool ref_compare(T const & a, T const & b, long)
+{
+ return a == b;
+}
+
+template<class T> bool ref_compare(reference_wrapper<T> const & a, reference_wrapper<T> const & b, int)
+{
+ return a.get_pointer() == b.get_pointer();
+}
+
+// bind_t forward declaration for listN
+
+template<class R, class F, class L> class bind_t;
+
+// value
+
+template<class T> class value
+{
+public:
+
+ value(T const & t): t_(t) {}
+
+ T & get() { return t_; }
+ T const & get() const { return t_; }
+
+ bool operator==(value const & rhs) const
+ {
+ return t_ == rhs.t_;
+ }
+
+private:
+
+ T t_;
+};
+
+// type
+
+template<class T> class type {};
+
+// unwrap
+
+template<class F> inline F & unwrap(F * f, long)
+{
+ return *f;
+}
+
+template<class F> inline F & unwrap(reference_wrapper<F> * f, int)
+{
+ return f->get();
+}
+
+template<class F> inline F & unwrap(reference_wrapper<F> const * f, int)
+{
+ return f->get();
+}
+
+#if !( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, <= 0x3004) )
+
+template<class R, class T> inline _mfi::dm<R, T> unwrap(R T::* * pm, int)
+{
+ return _mfi::dm<R, T>(*pm);
+}
+
+#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
+// IBM/VisualAge 6.0 is not able to handle this overload.
+template<class R, class T> inline _mfi::dm<R, T> unwrap(R T::* const * pm, int)
+{
+ return _mfi::dm<R, T>(*pm);
+}
+#endif
+
+
+#endif
+
+// listN
+
+class list0
+{
+public:
+
+ list0() {}
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A &, long)
+ {
+ return unwrap(&f, 0)();
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const
+ {
+ return unwrap(&f, 0)();
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A &, int)
+ {
+ unwrap(&f, 0)();
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A &, int) const
+ {
+ unwrap(&f, 0)();
+ }
+
+ template<class V> void accept(V &) const
+ {
+ }
+
+ bool operator==(list0 const &) const
+ {
+ return true;
+ }
+};
+
+template<class A1> class list1
+{
+public:
+
+ explicit list1(A1 a1): a1_(a1) {}
+
+ A1 operator[] (boost::arg<1>) const { return a1_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrap(&f, 0)(a[a1_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrap(&f, 0)(a[a1_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrap(&f, 0)(a[a1_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrap(&f, 0)(a[a1_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ }
+
+ bool operator==(list1 const & rhs) const
+ {
+ return ref_compare(a1_, rhs.a1_, 0);
+ }
+
+private:
+
+ A1 a1_;
+};
+
+template<class A1, class A2> class list2
+{
+public:
+
+ list2(A1 a1, A2 a2): a1_(a1), a2_(a2) {}
+
+ A1 operator[] (boost::arg<1>) const { return a1_; }
+ A2 operator[] (boost::arg<2>) const { return a2_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ BOOST_BIND_VISIT_EACH(v, a2_, 0);
+ }
+
+ bool operator==(list2 const & rhs) const
+ {
+ return ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0);
+ }
+
+private:
+
+ A1 a1_;
+ A2 a2_;
+};
+
+template<class A1, class A2, class A3> class list3
+{
+public:
+
+ list3(A1 a1, A2 a2, A3 a3): a1_(a1), a2_(a2), a3_(a3) {}
+
+ A1 operator[] (boost::arg<1>) const { return a1_; }
+ A2 operator[] (boost::arg<2>) const { return a2_; }
+ A3 operator[] (boost::arg<3>) const { return a3_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return a3_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ BOOST_BIND_VISIT_EACH(v, a2_, 0);
+ BOOST_BIND_VISIT_EACH(v, a3_, 0);
+ }
+
+ bool operator==(list3 const & rhs) const
+ {
+ return ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0);
+ }
+
+private:
+
+ A1 a1_;
+ A2 a2_;
+ A3 a3_;
+};
+
+template<class A1, class A2, class A3, class A4> class list4
+{
+public:
+
+ list4(A1 a1, A2 a2, A3 a3, A4 a4): a1_(a1), a2_(a2), a3_(a3), a4_(a4) {}
+
+ A1 operator[] (boost::arg<1>) const { return a1_; }
+ A2 operator[] (boost::arg<2>) const { return a2_; }
+ A3 operator[] (boost::arg<3>) const { return a3_; }
+ A4 operator[] (boost::arg<4>) const { return a4_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return a4_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ BOOST_BIND_VISIT_EACH(v, a2_, 0);
+ BOOST_BIND_VISIT_EACH(v, a3_, 0);
+ BOOST_BIND_VISIT_EACH(v, a4_, 0);
+ }
+
+ bool operator==(list4 const & rhs) const
+ {
+ return
+ ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
+ ref_compare(a4_, rhs.a4_, 0);
+ }
+
+private:
+
+ A1 a1_;
+ A2 a2_;
+ A3 a3_;
+ A4 a4_;
+};
+
+template<class A1, class A2, class A3, class A4, class A5> class list5
+{
+public:
+
+ list5(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5) {}
+
+ A1 operator[] (boost::arg<1>) const { return a1_; }
+ A2 operator[] (boost::arg<2>) const { return a2_; }
+ A3 operator[] (boost::arg<3>) const { return a3_; }
+ A4 operator[] (boost::arg<4>) const { return a4_; }
+ A5 operator[] (boost::arg<5>) const { return a5_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return a5_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ BOOST_BIND_VISIT_EACH(v, a2_, 0);
+ BOOST_BIND_VISIT_EACH(v, a3_, 0);
+ BOOST_BIND_VISIT_EACH(v, a4_, 0);
+ BOOST_BIND_VISIT_EACH(v, a5_, 0);
+ }
+
+ bool operator==(list5 const & rhs) const
+ {
+ return
+ ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
+ ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0);
+ }
+
+private:
+
+ A1 a1_;
+ A2 a2_;
+ A3 a3_;
+ A4 a4_;
+ A5 a5_;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6> class list6
+{
+public:
+
+ list6(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6) {}
+
+ A1 operator[] (boost::arg<1>) const { return a1_; }
+ A2 operator[] (boost::arg<2>) const { return a2_; }
+ A3 operator[] (boost::arg<3>) const { return a3_; }
+ A4 operator[] (boost::arg<4>) const { return a4_; }
+ A5 operator[] (boost::arg<5>) const { return a5_; }
+ A6 operator[] (boost::arg<6>) const { return a6_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return a5_; }
+ A6 operator[] (boost::arg<6> (*) ()) const { return a6_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ BOOST_BIND_VISIT_EACH(v, a2_, 0);
+ BOOST_BIND_VISIT_EACH(v, a3_, 0);
+ BOOST_BIND_VISIT_EACH(v, a4_, 0);
+ BOOST_BIND_VISIT_EACH(v, a5_, 0);
+ BOOST_BIND_VISIT_EACH(v, a6_, 0);
+ }
+
+ bool operator==(list6 const & rhs) const
+ {
+ return
+ ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
+ ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0);
+ }
+
+private:
+
+ A1 a1_;
+ A2 a2_;
+ A3 a3_;
+ A4 a4_;
+ A5 a5_;
+ A6 a6_;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> class list7
+{
+public:
+
+ list7(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6), a7_(a7) {}
+
+ A1 operator[] (boost::arg<1>) const { return a1_; }
+ A2 operator[] (boost::arg<2>) const { return a2_; }
+ A3 operator[] (boost::arg<3>) const { return a3_; }
+ A4 operator[] (boost::arg<4>) const { return a4_; }
+ A5 operator[] (boost::arg<5>) const { return a5_; }
+ A6 operator[] (boost::arg<6>) const { return a6_; }
+ A7 operator[] (boost::arg<7>) const { return a7_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return a5_; }
+ A6 operator[] (boost::arg<6> (*) ()) const { return a6_; }
+ A7 operator[] (boost::arg<7> (*) ()) const { return a7_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ BOOST_BIND_VISIT_EACH(v, a2_, 0);
+ BOOST_BIND_VISIT_EACH(v, a3_, 0);
+ BOOST_BIND_VISIT_EACH(v, a4_, 0);
+ BOOST_BIND_VISIT_EACH(v, a5_, 0);
+ BOOST_BIND_VISIT_EACH(v, a6_, 0);
+ BOOST_BIND_VISIT_EACH(v, a7_, 0);
+ }
+
+ bool operator==(list7 const & rhs) const
+ {
+ return
+ ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
+ ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) &&
+ ref_compare(a7_, rhs.a7_, 0);
+ }
+
+private:
+
+ A1 a1_;
+ A2 a2_;
+ A3 a3_;
+ A4 a4_;
+ A5 a5_;
+ A6 a6_;
+ A7 a7_;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> class list8
+{
+public:
+
+ list8(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6), a7_(a7), a8_(a8) {}
+
+ A1 operator[] (boost::arg<1>) const { return a1_; }
+ A2 operator[] (boost::arg<2>) const { return a2_; }
+ A3 operator[] (boost::arg<3>) const { return a3_; }
+ A4 operator[] (boost::arg<4>) const { return a4_; }
+ A5 operator[] (boost::arg<5>) const { return a5_; }
+ A6 operator[] (boost::arg<6>) const { return a6_; }
+ A7 operator[] (boost::arg<7>) const { return a7_; }
+ A8 operator[] (boost::arg<8>) const { return a8_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return a5_; }
+ A6 operator[] (boost::arg<6> (*) ()) const { return a6_; }
+ A7 operator[] (boost::arg<7> (*) ()) const { return a7_; }
+ A8 operator[] (boost::arg<8> (*) ()) const { return a8_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ BOOST_BIND_VISIT_EACH(v, a2_, 0);
+ BOOST_BIND_VISIT_EACH(v, a3_, 0);
+ BOOST_BIND_VISIT_EACH(v, a4_, 0);
+ BOOST_BIND_VISIT_EACH(v, a5_, 0);
+ BOOST_BIND_VISIT_EACH(v, a6_, 0);
+ BOOST_BIND_VISIT_EACH(v, a7_, 0);
+ BOOST_BIND_VISIT_EACH(v, a8_, 0);
+ }
+
+ bool operator==(list8 const & rhs) const
+ {
+ return
+ ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
+ ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) &&
+ ref_compare(a7_, rhs.a7_, 0) && ref_compare(a8_, rhs.a8_, 0);
+ }
+
+private:
+
+ A1 a1_;
+ A2 a2_;
+ A3 a3_;
+ A4 a4_;
+ A5 a5_;
+ A6 a6_;
+ A7 a7_;
+ A8 a8_;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> class list9
+{
+public:
+
+ list9(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6), a7_(a7), a8_(a8), a9_(a9) {}
+
+ A1 operator[] (boost::arg<1>) const { return a1_; }
+ A2 operator[] (boost::arg<2>) const { return a2_; }
+ A3 operator[] (boost::arg<3>) const { return a3_; }
+ A4 operator[] (boost::arg<4>) const { return a4_; }
+ A5 operator[] (boost::arg<5>) const { return a5_; }
+ A6 operator[] (boost::arg<6>) const { return a6_; }
+ A7 operator[] (boost::arg<7>) const { return a7_; }
+ A8 operator[] (boost::arg<8>) const { return a8_; }
+ A9 operator[] (boost::arg<9>) const { return a9_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return a5_; }
+ A6 operator[] (boost::arg<6> (*) ()) const { return a6_; }
+ A7 operator[] (boost::arg<7> (*) ()) const { return a7_; }
+ A8 operator[] (boost::arg<8> (*) ()) const { return a8_; }
+ A9 operator[] (boost::arg<9> (*) ()) const { return a9_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ BOOST_BIND_VISIT_EACH(v, a2_, 0);
+ BOOST_BIND_VISIT_EACH(v, a3_, 0);
+ BOOST_BIND_VISIT_EACH(v, a4_, 0);
+ BOOST_BIND_VISIT_EACH(v, a5_, 0);
+ BOOST_BIND_VISIT_EACH(v, a6_, 0);
+ BOOST_BIND_VISIT_EACH(v, a7_, 0);
+ BOOST_BIND_VISIT_EACH(v, a8_, 0);
+ BOOST_BIND_VISIT_EACH(v, a9_, 0);
+ }
+
+ bool operator==(list9 const & rhs) const
+ {
+ return
+ ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) &&
+ ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) &&
+ ref_compare(a7_, rhs.a7_, 0) && ref_compare(a8_, rhs.a8_, 0) && ref_compare(a9_, rhs.a9_, 0);
+ }
+
+private:
+
+ A1 a1_;
+ A2 a2_;
+ A3 a3_;
+ A4 a4_;
+ A5 a5_;
+ A6 a6_;
+ A7 a7_;
+ A8 a8_;
+ A9 a9_;
+};
+
+// bind_t
+
+#ifndef BOOST_NO_VOID_RETURNS
+
+template<class R, class F, class L> class bind_t
+{
+public:
+
+ typedef bind_t this_type;
+
+ bind_t(F f, L const & l): f_(f), l_(l) {}
+
+#define BOOST_BIND_RETURN return
+#include <boost/bind/bind_template.hpp>
+#undef BOOST_BIND_RETURN
+
+};
+
+#else
+
+template<class R> struct bind_t_generator
+{
+
+template<class F, class L> class implementation
+{
+public:
+
+ typedef implementation this_type;
+
+ implementation(F f, L const & l): f_(f), l_(l) {}
+
+#define BOOST_BIND_RETURN return
+#include <boost/bind/bind_template.hpp>
+#undef BOOST_BIND_RETURN
+
+};
+
+};
+
+template<> struct bind_t_generator<void>
+{
+
+template<class F, class L> class implementation
+{
+private:
+
+ typedef void R;
+
+public:
+
+ typedef implementation this_type;
+
+ implementation(F f, L const & l): f_(f), l_(l) {}
+
+#define BOOST_BIND_RETURN
+#include <boost/bind/bind_template.hpp>
+#undef BOOST_BIND_RETURN
+
+};
+
+};
+
+template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>
+{
+public:
+
+ bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {}
+
+};
+
+#endif
+
+// function_equal
+
+#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+// put overloads in _bi, rely on ADL
+
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
+{
+ return a.compare(b);
+}
+
+# else
+
+template<class R, class F, class L> bool function_equal_impl( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
+{
+ return a.compare(b);
+}
+
+# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+// put overloads in boost
+
+} // namespace _bi
+
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+template<class R, class F, class L> bool function_equal( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b )
+{
+ return a.compare(b);
+}
+
+# else
+
+template<class R, class F, class L> bool function_equal_impl( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b, int )
+{
+ return a.compare(b);
+}
+
+# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+namespace _bi
+{
+
+#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+// add_value
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
+
+template<class T> struct add_value
+{
+ typedef _bi::value<T> type;
+};
+
+template<class T> struct add_value< value<T> >
+{
+ typedef _bi::value<T> type;
+};
+
+template<class T> struct add_value< reference_wrapper<T> >
+{
+ typedef reference_wrapper<T> type;
+};
+
+template<int I> struct add_value< arg<I> >
+{
+ typedef boost::arg<I> type;
+};
+
+template<int I> struct add_value< arg<I> (*) () >
+{
+ typedef boost::arg<I> (*type) ();
+};
+
+template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
+{
+ typedef bind_t<R, F, L> type;
+};
+
+#else
+
+template<int I> struct _avt_0;
+
+template<> struct _avt_0<1>
+{
+ template<class T> struct inner
+ {
+ typedef T type;
+ };
+};
+
+template<> struct _avt_0<2>
+{
+ template<class T> struct inner
+ {
+ typedef value<T> type;
+ };
+};
+
+typedef char (&_avt_r1) [1];
+typedef char (&_avt_r2) [2];
+
+template<class T> _avt_r1 _avt_f(value<T>);
+template<class T> _avt_r1 _avt_f(reference_wrapper<T>);
+template<int I> _avt_r1 _avt_f(arg<I>);
+template<int I> _avt_r1 _avt_f(arg<I> (*) ());
+template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>);
+
+_avt_r2 _avt_f(...);
+
+template<class T> struct add_value
+{
+ static T t();
+ typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type;
+};
+
+#endif
+
+// list_av_N
+
+template<class A1> struct list_av_1
+{
+ typedef typename add_value<A1>::type B1;
+ typedef list1<B1> type;
+};
+
+template<class A1, class A2> struct list_av_2
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef list2<B1, B2> type;
+};
+
+template<class A1, class A2, class A3> struct list_av_3
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef list3<B1, B2, B3> type;
+};
+
+template<class A1, class A2, class A3, class A4> struct list_av_4
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef list4<B1, B2, B3, B4> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5> struct list_av_5
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef list5<B1, B2, B3, B4, B5> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef typename add_value<A6>::type B6;
+ typedef list6<B1, B2, B3, B4, B5, B6> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef typename add_value<A6>::type B6;
+ typedef typename add_value<A7>::type B7;
+ typedef list7<B1, B2, B3, B4, B5, B6, B7> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef typename add_value<A6>::type B6;
+ typedef typename add_value<A7>::type B7;
+ typedef typename add_value<A8>::type B8;
+ typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef typename add_value<A6>::type B6;
+ typedef typename add_value<A7>::type B7;
+ typedef typename add_value<A8>::type B8;
+ typedef typename add_value<A9>::type B9;
+ typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
+};
+
+// operator!
+
+struct logical_not
+{
+ template<class V> bool operator()(V const & v) const { return !v; }
+};
+
+template<class R, class F, class L>
+ bind_t< bool, logical_not, list1< bind_t<R, F, L> > >
+ operator! (bind_t<R, F, L> const & f)
+{
+ typedef list1< bind_t<R, F, L> > list_type;
+ return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
+}
+
+// relational operators
+
+#define BOOST_BIND_OPERATOR( op, name ) \
+\
+struct name \
+{ \
+ template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
+}; \
+ \
+template<class R, class F, class L, class A2> \
+ bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \
+ operator op (bind_t<R, F, L> const & f, A2 a2) \
+{ \
+ typedef typename add_value<A2>::type B2; \
+ typedef list2< bind_t<R, F, L>, B2> list_type; \
+ return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
+}
+
+BOOST_BIND_OPERATOR( ==, equal )
+BOOST_BIND_OPERATOR( !=, not_equal )
+
+BOOST_BIND_OPERATOR( <, less )
+BOOST_BIND_OPERATOR( <=, less_equal )
+
+BOOST_BIND_OPERATOR( >, greater )
+BOOST_BIND_OPERATOR( >=, greater_equal )
+
+#undef BOOST_BIND_OPERATOR
+
+#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)
+
+// resolve ambiguity with rel_ops
+
+#define BOOST_BIND_OPERATOR( op, name ) \
+\
+template<class R, class F, class L> \
+ bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \
+ operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \
+{ \
+ typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \
+ return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \
+}
+
+BOOST_BIND_OPERATOR( !=, not_equal )
+BOOST_BIND_OPERATOR( <=, less_equal )
+BOOST_BIND_OPERATOR( >, greater )
+BOOST_BIND_OPERATOR( >=, greater_equal )
+
+#endif
+
+} // namespace _bi
+
+// visit_each
+
+template<class V, class T> void visit_each(V & v, _bi::value<T> const & t, int)
+{
+ BOOST_BIND_VISIT_EACH(v, t.get(), 0);
+}
+
+template<class V, class R, class F, class L> void visit_each(V & v, _bi::bind_t<R, F, L> const & t, int)
+{
+ t.accept(v);
+}
+
+// bind
+
+#ifndef BOOST_BIND
+#define BOOST_BIND bind
+#endif
+
+// generic function objects
+
+template<class R, class F>
+ _bi::bind_t<R, F, _bi::list0>
+ BOOST_BIND(F f)
+{
+ typedef _bi::list0 list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type());
+}
+
+template<class R, class F, class A1>
+ _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(F f, A1 a1)
+{
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1));
+}
+
+template<class R, class F, class A1, class A2>
+ _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2)
+{
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
+}
+
+template<class R, class F, class A1, class A2, class A3>
+ _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
+{
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4>
+ _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+// generic function objects, alternative syntax
+
+template<class R, class F>
+ _bi::bind_t<R, F, _bi::list0>
+ BOOST_BIND(boost::type<R>, F f)
+{
+ typedef _bi::list0 list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type());
+}
+
+template<class R, class F, class A1>
+ _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1)
+{
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1));
+}
+
+template<class R, class F, class A1, class A2>
+ _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2)
+{
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
+}
+
+template<class R, class F, class A1, class A2, class A3>
+ _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3)
+{
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4>
+ _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+
+// adaptable function objects
+
+template<class F>
+ _bi::bind_t<_bi::unspecified, F, _bi::list0>
+ BOOST_BIND(F f)
+{
+ typedef _bi::list0 list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type());
+}
+
+template<class F, class A1>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(F f, A1 a1)
+{
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1));
+}
+
+template<class F, class A1, class A2>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2)
+{
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2));
+}
+
+template<class F, class A1, class A2, class A3>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
+{
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3));
+}
+
+template<class F, class A1, class A2, class A3, class A4>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4));
+}
+
+template<class F, class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
+}
+
+template<class F, class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(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>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(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>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+
+// function pointers
+
+#define BOOST_BIND_CC
+#define BOOST_BIND_ST
+
+#include <boost/bind/bind_cc.hpp>
+
+#undef BOOST_BIND_CC
+#undef BOOST_BIND_ST
+
+#ifdef BOOST_BIND_ENABLE_STDCALL
+
+#define BOOST_BIND_CC __stdcall
+#define BOOST_BIND_ST
+
+#include <boost/bind/bind_cc.hpp>
+
+#undef BOOST_BIND_CC
+#undef BOOST_BIND_ST
+
+#endif
+
+#ifdef BOOST_BIND_ENABLE_FASTCALL
+
+#define BOOST_BIND_CC __fastcall
+#define BOOST_BIND_ST
+
+#include <boost/bind/bind_cc.hpp>
+
+#undef BOOST_BIND_CC
+#undef BOOST_BIND_ST
+
+#endif
+
+#ifdef BOOST_BIND_ENABLE_PASCAL
+
+#define BOOST_BIND_ST pascal
+#define BOOST_BIND_CC
+
+#include <boost/bind/bind_cc.hpp>
+
+#undef BOOST_BIND_ST
+#undef BOOST_BIND_CC
+
+#endif
+
+// member function pointers
+
+#define BOOST_BIND_MF_NAME(X) X
+#define BOOST_BIND_MF_CC
+
+#include <boost/bind/bind_mf_cc.hpp>
+
+#undef BOOST_BIND_MF_NAME
+#undef BOOST_BIND_MF_CC
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_BIND_MF_NAME(X) X##_cdecl
+#define BOOST_BIND_MF_CC __cdecl
+
+#include <boost/bind/bind_mf_cc.hpp>
+
+#undef BOOST_BIND_MF_NAME
+#undef BOOST_BIND_MF_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_BIND_MF_NAME(X) X##_stdcall
+#define BOOST_BIND_MF_CC __stdcall
+
+#include <boost/bind/bind_mf_cc.hpp>
+
+#undef BOOST_BIND_MF_NAME
+#undef BOOST_BIND_MF_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_BIND_MF_NAME(X) X##_fastcall
+#define BOOST_BIND_MF_CC __fastcall
+
+#include <boost/bind/bind_mf_cc.hpp>
+
+#undef BOOST_BIND_MF_NAME
+#undef BOOST_BIND_MF_CC
+
+#endif
+
+// data member pointers
+
+/*
+
+#if defined(__GNUC__) && (__GNUC__ == 2)
+
+namespace _bi
+{
+
+template<class T> struct add_cref
+{
+ typedef T const & type;
+};
+
+template<class T> struct add_cref< T & >
+{
+ typedef T const & type;
+};
+
+template<> struct add_cref<void>
+{
+ typedef void type;
+};
+
+} // namespace _bi
+
+template<class R, class T, class A1>
+_bi::bind_t< typename _bi::add_cref<R>::type, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
+ BOOST_BIND(R T::*f, A1 a1)
+{
+ typedef _mfi::dm<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<typename _bi::add_cref<R>::type, F, list_type>(F(f), list_type(a1));
+}
+
+#else
+
+template<class R, class T, class A1>
+_bi::bind_t< R const &, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
+ BOOST_BIND(R T::*f, A1 a1)
+{
+ typedef _mfi::dm<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R const &, F, list_type>(F(f), list_type(a1));
+}
+
+#endif
+
+*/
+
+template<class R, class T, class A1>
+_bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
+ BOOST_BIND(R T::*f, A1 a1)
+{
+ typedef _mfi::dm<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) );
+}
+
+} // namespace boost
+
+#ifndef BOOST_BIND_NO_PLACEHOLDERS
+
+# include <boost/bind/placeholders.hpp>
+
+#endif
+
+#ifdef BOOST_MSVC
+# pragma warning(default: 4512) // assignment operator could not be generated
+# pragma warning(pop)
+#endif
+
+#endif // #ifndef BOOST_BIND_HPP_INCLUDED
--- /dev/null
+//-----------------------------------------------------------------------------
+// boost blank.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_BLANK_HPP
+#define BOOST_BLANK_HPP
+
+#include "boost/blank_fwd.hpp"
+
+#include <iosfwd> // for std::basic_ostream forward declare
+
+#include "boost/detail/templated_streams.hpp"
+#include "boost/mpl/bool.hpp"
+#include "boost/type_traits/is_empty.hpp"
+#include "boost/type_traits/is_pod.hpp"
+#include "boost/type_traits/is_stateless.hpp"
+
+namespace boost {
+
+struct blank
+{
+};
+
+// type traits specializations
+//
+
+template <>
+struct is_pod< blank >
+ : mpl::true_
+{
+};
+
+template <>
+struct is_empty< blank >
+ : mpl::true_
+{
+};
+
+template <>
+struct is_stateless< blank >
+ : mpl::true_
+{
+};
+
+// relational operators
+//
+
+inline bool operator==(const blank&, const blank&)
+{
+ return true;
+}
+
+inline bool operator<(const blank&, const blank&)
+{
+ return false;
+}
+
+// streaming support
+//
+BOOST_TEMPLATED_STREAM_TEMPLATE(E,T)
+inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
+ BOOST_TEMPLATED_STREAM(ostream, E,T)& out
+ , const blank&
+ )
+{
+ // (output nothing)
+ return out;
+}
+
+} // namespace boost
+
+#endif // BOOST_BLANK_HPP
--- /dev/null
+//-----------------------------------------------------------------------------
+// boost blank_fwd.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_BLANK_FWD_HPP
+#define BOOST_BLANK_FWD_HPP
+
+namespace boost {
+
+struct blank;
+
+} // namespace boost
+
+#endif // BOOST_BLANK_FWD_HPP
--- /dev/null
+// (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/call_traits.hpp and boost/detail/ob_call_traits.hpp
+// for full copyright notices.
+
+#ifndef BOOST_CALL_TRAITS_HPP
+#define BOOST_CALL_TRAITS_HPP
+
+#ifndef BOOST_CONFIG_HPP
+#include <boost/config.hpp>
+#endif
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/detail/ob_call_traits.hpp>
+#else
+#include <boost/detail/call_traits.hpp>
+#endif
+
+#endif // BOOST_CALL_TRAITS_HPP
--- /dev/null
+// 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 <cassert>
+# 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 <= 1200 // 1200 = VC6
+# 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 ----------------------------------------------------//
+
+ // assert() checked polymorphic downcast. Crosscasts prohibited.
+
+ // WARNING: Because this cast uses assert(), it violates the One Definition
+ // Rule if NDEBUG is inconsistently defined across translation units.
+
+ // Contributed by Dave Abrahams
+
+ template <class Target, class Source>
+ inline Target polymorphic_downcast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET)
+ {
+ 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
--- /dev/null
+// (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
--- /dev/null
+//
+// (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
--- /dev/null
+//
+// (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:
+// 05 May 2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
+// 02 April 2001: Removed limits header altogether. (Jeremy Siek)
+// 01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
+//
+
+// See http://www.boost.org/libs/concept_check for documentation.
+
+#ifndef BOOST_CONCEPT_CHECKS_HPP
+#define BOOST_CONCEPT_CHECKS_HPP
+
+#include <boost/config.hpp>
+#include <boost/iterator.hpp>
+#include <boost/type_traits/conversion_traits.hpp>
+#include <utility>
+#include <boost/type_traits/conversion_traits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/mpl/identity.hpp>
+
+
+#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__)
+#define BOOST_FPTR
+#else
+#define BOOST_FPTR &
+#endif
+
+namespace boost {
+
+/*
+ "inline" is used for ignore_unused_variable_warning()
+ and function_requires() to make sure there is no
+ overhead with g++.
+ */
+
+template <class T> inline void ignore_unused_variable_warning(const T&) { }
+
+// the unused, defaulted parameter is a workaround for MSVC and Compaq C++
+template <class Concept>
+inline void function_requires(mpl::identity<Concept>* = 0)
+{
+#if !defined(NDEBUG)
+ void (Concept::*x)() = BOOST_FPTR Concept::constraints;
+ ignore_unused_variable_warning(x);
+#endif
+}
+
+#define BOOST_CLASS_REQUIRE(type_var, ns, concept) \
+ typedef void (ns::concept <type_var>::* func##type_var##concept)(); \
+ template <func##type_var##concept Tp1_> \
+ struct concept_checking_##type_var##concept { }; \
+ typedef concept_checking_##type_var##concept< \
+ BOOST_FPTR ns::concept<type_var>::constraints> \
+ concept_checking_typedef_##type_var##concept
+
+#define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \
+ typedef void (ns::concept <type_var1,type_var2>::* \
+ func##type_var1##type_var2##concept)(); \
+ template <func##type_var1##type_var2##concept Tp1_> \
+ struct concept_checking_##type_var1##type_var2##concept { }; \
+ typedef concept_checking_##type_var1##type_var2##concept< \
+ BOOST_FPTR ns::concept<type_var1,type_var2>::constraints> \
+ concept_checking_typedef_##type_var1##type_var2##concept
+
+#define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \
+ typedef void (ns::concept <tv1,tv2,tv3>::* \
+ func##tv1##tv2##tv3##concept)(); \
+ template <func##tv1##tv2##tv3##concept Tp1_> \
+ struct concept_checking_##tv1##tv2##tv3##concept { }; \
+ typedef concept_checking_##tv1##tv2##tv3##concept< \
+ BOOST_FPTR ns::concept<tv1,tv2,tv3>::constraints> \
+ concept_checking_typedef_##tv1##tv2##tv3##concept
+
+#define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \
+ typedef void (ns::concept <tv1,tv2,tv3,tv4>::* \
+ func##tv1##tv2##tv3##tv4##concept)(); \
+ template <func##tv1##tv2##tv3##tv4##concept Tp1_> \
+ struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \
+ typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \
+ BOOST_FPTR ns::concept<tv1,tv2,tv3,tv4>::constraints> \
+ concept_checking_typedef_##tv1##tv2##tv3##tv4##concept
+
+// NOTE: The BOOST_CLASS_REQUIRES (with an 'S' at the end) is deprecated.
+
+// The BOOST_CLASS_REQUIRES macros use function pointers as
+// template parameters, which VC++ does not support.
+
+#if defined(BOOST_NO_FUNCTION_PTR_TEMPLATE_PARAMETERS)
+
+#define BOOST_CLASS_REQUIRES(type_var, concept)
+#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept)
+#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept)
+#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, concept)
+
+#else
+
+#define BOOST_CLASS_REQUIRES(type_var, concept) \
+ typedef void (concept <type_var>::* func##type_var##concept)(); \
+ template <func##type_var##concept Tp1_> \
+ struct concept_checking_##type_var##concept { }; \
+ typedef concept_checking_##type_var##concept< \
+ BOOST_FPTR concept <type_var>::constraints> \
+ concept_checking_typedef_##type_var##concept
+
+#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept) \
+ typedef void (concept <type_var1,type_var2>::* func##type_var1##type_var2##concept)(); \
+ template <func##type_var1##type_var2##concept Tp1_> \
+ struct concept_checking_##type_var1##type_var2##concept { }; \
+ typedef concept_checking_##type_var1##type_var2##concept< \
+ BOOST_FPTR concept <type_var1,type_var2>::constraints> \
+ concept_checking_typedef_##type_var1##type_var2##concept
+
+#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept) \
+ typedef void (concept <type_var1,type_var2,type_var3>::* func##type_var1##type_var2##type_var3##concept)(); \
+ template <func##type_var1##type_var2##type_var3##concept Tp1_> \
+ struct concept_checking_##type_var1##type_var2##type_var3##concept { }; \
+ typedef concept_checking_##type_var1##type_var2##type_var3##concept< \
+ BOOST_FPTR concept <type_var1,type_var2,type_var3>::constraints> \
+ concept_checking_typedef_##type_var1##type_var2##type_var3##concept
+
+#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, concept) \
+ typedef void (concept <type_var1,type_var2,type_var3,type_var4>::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \
+ template <func##type_var1##type_var2##type_var3##type_var4##concept Tp1_> \
+ struct concept_checking_##type_var1##type_var2##type_var3##type_var4##concept { }; \
+ typedef concept_checking_##type_var1##type_var2##type_var3##type_var4##concept< \
+ BOOST_FPTR concept <type_var1,type_var2,type_var3,type_var4>::constraints> \
+ concept_checking_typedef_##type_var1##type_var2##type_var3##type_var4##concept
+
+
+#endif
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+template <class T, class U>
+struct require_same { };
+
+template <class T>
+struct require_same<T,T> { typedef T type; };
+#else
+// This version does not perform checking, but will not do any harm.
+template <class T, class U>
+struct require_same { typedef T type; };
+#endif
+
+ template <class T>
+ struct IntegerConcept {
+ void constraints() {
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ x.error_type_must_be_an_integer_type();
+#endif
+ }
+ T x;
+ };
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <> struct IntegerConcept<short> { void constraints() {} };
+ template <> struct IntegerConcept<unsigned short> { void constraints() {} };
+ template <> struct IntegerConcept<int> { void constraints() {} };
+ template <> struct IntegerConcept<unsigned int> { void constraints() {} };
+ template <> struct IntegerConcept<long> { void constraints() {} };
+ template <> struct IntegerConcept<unsigned long> { void constraints() {} };
+ // etc.
+#endif
+
+ template <class T>
+ struct SignedIntegerConcept {
+ void constraints() {
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ x.error_type_must_be_a_signed_integer_type();
+#endif
+ }
+ T x;
+ };
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <> struct SignedIntegerConcept<short> { void constraints() {} };
+ template <> struct SignedIntegerConcept<int> { void constraints() {} };
+ template <> struct SignedIntegerConcept<long> { void constraints() {} };
+# if defined(BOOST_HAS_LONG_LONG)
+ template <> struct SignedIntegerConcept< ::boost::long_long_type> { void constraints() {} };
+# endif
+ // etc.
+#endif
+
+ template <class T>
+ struct UnsignedIntegerConcept {
+ void constraints() {
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ x.error_type_must_be_an_unsigned_integer_type();
+#endif
+ }
+ T x;
+ };
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <> struct UnsignedIntegerConcept<unsigned short>
+ { void constraints() {} };
+ template <> struct UnsignedIntegerConcept<unsigned int>
+ { void constraints() {} };
+ template <> struct UnsignedIntegerConcept<unsigned long>
+ { void constraints() {} };
+ // etc.
+#endif
+
+ //===========================================================================
+ // Basic Concepts
+
+ template <class TT>
+ struct DefaultConstructibleConcept
+ {
+ void constraints() {
+ TT a; // require default constructor
+ ignore_unused_variable_warning(a);
+ }
+ };
+
+ template <class TT>
+ struct AssignableConcept
+ {
+ void constraints() {
+#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
+ a = a; // require assignment operator
+#endif
+ const_constraints(a);
+ }
+ void const_constraints(const TT& b) {
+#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
+ a = b; // const required for argument to assignment
+#endif
+ }
+ TT a;
+ };
+
+ template <class TT>
+ struct CopyConstructibleConcept
+ {
+ void constraints() {
+ TT a(b); // require copy constructor
+ TT* ptr = &a; // require address of operator
+ const_constraints(a);
+ ignore_unused_variable_warning(ptr);
+ }
+ void const_constraints(const TT& a) {
+ TT c(a); // require const copy constructor
+ const TT* ptr = &a; // require const address of operator
+ ignore_unused_variable_warning(c);
+ ignore_unused_variable_warning(ptr);
+ }
+ TT b;
+ };
+
+ // The SGI STL version of Assignable requires copy constructor and operator=
+ template <class TT>
+ struct SGIAssignableConcept
+ {
+ void constraints() {
+ TT b(a);
+#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
+ a = a; // require assignment operator
+#endif
+ const_constraints(a);
+ ignore_unused_variable_warning(b);
+ }
+ void const_constraints(const TT& b) {
+ TT c(b);
+#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
+ a = b; // const required for argument to assignment
+#endif
+ ignore_unused_variable_warning(c);
+ }
+ TT a;
+ };
+
+ template <class X, class Y>
+ struct ConvertibleConcept
+ {
+ void constraints() {
+ Y y = x;
+ ignore_unused_variable_warning(y);
+ }
+ X x;
+ };
+
+ // The C++ standard requirements for many concepts talk about return
+ // types that must be "convertible to bool". The problem with this
+ // requirement is that it leaves the door open for evil proxies that
+ // define things like operator|| with strange return types. Two
+ // possible solutions are:
+ // 1) require the return type to be exactly bool
+ // 2) stay with convertible to bool, and also
+ // specify stuff about all the logical operators.
+ // For now we just test for convertible to bool.
+ template <class TT>
+ void require_boolean_expr(const TT& t) {
+ bool x = t;
+ ignore_unused_variable_warning(x);
+ }
+
+ template <class TT>
+ struct EqualityComparableConcept
+ {
+ void constraints() {
+ require_boolean_expr(a == b);
+ require_boolean_expr(a != b);
+ }
+ TT a, b;
+ };
+
+ template <class TT>
+ struct LessThanComparableConcept
+ {
+ void constraints() {
+ require_boolean_expr(a < b);
+ }
+ TT a, b;
+ };
+
+ // This is equivalent to SGI STL's LessThanComparable.
+ template <class TT>
+ struct ComparableConcept
+ {
+ void constraints() {
+ require_boolean_expr(a < b);
+ require_boolean_expr(a > b);
+ require_boolean_expr(a <= b);
+ require_boolean_expr(a >= b);
+ }
+ TT a, b;
+ };
+
+#define BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(OP,NAME) \
+ template <class First, class Second> \
+ struct NAME { \
+ void constraints() { (void)constraints_(); } \
+ bool constraints_() { \
+ return a OP b; \
+ } \
+ First a; \
+ Second b; \
+ }
+
+#define BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(OP,NAME) \
+ template <class Ret, class First, class Second> \
+ struct NAME { \
+ void constraints() { (void)constraints_(); } \
+ Ret constraints_() { \
+ return a OP b; \
+ } \
+ First a; \
+ Second b; \
+ }
+
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, EqualOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, NotEqualOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, LessThanOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, LessEqualOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, GreaterThanOpConcept);
+ BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, GreaterEqualOpConcept);
+
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, PlusOpConcept);
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, TimesOpConcept);
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, DivideOpConcept);
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, SubtractOpConcept);
+ BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, ModOpConcept);
+
+ //===========================================================================
+ // Function Object Concepts
+
+ template <class Func, class Return>
+ struct GeneratorConcept
+ {
+ void constraints() {
+ const Return& r = f(); // require operator() member function
+ ignore_unused_variable_warning(r);
+ }
+ Func f;
+ };
+
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <class Func>
+ struct GeneratorConcept<Func,void>
+ {
+ void constraints() {
+ f(); // require operator() member function
+ }
+ Func f;
+ };
+#endif
+
+ template <class Func, class Return, class Arg>
+ struct UnaryFunctionConcept
+ {
+ // required in case any of our template args are const-qualified:
+ UnaryFunctionConcept();
+
+ void constraints() {
+ r = f(arg); // require operator()
+ }
+ Func f;
+ Arg arg;
+ Return r;
+ };
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <class Func, class Arg>
+ struct UnaryFunctionConcept<Func, void, Arg> {
+ void constraints() {
+ f(arg); // require operator()
+ }
+ Func f;
+ Arg arg;
+ };
+#endif
+
+ template <class Func, class Return, class First, class Second>
+ struct BinaryFunctionConcept
+ {
+ void constraints() {
+ r = f(first, second); // require operator()
+ }
+ Func f;
+ First first;
+ Second second;
+ Return r;
+ };
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <class Func, class First, class Second>
+ struct BinaryFunctionConcept<Func, void, First, Second>
+ {
+ void constraints() {
+ f(first, second); // require operator()
+ }
+ Func f;
+ First first;
+ Second second;
+ };
+#endif
+
+ template <class Func, class Arg>
+ struct UnaryPredicateConcept
+ {
+ void constraints() {
+ require_boolean_expr(f(arg)); // require operator() returning bool
+ }
+ Func f;
+ Arg arg;
+ };
+
+ template <class Func, class First, class Second>
+ struct BinaryPredicateConcept
+ {
+ void constraints() {
+ require_boolean_expr(f(a, b)); // require operator() returning bool
+ }
+ Func f;
+ First a;
+ Second b;
+ };
+
+ // use this when functor is used inside a container class like std::set
+ template <class Func, class First, class Second>
+ struct Const_BinaryPredicateConcept {
+ void constraints() {
+ const_constraints(f);
+ }
+ void const_constraints(const Func& fun) {
+ function_requires<BinaryPredicateConcept<Func, First, Second> >();
+ // operator() must be a const member function
+ require_boolean_expr(fun(a, b));
+ }
+ Func f;
+ First a;
+ Second b;
+ };
+
+ template <class Func, class Return>
+ struct AdaptableGeneratorConcept
+ {
+ void constraints() {
+ typedef typename Func::result_type result_type;
+ BOOST_STATIC_ASSERT((is_convertible<result_type, Return>::value));
+ function_requires< GeneratorConcept<Func, result_type> >();
+ }
+ };
+
+ template <class Func, class Return, class Arg>
+ struct AdaptableUnaryFunctionConcept
+ {
+ void constraints() {
+ typedef typename Func::argument_type argument_type;
+ typedef typename Func::result_type result_type;
+ BOOST_STATIC_ASSERT((is_convertible<result_type, Return>::value));
+ BOOST_STATIC_ASSERT((is_convertible<Arg, argument_type>::value));
+ function_requires< UnaryFunctionConcept<Func, result_type, argument_type> >();
+ }
+ };
+
+ template <class Func, class Return, class First, class Second>
+ struct AdaptableBinaryFunctionConcept
+ {
+ void constraints() {
+ typedef typename Func::first_argument_type first_argument_type;
+ typedef typename Func::second_argument_type second_argument_type;
+ typedef typename Func::result_type result_type;
+ BOOST_STATIC_ASSERT((is_convertible<result_type, Return>::value));
+ BOOST_STATIC_ASSERT((is_convertible<First, first_argument_type>::value));
+ BOOST_STATIC_ASSERT((is_convertible<Second, second_argument_type>::value));
+ function_requires< BinaryFunctionConcept<Func, result_type,
+ first_argument_type, second_argument_type> >();
+ }
+ };
+
+ template <class Func, class Arg>
+ struct AdaptablePredicateConcept
+ {
+ void constraints() {
+ function_requires< UnaryPredicateConcept<Func, Arg> >();
+ function_requires< AdaptableUnaryFunctionConcept<Func, bool, Arg> >();
+ }
+ };
+
+ template <class Func, class First, class Second>
+ struct AdaptableBinaryPredicateConcept
+ {
+ void constraints() {
+ function_requires< BinaryPredicateConcept<Func, First, Second> >();
+ function_requires< AdaptableBinaryFunctionConcept<Func, bool, First, Second> >();
+ }
+ };
+
+ //===========================================================================
+ // Iterator Concepts
+
+ template <class TT>
+ struct InputIteratorConcept
+ {
+ void constraints() {
+ function_requires< AssignableConcept<TT> >();
+ function_requires< EqualityComparableConcept<TT> >();
+ TT j(i);
+ (void)*i; // require dereference operator
+#ifndef BOOST_NO_STD_ITERATOR_TRAITS
+ // require iterator_traits typedef's
+ typedef typename std::iterator_traits<TT>::difference_type D;
+ // Hmm, the following is a bit fragile
+ //function_requires< SignedIntegerConcept<D> >();
+ typedef typename std::iterator_traits<TT>::reference R;
+ typedef typename std::iterator_traits<TT>::pointer P;
+ typedef typename std::iterator_traits<TT>::iterator_category C;
+ function_requires< ConvertibleConcept<C, std::input_iterator_tag> >();
+#endif
+ ++j; // require preincrement operator
+ i++; // require postincrement operator
+ }
+ TT i;
+ };
+
+ template <class TT, class ValueT>
+ struct OutputIteratorConcept
+ {
+ void constraints() {
+ function_requires< AssignableConcept<TT> >();
+ ++i; // require preincrement operator
+ i++; // require postincrement operator
+ *i++ = t; // require postincrement and assignment
+ }
+ TT i, j;
+ ValueT t;
+ };
+
+ template <class TT>
+ struct ForwardIteratorConcept
+ {
+ void constraints() {
+ function_requires< InputIteratorConcept<TT> >();
+#ifndef BOOST_NO_STD_ITERATOR_TRAITS
+ typedef typename std::iterator_traits<TT>::iterator_category C;
+ function_requires< ConvertibleConcept<C, std::forward_iterator_tag> >();
+ typedef typename std::iterator_traits<TT>::reference reference;
+ reference r = *i;
+ ignore_unused_variable_warning(r);
+#endif
+ }
+ TT i;
+ };
+
+ template <class TT>
+ struct Mutable_ForwardIteratorConcept
+ {
+ void constraints() {
+ function_requires< ForwardIteratorConcept<TT> >();
+ *i++ = *i; // require postincrement and assignment
+ }
+ TT i;
+ };
+
+ template <class TT>
+ struct BidirectionalIteratorConcept
+ {
+ void constraints() {
+ function_requires< ForwardIteratorConcept<TT> >();
+#ifndef BOOST_NO_STD_ITERATOR_TRAITS
+ typedef typename std::iterator_traits<TT>::iterator_category C;
+ function_requires< ConvertibleConcept<C,
+ std::bidirectional_iterator_tag> >();
+#endif
+ --i; // require predecrement operator
+ i--; // require postdecrement operator
+ }
+ TT i;
+ };
+
+ template <class TT>
+ struct Mutable_BidirectionalIteratorConcept
+ {
+ void constraints() {
+ function_requires< BidirectionalIteratorConcept<TT> >();
+ function_requires< Mutable_ForwardIteratorConcept<TT> >();
+ *i-- = *i; // require postdecrement and assignment
+ }
+ TT i;
+ };
+
+
+ template <class TT>
+ struct RandomAccessIteratorConcept
+ {
+ void constraints() {
+ function_requires< BidirectionalIteratorConcept<TT> >();
+ function_requires< ComparableConcept<TT> >();
+#ifndef BOOST_NO_STD_ITERATOR_TRAITS
+ typedef typename std::iterator_traits<TT>::iterator_category C;
+ function_requires< ConvertibleConcept< C,
+ std::random_access_iterator_tag> >();
+ typedef typename std::iterator_traits<TT>::reference R;
+#endif
+
+ i += n; // require assignment addition operator
+ i = i + n; i = n + i; // require addition with difference type
+ i -= n; // require assignment subtraction operator
+ i = i - n; // require subtraction with difference type
+ n = i - j; // require difference operator
+ (void)i[n]; // require element access operator
+ }
+ TT a, b;
+ TT i, j;
+#ifndef BOOST_NO_STD_ITERATOR_TRAITS
+ typename std::iterator_traits<TT>::difference_type n;
+#else
+ std::ptrdiff_t n;
+#endif
+ };
+
+ template <class TT>
+ struct Mutable_RandomAccessIteratorConcept
+ {
+ void constraints() {
+ function_requires< RandomAccessIteratorConcept<TT> >();
+ function_requires< Mutable_BidirectionalIteratorConcept<TT> >();
+ i[n] = *i; // require element access and assignment
+ }
+ TT i;
+#ifndef BOOST_NO_STD_ITERATOR_TRAITS
+ typename std::iterator_traits<TT>::difference_type n;
+#else
+ std::ptrdiff_t n;
+#endif
+ };
+
+ //===========================================================================
+ // Container Concepts
+
+ template <class Container>
+ struct ContainerConcept
+ {
+ typedef typename Container::value_type value_type;
+ typedef typename Container::difference_type difference_type;
+ typedef typename Container::size_type size_type;
+ typedef typename Container::const_reference const_reference;
+ typedef typename Container::const_pointer const_pointer;
+ typedef typename Container::const_iterator const_iterator;
+
+ void constraints() {
+ function_requires< InputIteratorConcept<const_iterator> >();
+ function_requires< AssignableConcept<Container> >();
+ const_constraints(c);
+ }
+ void const_constraints(const Container& cc) {
+ i = cc.begin();
+ i = cc.end();
+ n = cc.size();
+ n = cc.max_size();
+ b = cc.empty();
+ }
+ Container c;
+ bool b;
+ const_iterator i;
+ size_type n;
+ };
+
+ template <class Container>
+ struct Mutable_ContainerConcept
+ {
+ typedef typename Container::value_type value_type;
+ typedef typename Container::reference reference;
+ typedef typename Container::iterator iterator;
+ typedef typename Container::pointer pointer;
+
+ void constraints() {
+ function_requires< ContainerConcept<Container> >();
+ function_requires< AssignableConcept<value_type> >();
+ function_requires< InputIteratorConcept<iterator> >();
+
+ i = c.begin();
+ i = c.end();
+ c.swap(c2);
+ }
+ iterator i;
+ Container c, c2;
+ };
+
+ template <class ForwardContainer>
+ struct ForwardContainerConcept
+ {
+ void constraints() {
+ function_requires< ContainerConcept<ForwardContainer> >();
+ typedef typename ForwardContainer::const_iterator const_iterator;
+ function_requires< ForwardIteratorConcept<const_iterator> >();
+ }
+ };
+
+ template <class ForwardContainer>
+ struct Mutable_ForwardContainerConcept
+ {
+ void constraints() {
+ function_requires< ForwardContainerConcept<ForwardContainer> >();
+ function_requires< Mutable_ContainerConcept<ForwardContainer> >();
+ typedef typename ForwardContainer::iterator iterator;
+ function_requires< Mutable_ForwardIteratorConcept<iterator> >();
+ }
+ };
+
+ template <class ReversibleContainer>
+ struct ReversibleContainerConcept
+ {
+ typedef typename ReversibleContainer::const_iterator const_iterator;
+ typedef typename ReversibleContainer::const_reverse_iterator
+ const_reverse_iterator;
+
+ void constraints() {
+ function_requires< ForwardContainerConcept<ReversibleContainer> >();
+ function_requires< BidirectionalIteratorConcept<const_iterator> >();
+ function_requires<
+ BidirectionalIteratorConcept<const_reverse_iterator> >();
+ const_constraints(c);
+ }
+ void const_constraints(const ReversibleContainer& cc) {
+ const_reverse_iterator i = cc.rbegin();
+ i = cc.rend();
+ }
+ ReversibleContainer c;
+ };
+
+ template <class ReversibleContainer>
+ struct Mutable_ReversibleContainerConcept
+ {
+ typedef typename ReversibleContainer::iterator iterator;
+ typedef typename ReversibleContainer::reverse_iterator reverse_iterator;
+
+ void constraints() {
+ function_requires< ReversibleContainerConcept<ReversibleContainer> >();
+ function_requires<
+ Mutable_ForwardContainerConcept<ReversibleContainer> >();
+ function_requires< Mutable_BidirectionalIteratorConcept<iterator> >();
+ function_requires<
+ Mutable_BidirectionalIteratorConcept<reverse_iterator> >();
+
+ reverse_iterator i = c.rbegin();
+ i = c.rend();
+ }
+ ReversibleContainer c;
+ };
+
+ template <class RandomAccessContainer>
+ struct RandomAccessContainerConcept
+ {
+ typedef typename RandomAccessContainer::size_type size_type;
+ typedef typename RandomAccessContainer::const_reference const_reference;
+ typedef typename RandomAccessContainer::const_iterator const_iterator;
+ typedef typename RandomAccessContainer::const_reverse_iterator
+ const_reverse_iterator;
+
+ void constraints() {
+ function_requires< ReversibleContainerConcept<RandomAccessContainer> >();
+ function_requires< RandomAccessIteratorConcept<const_iterator> >();
+ function_requires<
+ RandomAccessIteratorConcept<const_reverse_iterator> >();
+
+ const_constraints(c);
+ }
+ void const_constraints(const RandomAccessContainer& cc) {
+ const_reference r = cc[n];
+ ignore_unused_variable_warning(r);
+ }
+ RandomAccessContainer c;
+ size_type n;
+ };
+
+ template <class RandomAccessContainer>
+ struct Mutable_RandomAccessContainerConcept
+ {
+ typedef typename RandomAccessContainer::size_type size_type;
+ typedef typename RandomAccessContainer::reference reference;
+ typedef typename RandomAccessContainer::iterator iterator;
+ typedef typename RandomAccessContainer::reverse_iterator reverse_iterator;
+
+ void constraints() {
+ function_requires<
+ RandomAccessContainerConcept<RandomAccessContainer> >();
+ function_requires<
+ Mutable_ReversibleContainerConcept<RandomAccessContainer> >();
+ function_requires< Mutable_RandomAccessIteratorConcept<iterator> >();
+ function_requires<
+ Mutable_RandomAccessIteratorConcept<reverse_iterator> >();
+
+ reference r = c[i];
+ ignore_unused_variable_warning(r);
+ }
+ size_type i;
+ RandomAccessContainer c;
+ };
+
+ // A Sequence is inherently mutable
+ template <class Sequence>
+ struct SequenceConcept
+ {
+
+ typedef typename Sequence::reference reference;
+ typedef typename Sequence::const_reference const_reference;
+
+ void constraints() {
+ // Matt Austern's book puts DefaultConstructible here, the C++
+ // standard places it in Container
+ // function_requires< DefaultConstructible<Sequence> >();
+ function_requires< Mutable_ForwardContainerConcept<Sequence> >();
+ function_requires< DefaultConstructibleConcept<Sequence> >();
+
+ Sequence
+ c(n),
+ c2(n, t),
+ c3(first, last);
+
+ c.insert(p, t);
+ c.insert(p, n, t);
+ c.insert(p, first, last);
+
+ c.erase(p);
+ c.erase(p, q);
+
+ reference r = c.front();
+
+ ignore_unused_variable_warning(c);
+ ignore_unused_variable_warning(c2);
+ ignore_unused_variable_warning(c3);
+ ignore_unused_variable_warning(r);
+ const_constraints(c);
+ }
+ void const_constraints(const Sequence& c) {
+ const_reference r = c.front();
+ ignore_unused_variable_warning(r);
+ }
+ typename Sequence::value_type t;
+ typename Sequence::size_type n;
+ typename Sequence::value_type* first, *last;
+ typename Sequence::iterator p, q;
+ };
+
+ template <class FrontInsertionSequence>
+ struct FrontInsertionSequenceConcept
+ {
+ void constraints() {
+ function_requires< SequenceConcept<FrontInsertionSequence> >();
+
+ c.push_front(t);
+ c.pop_front();
+ }
+ FrontInsertionSequence c;
+ typename FrontInsertionSequence::value_type t;
+ };
+
+ template <class BackInsertionSequence>
+ struct BackInsertionSequenceConcept
+ {
+ typedef typename BackInsertionSequence::reference reference;
+ typedef typename BackInsertionSequence::const_reference const_reference;
+
+ void constraints() {
+ function_requires< SequenceConcept<BackInsertionSequence> >();
+
+ c.push_back(t);
+ c.pop_back();
+ reference r = c.back();
+ ignore_unused_variable_warning(r);
+ }
+ void const_constraints(const BackInsertionSequence& cc) {
+ const_reference r = cc.back();
+ ignore_unused_variable_warning(r);
+ };
+ BackInsertionSequence c;
+ typename BackInsertionSequence::value_type t;
+ };
+
+ template <class AssociativeContainer>
+ struct AssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< ForwardContainerConcept<AssociativeContainer> >();
+ function_requires< DefaultConstructibleConcept<AssociativeContainer> >();
+
+ i = c.find(k);
+ r = c.equal_range(k);
+ c.erase(k);
+ c.erase(i);
+ c.erase(r.first, r.second);
+ const_constraints(c);
+ }
+ void const_constraints(const AssociativeContainer& cc) {
+ ci = cc.find(k);
+ n = cc.count(k);
+ cr = cc.equal_range(k);
+ }
+ typedef typename AssociativeContainer::iterator iterator;
+ typedef typename AssociativeContainer::const_iterator const_iterator;
+
+ AssociativeContainer c;
+ iterator i;
+ std::pair<iterator,iterator> r;
+ const_iterator ci;
+ std::pair<const_iterator,const_iterator> cr;
+ typename AssociativeContainer::key_type k;
+ typename AssociativeContainer::size_type n;
+ };
+
+ template <class UniqueAssociativeContainer>
+ struct UniqueAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept<UniqueAssociativeContainer> >();
+
+ UniqueAssociativeContainer c(first, last);
+
+ pos_flag = c.insert(t);
+ c.insert(first, last);
+
+ ignore_unused_variable_warning(c);
+ }
+ std::pair<typename UniqueAssociativeContainer::iterator, bool> pos_flag;
+ typename UniqueAssociativeContainer::value_type t;
+ typename UniqueAssociativeContainer::value_type* first, *last;
+ };
+
+ template <class MultipleAssociativeContainer>
+ struct MultipleAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept<MultipleAssociativeContainer> >();
+
+ MultipleAssociativeContainer c(first, last);
+
+ pos = c.insert(t);
+ c.insert(first, last);
+
+ ignore_unused_variable_warning(c);
+ ignore_unused_variable_warning(pos);
+ }
+ typename MultipleAssociativeContainer::iterator pos;
+ typename MultipleAssociativeContainer::value_type t;
+ typename MultipleAssociativeContainer::value_type* first, *last;
+ };
+
+ template <class SimpleAssociativeContainer>
+ struct SimpleAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept<SimpleAssociativeContainer> >();
+ typedef typename SimpleAssociativeContainer::key_type key_type;
+ typedef typename SimpleAssociativeContainer::value_type value_type;
+ typedef typename require_same<key_type, value_type>::type req;
+ }
+ };
+
+ template <class SimpleAssociativeContainer>
+ struct PairAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept<SimpleAssociativeContainer> >();
+ typedef typename SimpleAssociativeContainer::key_type key_type;
+ typedef typename SimpleAssociativeContainer::value_type value_type;
+ typedef typename SimpleAssociativeContainer::mapped_type mapped_type;
+ typedef std::pair<const key_type, mapped_type> required_value_type;
+ typedef typename require_same<value_type, required_value_type>::type req;
+ }
+ };
+
+ template <class SortedAssociativeContainer>
+ struct SortedAssociativeContainerConcept
+ {
+ void constraints() {
+ function_requires< AssociativeContainerConcept<SortedAssociativeContainer> >();
+ function_requires< ReversibleContainerConcept<SortedAssociativeContainer> >();
+
+ SortedAssociativeContainer
+ c(kc),
+ c2(first, last),
+ c3(first, last, kc);
+
+ p = c.upper_bound(k);
+ p = c.lower_bound(k);
+ r = c.equal_range(k);
+
+ c.insert(p, t);
+
+ ignore_unused_variable_warning(c);
+ ignore_unused_variable_warning(c2);
+ ignore_unused_variable_warning(c3);
+ }
+ void const_constraints(const SortedAssociativeContainer& c) {
+ kc = c.key_comp();
+ vc = c.value_comp();
+
+ cp = c.upper_bound(k);
+ cp = c.lower_bound(k);
+ cr = c.equal_range(k);
+ }
+ typename SortedAssociativeContainer::key_compare kc;
+ typename SortedAssociativeContainer::value_compare vc;
+ typename SortedAssociativeContainer::value_type t;
+ typename SortedAssociativeContainer::key_type k;
+ typedef typename SortedAssociativeContainer::iterator iterator;
+ typedef typename SortedAssociativeContainer::const_iterator const_iterator;
+ iterator p;
+ const_iterator cp;
+ std::pair<iterator,iterator> r;
+ std::pair<const_iterator,const_iterator> cr;
+ typename SortedAssociativeContainer::value_type* first, *last;
+ };
+
+ // HashedAssociativeContainer
+
+} // namespace boost
+
+#endif // BOOST_CONCEPT_CHECKS_HPP
+
--- /dev/null
+// Boost CRC library crc.hpp header file -----------------------------------//
+
+// Copyright 2001, 2004 Daryle Walker. Use, modification, and distribution are
+// subject to the Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
+
+// See <http://www.boost.org/libs/crc/> for the library's home page.
+
+#ifndef BOOST_CRC_HPP
+#define BOOST_CRC_HPP
+
+#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT, etc.
+#include <boost/integer.hpp> // for boost::uint_t
+
+#include <climits> // for CHAR_BIT, etc.
+#include <cstddef> // for std::size_t
+
+#include <boost/limits.hpp> // for std::numeric_limits
+
+
+// The type of CRC parameters that can go in a template should be related
+// on the CRC's bit count. This macro expresses that type in a compact
+// form, but also allows an alternate type for compilers that don't support
+// dependent types (in template value-parameters).
+#if !(defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) || (defined(BOOST_MSVC) && (BOOST_MSVC <= 1300)))
+#define BOOST_CRC_PARM_TYPE typename ::boost::uint_t<Bits>::fast
+#else
+#define BOOST_CRC_PARM_TYPE unsigned long
+#endif
+
+// Some compilers [MS VC++ 6] cannot correctly set up several versions of a
+// function template unless every template argument can be unambiguously
+// deduced from the function arguments. (The bug is hidden if only one version
+// is needed.) Since all of the CRC function templates have this problem, the
+// workaround is to make up a dummy function argument that encodes the template
+// arguments. Calls to such template functions need all their template
+// arguments explicitly specified. At least one compiler that needs this
+// workaround also needs the default value for the dummy argument to be
+// specified in the definition.
+#if defined(__GNUC__) || !defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS)
+#define BOOST_CRC_DUMMY_PARM_TYPE
+#define BOOST_CRC_DUMMY_INIT
+#define BOOST_ACRC_DUMMY_PARM_TYPE
+#define BOOST_ACRC_DUMMY_INIT
+#else
+namespace boost { namespace detail {
+ template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+ struct dummy_crc_argument { };
+} }
+#define BOOST_CRC_DUMMY_PARM_TYPE , detail::dummy_crc_argument<Bits, \
+ TruncPoly, InitRem, FinalXor, ReflectIn, ReflectRem> *p_
+#define BOOST_CRC_DUMMY_INIT BOOST_CRC_DUMMY_PARM_TYPE = 0
+#define BOOST_ACRC_DUMMY_PARM_TYPE , detail::dummy_crc_argument<Bits, \
+ TruncPoly, 0, 0, false, false> *p_
+#define BOOST_ACRC_DUMMY_INIT BOOST_ACRC_DUMMY_PARM_TYPE = 0
+#endif
+
+
+namespace boost
+{
+
+
+// Forward declarations ----------------------------------------------------//
+
+template < std::size_t Bits >
+ class crc_basic;
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly = 0u,
+ BOOST_CRC_PARM_TYPE InitRem = 0u,
+ BOOST_CRC_PARM_TYPE FinalXor = 0u, bool ReflectIn = false,
+ bool ReflectRem = false >
+ class crc_optimal;
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+ typename uint_t<Bits>::fast crc( void const *buffer,
+ std::size_t byte_count
+ BOOST_CRC_DUMMY_PARM_TYPE );
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly >
+ typename uint_t<Bits>::fast augmented_crc( void const *buffer,
+ std::size_t byte_count, typename uint_t<Bits>::fast initial_remainder
+ BOOST_ACRC_DUMMY_PARM_TYPE );
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly >
+ typename uint_t<Bits>::fast augmented_crc( void const *buffer,
+ std::size_t byte_count
+ BOOST_ACRC_DUMMY_PARM_TYPE );
+
+typedef crc_optimal<16, 0x8005, 0, 0, true, true> crc_16_type;
+typedef crc_optimal<16, 0x1021, 0xFFFF, 0, false, false> crc_ccitt_type;
+typedef crc_optimal<16, 0x8408, 0, 0, true, true> crc_xmodem_type;
+
+typedef crc_optimal<32, 0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true, true>
+ crc_32_type;
+
+
+// Forward declarations for implementation detail stuff --------------------//
+// (Just for the stuff that will be needed for the next two sections)
+
+namespace detail
+{
+ template < std::size_t Bits >
+ struct mask_uint_t;
+
+ template < >
+ struct mask_uint_t< std::numeric_limits<unsigned char>::digits >;
+
+ #if USHRT_MAX > UCHAR_MAX
+ template < >
+ struct mask_uint_t< std::numeric_limits<unsigned short>::digits >;
+ #endif
+
+ #if UINT_MAX > USHRT_MAX
+ template < >
+ struct mask_uint_t< std::numeric_limits<unsigned int>::digits >;
+ #endif
+
+ #if ULONG_MAX > UINT_MAX
+ template < >
+ struct mask_uint_t< std::numeric_limits<unsigned long>::digits >;
+ #endif
+
+ template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, bool Reflect >
+ struct crc_table_t;
+
+ template < std::size_t Bits, bool DoReflect >
+ class crc_helper;
+
+ #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template < std::size_t Bits >
+ class crc_helper< Bits, false >;
+ #endif
+
+} // namespace detail
+
+
+// Simple cyclic redundancy code (CRC) class declaration -------------------//
+
+template < std::size_t Bits >
+class crc_basic
+{
+ // Implementation type
+ typedef detail::mask_uint_t<Bits> masking_type;
+
+public:
+ // Type
+ typedef typename masking_type::least value_type;
+
+ // Constant for the template parameter
+ BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits );
+
+ // Constructor
+ explicit crc_basic( value_type truncated_polynominal,
+ value_type initial_remainder = 0, value_type final_xor_value = 0,
+ bool reflect_input = false, bool reflect_remainder = false );
+
+ // Internal Operations
+ value_type get_truncated_polynominal() const;
+ value_type get_initial_remainder() const;
+ value_type get_final_xor_value() const;
+ bool get_reflect_input() const;
+ bool get_reflect_remainder() const;
+
+ value_type get_interim_remainder() const;
+ void reset( value_type new_rem );
+ void reset();
+
+ // External Operations
+ void process_bit( bool bit );
+ void process_bits( unsigned char bits, std::size_t bit_count );
+ void process_byte( unsigned char byte );
+ void process_block( void const *bytes_begin, void const *bytes_end );
+ void process_bytes( void const *buffer, std::size_t byte_count );
+
+ value_type checksum() const;
+
+private:
+ // Member data
+ value_type rem_;
+ value_type poly_, init_, final_; // non-const to allow assignability
+ bool rft_in_, rft_out_; // non-const to allow assignability
+
+}; // boost::crc_basic
+
+
+// Optimized cyclic redundancy code (CRC) class declaration ----------------//
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+class crc_optimal
+{
+ // Implementation type
+ typedef detail::mask_uint_t<Bits> masking_type;
+
+public:
+ // Type
+ typedef typename masking_type::fast value_type;
+
+ // Constants for the template parameters
+ BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits );
+ BOOST_STATIC_CONSTANT( value_type, truncated_polynominal = TruncPoly );
+ BOOST_STATIC_CONSTANT( value_type, initial_remainder = InitRem );
+ BOOST_STATIC_CONSTANT( value_type, final_xor_value = FinalXor );
+ BOOST_STATIC_CONSTANT( bool, reflect_input = ReflectIn );
+ BOOST_STATIC_CONSTANT( bool, reflect_remainder = ReflectRem );
+
+ // Constructor
+ explicit crc_optimal( value_type init_rem = InitRem );
+
+ // Internal Operations
+ value_type get_truncated_polynominal() const;
+ value_type get_initial_remainder() const;
+ value_type get_final_xor_value() const;
+ bool get_reflect_input() const;
+ bool get_reflect_remainder() const;
+
+ value_type get_interim_remainder() const;
+ void reset( value_type new_rem = InitRem );
+
+ // External Operations
+ void process_byte( unsigned char byte );
+ void process_block( void const *bytes_begin, void const *bytes_end );
+ void process_bytes( void const *buffer, std::size_t byte_count );
+
+ value_type checksum() const;
+
+ // Operators
+ void operator ()( unsigned char byte );
+ value_type operator ()() const;
+
+private:
+ // The implementation of output reflection depends on both reflect states.
+ BOOST_STATIC_CONSTANT( bool, reflect_output = (ReflectRem != ReflectIn) );
+
+ #ifndef __BORLANDC__
+ #define BOOST_CRC_REF_OUT_VAL reflect_output
+ #else
+ typedef crc_optimal self_type;
+ #define BOOST_CRC_REF_OUT_VAL (self_type::reflect_output)
+ #endif
+
+ // More implementation types
+ typedef detail::crc_table_t<Bits, TruncPoly, ReflectIn> crc_table_type;
+ typedef detail::crc_helper<Bits, ReflectIn> helper_type;
+ typedef detail::crc_helper<Bits, BOOST_CRC_REF_OUT_VAL> reflect_out_type;
+
+ #undef BOOST_CRC_REF_OUT_VAL
+
+ // Member data
+ value_type rem_;
+
+}; // boost::crc_optimal
+
+
+// Implementation detail stuff ---------------------------------------------//
+
+namespace detail
+{
+ // Forward declarations for more implementation details
+ template < std::size_t Bits >
+ struct high_uint_t;
+
+ template < std::size_t Bits >
+ struct reflector;
+
+
+ // Traits class for mask; given the bit number
+ // (1-based), get the mask for that bit by itself.
+ template < std::size_t Bits >
+ struct high_uint_t
+ : boost::uint_t< Bits >
+ {
+ typedef boost::uint_t<Bits> base_type;
+ typedef typename base_type::least least;
+ typedef typename base_type::fast fast;
+
+#if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 243
+ static const least high_bit = 1ul << ( Bits - 1u );
+ static const fast high_bit_fast = 1ul << ( Bits - 1u );
+#else
+ BOOST_STATIC_CONSTANT( least, high_bit = (least( 1u ) << ( Bits
+ - 1u )) );
+ BOOST_STATIC_CONSTANT( fast, high_bit_fast = (fast( 1u ) << ( Bits
+ - 1u )) );
+#endif
+
+ }; // boost::detail::high_uint_t
+
+
+ // Reflection routine class wrapper
+ // (since MS VC++ 6 couldn't handle the unwrapped version)
+ template < std::size_t Bits >
+ struct reflector
+ {
+ typedef typename boost::uint_t<Bits>::fast value_type;
+
+ static value_type reflect( value_type x );
+
+ }; // boost::detail::reflector
+
+ // Function that reflects its argument
+ template < std::size_t Bits >
+ typename reflector<Bits>::value_type
+ reflector<Bits>::reflect
+ (
+ typename reflector<Bits>::value_type x
+ )
+ {
+ value_type reflection = 0;
+ value_type const one = 1;
+
+ for ( std::size_t i = 0 ; i < Bits ; ++i, x >>= 1 )
+ {
+ if ( x & one )
+ {
+ reflection |= ( one << (Bits - 1u - i) );
+ }
+ }
+
+ return reflection;
+ }
+
+
+ // Traits class for masks; given the bit number (1-based),
+ // get the mask for that bit and its lower bits.
+ template < std::size_t Bits >
+ struct mask_uint_t
+ : high_uint_t< Bits >
+ {
+ typedef high_uint_t<Bits> base_type;
+ typedef typename base_type::least least;
+ typedef typename base_type::fast fast;
+
+ #ifndef __BORLANDC__
+ using base_type::high_bit;
+ using base_type::high_bit_fast;
+ #else
+ BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit );
+ BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast );
+ #endif
+
+#if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 243
+ static const least sig_bits = (~( ~( 0ul ) << Bits )) ;
+#else
+ BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) );
+#endif
+#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
+ // Work around a weird bug that ICEs the compiler in build_c_cast
+ BOOST_STATIC_CONSTANT( fast, sig_bits_fast = static_cast<fast>(sig_bits) );
+#else
+ BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) );
+#endif
+ }; // boost::detail::mask_uint_t
+
+ template < >
+ struct mask_uint_t< std::numeric_limits<unsigned char>::digits >
+ : high_uint_t< std::numeric_limits<unsigned char>::digits >
+ {
+ typedef high_uint_t<std::numeric_limits<unsigned char>::digits>
+ base_type;
+ typedef base_type::least least;
+ typedef base_type::fast fast;
+
+ #ifndef __BORLANDC__
+ using base_type::high_bit;
+ using base_type::high_bit_fast;
+ #else
+ BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit );
+ BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast );
+ #endif
+
+ BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) );
+ BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) );
+
+ }; // boost::detail::mask_uint_t
+
+ #if USHRT_MAX > UCHAR_MAX
+ template < >
+ struct mask_uint_t< std::numeric_limits<unsigned short>::digits >
+ : high_uint_t< std::numeric_limits<unsigned short>::digits >
+ {
+ typedef high_uint_t<std::numeric_limits<unsigned short>::digits>
+ base_type;
+ typedef base_type::least least;
+ typedef base_type::fast fast;
+
+ #ifndef __BORLANDC__
+ using base_type::high_bit;
+ using base_type::high_bit_fast;
+ #else
+ BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit );
+ BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast );
+ #endif
+
+ BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) );
+ BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) );
+
+ }; // boost::detail::mask_uint_t
+ #endif
+
+ #if UINT_MAX > USHRT_MAX
+ template < >
+ struct mask_uint_t< std::numeric_limits<unsigned int>::digits >
+ : high_uint_t< std::numeric_limits<unsigned int>::digits >
+ {
+ typedef high_uint_t<std::numeric_limits<unsigned int>::digits>
+ base_type;
+ typedef base_type::least least;
+ typedef base_type::fast fast;
+
+ #ifndef __BORLANDC__
+ using base_type::high_bit;
+ using base_type::high_bit_fast;
+ #else
+ BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit );
+ BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast );
+ #endif
+
+ BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) );
+ BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) );
+
+ }; // boost::detail::mask_uint_t
+ #endif
+
+ #if ULONG_MAX > UINT_MAX
+ template < >
+ struct mask_uint_t< std::numeric_limits<unsigned long>::digits >
+ : high_uint_t< std::numeric_limits<unsigned long>::digits >
+ {
+ typedef high_uint_t<std::numeric_limits<unsigned long>::digits>
+ base_type;
+ typedef base_type::least least;
+ typedef base_type::fast fast;
+
+ #ifndef __BORLANDC__
+ using base_type::high_bit;
+ using base_type::high_bit_fast;
+ #else
+ BOOST_STATIC_CONSTANT( least, high_bit = base_type::high_bit );
+ BOOST_STATIC_CONSTANT( fast, high_bit_fast = base_type::high_bit_fast );
+ #endif
+
+ BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) );
+ BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) );
+
+ }; // boost::detail::mask_uint_t
+ #endif
+
+
+ // CRC table generator
+ template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, bool Reflect >
+ struct crc_table_t
+ {
+ BOOST_STATIC_CONSTANT( std::size_t, byte_combos = (1ul << CHAR_BIT) );
+
+ typedef mask_uint_t<Bits> masking_type;
+ typedef typename masking_type::fast value_type;
+#if defined(__BORLANDC__) && defined(_M_IX86) && (__BORLANDC__ == 0x560)
+ // for some reason Borland's command line compiler (version 0x560)
+ // chokes over this unless we do the calculation for it:
+ typedef value_type table_type[ 0x100 ];
+#else
+ typedef value_type table_type[ byte_combos ];
+#endif
+
+ static void init_table();
+
+ static table_type table_;
+
+ }; // boost::detail::crc_table_t
+
+ // CRC table generator static data member definition
+ // (Some compilers [Borland C++] require the initializer to be present.)
+ template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, bool Reflect >
+ typename crc_table_t<Bits, TruncPoly, Reflect>::table_type
+ crc_table_t<Bits, TruncPoly, Reflect>::table_
+ = { 0 };
+
+ // Populate CRC lookup table
+ template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, bool Reflect >
+ void
+ crc_table_t<Bits, TruncPoly, Reflect>::init_table
+ (
+ )
+ {
+ // compute table only on the first run
+ static bool did_init = false;
+ if ( did_init ) return;
+
+ // factor-out constants to avoid recalculation
+ value_type const fast_hi_bit = masking_type::high_bit_fast;
+ unsigned char const byte_hi_bit = 1u << (CHAR_BIT - 1u);
+
+ // loop over every possible dividend value
+ unsigned char dividend = 0;
+ do
+ {
+ value_type remainder = 0;
+
+ // go through all the dividend's bits
+ for ( unsigned char mask = byte_hi_bit ; mask ; mask >>= 1 )
+ {
+ // check if divisor fits
+ if ( dividend & mask )
+ {
+ remainder ^= fast_hi_bit;
+ }
+
+ // do polynominal division
+ if ( remainder & fast_hi_bit )
+ {
+ remainder <<= 1;
+ remainder ^= TruncPoly;
+ }
+ else
+ {
+ remainder <<= 1;
+ }
+ }
+
+ table_[ crc_helper<CHAR_BIT, Reflect>::reflect(dividend) ]
+ = crc_helper<Bits, Reflect>::reflect( remainder );
+ }
+ while ( ++dividend );
+
+ did_init = true;
+ }
+
+ #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // Align the msb of the remainder to a byte
+ template < std::size_t Bits, bool RightShift >
+ class remainder
+ {
+ public:
+ typedef typename uint_t<Bits>::fast value_type;
+
+ static unsigned char align_msb( value_type rem )
+ { return rem >> (Bits - CHAR_BIT); }
+ };
+
+ // Specialization for the case that the remainder has less
+ // bits than a byte: align the remainder msb to the byte msb
+ template < std::size_t Bits >
+ class remainder< Bits, false >
+ {
+ public:
+ typedef typename uint_t<Bits>::fast value_type;
+
+ static unsigned char align_msb( value_type rem )
+ { return rem << (CHAR_BIT - Bits); }
+ };
+ #endif
+
+ // CRC helper routines
+ template < std::size_t Bits, bool DoReflect >
+ class crc_helper
+ {
+ public:
+ // Type
+ typedef typename uint_t<Bits>::fast value_type;
+
+ #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // Possibly reflect a remainder
+ static value_type reflect( value_type x )
+ { return detail::reflector<Bits>::reflect( x ); }
+
+ // Compare a byte to the remainder's highest byte
+ static unsigned char index( value_type rem, unsigned char x )
+ { return x ^ rem; }
+
+ // Shift out the remainder's highest byte
+ static value_type shift( value_type rem )
+ { return rem >> CHAR_BIT; }
+ #else
+ // Possibly reflect a remainder
+ static value_type reflect( value_type x )
+ { return DoReflect ? detail::reflector<Bits>::reflect( x ) : x; }
+
+ // Compare a byte to the remainder's highest byte
+ static unsigned char index( value_type rem, unsigned char x )
+ { return x ^ ( DoReflect ? rem :
+ ((Bits>CHAR_BIT)?( rem >> (Bits - CHAR_BIT) ) :
+ ( rem << (CHAR_BIT - Bits) ))); }
+
+ // Shift out the remainder's highest byte
+ static value_type shift( value_type rem )
+ { return DoReflect ? rem >> CHAR_BIT : rem << CHAR_BIT; }
+ #endif
+
+ }; // boost::detail::crc_helper
+
+ #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template < std::size_t Bits >
+ class crc_helper<Bits, false>
+ {
+ public:
+ // Type
+ typedef typename uint_t<Bits>::fast value_type;
+
+ // Possibly reflect a remainder
+ static value_type reflect( value_type x )
+ { return x; }
+
+ // Compare a byte to the remainder's highest byte
+ static unsigned char index( value_type rem, unsigned char x )
+ { return x ^ remainder<Bits,(Bits>CHAR_BIT)>::align_msb( rem ); }
+
+ // Shift out the remainder's highest byte
+ static value_type shift( value_type rem )
+ { return rem << CHAR_BIT; }
+
+ }; // boost::detail::crc_helper
+ #endif
+
+
+} // namespace detail
+
+
+// Simple CRC class function definitions -----------------------------------//
+
+template < std::size_t Bits >
+inline
+crc_basic<Bits>::crc_basic
+(
+ typename crc_basic<Bits>::value_type truncated_polynominal,
+ typename crc_basic<Bits>::value_type initial_remainder, // = 0
+ typename crc_basic<Bits>::value_type final_xor_value, // = 0
+ bool reflect_input, // = false
+ bool reflect_remainder // = false
+)
+ : rem_( initial_remainder ), poly_( truncated_polynominal )
+ , init_( initial_remainder ), final_( final_xor_value )
+ , rft_in_( reflect_input ), rft_out_( reflect_remainder )
+{
+}
+
+template < std::size_t Bits >
+inline
+typename crc_basic<Bits>::value_type
+crc_basic<Bits>::get_truncated_polynominal
+(
+) const
+{
+ return poly_;
+}
+
+template < std::size_t Bits >
+inline
+typename crc_basic<Bits>::value_type
+crc_basic<Bits>::get_initial_remainder
+(
+) const
+{
+ return init_;
+}
+
+template < std::size_t Bits >
+inline
+typename crc_basic<Bits>::value_type
+crc_basic<Bits>::get_final_xor_value
+(
+) const
+{
+ return final_;
+}
+
+template < std::size_t Bits >
+inline
+bool
+crc_basic<Bits>::get_reflect_input
+(
+) const
+{
+ return rft_in_;
+}
+
+template < std::size_t Bits >
+inline
+bool
+crc_basic<Bits>::get_reflect_remainder
+(
+) const
+{
+ return rft_out_;
+}
+
+template < std::size_t Bits >
+inline
+typename crc_basic<Bits>::value_type
+crc_basic<Bits>::get_interim_remainder
+(
+) const
+{
+ return rem_ & masking_type::sig_bits;
+}
+
+template < std::size_t Bits >
+inline
+void
+crc_basic<Bits>::reset
+(
+ typename crc_basic<Bits>::value_type new_rem
+)
+{
+ rem_ = new_rem;
+}
+
+template < std::size_t Bits >
+inline
+void
+crc_basic<Bits>::reset
+(
+)
+{
+ this->reset( this->get_initial_remainder() );
+}
+
+template < std::size_t Bits >
+inline
+void
+crc_basic<Bits>::process_bit
+(
+ bool bit
+)
+{
+ value_type const high_bit_mask = masking_type::high_bit;
+
+ // compare the new bit with the remainder's highest
+ rem_ ^= ( bit ? high_bit_mask : 0u );
+
+ // a full polynominal division step is done when the highest bit is one
+ bool const do_poly_div = static_cast<bool>( rem_ & high_bit_mask );
+
+ // shift out the highest bit
+ rem_ <<= 1;
+
+ // carry out the division, if needed
+ if ( do_poly_div )
+ {
+ rem_ ^= poly_;
+ }
+}
+
+template < std::size_t Bits >
+void
+crc_basic<Bits>::process_bits
+(
+ unsigned char bits,
+ std::size_t bit_count
+)
+{
+ // ignore the bits above the ones we want
+ bits <<= CHAR_BIT - bit_count;
+
+ // compute the CRC for each bit, starting with the upper ones
+ unsigned char const high_bit_mask = 1u << ( CHAR_BIT - 1u );
+ for ( std::size_t i = bit_count ; i > 0u ; --i, bits <<= 1u )
+ {
+ process_bit( static_cast<bool>(bits & high_bit_mask) );
+ }
+}
+
+template < std::size_t Bits >
+inline
+void
+crc_basic<Bits>::process_byte
+(
+ unsigned char byte
+)
+{
+ process_bits( (rft_in_ ? detail::reflector<CHAR_BIT>::reflect(byte)
+ : byte), CHAR_BIT );
+}
+
+template < std::size_t Bits >
+void
+crc_basic<Bits>::process_block
+(
+ void const * bytes_begin,
+ void const * bytes_end
+)
+{
+ for ( unsigned char const * p
+ = static_cast<unsigned char const *>(bytes_begin) ; p < bytes_end ; ++p )
+ {
+ process_byte( *p );
+ }
+}
+
+template < std::size_t Bits >
+inline
+void
+crc_basic<Bits>::process_bytes
+(
+ void const * buffer,
+ std::size_t byte_count
+)
+{
+ unsigned char const * const b = static_cast<unsigned char const *>(
+ buffer );
+
+ process_block( b, b + byte_count );
+}
+
+template < std::size_t Bits >
+inline
+typename crc_basic<Bits>::value_type
+crc_basic<Bits>::checksum
+(
+) const
+{
+ return ( (rft_out_ ? detail::reflector<Bits>::reflect( rem_ ) : rem_)
+ ^ final_ ) & masking_type::sig_bits;
+}
+
+
+// Optimized CRC class function definitions --------------------------------//
+
+// Macro to compact code
+#define BOOST_CRC_OPTIMAL_NAME crc_optimal<Bits, TruncPoly, InitRem, \
+ FinalXor, ReflectIn, ReflectRem>
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+BOOST_CRC_OPTIMAL_NAME::crc_optimal
+(
+ typename BOOST_CRC_OPTIMAL_NAME::value_type init_rem // = InitRem
+)
+ : rem_( helper_type::reflect(init_rem) )
+{
+ crc_table_type::init_table();
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+typename BOOST_CRC_OPTIMAL_NAME::value_type
+BOOST_CRC_OPTIMAL_NAME::get_truncated_polynominal
+(
+) const
+{
+ return TruncPoly;
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+typename BOOST_CRC_OPTIMAL_NAME::value_type
+BOOST_CRC_OPTIMAL_NAME::get_initial_remainder
+(
+) const
+{
+ return InitRem;
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+typename BOOST_CRC_OPTIMAL_NAME::value_type
+BOOST_CRC_OPTIMAL_NAME::get_final_xor_value
+(
+) const
+{
+ return FinalXor;
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+bool
+BOOST_CRC_OPTIMAL_NAME::get_reflect_input
+(
+) const
+{
+ return ReflectIn;
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+bool
+BOOST_CRC_OPTIMAL_NAME::get_reflect_remainder
+(
+) const
+{
+ return ReflectRem;
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+typename BOOST_CRC_OPTIMAL_NAME::value_type
+BOOST_CRC_OPTIMAL_NAME::get_interim_remainder
+(
+) const
+{
+ // Interim remainder should be _un_-reflected, so we have to undo it.
+ return helper_type::reflect( rem_ ) & masking_type::sig_bits_fast;
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+void
+BOOST_CRC_OPTIMAL_NAME::reset
+(
+ typename BOOST_CRC_OPTIMAL_NAME::value_type new_rem // = InitRem
+)
+{
+ rem_ = helper_type::reflect( new_rem );
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+void
+BOOST_CRC_OPTIMAL_NAME::process_byte
+(
+ unsigned char byte
+)
+{
+ process_bytes( &byte, sizeof(byte) );
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+void
+BOOST_CRC_OPTIMAL_NAME::process_block
+(
+ void const * bytes_begin,
+ void const * bytes_end
+)
+{
+ // Recompute the CRC for each byte passed
+ for ( unsigned char const * p
+ = static_cast<unsigned char const *>(bytes_begin) ; p < bytes_end ; ++p )
+ {
+ // Compare the new byte with the remainder's higher bits to
+ // get the new bits, shift out the remainder's current higher
+ // bits, and update the remainder with the polynominal division
+ // of the new bits.
+ unsigned char const byte_index = helper_type::index( rem_, *p );
+ rem_ = helper_type::shift( rem_ );
+ rem_ ^= crc_table_type::table_[ byte_index ];
+ }
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+void
+BOOST_CRC_OPTIMAL_NAME::process_bytes
+(
+ void const * buffer,
+ std::size_t byte_count
+)
+{
+ unsigned char const * const b = static_cast<unsigned char const *>(
+ buffer );
+ process_block( b, b + byte_count );
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+typename BOOST_CRC_OPTIMAL_NAME::value_type
+BOOST_CRC_OPTIMAL_NAME::checksum
+(
+) const
+{
+ return ( reflect_out_type::reflect(rem_) ^ get_final_xor_value() )
+ & masking_type::sig_bits_fast;
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+void
+BOOST_CRC_OPTIMAL_NAME::operator ()
+(
+ unsigned char byte
+)
+{
+ process_byte( byte );
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+typename BOOST_CRC_OPTIMAL_NAME::value_type
+BOOST_CRC_OPTIMAL_NAME::operator ()
+(
+) const
+{
+ return checksum();
+}
+
+
+// CRC computation function definition -------------------------------------//
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
+ BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor,
+ bool ReflectIn, bool ReflectRem >
+inline
+typename uint_t<Bits>::fast
+crc
+(
+ void const * buffer,
+ std::size_t byte_count
+ BOOST_CRC_DUMMY_INIT
+)
+{
+ BOOST_CRC_OPTIMAL_NAME computer;
+ computer.process_bytes( buffer, byte_count );
+ return computer.checksum();
+}
+
+
+// Augmented-message CRC computation function definitions ------------------//
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly >
+typename uint_t<Bits>::fast
+augmented_crc
+(
+ void const * buffer,
+ std::size_t byte_count,
+ typename uint_t<Bits>::fast initial_remainder
+ BOOST_ACRC_DUMMY_INIT
+)
+{
+ typedef unsigned char byte_type;
+ typedef detail::mask_uint_t<Bits> masking_type;
+ typedef detail::crc_table_t<Bits, TruncPoly, false> crc_table_type;
+
+ typename masking_type::fast rem = initial_remainder;
+ byte_type const * const b = static_cast<byte_type const *>( buffer );
+ byte_type const * const e = b + byte_count;
+
+ crc_table_type::init_table();
+ for ( byte_type const * p = b ; p < e ; ++p )
+ {
+ // Use the current top byte as the table index to the next
+ // "partial product." Shift out that top byte, shifting in
+ // the next augmented-message byte. Complete the division.
+ byte_type const byte_index = rem >> ( Bits - CHAR_BIT );
+ rem <<= CHAR_BIT;
+ rem |= *p;
+ rem ^= crc_table_type::table_[ byte_index ];
+ }
+
+ return rem & masking_type::sig_bits_fast;
+}
+
+template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly >
+inline
+typename uint_t<Bits>::fast
+augmented_crc
+(
+ void const * buffer,
+ std::size_t byte_count
+ BOOST_ACRC_DUMMY_INIT
+)
+{
+ // The last function argument has its type specified so the other version of
+ // augmented_crc will be called. If the cast wasn't in place, and the
+ // BOOST_ACRC_DUMMY_INIT added a third argument (for a workaround), the "0"
+ // would match as that third argument, leading to infinite recursion.
+ return augmented_crc<Bits, TruncPoly>( buffer, byte_count,
+ static_cast<typename uint_t<Bits>::fast>(0) );
+}
+
+
+} // namespace boost
+
+
+// Undo header-private macros
+#undef BOOST_CRC_OPTIMAL_NAME
+#undef BOOST_ACRC_DUMMY_INIT
+#undef BOOST_ACRC_DUMMY_PARM_TYPE
+#undef BOOST_CRC_DUMMY_INIT
+#undef BOOST_CRC_DUMMY_PARM_TYPE
+#undef BOOST_CRC_PARM_TYPE
+
+
+#endif // BOOST_CRC_HPP
+
--- /dev/null
+/*
+ *
+ * Copyright (c) 1998-2002
+ * John Maddock
+ *
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org/libs/regex for most recent version.
+ * FILE cregex.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares POSIX API functions
+ * + boost::RegEx high level wrapper.
+ */
+
+#ifndef BOOST_RE_CREGEX_HPP
+#define BOOST_RE_CREGEX_HPP
+
+#ifndef BOOST_REGEX_CONFIG_HPP
+#include <boost/regex/config.hpp>
+#endif
+
+#include <boost/regex/v4/cregex.hpp>
+
+#endif /* include guard */
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// boost cstdint.hpp header file ------------------------------------------//
+
+// (C) Copyright Beman Dawes 1999.
+// (C) Copyright Jens Mauer 2001
+// (C) Copyright John Maddock 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/integer for documentation.
+
+// Revision History
+// 31 Oct 01 use BOOST_HAS_LONG_LONG to check for "long long" (Jens M.)
+// 16 Apr 01 check LONGLONG_MAX when looking for "long long" (Jens Maurer)
+// 23 Jan 01 prefer "long" over "int" for int32_t and intmax_t (Jens Maurer)
+// 12 Nov 00 Merged <boost/stdint.h> (Jens Maurer)
+// 23 Sep 00 Added INTXX_C macro support (John Maddock).
+// 22 Sep 00 Better 64-bit support (John Maddock)
+// 29 Jun 00 Reimplement to avoid including stdint.h within namespace boost
+// 8 Aug 99 Initial version (Beman Dawes)
+
+
+#ifndef BOOST_CSTDINT_HPP
+#define BOOST_CSTDINT_HPP
+
+#include <boost/config.hpp>
+
+
+#ifdef BOOST_HAS_STDINT_H
+
+// The following #include is an implementation artifact; not part of interface.
+# ifdef __hpux
+// HP-UX has a vaguely nice <stdint.h> in a non-standard location
+# include <inttypes.h>
+# ifdef __STDC_32_MODE__
+ // this is triggered with GCC, because it defines __cplusplus < 199707L
+# define BOOST_NO_INT64_T
+# endif
+# elif defined(__FreeBSD__) || defined(__IBMCPP__)
+# include <inttypes.h>
+# else
+# include <stdint.h>
+
+// There is a bug in Cygwin two _C macros
+# if defined(__STDC_CONSTANT_MACROS) && defined(__CYGWIN__)
+# undef INTMAX_C
+# undef UINTMAX_C
+# define INTMAX_C(c) c##LL
+# define UINTMAX_C(c) c##ULL
+# endif
+
+# endif
+
+#ifdef __QNX__
+
+// QNX (Dinkumware stdlib) defines these as non-standard names.
+// Reflect to the standard names.
+
+typedef ::intleast8_t int_least8_t;
+typedef ::intfast8_t int_fast8_t;
+typedef ::uintleast8_t uint_least8_t;
+typedef ::uintfast8_t uint_fast8_t;
+
+typedef ::intleast16_t int_least16_t;
+typedef ::intfast16_t int_fast16_t;
+typedef ::uintleast16_t uint_least16_t;
+typedef ::uintfast16_t uint_fast16_t;
+
+typedef ::intleast32_t int_least32_t;
+typedef ::intfast32_t int_fast32_t;
+typedef ::uintleast32_t uint_least32_t;
+typedef ::uintfast32_t uint_fast32_t;
+
+# ifndef BOOST_NO_INT64_T
+
+typedef ::intleast64_t int_least64_t;
+typedef ::intfast64_t int_fast64_t;
+typedef ::uintleast64_t uint_least64_t;
+typedef ::uintfast64_t uint_fast64_t;
+
+# endif
+
+#endif
+
+namespace boost
+{
+
+ using ::int8_t;
+ using ::int_least8_t;
+ using ::int_fast8_t;
+ using ::uint8_t;
+ using ::uint_least8_t;
+ using ::uint_fast8_t;
+
+ using ::int16_t;
+ using ::int_least16_t;
+ using ::int_fast16_t;
+ using ::uint16_t;
+ using ::uint_least16_t;
+ using ::uint_fast16_t;
+
+ using ::int32_t;
+ using ::int_least32_t;
+ using ::int_fast32_t;
+ using ::uint32_t;
+ using ::uint_least32_t;
+ using ::uint_fast32_t;
+
+# ifndef BOOST_NO_INT64_T
+
+ using ::int64_t;
+ using ::int_least64_t;
+ using ::int_fast64_t;
+ using ::uint64_t;
+ using ::uint_least64_t;
+ using ::uint_fast64_t;
+
+# endif
+
+ using ::intmax_t;
+ using ::uintmax_t;
+
+} // namespace boost
+
+#elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__)
+// FreeBSD and Tru64 have an <inttypes.h> that contains much of what we need.
+# include <inttypes.h>
+
+namespace boost {
+
+ using ::int8_t;
+ typedef int8_t int_least8_t;
+ typedef int8_t int_fast8_t;
+ using ::uint8_t;
+ typedef uint8_t uint_least8_t;
+ typedef uint8_t uint_fast8_t;
+
+ using ::int16_t;
+ typedef int16_t int_least16_t;
+ typedef int16_t int_fast16_t;
+ using ::uint16_t;
+ typedef uint16_t uint_least16_t;
+ typedef uint16_t uint_fast16_t;
+
+ using ::int32_t;
+ typedef int32_t int_least32_t;
+ typedef int32_t int_fast32_t;
+ using ::uint32_t;
+ typedef uint32_t uint_least32_t;
+ typedef uint32_t uint_fast32_t;
+
+# ifndef BOOST_NO_INT64_T
+
+ using ::int64_t;
+ typedef int64_t int_least64_t;
+ typedef int64_t int_fast64_t;
+ using ::uint64_t;
+ typedef uint64_t uint_least64_t;
+ typedef uint64_t uint_fast64_t;
+
+ typedef int64_t intmax_t;
+ typedef uint64_t uintmax_t;
+
+# else
+
+ typedef int32_t intmax_t;
+ typedef uint32_t uintmax_t;
+
+# endif
+
+} // namespace boost
+
+#else // BOOST_HAS_STDINT_H
+
+# include <boost/limits.hpp> // implementation artifact; not part of interface
+
+
+namespace boost
+{
+
+// These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit
+// platforms. For other systems, they will have to be hand tailored.
+//
+// Because the fast types are assumed to be the same as the undecorated types,
+// it may be possible to hand tailor a more efficient implementation. Such
+// an optimization may be illusionary; on the Intel x86-family 386 on, for
+// example, byte arithmetic and load/stores are as fast as "int" sized ones.
+
+// 8-bit types ------------------------------------------------------------//
+
+# if UCHAR_MAX == 0xff
+ typedef signed char int8_t;
+ typedef signed char int_least8_t;
+ typedef signed char int_fast8_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned char uint_least8_t;
+ typedef unsigned char uint_fast8_t;
+# else
+# error defaults not correct; you must hand modify boost/cstdint.hpp
+# endif
+
+// 16-bit types -----------------------------------------------------------//
+
+# if USHRT_MAX == 0xffff
+# if defined(__crayx1)
+ // The Cray X1 has a 16-bit short, however it is not recommend
+ // for use in performance critical code.
+ typedef short int16_t;
+ typedef short int_least16_t;
+ typedef int int_fast16_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned short uint_least16_t;
+ typedef unsigned int uint_fast16_t;
+# else
+ typedef short int16_t;
+ typedef short int_least16_t;
+ typedef short int_fast16_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned short uint_least16_t;
+ typedef unsigned short uint_fast16_t;
+# endif
+# elif (USHRT_MAX == 0xffffffff) && defined(CRAY)
+ // no 16-bit types on Cray:
+ typedef short int_least16_t;
+ typedef short int_fast16_t;
+ typedef unsigned short uint_least16_t;
+ typedef unsigned short uint_fast16_t;
+# else
+# error defaults not correct; you must hand modify boost/cstdint.hpp
+# endif
+
+// 32-bit types -----------------------------------------------------------//
+
+# if ULONG_MAX == 0xffffffff
+ typedef long int32_t;
+ typedef long int_least32_t;
+ typedef long int_fast32_t;
+ typedef unsigned long uint32_t;
+ typedef unsigned long uint_least32_t;
+ typedef unsigned long uint_fast32_t;
+# elif UINT_MAX == 0xffffffff
+ typedef int int32_t;
+ typedef int int_least32_t;
+ typedef int int_fast32_t;
+ typedef unsigned int uint32_t;
+ typedef unsigned int uint_least32_t;
+ typedef unsigned int uint_fast32_t;
+# else
+# error defaults not correct; you must hand modify boost/cstdint.hpp
+# endif
+
+// 64-bit types + intmax_t and uintmax_t ----------------------------------//
+
+# if defined(BOOST_HAS_LONG_LONG) && \
+ !defined(BOOST_MSVC) && !defined(__BORLANDC__) && \
+ (!defined(__GLIBCPP__) || defined(_GLIBCPP_USE_LONG_LONG)) && \
+ (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
+# if defined(__hpux)
+ // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
+# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL)
+ // 2**64 - 1
+# else
+# error defaults not correct; you must hand modify boost/cstdint.hpp
+# endif
+
+ typedef ::boost::long_long_type intmax_t;
+ typedef ::boost::ulong_long_type uintmax_t;
+ typedef ::boost::long_long_type int64_t;
+ typedef ::boost::long_long_type int_least64_t;
+ typedef ::boost::long_long_type int_fast64_t;
+ typedef ::boost::ulong_long_type uint64_t;
+ typedef ::boost::ulong_long_type uint_least64_t;
+ typedef ::boost::ulong_long_type uint_fast64_t;
+
+# elif ULONG_MAX != 0xffffffff
+
+# if ULONG_MAX == 18446744073709551615 // 2**64 - 1
+ typedef long intmax_t;
+ typedef unsigned long uintmax_t;
+ typedef long int64_t;
+ typedef long int_least64_t;
+ typedef long int_fast64_t;
+ typedef unsigned long uint64_t;
+ typedef unsigned long uint_least64_t;
+ typedef unsigned long uint_fast64_t;
+# else
+# error defaults not correct; you must hand modify boost/cstdint.hpp
+# endif
+# elif defined(__GNUC__) && defined(BOOST_HAS_LONG_LONG)
+ __extension__ typedef long long intmax_t;
+ __extension__ typedef unsigned long long uintmax_t;
+ __extension__ typedef long long int64_t;
+ __extension__ typedef long long int_least64_t;
+ __extension__ typedef long long int_fast64_t;
+ __extension__ typedef unsigned long long uint64_t;
+ __extension__ typedef unsigned long long uint_least64_t;
+ __extension__ typedef unsigned long long uint_fast64_t;
+# elif defined(BOOST_HAS_MS_INT64)
+ //
+ // we have Borland/Intel/Microsoft __int64:
+ //
+ typedef __int64 intmax_t;
+ typedef unsigned __int64 uintmax_t;
+ typedef __int64 int64_t;
+ typedef __int64 int_least64_t;
+ typedef __int64 int_fast64_t;
+ typedef unsigned __int64 uint64_t;
+ typedef unsigned __int64 uint_least64_t;
+ typedef unsigned __int64 uint_fast64_t;
+# else // assume no 64-bit integers
+# define BOOST_NO_INT64_T
+ typedef int32_t intmax_t;
+ typedef uint32_t uintmax_t;
+# endif
+
+} // namespace boost
+
+
+#endif // BOOST_HAS_STDINT_H
+
+#endif // BOOST_CSTDINT_HPP
+
+
+/****************************************************
+
+Macro definition section:
+
+Define various INTXX_C macros only if
+__STDC_CONSTANT_MACROS is defined.
+
+Undefine the macros if __STDC_CONSTANT_MACROS is
+not defined and the macros are (cf <cassert>).
+
+Added 23rd September 2000 (John Maddock).
+Modified 11th September 2001 to be excluded when
+BOOST_HAS_STDINT_H is defined (John Maddock).
+
+******************************************************/
+
+#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(BOOST_HAS_STDINT_H)
+# define BOOST__STDC_CONSTANT_MACROS_DEFINED
+# if defined(BOOST_HAS_MS_INT64)
+//
+// Borland/Intel/Microsoft compilers have width specific suffixes:
+//
+# define INT8_C(value) value##i8
+# define INT16_C(value) value##i16
+# define INT32_C(value) value##i32
+# define INT64_C(value) value##i64
+# ifdef __BORLANDC__
+ // Borland bug: appending ui8 makes the type a signed char
+# define UINT8_C(value) static_cast<unsigned char>(value##u)
+# else
+# define UINT8_C(value) value##ui8
+# endif
+# define UINT16_C(value) value##ui16
+# define UINT32_C(value) value##ui32
+# define UINT64_C(value) value##ui64
+# define INTMAX_C(value) value##i64
+# define UINTMAX_C(value) value##ui64
+
+# else
+// do it the old fashioned way:
+
+// 8-bit types ------------------------------------------------------------//
+
+# if UCHAR_MAX == 0xff
+# define INT8_C(value) static_cast<boost::int8_t>(value)
+# define UINT8_C(value) static_cast<boost::uint8_t>(value##u)
+# endif
+
+// 16-bit types -----------------------------------------------------------//
+
+# if USHRT_MAX == 0xffff
+# define INT16_C(value) static_cast<boost::int16_t>(value)
+# define UINT16_C(value) static_cast<boost::uint16_t>(value##u)
+# endif
+
+// 32-bit types -----------------------------------------------------------//
+
+# if UINT_MAX == 0xffffffff
+# define INT32_C(value) value
+# define UINT32_C(value) value##u
+# elif ULONG_MAX == 0xffffffff
+# define INT32_C(value) value##L
+# define UINT32_C(value) value##uL
+# endif
+
+// 64-bit types + intmax_t and uintmax_t ----------------------------------//
+
+# if defined(BOOST_HAS_LONG_LONG) && \
+ (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
+
+# if defined(__hpux)
+ // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
+# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U) || \
+ (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615U) || \
+ (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615U)
+
+# else
+# error defaults not correct; you must hand modify boost/cstdint.hpp
+# endif
+# define INT64_C(value) value##LL
+# define UINT64_C(value) value##uLL
+# elif ULONG_MAX != 0xffffffff
+
+# if ULONG_MAX == 18446744073709551615 // 2**64 - 1
+# define INT64_C(value) value##L
+# define UINT64_C(value) value##uL
+# else
+# error defaults not correct; you must hand modify boost/cstdint.hpp
+# endif
+# endif
+
+# ifdef BOOST_NO_INT64_T
+# define INTMAX_C(value) INT32_C(value)
+# define UINTMAX_C(value) UINT32_C(value)
+# else
+# define INTMAX_C(value) INT64_C(value)
+# define UINTMAX_C(value) UINT64_C(value)
+# endif
+
+# endif // Borland/Microsoft specific width suffixes
+
+
+#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) && !defined(BOOST_HAS_STDINT_H)
+//
+// undef all the macros:
+//
+# undef INT8_C
+# undef INT16_C
+# undef INT32_C
+# undef INT64_C
+# undef UINT8_C
+# undef UINT16_C
+# undef UINT32_C
+# undef UINT64_C
+# undef INTMAX_C
+# undef UINTMAX_C
+
+#endif // __STDC_CONSTANT_MACROS_DEFINED etc.
+
+
+
+
--- /dev/null
+// 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
+
--- /dev/null
+#ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED
+#define BOOST_CURRENT_FUNCTION_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// boost/current_function.hpp - BOOST_CURRENT_FUNCTION
+//
+// 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)
+//
+// http://www.boost.org/libs/utility/current_function.html
+//
+
+namespace boost
+{
+
+namespace detail
+{
+
+inline void current_function_helper()
+{
+
+#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600))
+
+# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__
+
+#elif defined(__FUNCSIG__)
+
+# define BOOST_CURRENT_FUNCTION __FUNCSIG__
+
+#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
+
+# define BOOST_CURRENT_FUNCTION __FUNCTION__
+
+#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
+
+# define BOOST_CURRENT_FUNCTION __FUNC__
+
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
+
+# define BOOST_CURRENT_FUNCTION __func__
+
+#else
+
+# define BOOST_CURRENT_FUNCTION "(unknown)"
+
+#endif
+
+}
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED
--- /dev/null
+// --------------------------------------------------
+//
+// (C) Copyright Chuck Allison and Jeremy Siek 2001 - 2002.
+// (C) Copyright Gennaro Prota 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/dynamic_bitset for documentation.
+
+#ifndef BOOST_DYNAMIC_BITSET_HPP
+#define BOOST_DYNAMIC_BITSET_HPP
+
+#include "boost/dynamic_bitset/dynamic_bitset.hpp"
+
+#endif // include guard
--- /dev/null
+// --------------------------------------------------
+//
+// (C) Copyright Chuck Allison and Jeremy Siek 2001 - 2002.
+// (C) Copyright Gennaro Prota 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/dynamic_bitset for documentation.
+
+
+#ifndef BOOST_DYNAMIC_BITSET_FWD_HPP
+#define BOOST_DYNAMIC_BITSET_FWD_HPP
+
+#include <memory>
+
+namespace boost {
+
+template <typename Block = unsigned long,
+ typename Allocator = std::allocator<Block> >
+class dynamic_bitset;
+
+} // namespace boost
+
+#endif // include guard
--- /dev/null
+#ifndef DYNAMIC_PROPERTY_MAP_RG09302004_HPP
+#define DYNAMIC_PROPERTY_MAP_RG09302004_HPP
+
+// Copyright 2004-5 The Trustees of Indiana University.
+
+// 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)
+
+// dynamic_property_map.hpp -
+// Support for runtime-polymorphic property maps. This header is factored
+// out of Doug Gregor's routines for reading GraphML files for use in reading
+// GraphViz graph files.
+
+// Authors: Doug Gregor
+// Ronald Garcia
+//
+
+
+#include <boost/config.hpp>
+#include <boost/property_map.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/any.hpp>
+#include <boost/function/function3.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <typeinfo>
+#include <boost/mpl/bool.hpp>
+#include <stdexcept>
+#include <sstream>
+#include <map>
+#include <boost/type.hpp>
+
+namespace boost {
+
+namespace detail {
+
+ // read_value -
+ // A wrapper around lexical_cast, which does not behave as
+ // desired for std::string types.
+ template<typename Value>
+ inline Value read_value(const std::string& value)
+ { return boost::lexical_cast<Value>(value); }
+
+ template<>
+ inline std::string read_value<std::string>(const std::string& value)
+ { return value; }
+
+}
+
+
+// dynamic_property_map -
+// This interface supports polymorphic manipulation of property maps.
+class dynamic_property_map
+{
+public:
+ virtual ~dynamic_property_map() { }
+
+ virtual boost::any get(const any& key) = 0;
+ virtual std::string get_string(const any& key) = 0;
+ virtual void put(const any& key, const any& value) = 0;
+ virtual const std::type_info& key() const = 0;
+ virtual const std::type_info& value() const = 0;
+};
+
+
+//////////////////////////////////////////////////////////////////////
+// Property map exceptions
+//////////////////////////////////////////////////////////////////////
+
+struct dynamic_property_exception : public std::exception {
+ virtual ~dynamic_property_exception() throw() {}
+ virtual const char* what() const throw() = 0;
+};
+
+struct property_not_found : public dynamic_property_exception {
+ std::string property;
+ mutable std::string statement;
+ property_not_found(const std::string& property) : property(property) {}
+ virtual ~property_not_found() throw() {}
+
+ const char* what() const throw() {
+ if(statement.empty())
+ statement =
+ std::string("Property not found: ") + property + ".";
+
+ return statement.c_str();
+ }
+};
+
+struct dynamic_get_failure : public dynamic_property_exception {
+ std::string property;
+ mutable std::string statement;
+ dynamic_get_failure(const std::string& property) : property(property) {}
+ virtual ~dynamic_get_failure() throw() {}
+
+ const char* what() const throw() {
+ if(statement.empty())
+ statement =
+ std::string(
+ "dynamic property get cannot retrieve value for property: ")
+ + property + ".";
+
+ return statement.c_str();
+ }
+};
+
+struct dynamic_const_put_error : public dynamic_property_exception {
+ virtual ~dynamic_const_put_error() throw() {}
+
+ const char* what() const throw() {
+ return "Attempt to put a value into a const property map: ";
+ }
+};
+
+
+namespace detail {
+
+//
+// dynamic_property_map_adaptor -
+// property-map adaptor to support runtime polymorphism.
+template<typename PropertyMap>
+class dynamic_property_map_adaptor : public dynamic_property_map
+{
+ typedef typename property_traits<PropertyMap>::key_type key_type;
+ typedef typename property_traits<PropertyMap>::value_type value_type;
+ typedef typename property_traits<PropertyMap>::category category;
+
+ // do_put - overloaded dispatches from the put() member function.
+ // Attempts to "put" to a property map that does not model
+ // WritablePropertyMap result in a runtime exception.
+
+ // in_value must either hold an object of value_type or a string that
+ // can be converted to value_type via iostreams.
+ void do_put(const any& in_key, const any& in_value, mpl::bool_<true>)
+ {
+#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95))
+ using boost::put;
+#endif
+
+ key_type key = any_cast<key_type>(in_key);
+ if (in_value.type() == typeid(value_type)) {
+#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)
+ boost::put(property_map, key, any_cast<value_type>(in_value));
+#else
+ put(property_map, key, any_cast<value_type>(in_value));
+#endif
+ } else {
+ // if in_value is an empty string, put a default constructed value_type.
+ std::string v = any_cast<std::string>(in_value);
+ if (v.empty()) {
+#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)
+ boost::put(property_map, key, value_type());
+#else
+ put(property_map, key, value_type());
+#endif
+ } else {
+#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)
+ boost::put(property_map, key, detail::read_value<value_type>(v));
+#else
+ put(property_map, key, detail::read_value<value_type>(v));
+#endif
+ }
+ }
+ }
+
+ void do_put(const any&, const any&, mpl::bool_<false>)
+ {
+ throw dynamic_const_put_error();
+ }
+
+public:
+ explicit dynamic_property_map_adaptor(const PropertyMap& property_map)
+ : property_map(property_map) { }
+
+ virtual boost::any get(const any& key)
+ {
+#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)
+ return boost::get(property_map, any_cast<key_type>(key));
+#else
+ using boost::get;
+
+ return get(property_map, any_cast<key_type>(key));
+#endif
+ }
+
+ virtual std::string get_string(const any& key)
+ {
+#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)
+ std::ostringstream out;
+ out << boost::get(property_map, any_cast<key_type>(key));
+ return out.str();
+#else
+ using boost::get;
+
+ std::ostringstream out;
+ out << get(property_map, any_cast<key_type>(key));
+ return out.str();
+#endif
+ }
+
+ virtual void put(const any& in_key, const any& in_value)
+ {
+ do_put(in_key, in_value,
+ mpl::bool_<(is_convertible<category*,
+ writable_property_map_tag*>::value)>());
+ }
+
+ virtual const std::type_info& key() const { return typeid(key_type); }
+ virtual const std::type_info& value() const { return typeid(value_type); }
+
+ PropertyMap& base() { return property_map; }
+ const PropertyMap& base() const { return property_map; }
+
+private:
+ PropertyMap property_map;
+};
+
+} // namespace detail
+
+//
+// dynamic_properties -
+// container for dynamic property maps
+//
+struct dynamic_properties
+{
+ typedef std::multimap<std::string, dynamic_property_map*>
+ property_maps_type;
+ typedef boost::function3<std::auto_ptr<dynamic_property_map>,
+ const std::string&,
+ const boost::any&,
+ const boost::any&> generate_fn_type;
+public:
+
+ typedef property_maps_type::iterator iterator;
+ typedef property_maps_type::const_iterator const_iterator;
+
+ dynamic_properties() : generate_fn() { }
+ dynamic_properties(const generate_fn_type& g) : generate_fn(g) {}
+
+ ~dynamic_properties()
+ {
+ for (property_maps_type::iterator i = property_maps.begin();
+ i != property_maps.end(); ++i) {
+ delete i->second;
+ }
+ }
+
+ template<typename PropertyMap>
+ dynamic_properties&
+ property(const std::string& name, PropertyMap property_map)
+ {
+ // Tbd: exception safety
+ std::auto_ptr<dynamic_property_map> pm(
+ new detail::dynamic_property_map_adaptor<PropertyMap>(property_map));
+ property_maps_type::iterator i =
+ property_maps.insert(property_maps_type::value_type(name, 0));
+ i->second = pm.release();
+
+ return *this;
+ }
+
+ iterator begin() { return property_maps.begin(); }
+ const_iterator begin() const { return property_maps.begin(); }
+ iterator end() { return property_maps.end(); }
+ const_iterator end() const { return property_maps.end(); }
+
+ iterator lower_bound(const std::string& name)
+ { return property_maps.lower_bound(name); }
+
+ const_iterator lower_bound(const std::string& name) const
+ { return property_maps.lower_bound(name); }
+
+ void
+ insert(const std::string& name, std::auto_ptr<dynamic_property_map> pm)
+ {
+ property_maps.insert(property_maps_type::value_type(name, pm.release()));
+ }
+
+ template<typename Key, typename Value>
+ std::auto_ptr<dynamic_property_map>
+ generate(const std::string& name, const Key& key, const Value& value)
+ {
+ if(!generate_fn) {
+ throw property_not_found(name);
+ } else {
+ return generate_fn(name,key,value);
+ }
+ }
+
+private:
+ property_maps_type property_maps;
+ generate_fn_type generate_fn;
+};
+
+template<typename Key, typename Value>
+bool
+put(const std::string& name, dynamic_properties& dp, const Key& key,
+ const Value& value)
+{
+ for (dynamic_properties::iterator i = dp.lower_bound(name);
+ i != dp.end() && i->first == name; ++i) {
+ if (i->second->key() == typeid(key)) {
+ i->second->put(key, value);
+ return true;
+ }
+ }
+
+ std::auto_ptr<dynamic_property_map> new_map = dp.generate(name, key, value);
+ if (new_map.get()) {
+ new_map->put(key, value);
+ dp.insert(name, new_map);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+#ifndef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+template<typename Value, typename Key>
+Value
+get(const std::string& name, const dynamic_properties& dp, const Key& key)
+{
+ for (dynamic_properties::const_iterator i = dp.lower_bound(name);
+ i != dp.end() && i->first == name; ++i) {
+ if (i->second->key() == typeid(key))
+ return any_cast<Value>(i->second->get(key));
+ }
+
+ throw dynamic_get_failure(name);
+}
+#endif
+
+template<typename Value, typename Key>
+Value
+get(const std::string& name, const dynamic_properties& dp, const Key& key, type<Value>)
+{
+ for (dynamic_properties::const_iterator i = dp.lower_bound(name);
+ i != dp.end() && i->first == name; ++i) {
+ if (i->second->key() == typeid(key))
+ return any_cast<Value>(i->second->get(key));
+ }
+
+ throw dynamic_get_failure(name);
+}
+
+template<typename Key>
+std::string
+get(const std::string& name, const dynamic_properties& dp, const Key& key)
+{
+ for (dynamic_properties::const_iterator i = dp.lower_bound(name);
+ i != dp.end() && i->first == name; ++i) {
+ if (i->second->key() == typeid(key))
+ return i->second->get_string(key);
+ }
+
+ throw dynamic_get_failure(name);
+}
+
+
+}
+
+#endif // DYNAMIC_PROPERTY_MAP_RG09302004_HPP
--- /dev/null
+#ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
+#define BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
+
+//
+// enable_shared_from_this.hpp
+//
+// Copyright (c) 2002 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)
+//
+// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html
+//
+
+#include <boost/weak_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/assert.hpp>
+#include <boost/config.hpp>
+
+namespace boost
+{
+
+template<class T> class enable_shared_from_this
+{
+protected:
+
+ enable_shared_from_this()
+ {
+ }
+
+ enable_shared_from_this(enable_shared_from_this const &)
+ {
+ }
+
+ enable_shared_from_this & operator=(enable_shared_from_this const &)
+ {
+ return *this;
+ }
+
+ ~enable_shared_from_this()
+ {
+ }
+
+public:
+
+ shared_ptr<T> shared_from_this()
+ {
+ shared_ptr<T> p(_internal_weak_this);
+ BOOST_ASSERT(p.get() == this);
+ return p;
+ }
+
+ shared_ptr<T const> shared_from_this() const
+ {
+ shared_ptr<T const> p(_internal_weak_this);
+ BOOST_ASSERT(p.get() == this);
+ return p;
+ }
+
+ typedef T _internal_element_type; // for bcc 5.5.1
+ mutable weak_ptr<_internal_element_type> _internal_weak_this;
+};
+
+} // namespace boost
+
+#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
--- /dev/null
+// ----------------------------------------------------------------------------
+// format.hpp : primary header
+// ----------------------------------------------------------------------------
+
+// Copyright Samuel Krempp 2003. 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/format for library home page
+
+
+// ----------------------------------------------------------------------------
+
+#ifndef BOOST_FORMAT_HPP
+#define BOOST_FORMAT_HPP
+
+#include <vector>
+#include <string>
+#include <boost/detail/workaround.hpp>
+#include <boost/config.hpp>
+
+#ifndef BOOST_NO_STD_LOCALE
+#include <locale>
+#endif
+
+// *** Compatibility framework
+#include <boost/format/detail/compat_workarounds.hpp>
+
+#ifdef BOOST_NO_LOCALE_ISIDIGIT
+#include <cctype> // we'll use the non-locale <cctype>'s std::isdigit(int)
+#endif
+
+// **** Forward declarations ----------------------------------
+#include <boost/format/format_fwd.hpp> // basic_format<Ch,Tr>, and other frontends
+#include <boost/format/internals_fwd.hpp> // misc forward declarations for internal use
+
+// **** Auxiliary structs (stream_format_state<Ch,Tr> , and format_item<Ch,Tr> )
+#include <boost/format/internals.hpp>
+
+// **** Format class interface --------------------------------
+#include <boost/format/format_class.hpp>
+
+// **** Exceptions -----------------------------------------------
+#include <boost/format/exceptions.hpp>
+
+// **** Implementation -------------------------------------------
+#include <boost/format/format_implementation.hpp> // member functions
+#include <boost/format/group.hpp> // class for grouping arguments
+#include <boost/format/feed_args.hpp> // argument-feeding functions
+#include <boost/format/parsing.hpp> // format-string parsing (member-)functions
+
+// **** Implementation of the free functions ----------------------
+#include <boost/format/free_funcs.hpp>
+
+
+// *** Undefine 'local' macros :
+#include <boost/format/detail/unset_macros.hpp>
+
+#endif // BOOST_FORMAT_HPP
--- /dev/null
+// Boost.Function library
+
+// Copyright Douglas Gregor 2001-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)
+
+// For more information, see http://www.boost.org/libs/function
+
+// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the
+// design of this library.
+
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/detail/workaround.hpp>
+
+#ifndef BOOST_FUNCTION_MAX_ARGS
+# define BOOST_FUNCTION_MAX_ARGS 10
+#endif // BOOST_FUNCTION_MAX_ARGS
+
+// Include the prologue here so that the use of file-level iteration
+// in anything that may be included by function_template.hpp doesn't break
+#include <boost/function/detail/prologue.hpp>
+
+// Visual Age C++ doesn't handle the file iteration well
+#if BOOST_WORKAROUND(__IBMCPP__, >= 500)
+# if BOOST_FUNCTION_MAX_ARGS >= 0
+# include <boost/function/function0.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 1
+# include <boost/function/function1.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 2
+# include <boost/function/function2.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 3
+# include <boost/function/function3.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 4
+# include <boost/function/function4.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 5
+# include <boost/function/function5.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 6
+# include <boost/function/function6.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 7
+# include <boost/function/function7.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 8
+# include <boost/function/function8.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 9
+# include <boost/function/function9.hpp>
+# endif
+# if BOOST_FUNCTION_MAX_ARGS >= 10
+# include <boost/function/function10.hpp>
+# endif
+#else
+// What is the '3' for?
+# define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_FUNCTION_MAX_ARGS,<boost/function/detail/function_iterate.hpp>))
+# include BOOST_PP_ITERATE()
+# undef BOOST_PP_ITERATION_PARAMS_1
+#endif
--- /dev/null
+// Copyright Douglas Gregor 2004.
+// Copyright 2005 Peter Dimov
+
+// 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)
+
+// For more information, see http://www.boost.org
+#ifndef BOOST_FUNCTION_EQUAL_HPP
+#define BOOST_FUNCTION_EQUAL_HPP
+
+namespace boost {
+
+template<typename F, typename G>
+ bool function_equal_impl(const F& f, const G& g, long)
+ { return f == g; }
+
+// function_equal_impl needs to be unqualified to pick
+// user overloads on two-phase compilers
+
+template<typename F, typename G>
+ bool function_equal(const F& f, const G& g)
+ { return function_equal_impl(f, g, 0); }
+
+} // end namespace boost
+
+#endif // BOOST_FUNCTION_EQUAL_HPP
--- /dev/null
+// (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
--- /dev/null
+// ------------------------------------------------------------------------------
+// Boost functional.hpp header file
+// See http://www.boost.org/libs/functional for documentation.
+// ------------------------------------------------------------------------------
+// Copyright (c) 2000
+// Cadenza New Zealand Ltd
+//
+// 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 appears in all copies
+// and that both the copyright notice and this permission notice
+// appear in supporting documentation. Cadenza New Zealand Ltd makes
+// no representations about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+// ------------------------------------------------------------------------------
+// $Id$
+// ------------------------------------------------------------------------------
+
+#ifndef BOOST_FUNCTIONAL_HPP
+#define BOOST_FUNCTIONAL_HPP
+
+#include <boost/config.hpp>
+#include <boost/call_traits.hpp>
+#include <functional>
+
+namespace boost
+{
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // --------------------------------------------------------------------------
+ // The following traits classes allow us to avoid the need for ptr_fun
+ // because the types of arguments and the result of a function can be
+ // deduced.
+ //
+ // In addition to the standard types defined in unary_function and
+ // binary_function, we add
+ //
+ // - function_type, the type of the function or function object itself.
+ //
+ // - param_type, the type that should be used for passing the function or
+ // function object as an argument.
+ // --------------------------------------------------------------------------
+ namespace detail
+ {
+ template <class Operation>
+ struct unary_traits_imp;
+
+ template <class Operation>
+ struct unary_traits_imp<Operation*>
+ {
+ typedef Operation function_type;
+ typedef const function_type & param_type;
+ typedef typename Operation::result_type result_type;
+ typedef typename Operation::argument_type argument_type;
+ };
+
+ template <class R, class A>
+ struct unary_traits_imp<R(*)(A)>
+ {
+ typedef R (*function_type)(A);
+ typedef R (*param_type)(A);
+ typedef R result_type;
+ typedef A argument_type;
+ };
+
+ template <class Operation>
+ struct binary_traits_imp;
+
+ template <class Operation>
+ struct binary_traits_imp<Operation*>
+ {
+ typedef Operation function_type;
+ typedef const function_type & param_type;
+ typedef typename Operation::result_type result_type;
+ typedef typename Operation::first_argument_type first_argument_type;
+ typedef typename Operation::second_argument_type second_argument_type;
+ };
+
+ template <class R, class A1, class A2>
+ struct binary_traits_imp<R(*)(A1,A2)>
+ {
+ typedef R (*function_type)(A1,A2);
+ typedef R (*param_type)(A1,A2);
+ typedef R result_type;
+ typedef A1 first_argument_type;
+ typedef A2 second_argument_type;
+ };
+ } // namespace detail
+
+ template <class Operation>
+ struct unary_traits
+ {
+ typedef typename detail::unary_traits_imp<Operation*>::function_type function_type;
+ typedef typename detail::unary_traits_imp<Operation*>::param_type param_type;
+ typedef typename detail::unary_traits_imp<Operation*>::result_type result_type;
+ typedef typename detail::unary_traits_imp<Operation*>::argument_type argument_type;
+ };
+
+ template <class R, class A>
+ struct unary_traits<R(*)(A)>
+ {
+ typedef R (*function_type)(A);
+ typedef R (*param_type)(A);
+ typedef R result_type;
+ typedef A argument_type;
+ };
+
+ template <class Operation>
+ struct binary_traits
+ {
+ typedef typename detail::binary_traits_imp<Operation*>::function_type function_type;
+ typedef typename detail::binary_traits_imp<Operation*>::param_type param_type;
+ typedef typename detail::binary_traits_imp<Operation*>::result_type result_type;
+ typedef typename detail::binary_traits_imp<Operation*>::first_argument_type first_argument_type;
+ typedef typename detail::binary_traits_imp<Operation*>::second_argument_type second_argument_type;
+ };
+
+ template <class R, class A1, class A2>
+ struct binary_traits<R(*)(A1,A2)>
+ {
+ typedef R (*function_type)(A1,A2);
+ typedef R (*param_type)(A1,A2);
+ typedef R result_type;
+ typedef A1 first_argument_type;
+ typedef A2 second_argument_type;
+ };
+#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // --------------------------------------------------------------------------
+ // If we have no partial specialisation available, decay to a situation
+ // that is no worse than in the Standard, i.e., ptr_fun will be required.
+ // --------------------------------------------------------------------------
+
+ template <class Operation>
+ struct unary_traits
+ {
+ typedef Operation function_type;
+ typedef const Operation& param_type;
+ typedef typename Operation::result_type result_type;
+ typedef typename Operation::argument_type argument_type;
+ };
+
+ template <class Operation>
+ struct binary_traits
+ {
+ typedef Operation function_type;
+ typedef const Operation & param_type;
+ typedef typename Operation::result_type result_type;
+ typedef typename Operation::first_argument_type first_argument_type;
+ typedef typename Operation::second_argument_type second_argument_type;
+ };
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ // --------------------------------------------------------------------------
+ // unary_negate, not1
+ // --------------------------------------------------------------------------
+ template <class Predicate>
+ class unary_negate
+ : public std::unary_function<typename unary_traits<Predicate>::argument_type,bool>
+ {
+ public:
+ explicit unary_negate(typename unary_traits<Predicate>::param_type x)
+ :
+ pred(x)
+ {}
+ bool operator()(typename call_traits<typename unary_traits<Predicate>::argument_type>::param_type x) const
+ {
+ return !pred(x);
+ }
+ private:
+ typename unary_traits<Predicate>::function_type pred;
+ };
+
+ template <class Predicate>
+ unary_negate<Predicate> not1(const Predicate &pred)
+ {
+ // The cast is to placate Borland C++Builder in certain circumstances.
+ // I don't think it should be necessary.
+ return unary_negate<Predicate>((typename unary_traits<Predicate>::param_type)pred);
+ }
+
+ template <class Predicate>
+ unary_negate<Predicate> not1(Predicate &pred)
+ {
+ return unary_negate<Predicate>(pred);
+ }
+
+ // --------------------------------------------------------------------------
+ // binary_negate, not2
+ // --------------------------------------------------------------------------
+ template <class Predicate>
+ class binary_negate
+ : public std::binary_function<typename binary_traits<Predicate>::first_argument_type,
+ typename binary_traits<Predicate>::second_argument_type,
+ bool>
+ {
+ public:
+ explicit binary_negate(typename binary_traits<Predicate>::param_type x)
+ :
+ pred(x)
+ {}
+ bool operator()(typename call_traits<typename binary_traits<Predicate>::first_argument_type>::param_type x,
+ typename call_traits<typename binary_traits<Predicate>::second_argument_type>::param_type y) const
+ {
+ return !pred(x,y);
+ }
+ private:
+ typename binary_traits<Predicate>::function_type pred;
+ };
+
+ template <class Predicate>
+ binary_negate<Predicate> not2(const Predicate &pred)
+ {
+ // The cast is to placate Borland C++Builder in certain circumstances.
+ // I don't think it should be necessary.
+ return binary_negate<Predicate>((typename binary_traits<Predicate>::param_type)pred);
+ }
+
+ template <class Predicate>
+ binary_negate<Predicate> not2(Predicate &pred)
+ {
+ return binary_negate<Predicate>(pred);
+ }
+
+ // --------------------------------------------------------------------------
+ // binder1st, bind1st
+ // --------------------------------------------------------------------------
+ template <class Operation>
+ class binder1st
+ : public std::unary_function<typename binary_traits<Operation>::second_argument_type,
+ typename binary_traits<Operation>::result_type>
+ {
+ public:
+ binder1st(typename binary_traits<Operation>::param_type x,
+ typename call_traits<typename binary_traits<Operation>::first_argument_type>::param_type y)
+ :
+ op(x), value(y)
+ {}
+
+ typename binary_traits<Operation>::result_type
+ operator()(typename call_traits<typename binary_traits<Operation>::second_argument_type>::param_type x) const
+ {
+ return op(value, x);
+ }
+
+ protected:
+ typename binary_traits<Operation>::function_type op;
+ typename binary_traits<Operation>::first_argument_type value;
+ };
+
+ template <class Operation>
+ inline binder1st<Operation> bind1st(const Operation &op,
+ typename call_traits<
+ typename binary_traits<Operation>::first_argument_type
+ >::param_type x)
+ {
+ // The cast is to placate Borland C++Builder in certain circumstances.
+ // I don't think it should be necessary.
+ return binder1st<Operation>((typename binary_traits<Operation>::param_type)op, x);
+ }
+
+ template <class Operation>
+ inline binder1st<Operation> bind1st(Operation &op,
+ typename call_traits<
+ typename binary_traits<Operation>::first_argument_type
+ >::param_type x)
+ {
+ return binder1st<Operation>(op, x);
+ }
+
+ // --------------------------------------------------------------------------
+ // binder2nd, bind2nd
+ // --------------------------------------------------------------------------
+ template <class Operation>
+ class binder2nd
+ : public std::unary_function<typename binary_traits<Operation>::first_argument_type,
+ typename binary_traits<Operation>::result_type>
+ {
+ public:
+ binder2nd(typename binary_traits<Operation>::param_type x,
+ typename call_traits<typename binary_traits<Operation>::second_argument_type>::param_type y)
+ :
+ op(x), value(y)
+ {}
+
+ typename binary_traits<Operation>::result_type
+ operator()(typename call_traits<typename binary_traits<Operation>::first_argument_type>::param_type x) const
+ {
+ return op(x, value);
+ }
+
+ protected:
+ typename binary_traits<Operation>::function_type op;
+ typename binary_traits<Operation>::second_argument_type value;
+ };
+
+ template <class Operation>
+ inline binder2nd<Operation> bind2nd(const Operation &op,
+ typename call_traits<
+ typename binary_traits<Operation>::second_argument_type
+ >::param_type x)
+ {
+ // The cast is to placate Borland C++Builder in certain circumstances.
+ // I don't think it should be necessary.
+ return binder2nd<Operation>((typename binary_traits<Operation>::param_type)op, x);
+ }
+
+ template <class Operation>
+ inline binder2nd<Operation> bind2nd(Operation &op,
+ typename call_traits<
+ typename binary_traits<Operation>::second_argument_type
+ >::param_type x)
+ {
+ return binder2nd<Operation>(op, x);
+ }
+
+ // --------------------------------------------------------------------------
+ // mem_fun, etc
+ // --------------------------------------------------------------------------
+ template <class S, class T>
+ class mem_fun_t : public std::unary_function<T*, S>
+ {
+ public:
+ explicit mem_fun_t(S (T::*p)())
+ :
+ ptr(p)
+ {}
+ S operator()(T* p) const
+ {
+ return (p->*ptr)();
+ }
+ private:
+ S (T::*ptr)();
+ };
+
+ template <class S, class T, class A>
+ class mem_fun1_t : public std::binary_function<T*, A, S>
+ {
+ public:
+ explicit mem_fun1_t(S (T::*p)(A))
+ :
+ ptr(p)
+ {}
+ S operator()(T* p, typename call_traits<A>::param_type x) const
+ {
+ return (p->*ptr)(x);
+ }
+ private:
+ S (T::*ptr)(A);
+ };
+
+ template <class S, class T>
+ class const_mem_fun_t : public std::unary_function<const T*, S>
+ {
+ public:
+ explicit const_mem_fun_t(S (T::*p)() const)
+ :
+ ptr(p)
+ {}
+ S operator()(const T* p) const
+ {
+ return (p->*ptr)();
+ }
+ private:
+ S (T::*ptr)() const;
+ };
+
+ template <class S, class T, class A>
+ class const_mem_fun1_t : public std::binary_function<const T*, A, S>
+ {
+ public:
+ explicit const_mem_fun1_t(S (T::*p)(A) const)
+ :
+ ptr(p)
+ {}
+ S operator()(const T* p, typename call_traits<A>::param_type x) const
+ {
+ return (p->*ptr)(x);
+ }
+ private:
+ S (T::*ptr)(A) const;
+ };
+
+ template<class S, class T>
+ inline mem_fun_t<S,T> mem_fun(S (T::*f)())
+ {
+ return mem_fun_t<S,T>(f);
+ }
+
+ template<class S, class T, class A>
+ inline mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A))
+ {
+ return mem_fun1_t<S,T,A>(f);
+ }
+
+#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST
+ template<class S, class T>
+ inline const_mem_fun_t<S,T> mem_fun(S (T::*f)() const)
+ {
+ return const_mem_fun_t<S,T>(f);
+ }
+
+ template<class S, class T, class A>
+ inline const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const)
+ {
+ return const_mem_fun1_t<S,T,A>(f);
+ }
+#endif // BOOST_NO_POINTER_TO_MEMBER_CONST
+
+ // --------------------------------------------------------------------------
+ // mem_fun_ref, etc
+ // --------------------------------------------------------------------------
+ template <class S, class T>
+ class mem_fun_ref_t : public std::unary_function<T&, S>
+ {
+ public:
+ explicit mem_fun_ref_t(S (T::*p)())
+ :
+ ptr(p)
+ {}
+ S operator()(T& p) const
+ {
+ return (p.*ptr)();
+ }
+ private:
+ S (T::*ptr)();
+ };
+
+ template <class S, class T, class A>
+ class mem_fun1_ref_t : public std::binary_function<T&, A, S>
+ {
+ public:
+ explicit mem_fun1_ref_t(S (T::*p)(A))
+ :
+ ptr(p)
+ {}
+ S operator()(T& p, typename call_traits<A>::param_type x) const
+ {
+ return (p.*ptr)(x);
+ }
+ private:
+ S (T::*ptr)(A);
+ };
+
+ template <class S, class T>
+ class const_mem_fun_ref_t : public std::unary_function<const T&, S>
+ {
+ public:
+ explicit const_mem_fun_ref_t(S (T::*p)() const)
+ :
+ ptr(p)
+ {}
+
+ S operator()(const T &p) const
+ {
+ return (p.*ptr)();
+ }
+ private:
+ S (T::*ptr)() const;
+ };
+
+ template <class S, class T, class A>
+ class const_mem_fun1_ref_t : public std::binary_function<const T&, A, S>
+ {
+ public:
+ explicit const_mem_fun1_ref_t(S (T::*p)(A) const)
+ :
+ ptr(p)
+ {}
+
+ S operator()(const T& p, typename call_traits<A>::param_type x) const
+ {
+ return (p.*ptr)(x);
+ }
+ private:
+ S (T::*ptr)(A) const;
+ };
+
+ template<class S, class T>
+ inline mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)())
+ {
+ return mem_fun_ref_t<S,T>(f);
+ }
+
+ template<class S, class T, class A>
+ inline mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A))
+ {
+ return mem_fun1_ref_t<S,T,A>(f);
+ }
+
+#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST
+ template<class S, class T>
+ inline const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const)
+ {
+ return const_mem_fun_ref_t<S,T>(f);
+ }
+
+ template<class S, class T, class A>
+ inline const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const)
+ {
+ return const_mem_fun1_ref_t<S,T,A>(f);
+ }
+#endif // BOOST_NO_POINTER_TO_MEMBER_CONST
+
+ // --------------------------------------------------------------------------
+ // ptr_fun
+ // --------------------------------------------------------------------------
+ template <class Arg, class Result>
+ class pointer_to_unary_function : public std::unary_function<Arg,Result>
+ {
+ public:
+ explicit pointer_to_unary_function(Result (*f)(Arg))
+ :
+ func(f)
+ {}
+
+ Result operator()(typename call_traits<Arg>::param_type x) const
+ {
+ return func(x);
+ }
+
+ private:
+ Result (*func)(Arg);
+ };
+
+ template <class Arg, class Result>
+ inline pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg))
+ {
+ return pointer_to_unary_function<Arg,Result>(f);
+ }
+
+ template <class Arg1, class Arg2, class Result>
+ class pointer_to_binary_function : public std::binary_function<Arg1,Arg2,Result>
+ {
+ public:
+ explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2))
+ :
+ func(f)
+ {}
+
+ Result operator()(typename call_traits<Arg1>::param_type x, typename call_traits<Arg2>::param_type y) const
+ {
+ return func(x,y);
+ }
+
+ private:
+ Result (*func)(Arg1, Arg2);
+ };
+
+ template <class Arg1, class Arg2, class Result>
+ inline pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1, Arg2))
+ {
+ return pointer_to_binary_function<Arg1,Arg2,Result>(f);
+ }
+} // namespace boost
+
+#endif
--- /dev/null
+// (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
+
--- /dev/null
+// Copyright Peter Dimov and David Abrahams 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 GET_POINTER_DWA20021219_HPP
+# define GET_POINTER_DWA20021219_HPP
+
+# include <memory>
+
+namespace boost {
+
+// get_pointer(p) extracts a ->* capable pointer from p
+
+template<class T> T * get_pointer(T * p)
+{
+ return p;
+}
+
+// get_pointer(shared_ptr<T> const & p) has been moved to shared_ptr.hpp
+
+template<class T> T * get_pointer(std::auto_ptr<T> const& p)
+{
+ return p.get();
+}
+
+
+} // namespace boost
+
+#endif // GET_POINTER_DWA20021219_HPP
--- /dev/null
+// 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 IMPLICIT_CAST_DWA200356_HPP
+# define IMPLICIT_CAST_DWA200356_HPP
+
+# include <boost/mpl/identity.hpp>
+
+namespace boost {
+
+// implementation originally suggested by C. Green in
+// http://lists.boost.org/MailArchives/boost/msg00886.php
+
+// The use of identity creates a non-deduced form, so that the
+// explicit template argument must be supplied
+template <typename T>
+inline T implicit_cast (typename mpl::identity<T>::type x) {
+ return x;
+}
+
+// incomplete return type now is here
+//template <typename T>
+//void implicit_cast (...);
+
+// Macro for when you need a constant expression (Gennaro Prota)
+#define BOOST_IMPLICIT_CAST(dst_type, expr) \
+ ( sizeof( implicit_cast<dst_type>(expr) ) \
+ , \
+ static_cast<dst_type>(expr) \
+ )
+
+} // namespace boost
+
+#endif // IMPLICIT_CAST_DWA200356_HPP
--- /dev/null
+#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
--- /dev/null
+// boost integer.hpp header file -------------------------------------------//
+
+// Copyright Beman Dawes and Daryle Walker 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/integer for documentation.
+
+// Revision History
+// 22 Sep 01 Added value-based integer templates. (Daryle Walker)
+// 01 Apr 01 Modified to use new <boost/limits.hpp> header. (John Maddock)
+// 30 Jul 00 Add typename syntax fix (Jens Maurer)
+// 28 Aug 99 Initial version
+
+#ifndef BOOST_INTEGER_HPP
+#define BOOST_INTEGER_HPP
+
+#include <boost/integer_fwd.hpp> // self include
+
+#include <boost/integer_traits.hpp> // for boost::integer_traits
+#include <boost/limits.hpp> // for std::numeric_limits
+
+namespace boost
+{
+
+ // Helper templates ------------------------------------------------------//
+
+ // fast integers from least integers
+ // int_fast_t<> works correctly for unsigned too, in spite of the name.
+ template< typename LeastInt >
+ struct int_fast_t { typedef LeastInt fast; }; // imps may specialize
+
+ // convert category to type
+ template< int Category > struct int_least_helper {}; // default is empty
+
+ // specializatons: 1=long, 2=int, 3=short, 4=signed char,
+ // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned long
+ // no specializations for 0 and 5: requests for a type > long are in error
+ template<> struct int_least_helper<1> { typedef long least; };
+ template<> struct int_least_helper<2> { typedef int least; };
+ template<> struct int_least_helper<3> { typedef short least; };
+ template<> struct int_least_helper<4> { typedef signed char least; };
+ template<> struct int_least_helper<6> { typedef unsigned long least; };
+ template<> struct int_least_helper<7> { typedef unsigned int least; };
+ template<> struct int_least_helper<8> { typedef unsigned short least; };
+ template<> struct int_least_helper<9> { typedef unsigned char least; };
+
+ // integer templates specifying number of bits ---------------------------//
+
+ // signed
+ template< int Bits > // bits (including sign) required
+ struct int_t
+ {
+ typedef typename int_least_helper
+ <
+ (Bits-1 <= std::numeric_limits<long>::digits) +
+ (Bits-1 <= std::numeric_limits<int>::digits) +
+ (Bits-1 <= std::numeric_limits<short>::digits) +
+ (Bits-1 <= std::numeric_limits<signed char>::digits)
+ >::least least;
+ typedef typename int_fast_t<least>::fast fast;
+ };
+
+ // unsigned
+ template< int Bits > // bits required
+ struct uint_t
+ {
+ typedef typename int_least_helper
+ <
+ 5 +
+ (Bits <= std::numeric_limits<unsigned long>::digits) +
+ (Bits <= std::numeric_limits<unsigned int>::digits) +
+ (Bits <= std::numeric_limits<unsigned short>::digits) +
+ (Bits <= std::numeric_limits<unsigned char>::digits)
+ >::least least;
+ typedef typename int_fast_t<least>::fast fast;
+ // int_fast_t<> works correctly for unsigned too, in spite of the name.
+ };
+
+ // integer templates specifying extreme value ----------------------------//
+
+ // signed
+ template< long MaxValue > // maximum value to require support
+ struct int_max_value_t
+ {
+ typedef typename int_least_helper
+ <
+ (MaxValue <= integer_traits<long>::const_max) +
+ (MaxValue <= integer_traits<int>::const_max) +
+ (MaxValue <= integer_traits<short>::const_max) +
+ (MaxValue <= integer_traits<signed char>::const_max)
+ >::least least;
+ typedef typename int_fast_t<least>::fast fast;
+ };
+
+ template< long MinValue > // minimum value to require support
+ struct int_min_value_t
+ {
+ typedef typename int_least_helper
+ <
+ (MinValue >= integer_traits<long>::const_min) +
+ (MinValue >= integer_traits<int>::const_min) +
+ (MinValue >= integer_traits<short>::const_min) +
+ (MinValue >= integer_traits<signed char>::const_min)
+ >::least least;
+ typedef typename int_fast_t<least>::fast fast;
+ };
+
+ // unsigned
+ template< unsigned long Value > // maximum value to require support
+ struct uint_value_t
+ {
+ typedef typename int_least_helper
+ <
+ 5 +
+ (Value <= integer_traits<unsigned long>::const_max) +
+ (Value <= integer_traits<unsigned int>::const_max) +
+ (Value <= integer_traits<unsigned short>::const_max) +
+ (Value <= integer_traits<unsigned char>::const_max)
+ >::least least;
+ typedef typename int_fast_t<least>::fast fast;
+ };
+
+
+} // namespace boost
+
+#endif // BOOST_INTEGER_HPP
--- /dev/null
+// Boost integer_fwd.hpp header file ---------------------------------------//
+
+// (C) Copyright Dave Abrahams and 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/libs/integer for documentation.
+
+#ifndef BOOST_INTEGER_FWD_HPP
+#define BOOST_INTEGER_FWD_HPP
+
+#include <climits> // for UCHAR_MAX, etc.
+#include <cstddef> // for std::size_t
+
+#include <boost/config.hpp> // for BOOST_NO_INTRINSIC_WCHAR_T
+#include <boost/limits.hpp> // for std::numeric_limits
+
+
+namespace boost
+{
+
+
+// From <boost/cstdint.hpp> ------------------------------------------------//
+
+// Only has typedefs or using statements, with #conditionals
+
+
+// From <boost/integer_traits.hpp> -----------------------------------------//
+
+template < class T >
+ class integer_traits;
+
+template < >
+ class integer_traits< bool >;
+
+template < >
+ class integer_traits< char >;
+
+template < >
+ class integer_traits< signed char >;
+
+template < >
+ class integer_traits< unsigned char >;
+
+#ifndef BOOST_NO_INTRINSIC_WCHAR_T
+template < >
+ class integer_traits< wchar_t >;
+#endif
+
+template < >
+ class integer_traits< short >;
+
+template < >
+ class integer_traits< unsigned short >;
+
+template < >
+ class integer_traits< int >;
+
+template < >
+ class integer_traits< unsigned int >;
+
+template < >
+ class integer_traits< long >;
+
+template < >
+ class integer_traits< unsigned long >;
+
+#ifdef ULLONG_MAX
+template < >
+ class integer_traits< ::boost::long_long_type>;
+
+template < >
+ class integer_traits< ::boost::ulong_long_type >;
+#endif
+
+
+// From <boost/integer.hpp> ------------------------------------------------//
+
+template < typename LeastInt >
+ struct int_fast_t;
+
+template< int Bits >
+ struct int_t;
+
+template< int Bits >
+ struct uint_t;
+
+template< long MaxValue >
+ struct int_max_value_t;
+
+template< long MinValue >
+ struct int_min_value_t;
+
+template< unsigned long Value >
+ struct uint_value_t;
+
+
+// From <boost/integer/integer_mask.hpp> -----------------------------------//
+
+template < std::size_t Bit >
+ struct high_bit_mask_t;
+
+template < std::size_t Bits >
+ struct low_bits_mask_t;
+
+template < >
+ struct low_bits_mask_t< ::std::numeric_limits<unsigned char>::digits >;
+
+#if USHRT_MAX > UCHAR_MAX
+template < >
+ struct low_bits_mask_t< ::std::numeric_limits<unsigned short>::digits >;
+#endif
+
+#if UINT_MAX > USHRT_MAX
+template < >
+ struct low_bits_mask_t< ::std::numeric_limits<unsigned int>::digits >;
+#endif
+
+#if ULONG_MAX > UINT_MAX
+template < >
+ struct low_bits_mask_t< ::std::numeric_limits<unsigned long>::digits >;
+#endif
+
+
+// From <boost/integer/static_log2.hpp> ------------------------------------//
+
+template < unsigned long Value >
+ struct static_log2;
+
+template < >
+ struct static_log2< 0ul >;
+
+
+// From <boost/integer/static_min_max.hpp> ---------------------------------//
+
+template < long Value1, long Value2 >
+ struct static_signed_min;
+
+template < long Value1, long Value2 >
+ struct static_signed_max;
+
+template < unsigned long Value1, unsigned long Value2 >
+ struct static_unsigned_min;
+
+template < unsigned long Value1, unsigned long Value2 >
+ struct static_unsigned_max;
+
+
+} // namespace boost
+
+
+#endif // BOOST_INTEGER_FWD_HPP
--- /dev/null
+/* boost integer_traits.hpp header file
+ *
+ * Copyright Jens Maurer 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)
+ *
+ * $Id$
+ *
+ * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
+ */
+
+// See http://www.boost.org/libs/integer for documentation.
+
+
+#ifndef BOOST_INTEGER_TRAITS_HPP
+#define BOOST_INTEGER_TRAITS_HPP
+
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+
+// These are an implementation detail and not part of the interface
+#include <limits.h>
+// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it,
+// and some may have <wchar.h> but not <cwchar> ...
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun))
+#include <wchar.h>
+#endif
+
+
+namespace boost {
+template<class T>
+class integer_traits : public std::numeric_limits<T>
+{
+public:
+ BOOST_STATIC_CONSTANT(bool, is_integral = false);
+};
+
+namespace detail {
+template<class T, T min_val, T max_val>
+class integer_traits_base
+{
+public:
+ BOOST_STATIC_CONSTANT(bool, is_integral = true);
+ BOOST_STATIC_CONSTANT(T, const_min = min_val);
+ BOOST_STATIC_CONSTANT(T, const_max = max_val);
+};
+
+#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+// A definition is required even for integral static constants
+template<class T, T min_val, T max_val>
+const bool integer_traits_base<T, min_val, max_val>::is_integral;
+
+template<class T, T min_val, T max_val>
+const T integer_traits_base<T, min_val, max_val>::const_min;
+
+template<class T, T min_val, T max_val>
+const T integer_traits_base<T, min_val, max_val>::const_max;
+#endif
+
+} // namespace detail
+
+template<>
+class integer_traits<bool>
+ : public std::numeric_limits<bool>,
+ public detail::integer_traits_base<bool, false, true>
+{ };
+
+template<>
+class integer_traits<char>
+ : public std::numeric_limits<char>,
+ public detail::integer_traits_base<char, CHAR_MIN, CHAR_MAX>
+{ };
+
+template<>
+class integer_traits<signed char>
+ : public std::numeric_limits<signed char>,
+ public detail::integer_traits_base<signed char, SCHAR_MIN, SCHAR_MAX>
+{ };
+
+template<>
+class integer_traits<unsigned char>
+ : public std::numeric_limits<unsigned char>,
+ public detail::integer_traits_base<unsigned char, 0, UCHAR_MAX>
+{ };
+
+#ifndef BOOST_NO_INTRINSIC_WCHAR_T
+template<>
+class integer_traits<wchar_t>
+ : public std::numeric_limits<wchar_t>,
+ // Don't trust WCHAR_MIN and WCHAR_MAX with Mac OS X's native
+ // library: they are wrong!
+#if defined(WCHAR_MIN) && defined(WCHAR_MAX) && !defined(__APPLE__)
+ public detail::integer_traits_base<wchar_t, WCHAR_MIN, WCHAR_MAX>
+#elif defined(__BORLANDC__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__BEOS__) && defined(__GNUC__))
+ // No WCHAR_MIN and WCHAR_MAX, whar_t is short and unsigned:
+ public detail::integer_traits_base<wchar_t, 0, 0xffff>
+#elif (defined(__sgi) && (!defined(__SGI_STL_PORT) || __SGI_STL_PORT < 0x400))\
+ || (defined __APPLE__)\
+ || (defined(__OpenBSD__) && defined(__GNUC__))\
+ || (defined(__NetBSD__) && defined(__GNUC__))\
+ || (defined(__FreeBSD__) && defined(__GNUC__))\
+ || (defined(__DragonFly__) && defined(__GNUC__))\
+ || (defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 3) && !defined(__SGI_STL_PORT))
+ // No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as int.
+ // - SGI MIPSpro with native library
+ // - gcc 3.x on HP-UX
+ // - Mac OS X with native library
+ // - gcc on FreeBSD, OpenBSD and NetBSD
+ public detail::integer_traits_base<wchar_t, INT_MIN, INT_MAX>
+#elif defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 2) && !defined(__SGI_STL_PORT)
+ // No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as unsigned int.
+ // - gcc 2.95.x on HP-UX
+ // (also, std::numeric_limits<wchar_t> appears to return the wrong values).
+ public detail::integer_traits_base<wchar_t, 0, UINT_MAX>
+#else
+#error No WCHAR_MIN and WCHAR_MAX present, please adjust integer_traits<> for your compiler.
+#endif
+{ };
+#endif // BOOST_NO_INTRINSIC_WCHAR_T
+
+template<>
+class integer_traits<short>
+ : public std::numeric_limits<short>,
+ public detail::integer_traits_base<short, SHRT_MIN, SHRT_MAX>
+{ };
+
+template<>
+class integer_traits<unsigned short>
+ : public std::numeric_limits<unsigned short>,
+ public detail::integer_traits_base<unsigned short, 0, USHRT_MAX>
+{ };
+
+template<>
+class integer_traits<int>
+ : public std::numeric_limits<int>,
+ public detail::integer_traits_base<int, INT_MIN, INT_MAX>
+{ };
+
+template<>
+class integer_traits<unsigned int>
+ : public std::numeric_limits<unsigned int>,
+ public detail::integer_traits_base<unsigned int, 0, UINT_MAX>
+{ };
+
+template<>
+class integer_traits<long>
+ : public std::numeric_limits<long>,
+ public detail::integer_traits_base<long, LONG_MIN, LONG_MAX>
+{ };
+
+template<>
+class integer_traits<unsigned long>
+ : public std::numeric_limits<unsigned long>,
+ public detail::integer_traits_base<unsigned long, 0, ULONG_MAX>
+{ };
+
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T)
+#if defined(ULLONG_MAX) && defined(BOOST_HAS_LONG_LONG)
+
+template<>
+class integer_traits< ::boost::long_long_type>
+ : public std::numeric_limits< ::boost::long_long_type>,
+ public detail::integer_traits_base< ::boost::long_long_type, LLONG_MIN, LLONG_MAX>
+{ };
+
+template<>
+class integer_traits< ::boost::ulong_long_type>
+ : public std::numeric_limits< ::boost::ulong_long_type>,
+ public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULLONG_MAX>
+{ };
+
+#elif defined(ULONG_LONG_MAX) && defined(BOOST_HAS_LONG_LONG)
+
+template<>
+class integer_traits< ::boost::long_long_type> : public std::numeric_limits< ::boost::long_long_type>, public detail::integer_traits_base< ::boost::long_long_type, LONG_LONG_MIN, LONG_LONG_MAX>{ };
+template<>
+class integer_traits< ::boost::ulong_long_type>
+ : public std::numeric_limits< ::boost::ulong_long_type>,
+ public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONG_LONG_MAX>
+{ };
+
+#elif defined(ULONGLONG_MAX) && defined(BOOST_HAS_LONG_LONG)
+
+template<>
+class integer_traits< ::boost::long_long_type>
+ : public std::numeric_limits< ::boost::long_long_type>,
+ public detail::integer_traits_base< ::boost::long_long_type, LONGLONG_MIN, LONGLONG_MAX>
+{ };
+
+template<>
+class integer_traits< ::boost::ulong_long_type>
+ : public std::numeric_limits< ::boost::ulong_long_type>,
+ public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONGLONG_MAX>
+{ };
+
+#elif defined(_LLONG_MAX) && defined(_C2) && defined(BOOST_HAS_LONG_LONG)
+
+template<>
+class integer_traits< ::boost::long_long_type>
+ : public std::numeric_limits< ::boost::long_long_type>,
+ public detail::integer_traits_base< ::boost::long_long_type, -_LLONG_MAX - _C2, _LLONG_MAX>
+{ };
+
+template<>
+class integer_traits< ::boost::ulong_long_type>
+ : public std::numeric_limits< ::boost::ulong_long_type>,
+ public detail::integer_traits_base< ::boost::ulong_long_type, 0, _ULLONG_MAX>
+{ };
+
+#elif defined(BOOST_HAS_LONG_LONG)
+//
+// we have long long but no constants, this happens for example with gcc in -ansi mode,
+// we'll just have to work out the values for ourselves (assumes 2's compliment representation):
+//
+template<>
+class integer_traits< ::boost::long_long_type>
+ : public std::numeric_limits< ::boost::long_long_type>,
+ public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) - 1)), ~(1LL << (sizeof(::boost::long_long_type) - 1))>
+{ };
+
+template<>
+class integer_traits< ::boost::ulong_long_type>
+ : public std::numeric_limits< ::boost::ulong_long_type>,
+ public detail::integer_traits_base< ::boost::ulong_long_type, 0, ~0uLL>
+{ };
+
+#endif
+#endif
+
+} // namespace boost
+
+#endif /* BOOST_INTEGER_TRAITS_HPP */
+
+
+
--- /dev/null
+#ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED
+#define BOOST_INTRUSIVE_PTR_HPP_INCLUDED
+
+//
+// intrusive_ptr.hpp
+//
+// Copyright (c) 2001, 2002 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)
+//
+// See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for documentation.
+//
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
+# pragma warning(push)
+# pragma warning(disable:4284) // odd return type for operator->
+#endif
+
+#include <boost/assert.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <functional> // for std::less
+#include <iosfwd> // for std::basic_ostream
+
+
+namespace boost
+{
+
+//
+// intrusive_ptr
+//
+// A smart pointer that uses intrusive reference counting.
+//
+// Relies on unqualified calls to
+//
+// void intrusive_ptr_add_ref(T * p);
+// void intrusive_ptr_release(T * p);
+//
+// (p != 0)
+//
+// The object is responsible for destroying itself.
+//
+
+template<class T> class intrusive_ptr
+{
+private:
+
+ typedef intrusive_ptr this_type;
+
+public:
+
+ typedef T element_type;
+
+ intrusive_ptr(): p_(0)
+ {
+ }
+
+ intrusive_ptr(T * p, bool add_ref = true): p_(p)
+ {
+ if(p_ != 0 && add_ref) intrusive_ptr_add_ref(p_);
+ }
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+
+ template<class U> intrusive_ptr(intrusive_ptr<U> const & rhs): p_(rhs.get())
+ {
+ if(p_ != 0) intrusive_ptr_add_ref(p_);
+ }
+
+#endif
+
+ intrusive_ptr(intrusive_ptr const & rhs): p_(rhs.p_)
+ {
+ if(p_ != 0) intrusive_ptr_add_ref(p_);
+ }
+
+ ~intrusive_ptr()
+ {
+ if(p_ != 0) intrusive_ptr_release(p_);
+ }
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+
+ template<class U> intrusive_ptr & operator=(intrusive_ptr<U> const & rhs)
+ {
+ this_type(rhs).swap(*this);
+ return *this;
+ }
+
+#endif
+
+ intrusive_ptr & operator=(intrusive_ptr const & rhs)
+ {
+ this_type(rhs).swap(*this);
+ return *this;
+ }
+
+ intrusive_ptr & operator=(T * rhs)
+ {
+ this_type(rhs).swap(*this);
+ return *this;
+ }
+
+ T * get() const
+ {
+ return p_;
+ }
+
+ T & operator*() const
+ {
+ return *p_;
+ }
+
+ T * operator->() const
+ {
+ return p_;
+ }
+
+#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
+
+ operator bool () const
+ {
+ return p_ != 0;
+ }
+
+#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+ typedef T * (this_type::*unspecified_bool_type)() const;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return p_ == 0? 0: &this_type::get;
+ }
+
+#else
+
+ typedef T * this_type::*unspecified_bool_type;
+
+ operator unspecified_bool_type () const
+ {
+ return p_ == 0? 0: &this_type::p_;
+ }
+
+#endif
+
+ // operator! is a Borland-specific workaround
+ bool operator! () const
+ {
+ return p_ == 0;
+ }
+
+ void swap(intrusive_ptr & rhs)
+ {
+ T * tmp = p_;
+ p_ = rhs.p_;
+ rhs.p_ = tmp;
+ }
+
+private:
+
+ T * p_;
+};
+
+template<class T, class U> inline bool operator==(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b)
+{
+ return a.get() == b.get();
+}
+
+template<class T, class U> inline bool operator!=(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b)
+{
+ return a.get() != b.get();
+}
+
+template<class T> inline bool operator==(intrusive_ptr<T> const & a, T * b)
+{
+ return a.get() == b;
+}
+
+template<class T> inline bool operator!=(intrusive_ptr<T> const & a, T * b)
+{
+ return a.get() != b;
+}
+
+template<class T> inline bool operator==(T * a, intrusive_ptr<T> const & b)
+{
+ return a == b.get();
+}
+
+template<class T> inline bool operator!=(T * a, intrusive_ptr<T> const & b)
+{
+ return a != b.get();
+}
+
+#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96
+
+// Resolve the ambiguity between our op!= and the one in rel_ops
+
+template<class T> inline bool operator!=(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b)
+{
+ return a.get() != b.get();
+}
+
+#endif
+
+template<class T> inline bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b)
+{
+ return std::less<T *>()(a.get(), b.get());
+}
+
+template<class T> void swap(intrusive_ptr<T> & lhs, intrusive_ptr<T> & rhs)
+{
+ lhs.swap(rhs);
+}
+
+// mem_fn support
+
+template<class T> T * get_pointer(intrusive_ptr<T> const & p)
+{
+ return p.get();
+}
+
+template<class T, class U> intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U> const & p)
+{
+ return static_cast<T *>(p.get());
+}
+
+template<class T, class U> intrusive_ptr<T> const_pointer_cast(intrusive_ptr<U> const & p)
+{
+ return const_cast<T *>(p.get());
+}
+
+template<class T, class U> intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U> const & p)
+{
+ return dynamic_cast<T *>(p.get());
+}
+
+// operator<<
+
+#if defined(__GNUC__) && (__GNUC__ < 3)
+
+template<class Y> std::ostream & operator<< (std::ostream & os, intrusive_ptr<Y> const & p)
+{
+ os << p.get();
+ return os;
+}
+
+#else
+
+# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT)
+// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL
+using std::basic_ostream;
+template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, intrusive_ptr<Y> const & p)
+# else
+template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, intrusive_ptr<Y> const & p)
+# endif
+{
+ os << p.get();
+ return os;
+}
+
+#endif
+
+} // namespace boost
+
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
+#endif // #ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED
--- /dev/null
+// Boost io_fwd.hpp header file --------------------------------------------//
+
+// Copyright 2002 Daryle Walker. Use, modification, and distribution are subject
+// to the Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
+
+// See <http://www.boost.org/libs/io/> for the library's home page.
+
+#ifndef BOOST_IO_FWD_HPP
+#define BOOST_IO_FWD_HPP
+
+#include <iosfwd> // for std::char_traits (declaration)
+
+
+namespace boost
+{
+namespace io
+{
+
+
+// From <boost/io/ios_state.hpp> -------------------------------------------//
+
+class ios_flags_saver;
+class ios_precision_saver;
+class ios_width_saver;
+class ios_base_all_saver;
+
+template < typename Ch, class Tr = ::std::char_traits<Ch> >
+ class basic_ios_iostate_saver;
+template < typename Ch, class Tr = ::std::char_traits<Ch> >
+ class basic_ios_exception_saver;
+template < typename Ch, class Tr = ::std::char_traits<Ch> >
+ class basic_ios_tie_saver;
+template < typename Ch, class Tr = ::std::char_traits<Ch> >
+ class basic_ios_rdbuf_saver;
+template < typename Ch, class Tr = ::std::char_traits<Ch> >
+ class basic_ios_fill_saver;
+template < typename Ch, class Tr = ::std::char_traits<Ch> >
+ class basic_ios_locale_saver;
+template < typename Ch, class Tr = ::std::char_traits<Ch> >
+ class basic_ios_all_saver;
+
+typedef basic_ios_iostate_saver<char> ios_iostate_saver;
+typedef basic_ios_iostate_saver<wchar_t> wios_iostate_saver;
+typedef basic_ios_exception_saver<char> ios_exception_saver;
+typedef basic_ios_exception_saver<wchar_t> wios_exception_saver;
+typedef basic_ios_tie_saver<char> ios_tie_saver;
+typedef basic_ios_tie_saver<wchar_t> wios_tie_saver;
+typedef basic_ios_rdbuf_saver<char> ios_rdbuf_saver;
+typedef basic_ios_rdbuf_saver<wchar_t> wios_rdbuf_saver;
+typedef basic_ios_fill_saver<char> ios_fill_saver;
+typedef basic_ios_fill_saver<wchar_t> wios_fill_saver;
+typedef basic_ios_locale_saver<char> ios_locale_saver;
+typedef basic_ios_locale_saver<wchar_t> wios_locale_saver;
+typedef basic_ios_all_saver<char> ios_all_saver;
+typedef basic_ios_all_saver<wchar_t> wios_all_saver;
+
+class ios_iword_saver;
+class ios_pword_saver;
+class ios_all_word_saver;
+
+
+} // namespace io
+} // namespace boost
+
+
+#endif // BOOST_IO_FWD_HPP
--- /dev/null
+// interator.hpp workarounds for non-conforming standard libraries ---------//
+
+// (C) Copyright Beman Dawes 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)
+
+// See http://www.boost.org/libs/utility for documentation.
+
+// Revision History
+// 12 Jan 01 added <cstddef> for std::ptrdiff_t (Jens Maurer)
+// 28 Jun 00 Workarounds to deal with known MSVC bugs (David Abrahams)
+// 26 Jun 00 Initial version (Jeremy Siek)
+
+#ifndef BOOST_ITERATOR_HPP
+#define BOOST_ITERATOR_HPP
+
+#include <iterator>
+#include <cstddef> // std::ptrdiff_t
+#include <boost/config.hpp>
+
+namespace boost
+{
+# if defined(BOOST_NO_STD_ITERATOR) && !defined(BOOST_MSVC_STD_ITERATOR)
+ template <class Category, class T,
+ class Distance = std::ptrdiff_t,
+ class Pointer = T*, class Reference = T&>
+ struct iterator
+ {
+ typedef T value_type;
+ typedef Distance difference_type;
+ typedef Pointer pointer;
+ typedef Reference reference;
+ typedef Category iterator_category;
+ };
+# else
+
+ // declare iterator_base in namespace detail to work around MSVC bugs which
+ // prevent derivation from an identically-named class in a different namespace.
+ namespace detail {
+ template <class Category, class T, class Distance, class Pointer, class Reference>
+# if !defined(BOOST_MSVC_STD_ITERATOR)
+ struct iterator_base : std::iterator<Category, T, Distance, Pointer, Reference> {};
+# else
+ struct iterator_base : std::iterator<Category, T, Distance>
+ {
+ typedef Reference reference;
+ typedef Pointer pointer;
+ typedef Distance difference_type;
+ };
+# endif
+ }
+
+ template <class Category, class T, class Distance = std::ptrdiff_t,
+ class Pointer = T*, class Reference = T&>
+ struct iterator : detail::iterator_base<Category, T, Distance, Pointer, Reference> {};
+# endif
+} // namespace boost
+
+#endif // BOOST_ITERATOR_HPP
--- /dev/null
+// 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)
+#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
--- /dev/null
+// last_value function object (documented as part of Boost.Signals)
+
+// Copyright Douglas Gregor 2001-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)
+
+// For more information, see http://www.boost.org/libs/signals
+
+#ifndef BOOST_LAST_VALUE_HPP
+#define BOOST_LAST_VALUE_HPP
+
+#include <cassert>
+
+namespace boost {
+ template<typename T>
+ struct last_value {
+ typedef T result_type;
+
+ template<typename InputIterator>
+ T operator()(InputIterator first, InputIterator last) const
+ {
+ assert(first != last);
+ T value = *first++;
+ while (first != last)
+ value = *first++;
+ return value;
+ }
+ };
+
+ template<>
+ struct last_value<void> {
+ struct unusable {};
+
+ public:
+ typedef unusable result_type;
+
+ template<typename InputIterator>
+ result_type
+ operator()(InputIterator first, InputIterator last) const
+ {
+ while (first != last)
+ *first++;
+ return result_type();
+ }
+ };
+}
+#endif // BOOST_SIGNALS_LAST_VALUE_HPP
--- /dev/null
+#ifndef BOOST_LEXICAL_CAST_INCLUDED
+#define BOOST_LEXICAL_CAST_INCLUDED
+
+// Boost lexical_cast.hpp header -------------------------------------------//
+//
+// See http://www.boost.org for most recent version including documentation.
+// See end of this header for rights and permissions.
+//
+// what: lexical_cast custom keyword cast
+// who: contributed by Kevlin Henney,
+// enhanced with contributions from Terje Slettebø,
+// with additional fixes and suggestions from Gennaro Prota,
+// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
+// and other Boosters
+// when: November 2000, March 2003, June 2005
+
+#include <cstddef>
+#include <string>
+#include <typeinfo>
+#include <boost/config.hpp>
+#include <boost/limits.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+
+#ifdef BOOST_NO_STRINGSTREAM
+#include <strstream>
+#else
+#include <sstream>
+#endif
+
+#if defined(BOOST_NO_STRINGSTREAM) || \
+ defined(BOOST_NO_STD_WSTRING) || \
+ defined(BOOST_NO_STD_LOCALE)
+#define DISABLE_WIDE_CHAR_SUPPORT
+#endif
+
+namespace boost
+{
+ // exception used to indicate runtime lexical_cast failure
+ class bad_lexical_cast : public std::bad_cast
+ {
+ public:
+ bad_lexical_cast() :
+ source(&typeid(void)), target(&typeid(void))
+ {
+ }
+ bad_lexical_cast(
+ const std::type_info &source_type,
+ const std::type_info &target_type) :
+ source(&source_type), target(&target_type)
+ {
+ }
+ const std::type_info &source_type() const
+ {
+ return *source;
+ }
+ const std::type_info &target_type() const
+ {
+ return *target;
+ }
+ virtual const char *what() const throw()
+ {
+ return "bad lexical cast: "
+ "source type value could not be interpreted as target";
+ }
+ virtual ~bad_lexical_cast() throw()
+ {
+ }
+ private:
+ const std::type_info *source;
+ const std::type_info *target;
+ };
+
+ namespace detail // selectors for choosing stream character type
+ {
+ template<typename Type>
+ struct stream_char
+ {
+ typedef char type;
+ };
+
+ #ifndef DISABLE_WIDE_CHAR_SUPPORT
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+ template<>
+ struct stream_char<wchar_t>
+ {
+ typedef wchar_t type;
+ };
+#endif
+
+ template<>
+ struct stream_char<wchar_t *>
+ {
+ typedef wchar_t type;
+ };
+
+ template<>
+ struct stream_char<const wchar_t *>
+ {
+ typedef wchar_t type;
+ };
+
+ template<>
+ struct stream_char<std::wstring>
+ {
+ typedef wchar_t type;
+ };
+ #endif
+
+ template<typename TargetChar, typename SourceChar>
+ struct widest_char
+ {
+ typedef TargetChar type;
+ };
+
+ template<>
+ struct widest_char<char, wchar_t>
+ {
+ typedef wchar_t type;
+ };
+ }
+
+ namespace detail // stream wrapper for handling lexical conversions
+ {
+ template<typename Target, typename Source>
+ class lexical_stream
+ {
+ private:
+ typedef typename widest_char<
+ typename stream_char<Target>::type,
+ typename stream_char<Source>::type>::type char_type;
+
+ public:
+ lexical_stream()
+ {
+ stream.unsetf(std::ios::skipws);
+
+ if(std::numeric_limits<Target>::is_specialized)
+ stream.precision(std::numeric_limits<Target>::digits10 + 1);
+ else if(std::numeric_limits<Source>::is_specialized)
+ stream.precision(std::numeric_limits<Source>::digits10 + 1);
+ }
+ ~lexical_stream()
+ {
+ #if defined(BOOST_NO_STRINGSTREAM)
+ stream.freeze(false);
+ #endif
+ }
+ bool operator<<(const Source &input)
+ {
+ return !(stream << input).fail();
+ }
+ template<typename InputStreamable>
+ bool operator>>(InputStreamable &output)
+ {
+ return !is_pointer<InputStreamable>::value &&
+ stream >> output &&
+ stream.get() ==
+#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING)
+// GCC 2.9x lacks std::char_traits<>::eof().
+// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3
+// configurations, which do provide std::char_traits<>::eof().
+
+ EOF;
+#else
+ std::char_traits<char_type>::eof();
+#endif
+ }
+ bool operator>>(std::string &output)
+ {
+ #if defined(BOOST_NO_STRINGSTREAM)
+ stream << '\0';
+ #endif
+ output = stream.str();
+ return true;
+ }
+ #ifndef DISABLE_WIDE_CHAR_SUPPORT
+ bool operator>>(std::wstring &output)
+ {
+ output = stream.str();
+ return true;
+ }
+ #endif
+ private:
+ #if defined(BOOST_NO_STRINGSTREAM)
+ std::strstream stream;
+ #elif defined(BOOST_NO_STD_LOCALE)
+ std::stringstream stream;
+ #else
+ std::basic_stringstream<char_type> stream;
+ #endif
+ };
+ }
+
+ #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ // call-by-const reference version
+
+ namespace detail
+ {
+ template<class T>
+ struct array_to_pointer_decay
+ {
+ typedef T type;
+ };
+
+ template<class T, std::size_t N>
+ struct array_to_pointer_decay<T[N]>
+ {
+ typedef const T * type;
+ };
+ }
+
+ template<typename Target, typename Source>
+ Target lexical_cast(const Source &arg)
+ {
+ typedef typename detail::array_to_pointer_decay<Source>::type NewSource;
+
+ detail::lexical_stream<Target, NewSource> interpreter;
+ Target result;
+
+ if(!(interpreter << arg && interpreter >> result))
+ throw_exception(bad_lexical_cast(typeid(NewSource), typeid(Target)));
+ return result;
+ }
+
+ #else
+
+ // call-by-value fallback version (deprecated)
+
+ template<typename Target, typename Source>
+ Target lexical_cast(Source arg)
+ {
+ detail::lexical_stream<Target, Source> interpreter;
+ Target result;
+
+ if(!(interpreter << arg && interpreter >> result))
+ throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
+ return result;
+ }
+
+ #endif
+}
+
+// Copyright Kevlin Henney, 2000-2005. All rights reserved.
+//
+// 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)
+
+#undef DISABLE_WIDE_CHAR_SUPPORT
+#endif
--- /dev/null
+
+// (C) Copyright John maddock 1999.
+// (C) David Abrahams 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)
+//
+// use this header as a workaround for missing <limits>
+
+// See http://www.boost.org/libs/utility/limits.html for documentation.
+
+#ifndef BOOST_LIMITS
+#define BOOST_LIMITS
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_NO_LIMITS
+# include <boost/detail/limits.hpp>
+#else
+# include <limits>
+#endif
+
+#if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \
+ || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS))
+// Add missing specializations for numeric_limits:
+#ifdef BOOST_HAS_MS_INT64
+# define BOOST_LLT __int64
+# define BOOST_ULLT unsigned __int64
+#else
+# define BOOST_LLT ::boost::long_long_type
+# define BOOST_ULLT ::boost::ulong_long_type
+#endif
+
+namespace std
+{
+ template<>
+ class numeric_limits<BOOST_LLT>
+ {
+ public:
+
+ BOOST_STATIC_CONSTANT(bool, is_specialized = true);
+#ifdef BOOST_HAS_MS_INT64
+ static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x8000000000000000i64; }
+ static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x7FFFFFFFFFFFFFFFi64; }
+#elif defined(LLONG_MAX)
+ static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MIN; }
+ static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MAX; }
+#elif defined(LONGLONG_MAX)
+ static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MIN; }
+ static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MAX; }
+#else
+ static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); }
+ static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~(min)(); }
+#endif
+ BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
+ BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
+ BOOST_STATIC_CONSTANT(bool, is_signed = true);
+ BOOST_STATIC_CONSTANT(bool, is_integer = true);
+ BOOST_STATIC_CONSTANT(bool, is_exact = true);
+ BOOST_STATIC_CONSTANT(int, radix = 2);
+ static BOOST_LLT epsilon() throw() { return 0; };
+ static BOOST_LLT round_error() throw() { return 0; };
+
+ BOOST_STATIC_CONSTANT(int, min_exponent = 0);
+ BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
+ BOOST_STATIC_CONSTANT(int, max_exponent = 0);
+ BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
+
+ BOOST_STATIC_CONSTANT(bool, has_infinity = false);
+ BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
+ BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
+ BOOST_STATIC_CONSTANT(bool, has_denorm = false);
+ BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
+ static BOOST_LLT infinity() throw() { return 0; };
+ static BOOST_LLT quiet_NaN() throw() { return 0; };
+ static BOOST_LLT signaling_NaN() throw() { return 0; };
+ static BOOST_LLT denorm_min() throw() { return 0; };
+
+ BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
+ BOOST_STATIC_CONSTANT(bool, is_bounded = false);
+ BOOST_STATIC_CONSTANT(bool, is_modulo = false);
+
+ BOOST_STATIC_CONSTANT(bool, traps = false);
+ BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
+ BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
+
+ };
+
+ template<>
+ class numeric_limits<BOOST_ULLT>
+ {
+ public:
+
+ BOOST_STATIC_CONSTANT(bool, is_specialized = true);
+#ifdef BOOST_HAS_MS_INT64
+ static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0ui64; }
+ static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0xFFFFFFFFFFFFFFFFui64; }
+#elif defined(ULLONG_MAX) && defined(ULLONG_MIN)
+ static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MIN; }
+ static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MAX; }
+#elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN)
+ static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MIN; }
+ static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MAX; }
+#else
+ static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0uLL; }
+ static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~0uLL; }
+#endif
+ BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT);
+ BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000);
+ BOOST_STATIC_CONSTANT(bool, is_signed = false);
+ BOOST_STATIC_CONSTANT(bool, is_integer = true);
+ BOOST_STATIC_CONSTANT(bool, is_exact = true);
+ BOOST_STATIC_CONSTANT(int, radix = 2);
+ static BOOST_ULLT epsilon() throw() { return 0; };
+ static BOOST_ULLT round_error() throw() { return 0; };
+
+ BOOST_STATIC_CONSTANT(int, min_exponent = 0);
+ BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
+ BOOST_STATIC_CONSTANT(int, max_exponent = 0);
+ BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
+
+ BOOST_STATIC_CONSTANT(bool, has_infinity = false);
+ BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
+ BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
+ BOOST_STATIC_CONSTANT(bool, has_denorm = false);
+ BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
+ static BOOST_ULLT infinity() throw() { return 0; };
+ static BOOST_ULLT quiet_NaN() throw() { return 0; };
+ static BOOST_ULLT signaling_NaN() throw() { return 0; };
+ static BOOST_ULLT denorm_min() throw() { return 0; };
+
+ BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
+ BOOST_STATIC_CONSTANT(bool, is_bounded = false);
+ BOOST_STATIC_CONSTANT(bool, is_modulo = false);
+
+ BOOST_STATIC_CONSTANT(bool, traps = false);
+ BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
+ BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
+
+ };
+}
+#endif
+
+#endif
--- /dev/null
+// Boost math_fwd.hpp header file ------------------------------------------//
+
+// (C) Copyright Hubert Holin and Daryle Walker 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/math for documentation.
+
+#ifndef BOOST_MATH_FWD_HPP
+#define BOOST_MATH_FWD_HPP
+
+
+namespace boost
+{
+namespace math
+{
+
+
+// From <boost/math/quaternion.hpp> ----------------------------------------//
+
+template < typename T >
+ class quaternion;
+
+template < >
+ class quaternion< float >;
+template < >
+ class quaternion< double >;
+template < >
+ class quaternion< long double >;
+
+// Also has many function templates (including operators)
+
+
+// From <boost/math/octonion.hpp> ------------------------------------------//
+
+template < typename T >
+ class octonion;
+
+template < >
+ class octonion< float >;
+template < >
+ class octonion< double >;
+template < >
+ class octonion< long double >;
+
+// Also has many function templates (including operators)
+
+
+// From <boost/math/special_functions/acosh.hpp> ---------------------------//
+
+// Only has function template
+
+
+// From <boost/math/special_functions/asinh.hpp> ---------------------------//
+
+// Only has function template
+
+
+// From <boost/math/special_functions/atanh.hpp> ---------------------------//
+
+// Only has function template
+
+
+// From <boost/math/special_functions/sinc.hpp> ----------------------------//
+
+// Only has function templates
+
+
+// From <boost/math/special_functions/sinhc.hpp> ---------------------------//
+
+// Only has function templates
+
+
+// From <boost/math/common_factor.hpp> -------------------------------------//
+
+// Only #includes other headers
+
+
+// From <boost/math/common_factor_ct.hpp> ----------------------------------//
+
+template < unsigned long Value1, unsigned long Value2 >
+ struct static_gcd;
+template < unsigned long Value1, unsigned long Value2 >
+ struct static_lcm;
+
+
+// From <boost/math/common_factor_rt.hpp> ----------------------------------//
+
+template < typename IntegerType >
+ class gcd_evaluator;
+template < typename IntegerType >
+ class lcm_evaluator;
+
+// Also has a couple of function templates
+
+
+} // namespace math
+} // namespace boost
+
+
+#endif // BOOST_MATH_FWD_HPP
--- /dev/null
+#ifndef BOOST_MEM_FN_HPP_INCLUDED
+#define BOOST_MEM_FN_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// mem_fn.hpp - a generalization of std::mem_fun[_ref]
+//
+// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2001 David Abrahams
+// Copyright (c) 2003-2005 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)
+//
+// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
+//
+
+#include <boost/config.hpp>
+#include <boost/get_pointer.hpp>
+#include <boost/detail/workaround.hpp>
+
+namespace boost
+{
+
+#if defined(BOOST_NO_VOID_RETURNS)
+
+#define BOOST_MEM_FN_CLASS_F , class F
+#define BOOST_MEM_FN_TYPEDEF(X)
+
+namespace _mfi // mem_fun_impl
+{
+
+template<class V> struct mf
+{
+
+#define BOOST_MEM_FN_RETURN return
+
+#define BOOST_MEM_FN_NAME(X) inner_##X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#undef BOOST_MEM_FN_RETURN
+
+}; // struct mf<V>
+
+template<> struct mf<void>
+{
+
+#define BOOST_MEM_FN_RETURN
+
+#define BOOST_MEM_FN_NAME(X) inner_##X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#undef BOOST_MEM_FN_RETURN
+
+}; // struct mf<void>
+
+#undef BOOST_MEM_FN_CLASS_F
+#undef BOOST_MEM_FN_TYPEDEF_F
+
+#define BOOST_MEM_FN_NAME(X) X
+#define BOOST_MEM_FN_NAME2(X) inner_##X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_vw.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_NAME2
+#undef BOOST_MEM_FN_CC
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) X##_cdecl
+#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_vw.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_NAME2
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_stdcall
+#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_vw.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_NAME2
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_fastcall
+#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_vw.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_NAME2
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+} // namespace _mfi
+
+#else // #ifdef BOOST_NO_VOID_RETURNS
+
+#define BOOST_MEM_FN_CLASS_F
+#define BOOST_MEM_FN_TYPEDEF(X) typedef X;
+
+namespace _mfi
+{
+
+#define BOOST_MEM_FN_RETURN return
+
+#define BOOST_MEM_FN_NAME(X) X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#undef BOOST_MEM_FN_RETURN
+
+} // namespace _mfi
+
+#undef BOOST_MEM_FN_CLASS_F
+#undef BOOST_MEM_FN_TYPEDEF
+
+#endif // #ifdef BOOST_NO_VOID_RETURNS
+
+#define BOOST_MEM_FN_NAME(X) X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_cc.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_CC
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_cc.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_cc.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_cc.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+// data member support
+
+namespace _mfi
+{
+
+template<class R, class T> class dm
+{
+public:
+
+ typedef R const & result_type;
+ typedef T const * argument_type;
+
+private:
+
+ typedef R (T::*F);
+ F f_;
+
+ template<class U> R const & call(U & u, T const *) const
+ {
+ return (u.*f_);
+ }
+
+ template<class U> R & call(U & u, T *) const
+ {
+ return (u.*f_);
+ }
+
+ template<class U> R const & call(U & u, void const *) const
+ {
+ return (get_pointer(u)->*f_);
+ }
+
+public:
+
+ explicit dm(F f): f_(f) {}
+
+ R & operator()(T * p) const
+ {
+ return (p->*f_);
+ }
+
+ R const & operator()(T const * p) const
+ {
+ return (p->*f_);
+ }
+
+ template<class U> R const & operator()(U & u) const
+ {
+ return call(u, &u);
+ }
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200)
+
+ R & operator()(T & t) const
+ {
+ return (t.*f_);
+ }
+
+#endif
+
+ R const & operator()(T const & t) const
+ {
+ return (t.*f_);
+ }
+
+ bool operator==(dm const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(dm const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+} // namespace _mfi
+
+template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f)
+{
+ return _mfi::dm<R, T>(f);
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED
--- /dev/null
+// Copyright 2002 The Trustees of Indiana University.
+
+// 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)
+
+// Boost.MultiArray Library
+// Authors: Ronald Garcia
+// Jeremy Siek
+// Andrew Lumsdaine
+// See http://www.boost.org/libs/multi_array for documentation.
+
+#ifndef BOOST_MULTI_ARRAY_RG071801_HPP
+#define BOOST_MULTI_ARRAY_RG071801_HPP
+
+//
+// multi_array.hpp - contains the multi_array class template
+// declaration and definition
+//
+
+#include "boost/multi_array/base.hpp"
+#include "boost/multi_array/collection_concept.hpp"
+#include "boost/multi_array/copy_array.hpp"
+#include "boost/multi_array/iterator.hpp"
+#include "boost/multi_array/subarray.hpp"
+#include "boost/multi_array/multi_array_ref.hpp"
+#include "boost/multi_array/algorithm.hpp"
+#include "boost/array.hpp"
+#include "boost/mpl/if.hpp"
+#include "boost/type_traits.hpp"
+#include <algorithm>
+#include <cstddef>
+#include <functional>
+#include <numeric>
+#include <vector>
+
+
+
+namespace boost {
+ namespace detail {
+ namespace multi_array {
+
+ struct populate_index_ranges {
+ multi_array_types::index_range
+ operator()(multi_array_types::index base,
+ multi_array_types::size_type extent) {
+ return multi_array_types::index_range(base,base+extent);
+ }
+ };
+
+#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+//
+// Compilers that don't support partial ordering may need help to
+// disambiguate multi_array's templated constructors. Even vc6/7 are
+// capable of some limited SFINAE, so we take the most-general version
+// out of the overload set with disable_multi_array_impl.
+//
+template <typename T, std::size_t NumDims, typename TPtr>
+char is_multi_array_impl_help(const_multi_array_view<T,NumDims,TPtr>&);
+template <typename T, std::size_t NumDims, typename TPtr>
+char is_multi_array_impl_help(const_sub_array<T,NumDims,TPtr>&);
+template <typename T, std::size_t NumDims, typename TPtr>
+char is_multi_array_impl_help(const_multi_array_ref<T,NumDims,TPtr>&);
+
+char ( &is_multi_array_impl_help(...) )[2];
+
+template <class T>
+struct is_multi_array_impl
+{
+ static T x;
+ BOOST_STATIC_CONSTANT(bool, value = sizeof((is_multi_array_impl_help)(x)) == 1);
+
+ typedef mpl::bool_<value> type;
+};
+
+template <bool multi_array = false>
+struct disable_multi_array_impl_impl
+{
+ typedef int type;
+};
+
+template <>
+struct disable_multi_array_impl_impl<true>
+{
+ // forming a pointer to a reference triggers SFINAE
+ typedef int& type;
+};
+
+
+template <class T>
+struct disable_multi_array_impl :
+ disable_multi_array_impl_impl<is_multi_array_impl<T>::value>
+{ };
+
+
+template <>
+struct disable_multi_array_impl<int>
+{
+ typedef int type;
+};
+
+
+#endif
+
+ } //namespace multi_array
+ } // namespace detail
+
+template<typename T, std::size_t NumDims,
+ typename Allocator>
+class multi_array :
+ public multi_array_ref<T,NumDims>
+{
+ typedef multi_array_ref<T,NumDims> super_type;
+public:
+ typedef typename super_type::value_type value_type;
+ typedef typename super_type::reference reference;
+ typedef typename super_type::const_reference const_reference;
+ typedef typename super_type::iterator iterator;
+ typedef typename super_type::const_iterator const_iterator;
+ typedef typename super_type::reverse_iterator reverse_iterator;
+ typedef typename super_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename super_type::element element;
+ typedef typename super_type::size_type size_type;
+ typedef typename super_type::difference_type difference_type;
+ typedef typename super_type::index index;
+ typedef typename super_type::extent_range extent_range;
+
+
+ template <std::size_t NDims>
+ struct const_array_view {
+ typedef boost::detail::multi_array::const_multi_array_view<T,NDims> type;
+ };
+
+ template <std::size_t NDims>
+ struct array_view {
+ typedef boost::detail::multi_array::multi_array_view<T,NDims> type;
+ };
+
+ explicit multi_array() :
+ super_type((T*)initial_base_,c_storage_order(),
+ /*index_bases=*/0, /*extents=*/0) {
+ allocate_space();
+ }
+
+ template <class ExtentList>
+ explicit multi_array(
+ ExtentList const& extents
+#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+ , typename mpl::if_<
+ detail::multi_array::is_multi_array_impl<ExtentList>,
+ int&,int>::type* = 0
+#endif
+ ) :
+ super_type((T*)initial_base_,extents) {
+ boost::function_requires<
+ detail::multi_array::CollectionConcept<ExtentList> >();
+ allocate_space();
+ }
+
+
+ template <class ExtentList>
+ explicit multi_array(ExtentList const& extents,
+ const general_storage_order<NumDims>& so) :
+ super_type((T*)initial_base_,extents,so) {
+ boost::function_requires<
+ detail::multi_array::CollectionConcept<ExtentList> >();
+ allocate_space();
+ }
+
+ template <class ExtentList>
+ explicit multi_array(ExtentList const& extents,
+ const general_storage_order<NumDims>& so,
+ Allocator const& alloc) :
+ super_type((T*)initial_base_,extents,so), allocator_(alloc) {
+ boost::function_requires<
+ detail::multi_array::CollectionConcept<ExtentList> >();
+ allocate_space();
+ }
+
+
+ explicit multi_array(const detail::multi_array
+ ::extent_gen<NumDims>& ranges) :
+ super_type((T*)initial_base_,ranges) {
+
+ allocate_space();
+ }
+
+
+ explicit multi_array(const detail::multi_array
+ ::extent_gen<NumDims>& ranges,
+ const general_storage_order<NumDims>& so) :
+ super_type((T*)initial_base_,ranges,so) {
+
+ allocate_space();
+ }
+
+
+ explicit multi_array(const detail::multi_array
+ ::extent_gen<NumDims>& ranges,
+ const general_storage_order<NumDims>& so,
+ Allocator const& alloc) :
+ super_type((T*)initial_base_,ranges,so), allocator_(alloc) {
+
+ allocate_space();
+ }
+
+ multi_array(const multi_array& rhs) :
+ super_type(rhs), allocator_(rhs.allocator_) {
+ allocate_space();
+ boost::detail::multi_array::copy_n(rhs.base_,rhs.num_elements(),base_);
+ }
+
+
+ //
+ // A multi_array is constructible from any multi_array_ref, subarray, or
+ // array_view object. The following constructors ensure that.
+ //
+
+ // Due to limited support for partial template ordering,
+ // MSVC 6&7 confuse the following with the most basic ExtentList
+ // constructor.
+#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+ template <typename OPtr>
+ multi_array(const const_multi_array_ref<T,NumDims,OPtr>& rhs,
+ const general_storage_order<NumDims>& so = c_storage_order())
+ : super_type(0,so,rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ // Warning! storage order may change, hence the following copy technique.
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+ template <typename OPtr>
+ multi_array(const detail::multi_array::
+ const_sub_array<T,NumDims,OPtr>& rhs,
+ const general_storage_order<NumDims>& so = c_storage_order())
+ : super_type(0,so,rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+
+ template <typename OPtr>
+ multi_array(const detail::multi_array::
+ const_multi_array_view<T,NumDims,OPtr>& rhs,
+ const general_storage_order<NumDims>& so = c_storage_order())
+ : super_type(0,so,rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+ // More limited support for MSVC
+
+
+ multi_array(const const_multi_array_ref<T,NumDims>& rhs)
+ : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ // Warning! storage order may change, hence the following copy technique.
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+ multi_array(const const_multi_array_ref<T,NumDims>& rhs,
+ const general_storage_order<NumDims>& so)
+ : super_type(0,so,rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ // Warning! storage order may change, hence the following copy technique.
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+ multi_array(const detail::multi_array::
+ const_sub_array<T,NumDims>& rhs)
+ : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+ multi_array(const detail::multi_array::
+ const_sub_array<T,NumDims>& rhs,
+ const general_storage_order<NumDims>& so)
+ : super_type(0,so,rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+
+ multi_array(const detail::multi_array::
+ const_multi_array_view<T,NumDims>& rhs)
+ : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+ multi_array(const detail::multi_array::
+ const_multi_array_view<T,NumDims>& rhs,
+ const general_storage_order<NumDims>& so)
+ : super_type(0,so,rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+#endif // !BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+ // Thes constructors are necessary because of more exact template matches.
+ multi_array(const multi_array_ref<T,NumDims>& rhs)
+ : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ // Warning! storage order may change, hence the following copy technique.
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+ multi_array(const multi_array_ref<T,NumDims>& rhs,
+ const general_storage_order<NumDims>& so)
+ : super_type(0,so,rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ // Warning! storage order may change, hence the following copy technique.
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+
+ multi_array(const detail::multi_array::
+ sub_array<T,NumDims>& rhs)
+ : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+ multi_array(const detail::multi_array::
+ sub_array<T,NumDims>& rhs,
+ const general_storage_order<NumDims>& so)
+ : super_type(0,so,rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+
+ multi_array(const detail::multi_array::
+ multi_array_view<T,NumDims>& rhs)
+ : super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+ multi_array(const detail::multi_array::
+ multi_array_view<T,NumDims>& rhs,
+ const general_storage_order<NumDims>& so)
+ : super_type(0,so,rhs.index_bases(),rhs.shape())
+ {
+ allocate_space();
+ std::copy(rhs.begin(),rhs.end(),this->begin());
+ }
+
+ // Since assignment is a deep copy, multi_array_ref
+ // contains all the necessary code.
+ template <typename ConstMultiArray>
+ multi_array& operator=(const ConstMultiArray& other) {
+ super_type::operator=(other);
+ return *this;
+ }
+
+ multi_array& operator=(const multi_array& other) {
+ if (&other != this) {
+ super_type::operator=(other);
+ }
+ return *this;
+ }
+
+
+ multi_array& resize(const detail::multi_array
+ ::extent_gen<NumDims>& ranges) {
+
+
+ // build a multi_array with the specs given
+ multi_array new_array(ranges);
+
+
+ // build a view of tmp with the minimum extents
+
+ // Get the minimum extents of the arrays.
+ boost::array<size_type,NumDims> min_extents;
+
+ const size_type& (*min)(const size_type&, const size_type&) =
+ std::min;
+ std::transform(new_array.extent_list_.begin(),new_array.extent_list_.end(),
+ this->extent_list_.begin(),
+ min_extents.begin(),
+ min);
+
+
+ // typedef boost::array<index,NumDims> index_list;
+ // Build index_gen objects to create views with the same shape
+
+ // these need to be separate to handle non-zero index bases
+ typedef detail::multi_array::index_gen<NumDims,NumDims> index_gen;
+ index_gen old_idxes;
+ index_gen new_idxes;
+
+ std::transform(new_array.index_base_list_.begin(),
+ new_array.index_base_list_.end(),
+ min_extents.begin(),old_idxes.ranges_.begin(),
+ detail::multi_array::populate_index_ranges());
+
+ std::transform(this->index_base_list_.begin(),
+ this->index_base_list_.end(),
+ min_extents.begin(),new_idxes.ranges_.begin(),
+ detail::multi_array::populate_index_ranges());
+
+ // Build same-shape views of the two arrays
+ typename
+ multi_array::BOOST_NESTED_TEMPLATE array_view<NumDims>::type view_old = (*this)[old_idxes];
+ typename
+ multi_array::BOOST_NESTED_TEMPLATE array_view<NumDims>::type view_new = new_array[new_idxes];
+
+ // Set the right portion of the new array
+ view_new = view_old;
+
+ using std::swap;
+ // Swap the internals of these arrays.
+ swap(this->super_type::base_,new_array.super_type::base_);
+ swap(this->storage_,new_array.storage_);
+ swap(this->extent_list_,new_array.extent_list_);
+ swap(this->stride_list_,new_array.stride_list_);
+ swap(this->index_base_list_,new_array.index_base_list_);
+ swap(this->origin_offset_,new_array.origin_offset_);
+ swap(this->directional_offset_,new_array.directional_offset_);
+ swap(this->num_elements_,new_array.num_elements_);
+ swap(this->allocator_,new_array.allocator_);
+ swap(this->base_,new_array.base_);
+ swap(this->allocated_elements_,new_array.allocated_elements_);
+
+ return *this;
+ }
+
+
+ ~multi_array() {
+ deallocate_space();
+ }
+
+private:
+ void allocate_space() {
+ typename Allocator::const_pointer no_hint=0;
+ base_ = allocator_.allocate(this->num_elements(),no_hint);
+ this->set_base_ptr(base_);
+ allocated_elements_ = this->num_elements();
+ std::uninitialized_fill_n(base_,allocated_elements_,T());
+ }
+
+ void deallocate_space() {
+ if(base_) {
+ for(T* i = base_; i != base_+allocated_elements_; ++i)
+ allocator_.destroy(i);
+ allocator_.deallocate(base_,allocated_elements_);
+ }
+ }
+
+ typedef boost::array<size_type,NumDims> size_list;
+ typedef boost::array<index,NumDims> index_list;
+
+ Allocator allocator_;
+ T* base_;
+ size_type allocated_elements_;
+ enum {initial_base_ = 0};
+};
+
+} // namespace boost
+
+#endif // BOOST_MULTI_ARRAY_RG071801_HPP
--- /dev/null
+/* Multiply indexed container.
+ *
+ * Copyright 2003-2005 Joaquín M López Muñoz.
+ * 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/multi_index for library home page.
+ */
+
+#ifndef BOOST_MULTI_INDEX_HPP
+#define BOOST_MULTI_INDEX_HPP
+
+#if defined(_MSC_VER)&&(_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
+#include <algorithm>
+#include <boost/detail/allocator_utilities.hpp>
+#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/contains.hpp>
+#include <boost/mpl/find_if.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/multi_index_container_fwd.hpp>
+#include <boost/multi_index/detail/access_specifier.hpp>
+#include <boost/multi_index/detail/base_type.hpp>
+#include <boost/multi_index/detail/converter.hpp>
+#include <boost/multi_index/detail/def_ctor_tuple_cons.hpp>
+#include <boost/multi_index/detail/header_holder.hpp>
+#include <boost/multi_index/detail/has_tag.hpp>
+#include <boost/multi_index/detail/no_duplicate_tags.hpp>
+#include <boost/multi_index/detail/prevent_eti.hpp>
+#include <boost/multi_index/detail/safe_mode.hpp>
+#include <boost/multi_index/detail/scope_guard.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/utility/base_from_member.hpp>
+
+#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
+#include <boost/multi_index/detail/archive_constructed.hpp>
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/split_member.hpp>
+#include <boost/throw_exception.hpp>
+#endif
+
+#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)
+#include <boost/multi_index/detail/invariant_assert.hpp>
+#define BOOST_MULTI_INDEX_CHECK_INVARIANT \
+ detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \
+ detail::make_obj_guard(*this,&multi_index_container::check_invariant_); \
+ BOOST_JOIN(check_invariant_,__LINE__).touch();
+#else
+#define BOOST_MULTI_INDEX_CHECK_INVARIANT
+#endif
+
+namespace boost{
+
+namespace multi_index{
+
+template<typename Value,typename IndexSpecifierList,typename Allocator>
+class multi_index_container:
+ private ::boost::base_from_member<
+ typename boost::detail::allocator::rebind_to<
+ Allocator,
+ typename detail::multi_index_node_type<
+ Value,IndexSpecifierList,Allocator>::type
+ >::type>,
+ BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS detail::header_holder<
+ typename detail::multi_index_node_type<
+ Value,IndexSpecifierList,Allocator>::type,
+ multi_index_container<Value,IndexSpecifierList,Allocator> >,
+ public detail::multi_index_base_type<
+ Value,IndexSpecifierList,Allocator>::type
+{
+#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\
+ BOOST_WORKAROUND(__MWERKS__,<=0x3003)
+/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the
+ * lifetime of const references bound to temporaries --precisely what
+ * scopeguards are.
+ */
+
+#pragma parse_mfunc_templ off
+#endif
+
+private:
+#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+ template <typename,typename,typename> friend class detail::index_base;
+ template <typename,typename> friend class detail::header_holder;
+ template <typename,typename> friend class detail::converter;
+#endif
+
+ typedef typename detail::multi_index_base_type<
+ Value,IndexSpecifierList,Allocator>::type super;
+ typedef ::boost::base_from_member<
+ typename boost::detail::allocator::rebind_to<
+ Allocator,
+ typename super::node_type
+ >::type> bfm_allocator;
+ typedef detail::header_holder<
+ typename super::node_type,
+ multi_index_container> bfm_header;
+
+public:
+ /* All types are inherited from super, a few are explicitly
+ * brought forward here to save us some typename's.
+ */
+
+#if defined(BOOST_MSVC)
+ typedef
+ detail::default_constructible_tuple_cons<
+ typename super::ctor_args_list> ctor_args_list;
+#else
+ typedef typename super::ctor_args_list ctor_args_list;
+#endif
+
+ typedef IndexSpecifierList index_specifier_type_list;
+ typedef typename super::index_type_list index_type_list;
+ typedef typename super::iterator_type_list iterator_type_list;
+ typedef typename super::const_iterator_type_list const_iterator_type_list;
+ typedef typename super::value_type value_type;
+ typedef typename super::final_allocator_type allocator_type;
+ typedef typename super::iterator iterator;
+ typedef typename super::const_iterator const_iterator;
+
+ BOOST_STATIC_ASSERT(
+ detail::no_duplicate_tags_in_index_list<index_type_list>::value);
+
+ /* global project() needs to see this publicly */
+
+ typedef typename super::node_type node_type;
+
+ /* construct/copy/destroy */
+
+ explicit multi_index_container(
+
+#if BOOST_WORKAROUND(__IBMCPP__,<=600)
+ /* VisualAge seems to have an ETI issue with the default values
+ * for arguments args_list and al.
+ */
+
+ const ctor_args_list& args_list=
+ typename mpl::identity<multi_index_container>::type::
+ ctor_args_list(),
+ const allocator_type& al=
+ typename mpl::identity<multi_index_container>::type::
+ allocator_type()):
+#else
+ const ctor_args_list& args_list=ctor_args_list(),
+ const allocator_type& al=allocator_type()):
+#endif
+
+ bfm_allocator(al),
+ super(args_list,bfm_allocator::member),
+ node_count(0)
+ {
+ BOOST_MULTI_INDEX_CHECK_INVARIANT;
+ }
+
+ template<typename InputIterator>
+ multi_index_container(
+ InputIterator first,InputIterator last,
+
+#if BOOST_WORKAROUND(__IBMCPP__,<=600)
+ /* VisualAge seems to have an ETI issue with the default values
+ * for arguments args_list and al.
+ */
+
+ const ctor_args_list& args_list=
+ typename mpl::identity<multi_index_container>::type::
+ ctor_args_list(),
+ const allocator_type& al=
+ typename mpl::identity<multi_index_container>::type::
+ allocator_type()):
+#else
+ const ctor_args_list& args_list=ctor_args_list(),
+ const allocator_type& al=allocator_type()):
+#endif
+
+ bfm_allocator(al),
+ super(args_list,bfm_allocator::member),
+ node_count(0)
+ {
+ BOOST_MULTI_INDEX_CHECK_INVARIANT;
+ BOOST_TRY{
+ iterator hint=super::end();
+ for(;first!=last;++first){
+ hint=super::make_iterator(insert_(*first,hint.get_node()).first);
+ }
+ }
+ BOOST_CATCH(...){
+ clear_();
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ }
+
+ multi_index_container(
+ const multi_index_container<Value,IndexSpecifierList,Allocator>& x):
+ bfm_allocator(x.bfm_allocator::member),
+ super(x),
+ node_count(0)
+ {
+ copy_map_type map(bfm_allocator::member,x.size(),x.header(),header());
+ for(const_iterator it=x.begin(),it_end=x.end();it!=it_end;++it){
+ map.clone(it.get_node());
+ }
+ super::copy_(x,map);
+ map.release();
+ node_count=x.size();
+
+ /* Not until this point are the indices required to be consistent,
+ * hence the position of the invariant checker.
+ */
+
+ BOOST_MULTI_INDEX_CHECK_INVARIANT;
+ }
+
+ ~multi_index_container()
+ {
+ delete_all_nodes_();
+ }
+
+ multi_index_container<Value,IndexSpecifierList,Allocator>& operator=(
+ const multi_index_container<Value,IndexSpecifierList,Allocator>& x)
+ {
+ BOOST_MULTI_INDEX_CHECK_INVARIANT;
+ multi_index_container<Value,IndexSpecifierList,Allocator> tmp(x);
+ this->swap(tmp);
+ return *this;
+ }
+
+ allocator_type get_allocator()const
+ {
+ return allocator_type(bfm_allocator::member);
+ }
+
+ /* retrieval of indices by number */
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES)
+ template<int N>
+ struct nth_index
+ {
+ BOOST_STATIC_ASSERT(N>=0&&N<mpl::size<index_type_list>::type::value);
+ typedef typename mpl::at_c<index_type_list,N>::type type;
+ };
+
+ template<int N>
+ typename nth_index<N>::type& get(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int,N))
+ {
+ BOOST_STATIC_ASSERT(N>=0&&N<mpl::size<index_type_list>::type::value);
+ return *this;
+ }
+
+ template<int N>
+ const typename nth_index<N>::type& get(
+ BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int,N))const
+ {
+ BOOST_STATIC_ASSERT(N>=0&&N<mpl::size<index_type_list>::type::value);
+ return *this;
+ }
+#endif
+
+ /* retrieval of indices by tag */
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES)
+ template<typename Tag>
+ struct index
+ {
+ typedef typename mpl::find_if<
+ index_type_list,
+ detail::has_tag<Tag>
+ >::type iter;
+
+ BOOST_STATIC_CONSTANT(
+ bool,index_found=!(is_same<iter,typename mpl::end<index_type_list>::type >::value));
+ BOOST_STATIC_ASSERT(index_found);
+
+ typedef typename mpl::deref<iter>::type type;
+ };
+
+ template<typename Tag>
+ typename index<Tag>::type& get(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag))
+ {
+ return *this;
+ }
+
+ template<typename Tag>
+ const typename index<Tag>::type& get(
+ BOOST_EXPLICIT_TEMPLATE_TYPE(Tag))const
+ {
+ return *this;
+ }
+#endif
+
+ /* projection of iterators by number */
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES)
+ template<int N>
+ struct nth_index_iterator
+ {
+ typedef typename nth_index<N>::type::iterator type;
+ };
+
+ template<int N>
+ struct nth_index_const_iterator
+ {
+ typedef typename nth_index<N>::type::const_iterator type;
+ };
+
+ template<int N,typename IteratorType>
+ typename nth_index_iterator<N>::type project(
+ IteratorType it
+ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N))
+ {
+ typedef typename nth_index<N>::type index;
+
+ BOOST_STATIC_ASSERT(
+ (mpl::contains<iterator_type_list,IteratorType>::value));
+
+ BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
+ BOOST_MULTI_INDEX_CHECK_IS_OWNER(
+ it,static_cast<typename IteratorType::container_type&>(*this));
+
+ return index::make_iterator(static_cast<node_type*>(it.get_node()));
+ }
+
+ template<int N,typename IteratorType>
+ typename nth_index_const_iterator<N>::type project(
+ IteratorType it
+ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N))const
+ {
+ typedef typename nth_index<N>::type index;
+
+ BOOST_STATIC_ASSERT((
+ mpl::contains<iterator_type_list,IteratorType>::value||
+ mpl::contains<const_iterator_type_list,IteratorType>::value));
+
+ BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
+ BOOST_MULTI_INDEX_CHECK_IS_OWNER(
+ it,static_cast<const typename IteratorType::container_type&>(*this));
+ return index::make_iterator(static_cast<node_type*>(it.get_node()));
+ }
+#endif
+
+ /* projection of iterators by tag */
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES)
+ template<typename Tag>
+ struct index_iterator
+ {
+ typedef typename index<Tag>::type::iterator type;
+ };
+
+ template<typename Tag>
+ struct index_const_iterator
+ {
+ typedef typename index<Tag>::type::const_iterator type;
+ };
+
+ template<typename Tag,typename IteratorType>
+ typename index_iterator<Tag>::type project(
+ IteratorType it
+ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))
+ {
+ typedef typename index<Tag>::type index;
+
+ BOOST_STATIC_ASSERT(
+ (mpl::contains<iterator_type_list,IteratorType>::value));
+
+ BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
+ BOOST_MULTI_INDEX_CHECK_IS_OWNER(
+ it,static_cast<typename IteratorType::container_type&>(*this));
+ return index::make_iterator(static_cast<node_type*>(it.get_node()));
+ }
+
+ template<typename Tag,typename IteratorType>
+ typename index_const_iterator<Tag>::type project(
+ IteratorType it
+ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))const
+ {
+ typedef typename index<Tag>::type index;
+
+ BOOST_STATIC_ASSERT((
+ mpl::contains<iterator_type_list,IteratorType>::value||
+ mpl::contains<const_iterator_type_list,IteratorType>::value));
+
+ BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
+ BOOST_MULTI_INDEX_CHECK_IS_OWNER(
+ it,static_cast<const typename IteratorType::container_type&>(*this));
+ return index::make_iterator(static_cast<node_type*>(it.get_node()));
+ }
+#endif
+
+BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
+ typedef typename super::copy_map_type copy_map_type;
+
+ node_type* header()const
+ {
+ return bfm_header::member;
+ }
+
+ node_type* allocate_node()
+ {
+ return bfm_allocator::member.allocate(1);
+ }
+
+ void deallocate_node(node_type* x)
+ {
+ bfm_allocator::member.deallocate(x,1);
+ }
+
+ bool empty_()const
+ {
+ return node_count==0;
+ }
+
+ std::size_t size_()const
+ {
+ return node_count;
+ }
+
+ std::size_t max_size_()const
+ {
+ return static_cast<std::size_t >(-1);
+ }
+
+ std::pair<node_type*,bool> insert_(const Value& v)
+ {
+ node_type* x=allocate_node();
+ BOOST_TRY{
+ node_type* res=super::insert_(v,x);
+ if(res==x){
+ ++node_count;
+ return std::pair<node_type*,bool>(res,true);
+ }
+ else{
+ deallocate_node(x);
+ return std::pair<node_type*,bool>(res,false);
+ }
+ }
+ BOOST_CATCH(...){
+ deallocate_node(x);
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ }
+
+ std::pair<node_type*,bool> insert_(const Value& v,node_type* position)
+ {
+ node_type* x=allocate_node();
+ BOOST_TRY{
+ node_type* res=super::insert_(v,position,x);
+ if(res==x){
+ ++node_count;
+ return std::pair<node_type*,bool>(res,true);
+ }
+ else{
+ deallocate_node(x);
+ return std::pair<node_type*,bool>(res,false);
+ }
+ }
+ BOOST_CATCH(...){
+ deallocate_node(x);
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ }
+
+ void erase_(node_type* x)
+ {
+ super::erase_(x);
+ deallocate_node(x);
+ --node_count;
+ }
+
+ void delete_node_(node_type* x)
+ {
+ super::delete_node_(x);
+ deallocate_node(x);
+ }
+
+ void delete_all_nodes_()
+ {
+ super::delete_all_nodes_();
+ }
+
+ void clear_()
+ {
+ delete_all_nodes_();
+ super::clear_();
+ node_count=0;
+ }
+
+ void swap_(multi_index_container<Value,IndexSpecifierList,Allocator>& x)
+ {
+ std::swap(bfm_header::member,x.bfm_header::member);
+ super::swap_(x);
+ std::swap(node_count,x.node_count);
+ }
+
+ bool replace_(const Value& k,node_type* x)
+ {
+ return super::replace_(k,x);
+ }
+
+ template<typename Modifier>
+ bool modify_(Modifier mod,node_type* x)
+ {
+ mod(const_cast<value_type&>(x->value));
+
+ BOOST_TRY{
+ if(!super::modify_(x)){
+ deallocate_node(x);
+ --node_count;
+ return false;
+ }
+ else return true;
+ }
+ BOOST_CATCH(...){
+ deallocate_node(x);
+ --node_count;
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ }
+
+#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
+ /* serialization */
+
+ friend class boost::serialization::access;
+
+ BOOST_SERIALIZATION_SPLIT_MEMBER()
+
+ typedef typename super::index_saver_type index_saver_type;
+ typedef typename super::index_loader_type index_loader_type;
+
+ template<class Archive>
+ void save(Archive& ar,const unsigned int version)const
+ {
+ const std::size_t s=size_();
+ ar<<serialization::make_nvp("count",s);
+ index_saver_type sm(bfm_allocator::member,s);
+
+ for(iterator it=super::begin(),it_end=super::end();it!=it_end;++it){
+ ar<<serialization::make_nvp("item",*it);
+ sm.add(it.get_node(),ar,version);
+ }
+ sm.add_track(header(),ar,version);
+
+ super::save_(ar,version,sm);
+ }
+
+ template<class Archive>
+ void load(Archive& ar,const unsigned int version)
+ {
+ BOOST_MULTI_INDEX_CHECK_INVARIANT;
+
+ clear_();
+
+ std::size_t s;
+ ar>>serialization::make_nvp("count",s);
+ index_loader_type lm(bfm_allocator::member,s);
+
+ for(std::size_t n=0;n<s;++n){
+ detail::archive_constructed<Value> value("item",ar,version);
+ std::pair<node_type*,bool> p=insert_(
+ value.get(),super::end().get_node());
+ if(!p.second)throw_exception(
+ archive::archive_exception(
+ archive::archive_exception::other_exception));
+ ar.reset_object_address(&p.first->value,&value.get());
+ lm.add(p.first,ar,version);
+ }
+ lm.add_track(header(),ar,version);
+
+ super::load_(ar,version,lm);
+ }
+#endif
+
+#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)
+ /* invariant stuff */
+
+ bool invariant_()const
+ {
+ return super::invariant_();
+ }
+
+ void check_invariant_()const
+ {
+ BOOST_MULTI_INDEX_INVARIANT_ASSERT(invariant_());
+ }
+#endif
+
+private:
+ std::size_t node_count;
+
+#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\
+ BOOST_WORKAROUND(__MWERKS__,<=0x3003)
+#pragma parse_mfunc_templ reset
+#endif
+};
+
+/* retrieval of indices by number */
+
+template<typename MultiIndexContainer,int N>
+struct nth_index
+{
+ BOOST_STATIC_CONSTANT(
+ int,
+ M=mpl::size<typename MultiIndexContainer::index_type_list>::type::value);
+ BOOST_STATIC_ASSERT(N>=0&&N<M);
+ typedef typename mpl::at_c<
+ typename MultiIndexContainer::index_type_list,N>::type type;
+};
+
+template<int N,typename Value,typename IndexSpecifierList,typename Allocator>
+typename nth_index<
+ multi_index_container<Value,IndexSpecifierList,Allocator>,N>::type&
+get(
+ multi_index_container<Value,IndexSpecifierList,Allocator>& m
+ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N))
+{
+ typedef multi_index_container<
+ Value,IndexSpecifierList,Allocator> multi_index_type;
+ typedef typename nth_index<
+ multi_index_container<
+ Value,IndexSpecifierList,Allocator>,
+ N
+ >::type index;
+
+ BOOST_STATIC_ASSERT(N>=0&&
+ N<
+ mpl::size<
+ BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list
+ >::type::value);
+
+ return detail::converter<multi_index_type,index>::index(m);
+}
+
+template<int N,typename Value,typename IndexSpecifierList,typename Allocator>
+const typename nth_index<
+ multi_index_container<Value,IndexSpecifierList,Allocator>,N>::type&
+get(
+ const multi_index_container<Value,IndexSpecifierList,Allocator>& m
+ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N))
+{
+ typedef multi_index_container<
+ Value,IndexSpecifierList,Allocator> multi_index_type;
+ typedef typename nth_index<
+ multi_index_container<
+ Value,IndexSpecifierList,Allocator>,
+ N
+ >::type index;
+
+ BOOST_STATIC_ASSERT(N>=0&&
+ N<
+ mpl::size<
+ BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list
+ >::type::value);
+
+ return detail::converter<multi_index_type,index>::index(m);
+}
+
+/* retrieval of indices by tag */
+
+template<typename MultiIndexContainer,typename Tag>
+struct index
+{
+ typedef typename MultiIndexContainer::index_type_list index_type_list;
+
+ typedef typename mpl::find_if<
+ index_type_list,
+ detail::has_tag<Tag>
+ >::type iter;
+
+ BOOST_STATIC_CONSTANT(
+ bool,index_found=!(is_same<iter,typename mpl::end<index_type_list>::type >::value));
+ BOOST_STATIC_ASSERT(index_found);
+
+ typedef typename mpl::deref<iter>::type type;
+};
+
+template<
+ typename Tag,typename Value,typename IndexSpecifierList,typename Allocator
+>
+typename ::boost::multi_index::index<
+ multi_index_container<Value,IndexSpecifierList,Allocator>,Tag>::type&
+get(
+ multi_index_container<Value,IndexSpecifierList,Allocator>& m
+ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))
+{
+ typedef multi_index_container<
+ Value,IndexSpecifierList,Allocator> multi_index_type;
+ typedef typename ::boost::multi_index::index<
+ multi_index_container<
+ Value,IndexSpecifierList,Allocator>,
+ Tag
+ >::type index;
+
+ return detail::converter<multi_index_type,index>::index(m);
+}
+
+template<
+ typename Tag,typename Value,typename IndexSpecifierList,typename Allocator
+>
+const typename ::boost::multi_index::index<
+ multi_index_container<Value,IndexSpecifierList,Allocator>,Tag>::type&
+get(
+ const multi_index_container<Value,IndexSpecifierList,Allocator>& m
+ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))
+{
+ typedef multi_index_container<
+ Value,IndexSpecifierList,Allocator> multi_index_type;
+ typedef typename ::boost::multi_index::index<
+ multi_index_container<
+ Value,IndexSpecifierList,Allocator>,
+ Tag
+ >::type index;
+
+ return detail::converter<multi_index_type,index>::index(m);
+}
+
+/* projection of iterators by number */
+
+template<typename MultiIndexContainer,int N>
+struct nth_index_iterator
+{
+ typedef typename detail::prevent_eti<
+ nth_index<MultiIndexContainer,N>,
+ typename nth_index<MultiIndexContainer,N>::type>::type::iterator type;
+};
+
+template<typename MultiIndexContainer,int N>
+struct nth_index_const_iterator
+{
+ typedef typename detail::prevent_eti<
+ nth_index<MultiIndexContainer,N>,
+ typename nth_index<MultiIndexContainer,N>::type
+ >::type::const_iterator type;
+};
+
+template<
+ int N,typename IteratorType,
+ typename Value,typename IndexSpecifierList,typename Allocator>
+typename nth_index_iterator<
+ multi_index_container<Value,IndexSpecifierList,Allocator>,N>::type
+project(
+ multi_index_container<Value,IndexSpecifierList,Allocator>& m,
+ IteratorType it
+ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N))
+{
+ typedef multi_index_container<
+ Value,IndexSpecifierList,Allocator> multi_index_type;
+ typedef typename nth_index<multi_index_type,N>::type index;
+
+#if !defined(BOOST_MSVC)||!(BOOST_MSVC<1300) /* this ain't work in MSVC++ 6.0 */
+ BOOST_STATIC_ASSERT((
+ mpl::contains<
+ BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list,
+ IteratorType>::value));
+#endif
+
+ BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
+
+#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
+ typedef detail::converter<
+ multi_index_type,
+ BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter;
+ BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m));
+#endif
+
+ return detail::converter<multi_index_type,index>::iterator(
+ m,static_cast<typename multi_index_type::node_type*>(it.get_node()));
+}
+
+template<
+ int N,typename IteratorType,
+ typename Value,typename IndexSpecifierList,typename Allocator>
+typename nth_index_const_iterator<
+ multi_index_container<Value,IndexSpecifierList,Allocator>,N>::type
+project(
+ const multi_index_container<Value,IndexSpecifierList,Allocator>& m,
+ IteratorType it
+ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N))
+{
+ typedef multi_index_container<
+ Value,IndexSpecifierList,Allocator> multi_index_type;
+ typedef typename nth_index<multi_index_type,N>::type index;
+
+#if !defined(BOOST_MSVC)||!(BOOST_MSVC<1300) /* this ain't work in MSVC++ 6.0 */
+ BOOST_STATIC_ASSERT((
+ mpl::contains<
+ BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list,
+ IteratorType>::value||
+ mpl::contains<
+ BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list,
+ IteratorType>::value));
+#endif
+
+ BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
+
+#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
+ typedef detail::converter<
+ multi_index_type,
+ BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter;
+ BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m));
+#endif
+
+ return detail::converter<multi_index_type,index>::const_iterator(
+ m,static_cast<typename multi_index_type::node_type*>(it.get_node()));
+}
+
+/* projection of iterators by tag */
+
+template<typename MultiIndexContainer,typename Tag>
+struct index_iterator
+{
+ typedef typename ::boost::multi_index::index<
+ MultiIndexContainer,Tag>::type::iterator type;
+};
+
+template<typename MultiIndexContainer,typename Tag>
+struct index_const_iterator
+{
+ typedef typename ::boost::multi_index::index<
+ MultiIndexContainer,Tag>::type::const_iterator type;
+};
+
+template<
+ typename Tag,typename IteratorType,
+ typename Value,typename IndexSpecifierList,typename Allocator>
+typename index_iterator<
+ multi_index_container<Value,IndexSpecifierList,Allocator>,Tag>::type
+project(
+ multi_index_container<Value,IndexSpecifierList,Allocator>& m,
+ IteratorType it
+ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))
+{
+ typedef multi_index_container<
+ Value,IndexSpecifierList,Allocator> multi_index_type;
+ typedef typename ::boost::multi_index::index<
+ multi_index_type,Tag>::type index;
+
+#if !defined(BOOST_MSVC)||!(BOOST_MSVC<1300) /* this ain't work in MSVC++ 6.0 */
+ BOOST_STATIC_ASSERT((
+ mpl::contains<
+ BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list,
+ IteratorType>::value));
+#endif
+
+ BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
+
+#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
+ typedef detail::converter<
+ multi_index_type,
+ BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter;
+ BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m));
+#endif
+
+ return detail::converter<multi_index_type,index>::iterator(
+ m,static_cast<typename multi_index_type::node_type*>(it.get_node()));
+}
+
+template<
+ typename Tag,typename IteratorType,
+ typename Value,typename IndexSpecifierList,typename Allocator>
+typename index_const_iterator<
+ multi_index_container<Value,IndexSpecifierList,Allocator>,Tag>::type
+project(
+ const multi_index_container<Value,IndexSpecifierList,Allocator>& m,
+ IteratorType it
+ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))
+{
+ typedef multi_index_container<
+ Value,IndexSpecifierList,Allocator> multi_index_type;
+ typedef typename ::boost::multi_index::index<
+ multi_index_type,Tag>::type index;
+
+#if !defined(BOOST_MSVC)||!(BOOST_MSVC<1300) /* this ain't work in MSVC++ 6.0 */
+ BOOST_STATIC_ASSERT((
+ mpl::contains<
+ BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list,
+ IteratorType>::value||
+ mpl::contains<
+ BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list,
+ IteratorType>::value));
+#endif
+
+ BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
+
+#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
+ typedef detail::converter<
+ multi_index_type,
+ BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter;
+ BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m));
+#endif
+
+ return detail::converter<multi_index_type,index>::const_iterator(
+ m,static_cast<typename multi_index_type::node_type*>(it.get_node()));
+}
+
+/* Comparison. Simple forward to first index. */
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator==(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y)
+{
+ return get<0>(x)==get<0>(y);
+}
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator<(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y)
+{
+ return get<0>(x)<get<0>(y);
+}
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator!=(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y)
+{
+ return get<0>(x)!=get<0>(y);
+}
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator>(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y)
+{
+ return get<0>(x)>get<0>(y);
+}
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator>=(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y)
+{
+ return get<0>(x)>=get<0>(y);
+}
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator<=(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y)
+{
+ return get<0>(x)<=get<0>(y);
+}
+
+/* specialized algorithms */
+
+template<typename Value,typename IndexSpecifierList,typename Allocator>
+void swap(
+ multi_index_container<Value,IndexSpecifierList,Allocator>& x,
+ multi_index_container<Value,IndexSpecifierList,Allocator>& y)
+{
+ x.swap(y);
+}
+
+} /* namespace multi_index */
+
+/* Associated global functions are promoted to namespace boost, except
+ * comparison operators and swap, which are meant to be Koenig looked-up.
+ */
+
+using multi_index::get;
+using multi_index::project;
+
+} /* namespace boost */
+
+#undef BOOST_MULTI_INDEX_CHECK_INVARIANT
+
+#endif
--- /dev/null
+/* Copyright 2003-2005 Joaquín M López Muñoz.
+ * 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/multi_index for library home page.
+ */
+
+#ifndef BOOST_MULTI_INDEX_FWD_HPP
+#define BOOST_MULTI_INDEX_FWD_HPP
+
+#if defined(_MSC_VER)&&(_MSC_VER>=1200)
+#pragma once
+#endif
+
+#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
+#include <boost/multi_index/identity.hpp>
+#include <boost/multi_index/indexed_by.hpp>
+#include <boost/multi_index/ordered_index_fwd.hpp>
+#include <memory>
+
+namespace boost{
+
+namespace multi_index{
+
+/* Default value for IndexSpecifierList specifies a container
+ * equivalent to std::set<Value>.
+ */
+
+template<
+ typename Value,
+ typename IndexSpecifierList=indexed_by<ordered_unique<identity<Value> > >,
+ typename Allocator=std::allocator<Value> >
+class multi_index_container;
+
+template<typename MultiIndexContainer,int N>
+struct nth_index;
+
+template<typename MultiIndexContainer,typename Tag>
+struct index;
+
+template<typename MultiIndexContainer,int N>
+struct nth_index_iterator;
+
+template<typename MultiIndexContainer,int N>
+struct nth_index_const_iterator;
+
+template<typename MultiIndexContainer,typename Tag>
+struct index_iterator;
+
+template<typename MultiIndexContainer,typename Tag>
+struct index_const_iterator;
+
+/* get and project functions not fwd declared due to problems
+ * with dependent typenames
+ */
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator==(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator<(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator!=(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator>(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator>=(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
+
+template<
+ typename Value1,typename IndexSpecifierList1,typename Allocator1,
+ typename Value2,typename IndexSpecifierList2,typename Allocator2
+>
+bool operator<=(
+ const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x,
+ const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y);
+
+template<typename Value,typename IndexSpecifierList,typename Allocator>
+void swap(
+ multi_index_container<Value,IndexSpecifierList,Allocator>& x,
+ multi_index_container<Value,IndexSpecifierList,Allocator>& y);
+
+} /* namespace multi_index */
+
+/* multi_index_container, being the main type of this library, is promoted to
+ * namespace boost.
+ */
+
+using multi_index::multi_index_container;
+
+} /* namespace boost */
+
+#endif
--- /dev/null
+// Boost next_prior.hpp header file ---------------------------------------//
+
+// (C) Copyright Dave Abrahams and Daniel Walker 1999-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)
+
+// See http://www.boost.org/libs/utility for documentation.
+
+// Revision History
+// 13 Dec 2003 Added next(x, n) and prior(x, n) (Daniel Walker)
+
+#ifndef BOOST_NEXT_PRIOR_HPP_INCLUDED
+#define BOOST_NEXT_PRIOR_HPP_INCLUDED
+
+#include <iterator>
+
+namespace boost {
+
+// Helper functions for classes like bidirectional iterators not supporting
+// operator+ and operator-
+//
+// Usage:
+// const std::list<T>::iterator p = get_some_iterator();
+// const std::list<T>::iterator prev = boost::prior(p);
+// const std::list<T>::iterator next = boost::next(prev, 2);
+
+// Contributed by Dave Abrahams
+
+template <class T>
+inline T next(T x) { return ++x; }
+
+template <class T, class Distance>
+inline T next(T x, Distance n)
+{
+ std::advance(x, n);
+ return x;
+}
+
+template <class T>
+inline T prior(T x) { return --x; }
+
+template <class T, class Distance>
+inline T prior(T x, Distance n)
+{
+ std::advance(x, -n);
+ return x;
+}
+
+} // namespace boost
+
+#endif // BOOST_NEXT_PRIOR_HPP_INCLUDED
--- /dev/null
+// -------------------------------------
+//
+// (C) Copyright Gennaro Prota 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_NON_TYPE_HPP_GP_20030417
+#define BOOST_NON_TYPE_HPP_GP_20030417
+
+
+namespace boost {
+
+ // Just a simple "envelope" for non-type template parameters. Useful
+ // to work around some MSVC deficiencies.
+
+ template <typename T, T n>
+ struct non_type { };
+
+
+}
+
+
+#endif // include guard
--- /dev/null
+// Boost noncopyable.hpp header file --------------------------------------//
+
+// (C) Copyright Beman Dawes 1999-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)
+
+// See http://www.boost.org/libs/utility for documentation.
+
+#ifndef BOOST_NONCOPYABLE_HPP_INCLUDED
+#define BOOST_NONCOPYABLE_HPP_INCLUDED
+
+namespace boost {
+
+// Private copy constructor and copy assignment ensure classes derived from
+// class noncopyable cannot be copied.
+
+// Contributed by Dave Abrahams
+
+namespace noncopyable_ // protection from unintended ADL
+{
+ class noncopyable
+ {
+ protected:
+ noncopyable() {}
+ ~noncopyable() {}
+ private: // emphasize the following members are private
+ noncopyable( const noncopyable& );
+ const noncopyable& operator=( const noncopyable& );
+ };
+}
+
+typedef noncopyable_::noncopyable noncopyable;
+
+} // namespace boost
+
+#endif // BOOST_NONCOPYABLE_HPP_INCLUDED
--- /dev/null
+/* boost nondet_random.hpp header file
+ *
+ * Copyright Jens Maurer 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)
+ *
+ * $Id$
+ *
+ * Revision history
+ * 2000-02-18 Portability fixes (thanks to Beman Dawes)
+ */
+
+// See http://www.boost.org/libs/random for documentation.
+
+
+#ifndef BOOST_NONDET_RANDOM_HPP
+#define BOOST_NONDET_RANDOM_HPP
+
+#include <string> // std::abs
+#include <algorithm> // std::min
+#include <cmath>
+#include <boost/config.hpp>
+#include <boost/utility.hpp> // noncopyable
+#include <boost/integer_traits.hpp> // compile-time integral limits
+
+namespace boost {
+
+// use some OS service to generate non-deterministic random numbers
+class random_device : private noncopyable
+{
+public:
+ typedef unsigned int result_type;
+ BOOST_STATIC_CONSTANT(bool, has_fixed_range = true);
+ BOOST_STATIC_CONSTANT(result_type, min_value = integer_traits<result_type>::const_min);
+ BOOST_STATIC_CONSTANT(result_type, max_value = integer_traits<result_type>::const_max);
+
+ result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return min_value; }
+ result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return max_value; }
+ explicit random_device(const std::string& token = default_token);
+ ~random_device();
+ double entropy() const;
+ unsigned int operator()();
+
+private:
+ static const char * const default_token;
+
+ /*
+ * std:5.3.5/5 [expr.delete]: "If the object being deleted has incomplete
+ * class type at the point of deletion and the complete class has a
+ * non-trivial destructor [...], the behavior is undefined".
+ * This disallows the use of scoped_ptr<> with pimpl-like classes
+ * having a non-trivial destructor.
+ */
+ class impl;
+ impl * pimpl;
+};
+
+
+// TODO: put Schneier's Yarrow-160 algorithm here.
+
+} // namespace boost
+
+#endif /* BOOST_NONDET_RANDOM_HPP */
--- /dev/null
+// 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/lib/optional for documentation.
+//
+// You are welcome to contact the author at:
+// fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NONE_17SEP2003_HPP
+#define BOOST_NONE_17SEP2003_HPP
+
+#include "boost/none_t.hpp"
+
+// NOTE: Borland users have to include this header outside any precompiled headers
+// (bcc<=5.64 cannot include instance data in a precompiled header)
+
+namespace boost {
+
+namespace {
+
+none_t const none = ((none_t)0) ;
+
+}
+
+} // namespace boost
+
+#endif
+
--- /dev/null
+// 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/lib/optional for documentation.
+//
+// You are welcome to contact the author at:
+// fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NONE_T_17SEP2003_HPP
+#define BOOST_NONE_T_17SEP2003_HPP
+
+namespace boost {
+
+namespace detail { struct none_helper{}; }
+
+typedef int detail::none_helper::*none_t ;
+
+} // namespace boost
+
+#endif
+
--- /dev/null
+// Boost operators.hpp header file ----------------------------------------//
+
+// (C) Copyright David Abrahams, Jeremy Siek, Daryle Walker 1999-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/operators.htm for documentation.
+
+// Revision History
+// 21 Oct 02 Modified implementation of operators to allow compilers with a
+// correct named return value optimization (NRVO) to produce optimal
+// code. (Daniel Frey)
+// 02 Dec 01 Bug fixed in random_access_iteratable. (Helmut Zeisel)
+// 28 Sep 01 Factored out iterator operator groups. (Daryle Walker)
+// 27 Aug 01 'left' form for non commutative operators added;
+// additional classes for groups of related operators added;
+// workaround for empty base class optimization
+// bug of GCC 3.0 (Helmut Zeisel)
+// 25 Jun 01 output_iterator_helper changes: removed default template
+// parameters, added support for self-proxying, additional
+// documentation and tests (Aleksey Gurtovoy)
+// 29 May 01 Added operator classes for << and >>. Added input and output
+// iterator helper classes. Added classes to connect equality and
+// relational operators. Added classes for groups of related
+// operators. Reimplemented example operator and iterator helper
+// classes in terms of the new groups. (Daryle Walker, with help
+// from Alexy Gurtovoy)
+// 11 Feb 01 Fixed bugs in the iterator helpers which prevented explicitly
+// supplied arguments from actually being used (Dave Abrahams)
+// 04 Jul 00 Fixed NO_OPERATORS_IN_NAMESPACE bugs, major cleanup and
+// refactoring of compiler workarounds, additional documentation
+// (Alexy Gurtovoy and Mark Rodgers with some help and prompting from
+// Dave Abrahams)
+// 28 Jun 00 General cleanup and integration of bugfixes from Mark Rodgers and
+// Jeremy Siek (Dave Abrahams)
+// 20 Jun 00 Changes to accommodate Borland C++Builder 4 and Borland C++ 5.5
+// (Mark Rodgers)
+// 20 Jun 00 Minor fixes to the prior revision (Aleksey Gurtovoy)
+// 10 Jun 00 Support for the base class chaining technique was added
+// (Aleksey Gurtovoy). See documentation and the comments below
+// for the details.
+// 12 Dec 99 Initial version with iterator operators (Jeremy Siek)
+// 18 Nov 99 Change name "divideable" to "dividable", remove unnecessary
+// specializations of dividable, subtractable, modable (Ed Brey)
+// 17 Nov 99 Add comments (Beman Dawes)
+// Remove unnecessary specialization of operators<> (Ed Brey)
+// 15 Nov 99 Fix less_than_comparable<T,U> second operand type for first two
+// operators.(Beman Dawes)
+// 12 Nov 99 Add operators templates (Ed Brey)
+// 11 Nov 99 Add single template parameter version for compilers without
+// partial specialization (Beman Dawes)
+// 10 Nov 99 Initial version
+
+// 10 Jun 00:
+// An additional optional template parameter was added to most of
+// operator templates to support the base class chaining technique (see
+// documentation for the details). Unfortunately, a straightforward
+// implementation of this change would have broken compatibility with the
+// previous version of the library by making it impossible to use the same
+// template name (e.g. 'addable') for both the 1- and 2-argument versions of
+// an operator template. This implementation solves the backward-compatibility
+// issue at the cost of some simplicity.
+//
+// One of the complications is an existence of special auxiliary class template
+// 'is_chained_base<>' (see 'detail' namespace below), which is used
+// to determine whether its template parameter is a library's operator template
+// or not. You have to specialize 'is_chained_base<>' for each new
+// operator template you add to the library.
+//
+// However, most of the non-trivial implementation details are hidden behind
+// several local macros defined below, and as soon as you understand them,
+// you understand the whole library implementation.
+
+#ifndef BOOST_OPERATORS_HPP
+#define BOOST_OPERATORS_HPP
+
+#include <boost/config.hpp>
+#include <boost/iterator.hpp>
+#include <boost/detail/workaround.hpp>
+
+#if defined(__sgi) && !defined(__GNUC__)
+# pragma set woff 1234
+#endif
+
+#if defined(BOOST_MSVC)
+# pragma warning( disable : 4284 ) // complaint about return type of
+#endif // operator-> not begin a UDT
+
+namespace boost {
+namespace detail {
+
+// Helmut Zeisel, empty base class optimization bug with GCC 3.0.0
+#if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==0 && __GNU_PATCHLEVEL__==0
+class empty_base {
+ bool dummy;
+};
+#else
+class empty_base {};
+#endif
+
+} // namespace detail
+} // namespace boost
+
+// In this section we supply the xxxx1 and xxxx2 forms of the operator
+// templates, which are explicitly targeted at the 1-type-argument and
+// 2-type-argument operator forms, respectively. Some compilers get confused
+// when inline friend functions are overloaded in namespaces other than the
+// global namespace. When BOOST_NO_OPERATORS_IN_NAMESPACE is defined, all of
+// these templates must go in the global namespace.
+
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+namespace boost
+{
+#endif
+
+// Basic operator classes (contributed by Dave Abrahams) ------------------//
+
+// Note that friend functions defined in a class are implicitly inline.
+// See the C++ std, 11.4 [class.friend] paragraph 5
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct less_than_comparable2 : B
+{
+ friend bool operator<=(const T& x, const U& y) { return !(x > y); }
+ friend bool operator>=(const T& x, const U& y) { return !(x < y); }
+ friend bool operator>(const U& x, const T& y) { return y < x; }
+ friend bool operator<(const U& x, const T& y) { return y > x; }
+ friend bool operator<=(const U& x, const T& y) { return !(y < x); }
+ friend bool operator>=(const U& x, const T& y) { return !(y > x); }
+};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct less_than_comparable1 : B
+{
+ friend bool operator>(const T& x, const T& y) { return y < x; }
+ friend bool operator<=(const T& x, const T& y) { return !(y < x); }
+ friend bool operator>=(const T& x, const T& y) { return !(x < y); }
+};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct equality_comparable2 : B
+{
+ friend bool operator==(const U& y, const T& x) { return x == y; }
+ friend bool operator!=(const U& y, const T& x) { return !(x == y); }
+ friend bool operator!=(const T& y, const U& x) { return !(y == x); }
+};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct equality_comparable1 : B
+{
+ friend bool operator!=(const T& x, const T& y) { return !(x == y); }
+};
+
+// A macro which produces "name_2left" from "name".
+#define BOOST_OPERATOR2_LEFT(name) name##2##_##left
+
+// NRVO-friendly implementation (contributed by Daniel Frey) ---------------//
+
+#if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+// This is the optimal implementation for ISO/ANSI C++,
+// but it requires the compiler to implement the NRVO.
+// If the compiler has no NRVO, this is the best symmetric
+// implementation available.
+
+#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base> \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( const T& lhs, const U& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+ friend T operator OP( const U& lhs, const T& rhs ) \
+ { T nrv( rhs ); nrv OP##= lhs; return nrv; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base> \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( const T& lhs, const T& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+};
+
+#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base> \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( const T& lhs, const U& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+}; \
+ \
+template <class T, class U, class B = ::boost::detail::empty_base> \
+struct BOOST_OPERATOR2_LEFT(NAME) : B \
+{ \
+ friend T operator OP( const U& lhs, const T& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base> \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( const T& lhs, const T& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+};
+
+#else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+// For compilers without NRVO the following code is optimal, but not
+// symmetric! Note that the implementation of
+// BOOST_OPERATOR2_LEFT(NAME) only looks cool, but doesn't provide
+// optimization opportunities to the compiler :)
+
+#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base> \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \
+ friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base> \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \
+};
+
+#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base> \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \
+}; \
+ \
+template <class T, class U, class B = ::boost::detail::empty_base> \
+struct BOOST_OPERATOR2_LEFT(NAME) : B \
+{ \
+ friend T operator OP( const U& lhs, const T& rhs ) \
+ { return T( lhs ) OP##= rhs; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base> \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \
+};
+
+#endif // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+BOOST_BINARY_OPERATOR_COMMUTATIVE( multipliable, * )
+BOOST_BINARY_OPERATOR_COMMUTATIVE( addable, + )
+BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( subtractable, - )
+BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( dividable, / )
+BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( modable, % )
+BOOST_BINARY_OPERATOR_COMMUTATIVE( xorable, ^ )
+BOOST_BINARY_OPERATOR_COMMUTATIVE( andable, & )
+BOOST_BINARY_OPERATOR_COMMUTATIVE( orable, | )
+
+#undef BOOST_BINARY_OPERATOR_COMMUTATIVE
+#undef BOOST_BINARY_OPERATOR_NON_COMMUTATIVE
+#undef BOOST_OPERATOR2_LEFT
+
+// incrementable and decrementable contributed by Jeremy Siek
+
+template <class T, class B = ::boost::detail::empty_base>
+struct incrementable : B
+{
+ friend T operator++(T& x, int)
+ {
+ incrementable_type nrv(x);
+ ++x;
+ return nrv;
+ }
+private: // The use of this typedef works around a Borland bug
+ typedef T incrementable_type;
+};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct decrementable : B
+{
+ friend T operator--(T& x, int)
+ {
+ decrementable_type nrv(x);
+ --x;
+ return nrv;
+ }
+private: // The use of this typedef works around a Borland bug
+ typedef T decrementable_type;
+};
+
+// Iterator operator classes (contributed by Jeremy Siek) ------------------//
+
+template <class T, class P, class B = ::boost::detail::empty_base>
+struct dereferenceable : B
+{
+ P operator->() const
+ {
+ return &*static_cast<const T&>(*this);
+ }
+};
+
+template <class T, class I, class R, class B = ::boost::detail::empty_base>
+struct indexable : B
+{
+ R operator[](I n) const
+ {
+ return *(static_cast<const T&>(*this) + n);
+ }
+};
+
+// More operator classes (contributed by Daryle Walker) --------------------//
+// (NRVO-friendly implementation contributed by Daniel Frey) ---------------//
+
+#if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+#define BOOST_BINARY_OPERATOR( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base> \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( const T& lhs, const U& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base> \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( const T& lhs, const T& rhs ) \
+ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
+};
+
+#else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+#define BOOST_BINARY_OPERATOR( NAME, OP ) \
+template <class T, class U, class B = ::boost::detail::empty_base> \
+struct NAME##2 : B \
+{ \
+ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \
+}; \
+ \
+template <class T, class B = ::boost::detail::empty_base> \
+struct NAME##1 : B \
+{ \
+ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \
+};
+
+#endif // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
+
+BOOST_BINARY_OPERATOR( left_shiftable, << )
+BOOST_BINARY_OPERATOR( right_shiftable, >> )
+
+#undef BOOST_BINARY_OPERATOR
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct equivalent2 : B
+{
+ friend bool operator==(const T& x, const U& y)
+ {
+ return !(x < y) && !(x > y);
+ }
+};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct equivalent1 : B
+{
+ friend bool operator==(const T&x, const T&y)
+ {
+ return !(x < y) && !(y < x);
+ }
+};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct partially_ordered2 : B
+{
+ friend bool operator<=(const T& x, const U& y)
+ { return (x < y) || (x == y); }
+ friend bool operator>=(const T& x, const U& y)
+ { return (x > y) || (x == y); }
+ friend bool operator>(const U& x, const T& y)
+ { return y < x; }
+ friend bool operator<(const U& x, const T& y)
+ { return y > x; }
+ friend bool operator<=(const U& x, const T& y)
+ { return (y > x) || (y == x); }
+ friend bool operator>=(const U& x, const T& y)
+ { return (y < x) || (y == x); }
+};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct partially_ordered1 : B
+{
+ friend bool operator>(const T& x, const T& y)
+ { return y < x; }
+ friend bool operator<=(const T& x, const T& y)
+ { return (x < y) || (x == y); }
+ friend bool operator>=(const T& x, const T& y)
+ { return (y < x) || (x == y); }
+};
+
+// Combined operator classes (contributed by Daryle Walker) ----------------//
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct totally_ordered2
+ : less_than_comparable2<T, U
+ , equality_comparable2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct totally_ordered1
+ : less_than_comparable1<T
+ , equality_comparable1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct additive2
+ : addable2<T, U
+ , subtractable2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct additive1
+ : addable1<T
+ , subtractable1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct multiplicative2
+ : multipliable2<T, U
+ , dividable2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct multiplicative1
+ : multipliable1<T
+ , dividable1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct integer_multiplicative2
+ : multiplicative2<T, U
+ , modable2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct integer_multiplicative1
+ : multiplicative1<T
+ , modable1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct arithmetic2
+ : additive2<T, U
+ , multiplicative2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct arithmetic1
+ : additive1<T
+ , multiplicative1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct integer_arithmetic2
+ : additive2<T, U
+ , integer_multiplicative2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct integer_arithmetic1
+ : additive1<T
+ , integer_multiplicative1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct bitwise2
+ : xorable2<T, U
+ , andable2<T, U
+ , orable2<T, U, B
+ > > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct bitwise1
+ : xorable1<T
+ , andable1<T
+ , orable1<T, B
+ > > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct unit_steppable
+ : incrementable<T
+ , decrementable<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct shiftable2
+ : left_shiftable2<T, U
+ , right_shiftable2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct shiftable1
+ : left_shiftable1<T
+ , right_shiftable1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct ring_operators2
+ : additive2<T, U
+ , subtractable2_left<T, U
+ , multipliable2<T, U, B
+ > > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct ring_operators1
+ : additive1<T
+ , multipliable1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct ordered_ring_operators2
+ : ring_operators2<T, U
+ , totally_ordered2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct ordered_ring_operators1
+ : ring_operators1<T
+ , totally_ordered1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct field_operators2
+ : ring_operators2<T, U
+ , dividable2<T, U
+ , dividable2_left<T, U, B
+ > > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct field_operators1
+ : ring_operators1<T
+ , dividable1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct ordered_field_operators2
+ : field_operators2<T, U
+ , totally_ordered2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct ordered_field_operators1
+ : field_operators1<T
+ , totally_ordered1<T, B
+ > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct euclidian_ring_operators2
+ : ring_operators2<T, U
+ , dividable2<T, U
+ , dividable2_left<T, U
+ , modable2<T, U
+ , modable2_left<T, U, B
+ > > > > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct euclidian_ring_operators1
+ : ring_operators1<T
+ , dividable1<T
+ , modable1<T, B
+ > > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base>
+struct ordered_euclidian_ring_operators2
+ : totally_ordered2<T, U
+ , euclidian_ring_operators2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct ordered_euclidian_ring_operators1
+ : totally_ordered1<T
+ , euclidian_ring_operators1<T, B
+ > > {};
+
+template <class T, class P, class B = ::boost::detail::empty_base>
+struct input_iteratable
+ : equality_comparable1<T
+ , incrementable<T
+ , dereferenceable<T, P, B
+ > > > {};
+
+template <class T, class B = ::boost::detail::empty_base>
+struct output_iteratable
+ : incrementable<T, B
+ > {};
+
+template <class T, class P, class B = ::boost::detail::empty_base>
+struct forward_iteratable
+ : input_iteratable<T, P, B
+ > {};
+
+template <class T, class P, class B = ::boost::detail::empty_base>
+struct bidirectional_iteratable
+ : forward_iteratable<T, P
+ , decrementable<T, B
+ > > {};
+
+// To avoid repeated derivation from equality_comparable,
+// which is an indirect base class of bidirectional_iterable,
+// random_access_iteratable must not be derived from totally_ordered1
+// but from less_than_comparable1 only. (Helmut Zeisel, 02-Dec-2001)
+template <class T, class P, class D, class R, class B = ::boost::detail::empty_base>
+struct random_access_iteratable
+ : bidirectional_iteratable<T, P
+ , less_than_comparable1<T
+ , additive2<T, D
+ , indexable<T, D, R, B
+ > > > > {};
+
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+} // namespace boost
+#endif // BOOST_NO_OPERATORS_IN_NAMESPACE
+
+
+// BOOST_IMPORT_TEMPLATE1 .. BOOST_IMPORT_TEMPLATE4 -
+//
+// When BOOST_NO_OPERATORS_IN_NAMESPACE is defined we need a way to import an
+// operator template into the boost namespace. BOOST_IMPORT_TEMPLATE1 is used
+// for one-argument forms of operator templates; BOOST_IMPORT_TEMPLATE2 for
+// two-argument forms. Note that these macros expect to be invoked from within
+// boost.
+
+#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
+
+ // The template is already in boost so we have nothing to do.
+# define BOOST_IMPORT_TEMPLATE4(template_name)
+# define BOOST_IMPORT_TEMPLATE3(template_name)
+# define BOOST_IMPORT_TEMPLATE2(template_name)
+# define BOOST_IMPORT_TEMPLATE1(template_name)
+
+#else // BOOST_NO_OPERATORS_IN_NAMESPACE
+
+# ifndef BOOST_NO_USING_TEMPLATE
+
+ // Bring the names in with a using-declaration
+ // to avoid stressing the compiler.
+# define BOOST_IMPORT_TEMPLATE4(template_name) using ::template_name;
+# define BOOST_IMPORT_TEMPLATE3(template_name) using ::template_name;
+# define BOOST_IMPORT_TEMPLATE2(template_name) using ::template_name;
+# define BOOST_IMPORT_TEMPLATE1(template_name) using ::template_name;
+
+# else
+
+ // Otherwise, because a Borland C++ 5.5 bug prevents a using declaration
+ // from working, we are forced to use inheritance for that compiler.
+# define BOOST_IMPORT_TEMPLATE4(template_name) \
+ template <class T, class U, class V, class W, class B = ::boost::detail::empty_base> \
+ struct template_name : ::template_name<T, U, V, W, B> {};
+
+# define BOOST_IMPORT_TEMPLATE3(template_name) \
+ template <class T, class U, class V, class B = ::boost::detail::empty_base> \
+ struct template_name : ::template_name<T, U, V, B> {};
+
+# define BOOST_IMPORT_TEMPLATE2(template_name) \
+ template <class T, class U, class B = ::boost::detail::empty_base> \
+ struct template_name : ::template_name<T, U, B> {};
+
+# define BOOST_IMPORT_TEMPLATE1(template_name) \
+ template <class T, class B = ::boost::detail::empty_base> \
+ struct template_name : ::template_name<T, B> {};
+
+# endif // BOOST_NO_USING_TEMPLATE
+
+#endif // BOOST_NO_OPERATORS_IN_NAMESPACE
+
+//
+// Here's where we put it all together, defining the xxxx forms of the templates
+// in namespace boost. We also define specializations of is_chained_base<> for
+// the xxxx, xxxx1, and xxxx2 templates, importing them into boost:: as
+// necessary.
+//
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+// is_chained_base<> - a traits class used to distinguish whether an operator
+// template argument is being used for base class chaining, or is specifying a
+// 2nd argument type.
+
+namespace boost {
+// A type parameter is used instead of a plain bool because Borland's compiler
+// didn't cope well with the more obvious non-type template parameter.
+namespace detail {
+ struct true_t {};
+ struct false_t {};
+} // namespace detail
+
+// Unspecialized version assumes that most types are not being used for base
+// class chaining. We specialize for the operator templates defined in this
+// library.
+template<class T> struct is_chained_base {
+ typedef ::boost::detail::false_t value;
+};
+
+} // namespace boost
+
+// Import a 4-type-argument operator template into boost (if necessary) and
+// provide a specialization of 'is_chained_base<>' for it.
+# define BOOST_OPERATOR_TEMPLATE4(template_name4) \
+ BOOST_IMPORT_TEMPLATE4(template_name4) \
+ template<class T, class U, class V, class W, class B> \
+ struct is_chained_base< ::boost::template_name4<T, U, V, W, B> > { \
+ typedef ::boost::detail::true_t value; \
+ };
+
+// Import a 3-type-argument operator template into boost (if necessary) and
+// provide a specialization of 'is_chained_base<>' for it.
+# define BOOST_OPERATOR_TEMPLATE3(template_name3) \
+ BOOST_IMPORT_TEMPLATE3(template_name3) \
+ template<class T, class U, class V, class B> \
+ struct is_chained_base< ::boost::template_name3<T, U, V, B> > { \
+ typedef ::boost::detail::true_t value; \
+ };
+
+// Import a 2-type-argument operator template into boost (if necessary) and
+// provide a specialization of 'is_chained_base<>' for it.
+# define BOOST_OPERATOR_TEMPLATE2(template_name2) \
+ BOOST_IMPORT_TEMPLATE2(template_name2) \
+ template<class T, class U, class B> \
+ struct is_chained_base< ::boost::template_name2<T, U, B> > { \
+ typedef ::boost::detail::true_t value; \
+ };
+
+// Import a 1-type-argument operator template into boost (if necessary) and
+// provide a specialization of 'is_chained_base<>' for it.
+# define BOOST_OPERATOR_TEMPLATE1(template_name1) \
+ BOOST_IMPORT_TEMPLATE1(template_name1) \
+ template<class T, class B> \
+ struct is_chained_base< ::boost::template_name1<T, B> > { \
+ typedef ::boost::detail::true_t value; \
+ };
+
+// BOOST_OPERATOR_TEMPLATE(template_name) defines template_name<> such that it
+// can be used for specifying both 1-argument and 2-argument forms. Requires the
+// existence of two previously defined class templates named '<template_name>1'
+// and '<template_name>2' which must implement the corresponding 1- and 2-
+// argument forms.
+//
+// The template type parameter O == is_chained_base<U>::value is used to
+// distinguish whether the 2nd argument to <template_name> is being used for
+// base class chaining from another boost operator template or is describing a
+// 2nd operand type. O == true_t only when U is actually an another operator
+// template from the library. Partial specialization is used to select an
+// implementation in terms of either '<template_name>1' or '<template_name>2'.
+//
+
+# define BOOST_OPERATOR_TEMPLATE(template_name) \
+template <class T \
+ ,class U = T \
+ ,class B = ::boost::detail::empty_base \
+ ,class O = typename is_chained_base<U>::value \
+ > \
+struct template_name : template_name##2<T, U, B> {}; \
+ \
+template<class T, class U, class B> \
+struct template_name<T, U, B, ::boost::detail::true_t> \
+ : template_name##1<T, U> {}; \
+ \
+template <class T, class B> \
+struct template_name<T, T, B, ::boost::detail::false_t> \
+ : template_name##1<T, B> {}; \
+ \
+template<class T, class U, class B, class O> \
+struct is_chained_base< ::boost::template_name<T, U, B, O> > { \
+ typedef ::boost::detail::true_t value; \
+}; \
+ \
+BOOST_OPERATOR_TEMPLATE2(template_name##2) \
+BOOST_OPERATOR_TEMPLATE1(template_name##1)
+
+
+#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+# define BOOST_OPERATOR_TEMPLATE4(template_name4) \
+ BOOST_IMPORT_TEMPLATE4(template_name4)
+# define BOOST_OPERATOR_TEMPLATE3(template_name3) \
+ BOOST_IMPORT_TEMPLATE3(template_name3)
+# define BOOST_OPERATOR_TEMPLATE2(template_name2) \
+ BOOST_IMPORT_TEMPLATE2(template_name2)
+# define BOOST_OPERATOR_TEMPLATE1(template_name1) \
+ BOOST_IMPORT_TEMPLATE1(template_name1)
+
+ // In this case we can only assume that template_name<> is equivalent to the
+ // more commonly needed template_name1<> form.
+# define BOOST_OPERATOR_TEMPLATE(template_name) \
+ template <class T, class B = ::boost::detail::empty_base> \
+ struct template_name : template_name##1<T, B> {};
+
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+namespace boost {
+
+BOOST_OPERATOR_TEMPLATE(less_than_comparable)
+BOOST_OPERATOR_TEMPLATE(equality_comparable)
+BOOST_OPERATOR_TEMPLATE(multipliable)
+BOOST_OPERATOR_TEMPLATE(addable)
+BOOST_OPERATOR_TEMPLATE(subtractable)
+BOOST_OPERATOR_TEMPLATE2(subtractable2_left)
+BOOST_OPERATOR_TEMPLATE(dividable)
+BOOST_OPERATOR_TEMPLATE2(dividable2_left)
+BOOST_OPERATOR_TEMPLATE(modable)
+BOOST_OPERATOR_TEMPLATE2(modable2_left)
+BOOST_OPERATOR_TEMPLATE(xorable)
+BOOST_OPERATOR_TEMPLATE(andable)
+BOOST_OPERATOR_TEMPLATE(orable)
+
+BOOST_OPERATOR_TEMPLATE1(incrementable)
+BOOST_OPERATOR_TEMPLATE1(decrementable)
+
+BOOST_OPERATOR_TEMPLATE2(dereferenceable)
+BOOST_OPERATOR_TEMPLATE3(indexable)
+
+BOOST_OPERATOR_TEMPLATE(left_shiftable)
+BOOST_OPERATOR_TEMPLATE(right_shiftable)
+BOOST_OPERATOR_TEMPLATE(equivalent)
+BOOST_OPERATOR_TEMPLATE(partially_ordered)
+
+BOOST_OPERATOR_TEMPLATE(totally_ordered)
+BOOST_OPERATOR_TEMPLATE(additive)
+BOOST_OPERATOR_TEMPLATE(multiplicative)
+BOOST_OPERATOR_TEMPLATE(integer_multiplicative)
+BOOST_OPERATOR_TEMPLATE(arithmetic)
+BOOST_OPERATOR_TEMPLATE(integer_arithmetic)
+BOOST_OPERATOR_TEMPLATE(bitwise)
+BOOST_OPERATOR_TEMPLATE1(unit_steppable)
+BOOST_OPERATOR_TEMPLATE(shiftable)
+BOOST_OPERATOR_TEMPLATE(ring_operators)
+BOOST_OPERATOR_TEMPLATE(ordered_ring_operators)
+BOOST_OPERATOR_TEMPLATE(field_operators)
+BOOST_OPERATOR_TEMPLATE(ordered_field_operators)
+BOOST_OPERATOR_TEMPLATE(euclidian_ring_operators)
+BOOST_OPERATOR_TEMPLATE(ordered_euclidian_ring_operators)
+BOOST_OPERATOR_TEMPLATE2(input_iteratable)
+BOOST_OPERATOR_TEMPLATE1(output_iteratable)
+BOOST_OPERATOR_TEMPLATE2(forward_iteratable)
+BOOST_OPERATOR_TEMPLATE2(bidirectional_iteratable)
+BOOST_OPERATOR_TEMPLATE4(random_access_iteratable)
+
+#undef BOOST_OPERATOR_TEMPLATE
+#undef BOOST_OPERATOR_TEMPLATE4
+#undef BOOST_OPERATOR_TEMPLATE3
+#undef BOOST_OPERATOR_TEMPLATE2
+#undef BOOST_OPERATOR_TEMPLATE1
+#undef BOOST_IMPORT_TEMPLATE1
+#undef BOOST_IMPORT_TEMPLATE2
+#undef BOOST_IMPORT_TEMPLATE3
+#undef BOOST_IMPORT_TEMPLATE4
+
+// The following 'operators' classes can only be used portably if the derived class
+// declares ALL of the required member operators.
+template <class T, class U>
+struct operators2
+ : totally_ordered2<T,U
+ , integer_arithmetic2<T,U
+ , bitwise2<T,U
+ > > > {};
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+template <class T, class U = T>
+struct operators : operators2<T, U> {};
+
+template <class T> struct operators<T, T>
+#else
+template <class T> struct operators
+#endif
+ : totally_ordered<T
+ , integer_arithmetic<T
+ , bitwise<T
+ , unit_steppable<T
+ > > > > {};
+
+// Iterator helper classes (contributed by Jeremy Siek) -------------------//
+// (Input and output iterator helpers contributed by Daryle Walker) -------//
+// (Changed to use combined operator classes by Daryle Walker) ------------//
+template <class T,
+ class V,
+ class D = std::ptrdiff_t,
+ class P = V const *,
+ class R = V const &>
+struct input_iterator_helper
+ : input_iteratable<T, P
+ , boost::iterator<std::input_iterator_tag, V, D, P, R
+ > > {};
+
+template<class T>
+struct output_iterator_helper
+ : output_iteratable<T
+ , boost::iterator<std::output_iterator_tag, void, void, void, void
+ > >
+{
+ T& operator*() { return static_cast<T&>(*this); }
+ T& operator++() { return static_cast<T&>(*this); }
+};
+
+template <class T,
+ class V,
+ class D = std::ptrdiff_t,
+ class P = V*,
+ class R = V&>
+struct forward_iterator_helper
+ : forward_iteratable<T, P
+ , boost::iterator<std::forward_iterator_tag, V, D, P, R
+ > > {};
+
+template <class T,
+ class V,
+ class D = std::ptrdiff_t,
+ class P = V*,
+ class R = V&>
+struct bidirectional_iterator_helper
+ : bidirectional_iteratable<T, P
+ , boost::iterator<std::bidirectional_iterator_tag, V, D, P, R
+ > > {};
+
+template <class T,
+ class V,
+ class D = std::ptrdiff_t,
+ class P = V*,
+ class R = V&>
+struct random_access_iterator_helper
+ : random_access_iteratable<T, P, D, R
+ , boost::iterator<std::random_access_iterator_tag, V, D, P, R
+ > >
+{
+ friend D requires_difference_operator(const T& x, const T& y) {
+ return x - y;
+ }
+}; // random_access_iterator_helper
+
+} // namespace boost
+
+#if defined(__sgi) && !defined(__GNUC__)
+#pragma reset woff 1234
+#endif
+
+#endif // BOOST_OPERATORS_HPP
--- /dev/null
+// 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/lib/optional for documentation.
+//
+// You are welcome to contact the author at:
+// fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_OPTIONAL_FLC_19NOV2002_HPP
+#define BOOST_OPTIONAL_FLC_19NOV2002_HPP
+
+#include "boost/optional/optional.hpp"
+
+#endif
+
--- /dev/null
+// Copyright David Abrahams, Daniel Wallin 2005. 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 BOOST_PARAMETER_050401_HPP
+#define BOOST_PARAMETER_050401_HPP
+
+#include <boost/parameter/parameters.hpp>
+#include <boost/parameter/keyword.hpp>
+#include <boost/parameter/binding.hpp>
+#include <boost/parameter/macros.hpp>
+#include <boost/parameter/match.hpp>
+
+#endif // BOOST_PARAMETER_050401_HPP
+
--- /dev/null
+#ifndef BOOST_PFTO_HPP
+#define BOOST_PFTO_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
+// pfto.hpp: workarounds for compilers which have problems supporting
+// Partial Function Template Ordering (PFTO).
+
+// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// 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 for updates, documentation, and revision history.
+// PFTO version is used to specify the last argument of certain functions
+// Function it is used to support compilers that fail to support correct Partial
+// Template Ordering
+#include <boost/config.hpp>
+
+// some compilers can use an exta argument and use function overloading
+// to choose desired function. This extra argument is long in the default
+// function implementation and int for the rest. The function is called
+// with an int argument. This first attempts to match functions with an
+// int argument before the default one (with a long argument). This is
+// known to function with VC 6.0. On other compilers this fails (Borland)
+// or causes other problems (GCC). note: this
+
+#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+ #define BOOST_PFTO long
+#else
+ #define BOOST_PFTO
+#endif
+
+// here's another approach. Rather than use a default function - make sure
+// there is no default at all by requiring that all function invocations
+// have a "wrapped" argument type. This solves a problem with VC 6.0
+// (and perhaps others) while implementing templated constructors.
+
+namespace boost {
+
+template<class T>
+struct pfto_wrapper {
+ const T & t;
+ operator const T & (){
+ return t;
+ }
+ pfto_wrapper (const T & rhs) : t(rhs) {}
+};
+
+template<class T>
+pfto_wrapper<T> make_pfto_wrapper(const T & t, BOOST_PFTO int){
+ return pfto_wrapper<T>(t);
+}
+
+template<class T>
+pfto_wrapper<T> make_pfto_wrapper(const pfto_wrapper<T> & t, int){
+ return t;
+}
+
+} // namespace boost
+
+#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+ #define BOOST_PFTO_WRAPPER(T) boost::pfto_wrapper<T>
+ #define BOOST_MAKE_PFTO_WRAPPER(t) boost::make_pfto_wrapper(t, 0)
+#else
+ #define BOOST_PFTO_WRAPPER(T) T
+ #define BOOST_MAKE_PFTO_WRAPPER(t) t
+#endif
+
+#endif // BOOST_PFTO_HPP
--- /dev/null
+#ifndef POINTEE_DWA200415_HPP
+# define POINTEE_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 pointee<P>::type provides the pointee type of P.
+//
+// For example, it is T for T* and X for shared_ptr<X>.
+//
+// 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/add_const.hpp>
+# include <boost/type_traits/remove_cv.hpp>
+# include <boost/mpl/if.hpp>
+# include <boost/mpl/eval_if.hpp>
+
+namespace boost {
+
+namespace detail
+{
+ template <class P>
+ struct smart_ptr_pointee
+ {
+ typedef typename P::element_type type;
+ };
+
+ template <class Iterator>
+ struct iterator_pointee
+ {
+ typedef typename iterator_traits<Iterator>::value_type value_type;
+
+ struct impl
+ {
+ template <class T>
+ static char test(T const&);
+
+ static char (& test(value_type&) )[2];
+
+ static Iterator& x;
+ };
+
+ BOOST_STATIC_CONSTANT(bool, is_constant = sizeof(impl::test(*impl::x)) == 1);
+
+ typedef typename mpl::if_c<
+# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+ ::boost::detail::iterator_pointee<Iterator>::is_constant
+# else
+ is_constant
+# endif
+ , typename add_const<value_type>::type
+ , value_type
+ >::type type;
+ };
+}
+
+template <class P>
+struct pointee
+ : mpl::eval_if<
+ detail::is_incrementable<P>
+ , detail::iterator_pointee<P>
+ , detail::smart_ptr_pointee<P>
+ >
+{
+};
+
+} // namespace boost
+
+#endif // POINTEE_DWA200415_HPP
--- /dev/null
+# /* Copyright (C) 2001
+# * Housemarque Oy
+# * http://www.housemarque.com
+# *
+# * 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)
+# */
+#
+# /* Revised by Paul Mensonides (2002) */
+#
+# /* See http://www.boost.org/libs/preprocessor for documentation. */
+#
+# ifndef BOOST_PREPROCESSOR_HPP
+# define BOOST_PREPROCESSOR_HPP
+#
+# include <boost/preprocessor/library.hpp>
+#
+# endif
--- /dev/null
+// Copyright Vladimir Prus 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 PROGRAM_OPTIONS_VP_2003_05_19
+#define PROGRAM_OPTIONS_VP_2003_05_19
+
+#if _MSC_VER >= 1020
+#pragma once
+#endif
+
+#include <boost/program_options/options_description.hpp>
+#include <boost/program_options/positional_options.hpp>
+#include <boost/program_options/parsers.hpp>
+#include <boost/program_options/variables_map.hpp>
+#include <boost/program_options/cmdline.hpp>
+#include <boost/program_options/errors.hpp>
+#include <boost/program_options/option.hpp>
+#include <boost/program_options/value_semantic.hpp>
+#include <boost/program_options/version.hpp>
+
+#endif
--- /dev/null
+// boost progress.hpp header file ------------------------------------------//
+
+// Copyright Beman Dawes 1994-99. 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/timer for documentation.
+
+// Revision History
+// 1 Dec 01 Add leading progress display strings (suggested by Toon Knapen)
+// 20 May 01 Introduce several static_casts<> to eliminate warning messages
+// (Fixed by Beman, reported by Herve Bronnimann)
+// 12 Jan 01 Change to inline implementation to allow use without library
+// builds. See docs for more rationale. (Beman Dawes)
+// 22 Jul 99 Name changed to .hpp
+// 16 Jul 99 Second beta
+// 6 Jul 99 Initial boost version
+
+#ifndef BOOST_PROGRESS_HPP
+#define BOOST_PROGRESS_HPP
+
+#include <boost/timer.hpp>
+#include <boost/utility.hpp> // for noncopyable
+#include <boost/cstdint.hpp> // for uintmax_t
+#include <iostream> // for ostream, cout, etc
+#include <string> // for string
+
+namespace boost {
+
+// progress_timer ----------------------------------------------------------//
+
+// A progress_timer behaves like a timer except that the destructor displays
+// an elapsed time message at an appropriate place in an appropriate form.
+
+class progress_timer : public timer, private noncopyable
+{
+
+ public:
+ explicit progress_timer( std::ostream & os = std::cout )
+ // os is hint; implementation may ignore, particularly in embedded systems
+ : m_os(os) {}
+ ~progress_timer()
+ {
+ // A) Throwing an exception from a destructor is a Bad Thing.
+ // B) The progress_timer destructor does output which may throw.
+ // C) A progress_timer is usually not critical to the application.
+ // Therefore, wrap the I/O in a try block, catch and ignore all exceptions.
+ try
+ {
+ // use istream instead of ios_base to workaround GNU problem (Greg Chicares)
+ std::istream::fmtflags old_flags = m_os.setf( std::istream::fixed,
+ std::istream::floatfield );
+ std::streamsize old_prec = m_os.precision( 2 );
+ m_os << elapsed() << " s\n" // "s" is System International d'Unités std
+ << std::endl;
+ m_os.flags( old_flags );
+ m_os.precision( old_prec );
+ }
+
+ catch (...) {} // eat any exceptions
+ } // ~progress_timer
+
+ private:
+ std::ostream & m_os;
+};
+
+
+// progress_display --------------------------------------------------------//
+
+// progress_display displays an appropriate indication of
+// progress at an appropriate place in an appropriate form.
+
+// NOTE: (Jan 12, 2001) Tried to change unsigned long to boost::uintmax_t, but
+// found some compilers couldn't handle the required conversion to double.
+// Reverted to unsigned long until the compilers catch up.
+
+class progress_display : private noncopyable
+{
+ public:
+ explicit progress_display( unsigned long expected_count,
+ std::ostream & os = std::cout,
+ const std::string & s1 = "\n", //leading strings
+ const std::string & s2 = "",
+ const std::string & s3 = "" )
+ // os is hint; implementation may ignore, particularly in embedded systems
+ : m_os(os), m_s1(s1), m_s2(s2), m_s3(s3) { restart(expected_count); }
+
+ void restart( unsigned long expected_count )
+ // Effects: display appropriate scale
+ // Postconditions: count()==0, expected_count()==expected_count
+ {
+ _count = _next_tic_count = _tic = 0;
+ _expected_count = expected_count;
+
+ m_os << m_s1 << "0% 10 20 30 40 50 60 70 80 90 100%\n"
+ << m_s2 << "|----|----|----|----|----|----|----|----|----|----|"
+ << std::endl // endl implies flush, which ensures display
+ << m_s3;
+ if ( !_expected_count ) _expected_count = 1; // prevent divide by zero
+ } // restart
+
+ unsigned long operator+=( unsigned long increment )
+ // Effects: Display appropriate progress tic if needed.
+ // Postconditions: count()== original count() + increment
+ // Returns: count().
+ {
+ if ( (_count += increment) >= _next_tic_count ) { display_tic(); }
+ return _count;
+ }
+
+ unsigned long operator++() { return operator+=( 1 ); }
+ unsigned long count() const { return _count; }
+ unsigned long expected_count() const { return _expected_count; }
+
+ private:
+ std::ostream & m_os; // may not be present in all imps
+ const std::string m_s1; // string is more general, safer than
+ const std::string m_s2; // const char *, and efficiency or size are
+ const std::string m_s3; // not issues
+
+ unsigned long _count, _expected_count, _next_tic_count;
+ unsigned int _tic;
+ void display_tic()
+ {
+ // use of floating point ensures that both large and small counts
+ // work correctly. static_cast<>() is also used several places
+ // to suppress spurious compiler warnings.
+ unsigned int tics_needed =
+ static_cast<unsigned int>(
+ (static_cast<double>(_count)/_expected_count)*50.0 );
+ do { m_os << '*' << std::flush; } while ( ++_tic < tics_needed );
+ _next_tic_count =
+ static_cast<unsigned long>((_tic/50.0)*_expected_count);
+ if ( _count == _expected_count ) {
+ if ( _tic < 51 ) m_os << '*';
+ m_os << std::endl;
+ }
+ } // display_tic
+};
+
+} // namespace boost
+
+#endif // BOOST_PROGRESS_HPP
--- /dev/null
+// (C) Copyright Jeremy Siek 1999-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/property_map for documentation.
+
+#ifndef BOOST_PROPERTY_MAP_HPP
+#define BOOST_PROPERTY_MAP_HPP
+
+#include <cassert>
+#include <boost/config.hpp>
+#include <boost/pending/cstddef.hpp>
+#include <boost/detail/iterator.hpp>
+#include <boost/concept_check.hpp>
+#include <boost/concept_archetype.hpp>
+
+namespace boost {
+
+ //=========================================================================
+ // property_traits class
+
+ template <typename PA>
+ struct property_traits {
+ typedef typename PA::key_type key_type;
+ typedef typename PA::value_type value_type;
+ typedef typename PA::reference reference;
+ typedef typename PA::category category;
+ };
+
+ //=========================================================================
+ // property_traits category tags
+
+ namespace detail {
+ enum ePropertyMapID { READABLE_PA, WRITABLE_PA,
+ READ_WRITE_PA, LVALUE_PA, OP_BRACKET_PA,
+ RAND_ACCESS_ITER_PA, LAST_PA };
+ }
+ struct readable_property_map_tag { enum { id = detail::READABLE_PA }; };
+ struct writable_property_map_tag { enum { id = detail::WRITABLE_PA }; };
+ struct read_write_property_map_tag :
+ public readable_property_map_tag,
+ public writable_property_map_tag
+ { enum { id = detail::READ_WRITE_PA }; };
+
+ struct lvalue_property_map_tag : public read_write_property_map_tag
+ { enum { id = detail::LVALUE_PA }; };
+
+ //=========================================================================
+ // property_traits specialization for pointers
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // The user will just have to create their own specializations for
+ // other pointers types if the compiler does not have partial
+ // specializations. Sorry!
+#define BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(TYPE) \
+ template <> \
+ struct property_traits<TYPE*> { \
+ typedef TYPE value_type; \
+ typedef value_type& reference; \
+ typedef std::ptrdiff_t key_type; \
+ typedef lvalue_property_map_tag category; \
+ }; \
+ template <> \
+ struct property_traits<const TYPE*> { \
+ typedef TYPE value_type; \
+ typedef const value_type& reference; \
+ typedef std::ptrdiff_t key_type; \
+ typedef lvalue_property_map_tag category; \
+ }
+
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(long);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned long);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(int);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned int);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(short);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned short);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(char);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned char);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(signed char);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(bool);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(float);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(double);
+ BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(long double);
+
+ // This may need to be turned off for some older compilers that don't have
+ // wchar_t intrinsically.
+# ifndef BOOST_NO_INTRINSIC_WCHAR_T
+ template <>
+ struct property_traits<wchar_t*> {
+ typedef wchar_t value_type;
+ typedef value_type& reference;
+ typedef std::ptrdiff_t key_type;
+ typedef lvalue_property_map_tag category;
+ };
+ template <>
+ struct property_traits<const wchar_t*> {
+ typedef wchar_t value_type;
+ typedef const value_type& reference;
+ typedef std::ptrdiff_t key_type;
+ typedef lvalue_property_map_tag category;
+ };
+# endif
+
+#else
+ template <class T>
+ struct property_traits<T*> {
+ typedef T value_type;
+ typedef value_type& reference;
+ typedef std::ptrdiff_t key_type;
+ typedef lvalue_property_map_tag category;
+ };
+ template <class T>
+ struct property_traits<const T*> {
+ typedef T value_type;
+ typedef const value_type& reference;
+ typedef std::ptrdiff_t key_type;
+ typedef lvalue_property_map_tag category;
+ };
+#endif
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+ // MSVC doesn't have Koenig lookup, so the user has to
+ // do boost::get() anyways, and the using clause
+ // doesn't really work for MSVC.
+} // namespace boost
+#endif
+
+ // These need to go in global namespace because Koenig
+ // lookup does not apply to T*.
+
+ // V must be convertible to T
+ template <class T, class V>
+ inline void put(T* pa, std::ptrdiff_t k, const V& val) { pa[k] = val; }
+
+ template <class T>
+ inline const T& get(const T* pa, std::ptrdiff_t k) { return pa[k]; }
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+namespace boost {
+ using ::put;
+ using ::get;
+#endif
+
+ //=========================================================================
+ // concept checks for property maps
+
+ template <class PMap, class Key>
+ struct ReadablePropertyMapConcept
+ {
+ typedef typename property_traits<PMap>::key_type key_type;
+ typedef typename property_traits<PMap>::reference reference;
+ typedef typename property_traits<PMap>::category Category;
+ typedef boost::readable_property_map_tag ReadableTag;
+ void constraints() {
+ function_requires< ConvertibleConcept<Category, ReadableTag> >();
+
+ val = get(pmap, k);
+ }
+ PMap pmap;
+ Key k;
+ typename property_traits<PMap>::value_type val;
+ };
+ template <typename KeyArchetype, typename ValueArchetype>
+ struct readable_property_map_archetype {
+ typedef KeyArchetype key_type;
+ typedef ValueArchetype value_type;
+ typedef convertible_to_archetype<ValueArchetype> reference;
+ typedef readable_property_map_tag category;
+ };
+ template <typename K, typename V>
+ const typename readable_property_map_archetype<K,V>::reference&
+ get(const readable_property_map_archetype<K,V>&,
+ const typename readable_property_map_archetype<K,V>::key_type&)
+ {
+ typedef typename readable_property_map_archetype<K,V>::reference R;
+ return static_object<R>::get();
+ }
+
+
+ template <class PMap, class Key>
+ struct WritablePropertyMapConcept
+ {
+ typedef typename property_traits<PMap>::key_type key_type;
+ typedef typename property_traits<PMap>::category Category;
+ typedef boost::writable_property_map_tag WritableTag;
+ void constraints() {
+ function_requires< ConvertibleConcept<Category, WritableTag> >();
+ put(pmap, k, val);
+ }
+ PMap pmap;
+ Key k;
+ typename property_traits<PMap>::value_type val;
+ };
+ template <typename KeyArchetype, typename ValueArchetype>
+ struct writable_property_map_archetype {
+ typedef KeyArchetype key_type;
+ typedef ValueArchetype value_type;
+ typedef void reference;
+ typedef writable_property_map_tag category;
+ };
+ template <typename K, typename V>
+ void put(const writable_property_map_archetype<K,V>&,
+ const typename writable_property_map_archetype<K,V>::key_type&,
+ const typename writable_property_map_archetype<K,V>::value_type&) { }
+
+
+ template <class PMap, class Key>
+ struct ReadWritePropertyMapConcept
+ {
+ typedef typename property_traits<PMap>::category Category;
+ typedef boost::read_write_property_map_tag ReadWriteTag;
+ void constraints() {
+ function_requires< ReadablePropertyMapConcept<PMap, Key> >();
+ function_requires< WritablePropertyMapConcept<PMap, Key> >();
+ function_requires< ConvertibleConcept<Category, ReadWriteTag> >();
+ }
+ };
+ template <typename KeyArchetype, typename ValueArchetype>
+ struct read_write_property_map_archetype
+ : public readable_property_map_archetype<KeyArchetype, ValueArchetype>,
+ public writable_property_map_archetype<KeyArchetype, ValueArchetype>
+ {
+ typedef KeyArchetype key_type;
+ typedef ValueArchetype value_type;
+ typedef convertible_to_archetype<ValueArchetype> reference;
+ typedef read_write_property_map_tag category;
+ };
+
+
+ template <class PMap, class Key>
+ struct LvaluePropertyMapConcept
+ {
+ typedef typename property_traits<PMap>::category Category;
+ typedef boost::lvalue_property_map_tag LvalueTag;
+ typedef typename property_traits<PMap>::reference reference;
+
+ void constraints() {
+ function_requires< ReadablePropertyMapConcept<PMap, Key> >();
+ function_requires< ConvertibleConcept<Category, LvalueTag> >();
+
+ typedef typename property_traits<PMap>::value_type value_type;
+ typedef typename require_same<
+ const value_type&, reference>::type req;
+
+ reference ref = pmap[k];
+ ignore_unused_variable_warning(ref);
+ }
+ PMap pmap;
+ Key k;
+ };
+ template <typename KeyArchetype, typename ValueArchetype>
+ struct lvalue_property_map_archetype
+ : public readable_property_map_archetype<KeyArchetype, ValueArchetype>
+ {
+ typedef KeyArchetype key_type;
+ typedef ValueArchetype value_type;
+ typedef const ValueArchetype& reference;
+ typedef lvalue_property_map_tag category;
+ const value_type& operator[](const key_type&) const {
+ return static_object<value_type>::get();
+ }
+ };
+
+ template <class PMap, class Key>
+ struct Mutable_LvaluePropertyMapConcept
+ {
+ typedef typename property_traits<PMap>::category Category;
+ typedef boost::lvalue_property_map_tag LvalueTag;
+ typedef typename property_traits<PMap>::reference reference;
+ void constraints() {
+ boost::function_requires< ReadWritePropertyMapConcept<PMap, Key> >();
+ boost::function_requires<ConvertibleConcept<Category, LvalueTag> >();
+
+ typedef typename property_traits<PMap>::value_type value_type;
+ typedef typename require_same<
+ value_type&,
+ reference>::type req;
+
+ reference ref = pmap[k];
+ ignore_unused_variable_warning(ref);
+ }
+ PMap pmap;
+ Key k;
+ };
+ template <typename KeyArchetype, typename ValueArchetype>
+ struct mutable_lvalue_property_map_archetype
+ : public readable_property_map_archetype<KeyArchetype, ValueArchetype>,
+ public writable_property_map_archetype<KeyArchetype, ValueArchetype>
+ {
+ typedef KeyArchetype key_type;
+ typedef ValueArchetype value_type;
+ typedef ValueArchetype& reference;
+ typedef lvalue_property_map_tag category;
+ value_type& operator[](const key_type&) const {
+ return static_object<value_type>::get();
+ }
+ };
+
+ struct identity_property_map;
+
+ // A helper class for constructing a property map
+ // from a class that implements operator[]
+
+ template <class Reference, class LvaluePropertyMap>
+ struct put_get_helper { };
+
+ template <class PropertyMap, class Reference, class K>
+ inline Reference
+ get(const put_get_helper<Reference, PropertyMap>& pa, const K& k)
+ {
+ Reference v = static_cast<const PropertyMap&>(pa)[k];
+ return v;
+ }
+ template <class PropertyMap, class Reference, class K, class V>
+ inline void
+ put(const put_get_helper<Reference, PropertyMap>& pa, K k, const V& v)
+ {
+ static_cast<const PropertyMap&>(pa)[k] = v;
+ }
+
+ //=========================================================================
+ // Adapter to turn a RandomAccessIterator into a property map
+
+ template <class RandomAccessIterator,
+ class IndexMap
+#ifdef BOOST_NO_STD_ITERATOR_TRAITS
+ , class T, class R
+#else
+ , class T = typename std::iterator_traits<RandomAccessIterator>::value_type
+ , class R = typename std::iterator_traits<RandomAccessIterator>::reference
+#endif
+ >
+ class iterator_property_map
+ : public boost::put_get_helper< R,
+ iterator_property_map<RandomAccessIterator, IndexMap,
+ T, R> >
+ {
+ public:
+ typedef typename property_traits<IndexMap>::key_type key_type;
+ typedef T value_type;
+ typedef R reference;
+ typedef boost::lvalue_property_map_tag category;
+
+ inline iterator_property_map(
+ RandomAccessIterator cc = RandomAccessIterator(),
+ const IndexMap& _id = IndexMap() )
+ : iter(cc), index(_id) { }
+ inline R operator[](key_type v) const { return *(iter + get(index, v)) ; }
+ protected:
+ RandomAccessIterator iter;
+ IndexMap index;
+ };
+
+#if !defined BOOST_NO_STD_ITERATOR_TRAITS
+ template <class RAIter, class ID>
+ inline iterator_property_map<
+ RAIter, ID,
+ typename std::iterator_traits<RAIter>::value_type,
+ typename std::iterator_traits<RAIter>::reference>
+ make_iterator_property_map(RAIter iter, ID id) {
+ function_requires< RandomAccessIteratorConcept<RAIter> >();
+ typedef iterator_property_map<
+ RAIter, ID,
+ typename std::iterator_traits<RAIter>::value_type,
+ typename std::iterator_traits<RAIter>::reference> PA;
+ return PA(iter, id);
+ }
+#endif
+ template <class RAIter, class Value, class ID>
+ inline iterator_property_map<RAIter, ID, Value, Value&>
+ make_iterator_property_map(RAIter iter, ID id, Value) {
+ function_requires< RandomAccessIteratorConcept<RAIter> >();
+ typedef iterator_property_map<RAIter, ID, Value, Value&> PMap;
+ return PMap(iter, id);
+ }
+
+ template <class RandomAccessIterator,
+ class IndexMap
+#ifdef BOOST_NO_STD_ITERATOR_TRAITS
+ , class T, class R
+#else
+ , class T = typename std::iterator_traits<RandomAccessIterator>::value_type
+ , class R = typename std::iterator_traits<RandomAccessIterator>::reference
+#endif
+ >
+ class safe_iterator_property_map
+ : public boost::put_get_helper< R,
+ safe_iterator_property_map<RandomAccessIterator, IndexMap,
+ T, R> >
+ {
+ public:
+ typedef typename property_traits<IndexMap>::key_type key_type;
+ typedef T value_type;
+ typedef R reference;
+ typedef boost::lvalue_property_map_tag category;
+
+ inline safe_iterator_property_map(
+ RandomAccessIterator first,
+ std::size_t n_ = 0,
+ const IndexMap& _id = IndexMap() )
+ : iter(first), n(n_), index(_id) { }
+ inline safe_iterator_property_map() { }
+ inline R operator[](key_type v) const {
+ assert(get(index, v) < n);
+ return *(iter + get(index, v)) ;
+ }
+ typename property_traits<IndexMap>::value_type size() const { return n; }
+ protected:
+ RandomAccessIterator iter;
+ typename property_traits<IndexMap>::value_type n;
+ IndexMap index;
+ };
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ template <class RAIter, class ID>
+ inline safe_iterator_property_map<
+ RAIter, ID,
+ typename boost::detail::iterator_traits<RAIter>::value_type,
+ typename boost::detail::iterator_traits<RAIter>::reference>
+ make_safe_iterator_property_map(RAIter iter, std::size_t n, ID id) {
+ function_requires< RandomAccessIteratorConcept<RAIter> >();
+ typedef safe_iterator_property_map<
+ RAIter, ID,
+ typename boost::detail::iterator_traits<RAIter>::value_type,
+ typename boost::detail::iterator_traits<RAIter>::reference> PA;
+ return PA(iter, n, id);
+ }
+#endif
+ template <class RAIter, class Value, class ID>
+ inline safe_iterator_property_map<RAIter, ID, Value, Value&>
+ make_safe_iterator_property_map(RAIter iter, std::size_t n, ID id, Value) {
+ function_requires< RandomAccessIteratorConcept<RAIter> >();
+ typedef safe_iterator_property_map<RAIter, ID, Value, Value&> PMap;
+ return PMap(iter, n, id);
+ }
+
+ //=========================================================================
+ // An adaptor to turn a Unique Pair Associative Container like std::map or
+ // std::hash_map into an Lvalue Property Map.
+
+ template <typename UniquePairAssociativeContainer>
+ class associative_property_map
+ : public boost::put_get_helper<
+ typename UniquePairAssociativeContainer::value_type::second_type&,
+ associative_property_map<UniquePairAssociativeContainer> >
+ {
+ typedef UniquePairAssociativeContainer C;
+ public:
+ typedef typename C::key_type key_type;
+ typedef typename C::value_type::second_type value_type;
+ typedef value_type& reference;
+ typedef lvalue_property_map_tag category;
+ associative_property_map() : m_c(0) { }
+ associative_property_map(C& c) : m_c(&c) { }
+ reference operator[](const key_type& k) const {
+ return (*m_c)[k];
+ }
+ private:
+ C* m_c;
+ };
+
+ template <class UniquePairAssociativeContainer>
+ associative_property_map<UniquePairAssociativeContainer>
+ make_assoc_property_map(UniquePairAssociativeContainer& c)
+ {
+ return associative_property_map<UniquePairAssociativeContainer>(c);
+ }
+
+ template <typename UniquePairAssociativeContainer>
+ class const_associative_property_map
+ : public boost::put_get_helper<
+ const typename UniquePairAssociativeContainer::value_type::second_type&,
+ const_associative_property_map<UniquePairAssociativeContainer> >
+ {
+ typedef UniquePairAssociativeContainer C;
+ public:
+ typedef typename C::key_type key_type;
+ typedef typename C::value_type::second_type value_type;
+ typedef const value_type& reference;
+ typedef lvalue_property_map_tag category;
+ const_associative_property_map() : m_c(0) { }
+ const_associative_property_map(const C& c) : m_c(&c) { }
+ reference operator[](const key_type& k) const {
+ return m_c->find(k)->second;
+ }
+ private:
+ C const* m_c;
+ };
+
+ template <class UniquePairAssociativeContainer>
+ const_associative_property_map<UniquePairAssociativeContainer>
+ make_assoc_property_map(const UniquePairAssociativeContainer& c)
+ {
+ return const_associative_property_map<UniquePairAssociativeContainer>(c);
+ }
+
+ //=========================================================================
+ // A property map that applies the identity function to integers
+ struct identity_property_map
+ : public boost::put_get_helper<std::size_t,
+ identity_property_map>
+ {
+ typedef std::size_t key_type;
+ typedef std::size_t value_type;
+ typedef std::size_t reference;
+ typedef boost::readable_property_map_tag category;
+
+ inline value_type operator[](const key_type& v) const { return v; }
+ };
+
+ //=========================================================================
+ // A property map that does not do anything, for
+ // when you have to supply a property map, but don't need it.
+ namespace detail {
+ struct dummy_pmap_reference {
+ template <class T>
+ dummy_pmap_reference& operator=(const T&) { return *this; }
+ operator int() { return 0; }
+ };
+ }
+ class dummy_property_map
+ : public boost::put_get_helper<detail::dummy_pmap_reference,
+ dummy_property_map >
+ {
+ public:
+ typedef void key_type;
+ typedef int value_type;
+ typedef detail::dummy_pmap_reference reference;
+ typedef boost::read_write_property_map_tag category;
+ inline dummy_property_map() : c(0) { }
+ inline dummy_property_map(value_type cc) : c(cc) { }
+ inline dummy_property_map(const dummy_property_map& x)
+ : c(x.c) { }
+ template <class Vertex>
+ inline reference operator[](Vertex) const { return reference(); }
+ protected:
+ value_type c;
+ };
+
+
+} // namespace boost
+
+
+#endif /* BOOST_PROPERTY_MAP_HPP */
+
--- /dev/null
+// (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)
+
+// See http://www.boost.org/libs/property_map for documentation.
+
+#ifndef BOOST_PROPERTY_MAP_ITERATOR_HPP
+#define BOOST_PROPERTY_MAP_ITERATOR_HPP
+
+#include <boost/property_map.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+namespace boost {
+
+ //======================================================================
+ // property iterator, generalized from ideas by François Faure
+
+ namespace detail {
+
+ template <class Iterator, class LvaluePropertyMap>
+ class lvalue_pmap_iter
+ : public iterator_adaptor< lvalue_pmap_iter< Iterator, LvaluePropertyMap >,
+ Iterator,
+ typename property_traits<LvaluePropertyMap>::value_type,
+ use_default,
+ typename property_traits<LvaluePropertyMap>::reference>
+ {
+ friend class boost::iterator_core_access;
+
+ typedef iterator_adaptor< lvalue_pmap_iter< Iterator, LvaluePropertyMap >,
+ Iterator,
+ typename property_traits<LvaluePropertyMap>::value_type,
+ use_default,
+ typename property_traits<LvaluePropertyMap>::reference> super_t;
+
+ public:
+ lvalue_pmap_iter() { }
+ lvalue_pmap_iter(Iterator const& it,
+ LvaluePropertyMap m)
+ : super_t(it),
+ m_map(m) {}
+
+ private:
+ typename super_t::reference
+ dereference() const
+ {
+ return m_map[*(this->base_reference())];
+ }
+
+ LvaluePropertyMap m_map;
+ };
+
+ template <class Iterator, class ReadablePropertyMap>
+ class readable_pmap_iter :
+ public iterator_adaptor< readable_pmap_iter< Iterator, ReadablePropertyMap >,
+ Iterator,
+ typename property_traits<ReadablePropertyMap>::value_type,
+ use_default,
+ typename property_traits<ReadablePropertyMap>::value_type>
+
+
+ {
+ friend class iterator_core_access;
+
+ typedef iterator_adaptor< readable_pmap_iter< Iterator, ReadablePropertyMap >,
+ Iterator,
+ typename property_traits<ReadablePropertyMap>::value_type,
+ use_default,
+ typename property_traits<ReadablePropertyMap>::value_type> super_t;
+
+ public:
+ readable_pmap_iter() { }
+ readable_pmap_iter(Iterator const& it,
+ ReadablePropertyMap m)
+ : super_t(it),
+ m_map(m) {}
+
+ private:
+ typename super_t::reference
+ dereference() const
+ {
+ return get(m_map, *(this->base_reference()));
+ }
+
+ ReadablePropertyMap m_map;
+ };
+
+
+ } // namespace detail
+
+ template <class PropertyMap, class Iterator>
+ struct property_map_iterator_generator :
+ mpl::if_< is_same< typename property_traits<PropertyMap>::category, lvalue_property_map_tag>,
+ detail::lvalue_pmap_iter<Iterator, PropertyMap>,
+ detail::readable_pmap_iter<Iterator, PropertyMap> >
+ {};
+
+ template <class PropertyMap, class Iterator>
+ typename property_map_iterator_generator<PropertyMap, Iterator>::type
+ make_property_map_iterator(PropertyMap pmap, Iterator iter)
+ {
+ typedef typename property_map_iterator_generator<PropertyMap,
+ Iterator>::type Iter;
+ return Iter(iter, pmap);
+ }
+
+} // namespace boost
+
+#endif // BOOST_PROPERTY_MAP_ITERATOR_HPP
+
--- /dev/null
+// Copyright David Abrahams 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/python for documentation.
+
+#ifndef PYTHON_DWA2002810_HPP
+# define PYTHON_DWA2002810_HPP
+
+# include <boost/python/args.hpp>
+# include <boost/python/args_fwd.hpp>
+# include <boost/python/back_reference.hpp>
+# include <boost/python/bases.hpp>
+# include <boost/python/borrowed.hpp>
+# include <boost/python/call.hpp>
+# include <boost/python/call_method.hpp>
+# include <boost/python/class.hpp>
+# include <boost/python/copy_const_reference.hpp>
+# include <boost/python/copy_non_const_reference.hpp>
+# include <boost/python/data_members.hpp>
+# include <boost/python/def.hpp>
+# include <boost/python/default_call_policies.hpp>
+# include <boost/python/dict.hpp>
+# include <boost/python/enum.hpp>
+# include <boost/python/errors.hpp>
+# include <boost/python/exception_translator.hpp>
+# include <boost/python/extract.hpp>
+# include <boost/python/handle.hpp>
+# include <boost/python/has_back_reference.hpp>
+# include <boost/python/implicit.hpp>
+# include <boost/python/init.hpp>
+# include <boost/python/instance_holder.hpp>
+# include <boost/python/iterator.hpp>
+# include <boost/python/list.hpp>
+# include <boost/python/long.hpp>
+# include <boost/python/lvalue_from_pytype.hpp>
+# include <boost/python/make_constructor.hpp>
+# include <boost/python/make_function.hpp>
+# include <boost/python/manage_new_object.hpp>
+# include <boost/python/module.hpp>
+# include <boost/python/numeric.hpp>
+# include <boost/python/object.hpp>
+# include <boost/python/object_protocol.hpp>
+# include <boost/python/object_protocol_core.hpp>
+# include <boost/python/opaque_pointer_converter.hpp>
+# include <boost/python/operators.hpp>
+# include <boost/python/other.hpp>
+# include <boost/python/overloads.hpp>
+# include <boost/python/pointee.hpp>
+# include <boost/python/pure_virtual.hpp>
+# include <boost/python/ptr.hpp>
+# include <boost/python/reference_existing_object.hpp>
+# include <boost/python/register_ptr_to_python.hpp>
+# include <boost/python/return_arg.hpp>
+# include <boost/python/return_internal_reference.hpp>
+# include <boost/python/return_opaque_pointer.hpp>
+# include <boost/python/return_value_policy.hpp>
+# include <boost/python/scope.hpp>
+# include <boost/python/self.hpp>
+# include <boost/python/slice_nil.hpp>
+# include <boost/python/str.hpp>
+# include <boost/python/to_python_converter.hpp>
+# include <boost/python/to_python_indirect.hpp>
+# include <boost/python/to_python_value.hpp>
+# include <boost/python/tuple.hpp>
+# include <boost/python/type_id.hpp>
+# include <boost/python/with_custodian_and_ward.hpp>
+
+#endif // PYTHON_DWA2002810_HPP
--- /dev/null
+/* boost random.hpp header file
+ *
+ * Copyright Jens Maurer 2000-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/random for documentation.
+ *
+ * $Id$
+ *
+ * Revision history
+ * 2000-02-18 portability fixes (thanks to Beman Dawes)
+ * 2000-02-21 shuffle_output, inversive_congruential_schrage,
+ * generator_iterator, uniform_smallint
+ * 2000-02-23 generic modulus arithmetic helper, removed *_schrage classes,
+ * implemented Streamable and EqualityComparable concepts for
+ * generators, added Bernoulli distribution and Box-Muller
+ * transform
+ * 2000-03-01 cauchy, lognormal, triangle distributions; fixed
+ * uniform_smallint; renamed gaussian to normal distribution
+ * 2000-03-05 implemented iterator syntax for distribution functions
+ * 2000-04-21 removed some optimizations for better BCC/MSVC compatibility
+ * 2000-05-10 adapted to BCC and MSVC
+ * 2000-06-13 incorporated review results
+ * 2000-07-06 moved basic templates from namespace detail to random
+ * 2000-09-23 warning removals and int64 fixes (Ed Brey)
+ * 2000-09-24 added lagged_fibonacci generator (Matthias Troyer)
+ * 2001-02-18 moved to individual header files
+ */
+
+#ifndef BOOST_RANDOM_HPP
+#define BOOST_RANDOM_HPP
+
+// generators
+#include <boost/random/linear_congruential.hpp>
+#include <boost/random/additive_combine.hpp>
+#include <boost/random/inversive_congruential.hpp>
+#include <boost/random/shuffle_output.hpp>
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/random/lagged_fibonacci.hpp>
+#include <boost/random/ranlux.hpp>
+#include <boost/random/linear_feedback_shift.hpp>
+#include <boost/random/xor_combine.hpp>
+
+namespace boost {
+ typedef random::xor_combine<random::xor_combine<random::linear_feedback_shift<uint32_t, 32, 31, 13, 12, 0>, 0,
+ random::linear_feedback_shift<uint32_t, 32, 29, 2, 4, 0>, 0, 0>, 0,
+ random::linear_feedback_shift<uint32_t, 32, 28, 3, 17, 0>, 0, 0> taus88;
+} // namespace boost
+
+// misc
+#include <boost/random/random_number_generator.hpp>
+
+// distributions
+#include <boost/random/uniform_smallint.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/uniform_01.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/triangle_distribution.hpp>
+#include <boost/random/bernoulli_distribution.hpp>
+#include <boost/random/cauchy_distribution.hpp>
+#include <boost/random/exponential_distribution.hpp>
+#include <boost/random/geometric_distribution.hpp>
+#include <boost/random/normal_distribution.hpp>
+#include <boost/random/lognormal_distribution.hpp>
+#include <boost/random/poisson_distribution.hpp>
+#include <boost/random/gamma_distribution.hpp>
+#include <boost/random/binomial_distribution.hpp>
+#include <boost/random/uniform_on_sphere.hpp>
+
+#endif // BOOST_RANDOM_HPP
--- /dev/null
+// Boost.Range library
+//
+// Copyright Thorsten Ottosen 2003-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)
+//
+// For more information, see http://www.boost.org/libs/range/
+//
+
+#ifndef BOOST_RANGE_HPP_27_07_04
+#define BOOST_RANGE_HPP_27_07_04
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#if _MSC_VER == 1300 // experiment
+
+#include <boost/range/detail/collection_traits.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/range/sub_range.hpp>
+
+#else
+
+#include <boost/range/functions.hpp>
+#include <boost/range/metafunctions.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/range/sub_range.hpp>
+
+#endif // _MSC_VER == 1300 // experiment
+
+#endif
--- /dev/null
+// Boost rational.hpp header file ------------------------------------------//
+
+// (C) Copyright Paul Moore 1999. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or
+// implied warranty, and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org/libs/rational for documentation.
+
+// Credits:
+// Thanks to the boost mailing list in general for useful comments.
+// Particular contributions included:
+// Andrew D Jewell, for reminding me to take care to avoid overflow
+// Ed Brey, for many comments, including picking up on some dreadful typos
+// Stephen Silver contributed the test suite and comments on user-defined
+// IntType
+// Nickolay Mladenov, for the implementation of operator+=
+
+// Revision History
+// 28 Sep 02 Use _left versions of operators from operators.hpp
+// 05 Jul 01 Recode gcd(), avoiding std::swap (Helmut Zeisel)
+// 03 Mar 01 Workarounds for Intel C++ 5.0 (David Abrahams)
+// 05 Feb 01 Update operator>> to tighten up input syntax
+// 05 Feb 01 Final tidy up of gcd code prior to the new release
+// 27 Jan 01 Recode abs() without relying on abs(IntType)
+// 21 Jan 01 Include Nickolay Mladenov's operator+= algorithm,
+// tidy up a number of areas, use newer features of operators.hpp
+// (reduces space overhead to zero), add operator!,
+// introduce explicit mixed-mode arithmetic operations
+// 12 Jan 01 Include fixes to handle a user-defined IntType better
+// 19 Nov 00 Throw on divide by zero in operator /= (John (EBo) David)
+// 23 Jun 00 Incorporate changes from Mark Rodgers for Borland C++
+// 22 Jun 00 Change _MSC_VER to BOOST_MSVC so other compilers are not
+// affected (Beman Dawes)
+// 6 Mar 00 Fix operator-= normalization, #include <string> (Jens Maurer)
+// 14 Dec 99 Modifications based on comments from the boost list
+// 09 Dec 99 Initial Version (Paul Moore)
+
+#ifndef BOOST_RATIONAL_HPP
+#define BOOST_RATIONAL_HPP
+
+#include <iostream> // for std::istream and std::ostream
+#include <iomanip> // for std::noskipws
+#include <stdexcept> // for std::domain_error
+#include <string> // for std::string implicit constructor
+#include <boost/operators.hpp> // for boost::addable etc
+#include <cstdlib> // for std::abs
+#include <boost/call_traits.hpp> // for boost::call_traits
+#include <boost/config.hpp> // for BOOST_NO_STDC_NAMESPACE, BOOST_MSVC
+
+namespace boost {
+
+// Note: We use n and m as temporaries in this function, so there is no value
+// in using const IntType& as we would only need to make a copy anyway...
+template <typename IntType>
+IntType gcd(IntType n, IntType m)
+{
+ // Avoid repeated construction
+ IntType zero(0);
+
+ // This is abs() - given the existence of broken compilers with Koenig
+ // lookup issues and other problems, I code this explicitly. (Remember,
+ // IntType may be a user-defined type).
+ if (n < zero)
+ n = -n;
+ if (m < zero)
+ m = -m;
+
+ // As n and m are now positive, we can be sure that %= returns a
+ // positive value (the standard guarantees this for built-in types,
+ // and we require it of user-defined types).
+ for(;;) {
+ if(m == zero)
+ return n;
+ n %= m;
+ if(n == zero)
+ return m;
+ m %= n;
+ }
+}
+
+template <typename IntType>
+IntType lcm(IntType n, IntType m)
+{
+ // Avoid repeated construction
+ IntType zero(0);
+
+ if (n == zero || m == zero)
+ return zero;
+
+ n /= gcd(n, m);
+ n *= m;
+
+ if (n < zero)
+ n = -n;
+ return n;
+}
+
+class bad_rational : public std::domain_error
+{
+public:
+ explicit bad_rational() : std::domain_error("bad rational: zero denominator") {}
+};
+
+template <typename IntType>
+class rational;
+
+template <typename IntType>
+rational<IntType> abs(const rational<IntType>& r);
+
+template <typename IntType>
+class rational :
+ less_than_comparable < rational<IntType>,
+ equality_comparable < rational<IntType>,
+ less_than_comparable2 < rational<IntType>, IntType,
+ equality_comparable2 < rational<IntType>, IntType,
+ addable < rational<IntType>,
+ subtractable < rational<IntType>,
+ multipliable < rational<IntType>,
+ dividable < rational<IntType>,
+ addable2 < rational<IntType>, IntType,
+ subtractable2 < rational<IntType>, IntType,
+ subtractable2_left < rational<IntType>, IntType,
+ multipliable2 < rational<IntType>, IntType,
+ dividable2 < rational<IntType>, IntType,
+ dividable2_left < rational<IntType>, IntType,
+ incrementable < rational<IntType>,
+ decrementable < rational<IntType>
+ > > > > > > > > > > > > > > > >
+{
+ typedef typename boost::call_traits<IntType>::param_type param_type;
+public:
+ typedef IntType int_type;
+ rational() : num(0), den(1) {}
+ rational(param_type n) : num(n), den(1) {}
+ rational(param_type n, param_type d) : num(n), den(d) { normalize(); }
+
+ // Default copy constructor and assignment are fine
+
+ // Add assignment from IntType
+ rational& operator=(param_type n) { return assign(n, 1); }
+
+ // Assign in place
+ rational& assign(param_type n, param_type d);
+
+ // Access to representation
+ IntType numerator() const { return num; }
+ IntType denominator() const { return den; }
+
+ // Arithmetic assignment operators
+ rational& operator+= (const rational& r);
+ rational& operator-= (const rational& r);
+ rational& operator*= (const rational& r);
+ rational& operator/= (const rational& r);
+
+ rational& operator+= (param_type i);
+ rational& operator-= (param_type i);
+ rational& operator*= (param_type i);
+ rational& operator/= (param_type i);
+
+ // Increment and decrement
+ const rational& operator++();
+ const rational& operator--();
+
+ // Operator not
+ bool operator!() const { return !num; }
+
+ // Comparison operators
+ bool operator< (const rational& r) const;
+ bool operator== (const rational& r) const;
+
+ bool operator< (param_type i) const;
+ bool operator> (param_type i) const;
+ bool operator== (param_type i) const;
+
+private:
+ // Implementation - numerator and denominator (normalized).
+ // Other possibilities - separate whole-part, or sign, fields?
+ IntType num;
+ IntType den;
+
+ // Representation note: Fractions are kept in normalized form at all
+ // times. normalized form is defined as gcd(num,den) == 1 and den > 0.
+ // In particular, note that the implementation of abs() below relies
+ // on den always being positive.
+ void normalize();
+};
+
+// Assign in place
+template <typename IntType>
+inline rational<IntType>& rational<IntType>::assign(param_type n, param_type d)
+{
+ num = n;
+ den = d;
+ normalize();
+ return *this;
+}
+
+// Unary plus and minus
+template <typename IntType>
+inline rational<IntType> operator+ (const rational<IntType>& r)
+{
+ return r;
+}
+
+template <typename IntType>
+inline rational<IntType> operator- (const rational<IntType>& r)
+{
+ return rational<IntType>(-r.numerator(), r.denominator());
+}
+
+// Arithmetic assignment operators
+template <typename IntType>
+rational<IntType>& rational<IntType>::operator+= (const rational<IntType>& r)
+{
+ // This calculation avoids overflow, and minimises the number of expensive
+ // calculations. Thanks to Nickolay Mladenov for this algorithm.
+ //
+ // Proof:
+ // We have to compute a/b + c/d, where gcd(a,b)=1 and gcd(b,c)=1.
+ // Let g = gcd(b,d), and b = b1*g, d=d1*g. Then gcd(b1,d1)=1
+ //
+ // The result is (a*d1 + c*b1) / (b1*d1*g).
+ // Now we have to normalize this ratio.
+ // Let's assume h | gcd((a*d1 + c*b1), (b1*d1*g)), and h > 1
+ // If h | b1 then gcd(h,d1)=1 and hence h|(a*d1+c*b1) => h|a.
+ // But since gcd(a,b1)=1 we have h=1.
+ // Similarly h|d1 leads to h=1.
+ // So we have that h | gcd((a*d1 + c*b1) , (b1*d1*g)) => h|g
+ // Finally we have gcd((a*d1 + c*b1), (b1*d1*g)) = gcd((a*d1 + c*b1), g)
+ // Which proves that instead of normalizing the result, it is better to
+ // divide num and den by gcd((a*d1 + c*b1), g)
+
+ // Protect against self-modification
+ IntType r_num = r.num;
+ IntType r_den = r.den;
+
+ IntType g = gcd(den, r_den);
+ den /= g; // = b1 from the calculations above
+ num = num * (r_den / g) + r_num * den;
+ g = gcd(num, g);
+ num /= g;
+ den *= r_den/g;
+
+ return *this;
+}
+
+template <typename IntType>
+rational<IntType>& rational<IntType>::operator-= (const rational<IntType>& r)
+{
+ // Protect against self-modification
+ IntType r_num = r.num;
+ IntType r_den = r.den;
+
+ // This calculation avoids overflow, and minimises the number of expensive
+ // calculations. It corresponds exactly to the += case above
+ IntType g = gcd(den, r_den);
+ den /= g;
+ num = num * (r_den / g) - r_num * den;
+ g = gcd(num, g);
+ num /= g;
+ den *= r_den/g;
+
+ return *this;
+}
+
+template <typename IntType>
+rational<IntType>& rational<IntType>::operator*= (const rational<IntType>& r)
+{
+ // Protect against self-modification
+ IntType r_num = r.num;
+ IntType r_den = r.den;
+
+ // Avoid overflow and preserve normalization
+ IntType gcd1 = gcd<IntType>(num, r_den);
+ IntType gcd2 = gcd<IntType>(r_num, den);
+ num = (num/gcd1) * (r_num/gcd2);
+ den = (den/gcd2) * (r_den/gcd1);
+ return *this;
+}
+
+template <typename IntType>
+rational<IntType>& rational<IntType>::operator/= (const rational<IntType>& r)
+{
+ // Protect against self-modification
+ IntType r_num = r.num;
+ IntType r_den = r.den;
+
+ // Avoid repeated construction
+ IntType zero(0);
+
+ // Trap division by zero
+ if (r_num == zero)
+ throw bad_rational();
+ if (num == zero)
+ return *this;
+
+ // Avoid overflow and preserve normalization
+ IntType gcd1 = gcd<IntType>(num, r_num);
+ IntType gcd2 = gcd<IntType>(r_den, den);
+ num = (num/gcd1) * (r_den/gcd2);
+ den = (den/gcd2) * (r_num/gcd1);
+
+ if (den < zero) {
+ num = -num;
+ den = -den;
+ }
+ return *this;
+}
+
+// Mixed-mode operators
+template <typename IntType>
+inline rational<IntType>&
+rational<IntType>::operator+= (param_type i)
+{
+ return operator+= (rational<IntType>(i));
+}
+
+template <typename IntType>
+inline rational<IntType>&
+rational<IntType>::operator-= (param_type i)
+{
+ return operator-= (rational<IntType>(i));
+}
+
+template <typename IntType>
+inline rational<IntType>&
+rational<IntType>::operator*= (param_type i)
+{
+ return operator*= (rational<IntType>(i));
+}
+
+template <typename IntType>
+inline rational<IntType>&
+rational<IntType>::operator/= (param_type i)
+{
+ return operator/= (rational<IntType>(i));
+}
+
+// Increment and decrement
+template <typename IntType>
+inline const rational<IntType>& rational<IntType>::operator++()
+{
+ // This can never denormalise the fraction
+ num += den;
+ return *this;
+}
+
+template <typename IntType>
+inline const rational<IntType>& rational<IntType>::operator--()
+{
+ // This can never denormalise the fraction
+ num -= den;
+ return *this;
+}
+
+// Comparison operators
+template <typename IntType>
+bool rational<IntType>::operator< (const rational<IntType>& r) const
+{
+ // Avoid repeated construction
+ IntType zero(0);
+
+ // If the two values have different signs, we don't need to do the
+ // expensive calculations below. We take advantage here of the fact
+ // that the denominator is always positive.
+ if (num < zero && r.num >= zero) // -ve < +ve
+ return true;
+ if (num >= zero && r.num <= zero) // +ve or zero is not < -ve or zero
+ return false;
+
+ // Avoid overflow
+ IntType gcd1 = gcd<IntType>(num, r.num);
+ IntType gcd2 = gcd<IntType>(r.den, den);
+ return (num/gcd1) * (r.den/gcd2) < (den/gcd2) * (r.num/gcd1);
+}
+
+template <typename IntType>
+bool rational<IntType>::operator< (param_type i) const
+{
+ // Avoid repeated construction
+ IntType zero(0);
+
+ // If the two values have different signs, we don't need to do the
+ // expensive calculations below. We take advantage here of the fact
+ // that the denominator is always positive.
+ if (num < zero && i >= zero) // -ve < +ve
+ return true;
+ if (num >= zero && i <= zero) // +ve or zero is not < -ve or zero
+ return false;
+
+ // Now, use the fact that n/d truncates towards zero as long as n and d
+ // are both positive.
+ // Divide instead of multiplying to avoid overflow issues. Of course,
+ // division may be slower, but accuracy is more important than speed...
+ if (num > zero)
+ return (num/den) < i;
+ else
+ return -i < (-num/den);
+}
+
+template <typename IntType>
+bool rational<IntType>::operator> (param_type i) const
+{
+ // Trap equality first
+ if (num == i && den == IntType(1))
+ return false;
+
+ // Otherwise, we can use operator<
+ return !operator<(i);
+}
+
+template <typename IntType>
+inline bool rational<IntType>::operator== (const rational<IntType>& r) const
+{
+ return ((num == r.num) && (den == r.den));
+}
+
+template <typename IntType>
+inline bool rational<IntType>::operator== (param_type i) const
+{
+ return ((den == IntType(1)) && (num == i));
+}
+
+// Normalisation
+template <typename IntType>
+void rational<IntType>::normalize()
+{
+ // Avoid repeated construction
+ IntType zero(0);
+
+ if (den == zero)
+ throw bad_rational();
+
+ // Handle the case of zero separately, to avoid division by zero
+ if (num == zero) {
+ den = IntType(1);
+ return;
+ }
+
+ IntType g = gcd<IntType>(num, den);
+
+ num /= g;
+ den /= g;
+
+ // Ensure that the denominator is positive
+ if (den < zero) {
+ num = -num;
+ den = -den;
+ }
+}
+
+namespace detail {
+
+ // A utility class to reset the format flags for an istream at end
+ // of scope, even in case of exceptions
+ struct resetter {
+ resetter(std::istream& is) : is_(is), f_(is.flags()) {}
+ ~resetter() { is_.flags(f_); }
+ std::istream& is_;
+ std::istream::fmtflags f_; // old GNU c++ lib has no ios_base
+ };
+
+}
+
+// Input and output
+template <typename IntType>
+std::istream& operator>> (std::istream& is, rational<IntType>& r)
+{
+ IntType n = IntType(0), d = IntType(1);
+ char c = 0;
+ detail::resetter sentry(is);
+
+ is >> n;
+ c = is.get();
+
+ if (c != '/')
+ is.clear(std::istream::badbit); // old GNU c++ lib has no ios_base
+
+#if !defined(__GNUC__) || (defined(__GNUC__) && (__GNUC__ >= 3)) || defined __SGI_STL_PORT
+ is >> std::noskipws;
+#else
+ is.unsetf(ios::skipws); // compiles, but seems to have no effect.
+#endif
+ is >> d;
+
+ if (is)
+ r.assign(n, d);
+
+ return is;
+}
+
+// Add manipulators for output format?
+template <typename IntType>
+std::ostream& operator<< (std::ostream& os, const rational<IntType>& r)
+{
+ os << r.numerator() << '/' << r.denominator();
+ return os;
+}
+
+// Type conversion
+template <typename T, typename IntType>
+inline T rational_cast(const rational<IntType>& src)
+{
+ return static_cast<T>(src.numerator())/src.denominator();
+}
+
+// Do not use any abs() defined on IntType - it isn't worth it, given the
+// difficulties involved (Koenig lookup required, there may not *be* an abs()
+// defined, etc etc).
+template <typename IntType>
+inline rational<IntType> abs(const rational<IntType>& r)
+{
+ if (r.numerator() >= IntType(0))
+ return r;
+
+ return rational<IntType>(-r.numerator(), r.denominator());
+}
+
+} // namespace boost
+
+#endif // BOOST_RATIONAL_HPP
+
--- /dev/null
+/*
+ *
+ * Copyright (c) 1998-2002
+ * John Maddock
+ *
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org/libs/regex for documentation.
+ * FILE regex.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares boost::basic_regex<> and associated
+ * functions and classes. This header is the main
+ * entry point for the template regex code.
+ */
+
+
+/* start with C compatibility API */
+
+#ifndef BOOST_RE_REGEX_HPP
+#define BOOST_RE_REGEX_HPP
+
+#ifndef BOOST_REGEX_CONFIG_HPP
+#include <boost/regex/config.hpp>
+#endif
+
+#include <boost/regex/v4/regex.hpp>
+
+#endif // include
+
+
+
+
--- /dev/null
+/*
+ *
+ * Copyright (c) 1998-2002
+ * John Maddock
+ *
+ * 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)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org/libs/regex for documentation.
+ * FILE regex_fwd.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Forward declares boost::basic_regex<> and
+ * associated typedefs.
+ */
+
+#ifndef BOOST_REGEX_FWD_HPP
+#define BOOST_REGEX_FWD_HPP
+
+#ifndef BOOST_REGEX_CONFIG_HPP
+#include <boost/regex/config.hpp>
+#endif
+
+#include <boost/regex/v4/regex_fwd.hpp>
+
+#endif
+
+
+
+
--- /dev/null
+#ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED
+#define BOOST_SCOPED_ARRAY_HPP_INCLUDED
+
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 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)
+//
+// http://www.boost.org/libs/smart_ptr/scoped_array.htm
+//
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/config.hpp> // in case ptrdiff_t not in std
+
+#include <boost/detail/workaround.hpp>
+
+#include <cstddef> // for std::ptrdiff_t
+
+namespace boost
+{
+
+// Debug hooks
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+void sp_array_constructor_hook(void * p);
+void sp_array_destructor_hook(void * p);
+
+#endif
+
+// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to
+// is guaranteed, either on destruction of the scoped_array or via an explicit
+// reset(). Use shared_array or std::vector if your needs are more complex.
+
+template<class T> class scoped_array // noncopyable
+{
+private:
+
+ T * ptr;
+
+ scoped_array(scoped_array const &);
+ scoped_array & operator=(scoped_array const &);
+
+ typedef scoped_array<T> this_type;
+
+public:
+
+ typedef T element_type;
+
+ explicit scoped_array(T * p = 0) : ptr(p) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_array_constructor_hook(ptr);
+#endif
+ }
+
+ ~scoped_array() // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_array_destructor_hook(ptr);
+#endif
+ boost::checked_array_delete(ptr);
+ }
+
+ void reset(T * p = 0) // never throws
+ {
+ BOOST_ASSERT(p == 0 || p != ptr); // catch self-reset errors
+ this_type(p).swap(*this);
+ }
+
+ T & operator[](std::ptrdiff_t i) const // never throws
+ {
+ BOOST_ASSERT(ptr != 0);
+ BOOST_ASSERT(i >= 0);
+ return ptr[i];
+ }
+
+ T * get() const // never throws
+ {
+ return ptr;
+ }
+
+ // implicit conversion to "bool"
+
+#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
+
+ operator bool () const
+ {
+ return ptr != 0;
+ }
+
+#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+ typedef T * (this_type::*unspecified_bool_type)() const;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return ptr == 0? 0: &this_type::get;
+ }
+
+#else
+
+ typedef T * this_type::*unspecified_bool_type;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return ptr == 0? 0: &this_type::ptr;
+ }
+
+#endif
+
+ bool operator! () const // never throws
+ {
+ return ptr == 0;
+ }
+
+ void swap(scoped_array & b) // never throws
+ {
+ T * tmp = b.ptr;
+ b.ptr = ptr;
+ ptr = tmp;
+ }
+
+};
+
+template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) // never throws
+{
+ a.swap(b);
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_SCOPED_PTR_HPP_INCLUDED
+#define BOOST_SCOPED_PTR_HPP_INCLUDED
+
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 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)
+//
+// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm
+//
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/detail/workaround.hpp>
+
+#ifndef BOOST_NO_AUTO_PTR
+# include <memory> // for std::auto_ptr
+#endif
+
+namespace boost
+{
+
+// Debug hooks
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+void sp_scalar_constructor_hook(void * p);
+void sp_scalar_destructor_hook(void * p);
+
+#endif
+
+// scoped_ptr mimics a built-in pointer except that it guarantees deletion
+// of the object pointed to, either on destruction of the scoped_ptr or via
+// an explicit reset(). scoped_ptr is a simple solution for simple needs;
+// use shared_ptr or std::auto_ptr if your needs are more complex.
+
+template<class T> class scoped_ptr // noncopyable
+{
+private:
+
+ T * ptr;
+
+ scoped_ptr(scoped_ptr const &);
+ scoped_ptr & operator=(scoped_ptr const &);
+
+ typedef scoped_ptr<T> this_type;
+
+public:
+
+ typedef T element_type;
+
+ explicit scoped_ptr(T * p = 0): ptr(p) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_constructor_hook(ptr);
+#endif
+ }
+
+#ifndef BOOST_NO_AUTO_PTR
+
+ explicit scoped_ptr(std::auto_ptr<T> p): ptr(p.release()) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_constructor_hook(ptr);
+#endif
+ }
+
+#endif
+
+ ~scoped_ptr() // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_destructor_hook(ptr);
+#endif
+ boost::checked_delete(ptr);
+ }
+
+ void reset(T * p = 0) // never throws
+ {
+ BOOST_ASSERT(p == 0 || p != ptr); // catch self-reset errors
+ this_type(p).swap(*this);
+ }
+
+ T & operator*() const // never throws
+ {
+ BOOST_ASSERT(ptr != 0);
+ return *ptr;
+ }
+
+ T * operator->() const // never throws
+ {
+ BOOST_ASSERT(ptr != 0);
+ return ptr;
+ }
+
+ T * get() const // never throws
+ {
+ return ptr;
+ }
+
+ // implicit conversion to "bool"
+
+#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
+
+ operator bool () const
+ {
+ return ptr != 0;
+ }
+
+#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+ typedef T * (this_type::*unspecified_bool_type)() const;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return ptr == 0? 0: &this_type::get;
+ }
+
+#else
+ typedef T * this_type::*unspecified_bool_type;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return ptr == 0? 0: &this_type::ptr;
+ }
+
+#endif
+
+ bool operator! () const // never throws
+ {
+ return ptr == 0;
+ }
+
+ void swap(scoped_ptr & b) // never throws
+ {
+ T * tmp = b.ptr;
+ b.ptr = ptr;
+ ptr = tmp;
+ }
+};
+
+template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) // never throws
+{
+ a.swap(b);
+}
+
+// get_pointer(p) is a generic way to say p.get()
+
+template<class T> inline T * get_pointer(scoped_ptr<T> const & p)
+{
+ return p.get();
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_SHARED_ARRAY_HPP_INCLUDED
+#define BOOST_SHARED_ARRAY_HPP_INCLUDED
+
+//
+// shared_array.hpp
+//
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 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)
+//
+// See http://www.boost.org/libs/smart_ptr/shared_array.htm for documentation.
+//
+
+#include <boost/config.hpp> // for broken compiler workarounds
+
+#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+#include <boost/detail/shared_array_nmt.hpp>
+#else
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+
+#include <boost/detail/shared_count.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <cstddef> // for std::ptrdiff_t
+#include <algorithm> // for std::swap
+#include <functional> // for std::less
+
+namespace boost
+{
+
+//
+// shared_array
+//
+// shared_array extends shared_ptr to arrays.
+// The array pointed to is deleted when the last shared_array pointing to it
+// is destroyed or reset.
+//
+
+template<class T> class shared_array
+{
+private:
+
+ // Borland 5.5.1 specific workarounds
+ typedef checked_array_deleter<T> deleter;
+ typedef shared_array<T> this_type;
+
+public:
+
+ typedef T element_type;
+
+ explicit shared_array(T * p = 0): px(p), pn(p, deleter())
+ {
+ }
+
+ //
+ // Requirements: D's copy constructor must not throw
+ //
+ // shared_array will release p by calling d(p)
+ //
+
+ template<class D> shared_array(T * p, D d): px(p), pn(p, d)
+ {
+ }
+
+// generated copy constructor, assignment, destructor are fine
+
+ void reset(T * p = 0)
+ {
+ BOOST_ASSERT(p == 0 || p != px);
+ this_type(p).swap(*this);
+ }
+
+ template <class D> void reset(T * p, D d)
+ {
+ this_type(p, d).swap(*this);
+ }
+
+ T & operator[] (std::ptrdiff_t i) const // never throws
+ {
+ BOOST_ASSERT(px != 0);
+ BOOST_ASSERT(i >= 0);
+ return px[i];
+ }
+
+ T * get() const // never throws
+ {
+ return px;
+ }
+
+ // implicit conversion to "bool"
+
+#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
+
+ operator bool () const
+ {
+ return px != 0;
+ }
+
+#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+ typedef T * (this_type::*unspecified_bool_type)() const;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return px == 0? 0: &this_type::get;
+ }
+
+#else
+
+ typedef T * this_type::*unspecified_bool_type;
+
+ operator unspecified_bool_type() const // never throws
+ {
+ return px == 0? 0: &this_type::px;
+ }
+
+#endif
+
+ bool operator! () const // never throws
+ {
+ return px == 0;
+ }
+
+ bool unique() const // never throws
+ {
+ return pn.unique();
+ }
+
+ long use_count() const // never throws
+ {
+ return pn.use_count();
+ }
+
+ void swap(shared_array<T> & other) // never throws
+ {
+ std::swap(px, other.px);
+ pn.swap(other.pn);
+ }
+
+private:
+
+ T * px; // contained pointer
+ detail::shared_count pn; // reference counter
+
+}; // shared_array
+
+template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) // never throws
+{
+ return a.get() == b.get();
+}
+
+template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) // never throws
+{
+ return a.get() != b.get();
+}
+
+template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) // never throws
+{
+ return std::less<T*>()(a.get(), b.get());
+}
+
+template<class T> void swap(shared_array<T> & a, shared_array<T> & b) // never throws
+{
+ a.swap(b);
+}
+
+} // namespace boost
+
+#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+
+#endif // #ifndef BOOST_SHARED_ARRAY_HPP_INCLUDED
--- /dev/null
+// (C) Copyright Ronald Garcia 2002. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// See http://www.boost.org/libs/utility/shared_container_iterator.html for documentation.
+
+#ifndef SHARED_CONTAINER_ITERATOR_RG08102002_HPP
+#define SHARED_CONTAINER_ITERATOR_RG08102002_HPP
+
+#include "boost/iterator_adaptors.hpp"
+#include "boost/shared_ptr.hpp"
+#include <utility>
+
+namespace boost {
+
+template <typename Container>
+class shared_container_iterator : public iterator_adaptor<
+ shared_container_iterator<Container>,
+ typename Container::iterator> {
+
+ typedef iterator_adaptor<
+ shared_container_iterator<Container>,
+ typename Container::iterator> super_t;
+
+ typedef typename Container::iterator iterator_t;
+ typedef boost::shared_ptr<Container> container_ref_t;
+
+ container_ref_t container_ref;
+public:
+ shared_container_iterator() { }
+
+ shared_container_iterator(iterator_t const& x,container_ref_t const& c) :
+ super_t(x), container_ref(c) { }
+
+
+};
+
+template <typename Container>
+shared_container_iterator<Container>
+make_shared_container_iterator(typename Container::iterator iter,
+ boost::shared_ptr<Container> const& container) {
+ typedef shared_container_iterator<Container> iterator;
+ return iterator(iter,container);
+}
+
+
+
+template <typename Container>
+std::pair<
+ shared_container_iterator<Container>,
+ shared_container_iterator<Container> >
+make_shared_container_range(boost::shared_ptr<Container> const& container) {
+ return
+ std::make_pair(
+ make_shared_container_iterator(container->begin(),container),
+ make_shared_container_iterator(container->end(),container));
+}
+
+
+} // namespace boost
+#endif // SHARED_CONTAINER_ITERATOR_RG08102002_HPP
--- /dev/null
+// Boost.Signals library
+
+// Copyright Douglas Gregor 2001-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)
+
+// For more information, see http://www.boost.org/libs/signals
+
+#ifndef BOOST_SIGNAL_HPP
+#define BOOST_SIGNAL_HPP
+
+#define BOOST_SIGNALS_MAX_ARGS 10
+
+#include <boost/config.hpp>
+#include <boost/type_traits/function_traits.hpp>
+#include <boost/signals/signal0.hpp>
+#include <boost/signals/signal1.hpp>
+#include <boost/signals/signal2.hpp>
+#include <boost/signals/signal3.hpp>
+#include <boost/signals/signal4.hpp>
+#include <boost/signals/signal5.hpp>
+#include <boost/signals/signal6.hpp>
+#include <boost/signals/signal7.hpp>
+#include <boost/signals/signal8.hpp>
+#include <boost/signals/signal9.hpp>
+#include <boost/signals/signal10.hpp>
+#include <boost/function.hpp>
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+#ifndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
+ namespace BOOST_SIGNALS_NAMESPACE {
+ namespace detail {
+ template<int Arity,
+ typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl;
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<0, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal0<typename traits::result_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<1, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal1<typename traits::result_type,
+ typename traits::arg1_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<2, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal2<typename traits::result_type,
+ typename traits::arg1_type,
+ typename traits::arg2_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<3, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal3<typename traits::result_type,
+ typename traits::arg1_type,
+ typename traits::arg2_type,
+ typename traits::arg3_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<4, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal4<typename traits::result_type,
+ typename traits::arg1_type,
+ typename traits::arg2_type,
+ typename traits::arg3_type,
+ typename traits::arg4_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<5, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal5<typename traits::result_type,
+ typename traits::arg1_type,
+ typename traits::arg2_type,
+ typename traits::arg3_type,
+ typename traits::arg4_type,
+ typename traits::arg5_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<6, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal6<typename traits::result_type,
+ typename traits::arg1_type,
+ typename traits::arg2_type,
+ typename traits::arg3_type,
+ typename traits::arg4_type,
+ typename traits::arg5_type,
+ typename traits::arg6_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<7, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal7<typename traits::result_type,
+ typename traits::arg1_type,
+ typename traits::arg2_type,
+ typename traits::arg3_type,
+ typename traits::arg4_type,
+ typename traits::arg5_type,
+ typename traits::arg6_type,
+ typename traits::arg7_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<8, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal8<typename traits::result_type,
+ typename traits::arg1_type,
+ typename traits::arg2_type,
+ typename traits::arg3_type,
+ typename traits::arg4_type,
+ typename traits::arg5_type,
+ typename traits::arg6_type,
+ typename traits::arg7_type,
+ typename traits::arg8_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<9, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal9<typename traits::result_type,
+ typename traits::arg1_type,
+ typename traits::arg2_type,
+ typename traits::arg3_type,
+ typename traits::arg4_type,
+ typename traits::arg5_type,
+ typename traits::arg6_type,
+ typename traits::arg7_type,
+ typename traits::arg8_type,
+ typename traits::arg9_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ class real_get_signal_impl<10, Signature, Combiner, Group, GroupCompare,
+ SlotFunction>
+ {
+ typedef function_traits<Signature> traits;
+
+ public:
+ typedef signal10<typename traits::result_type,
+ typename traits::arg1_type,
+ typename traits::arg2_type,
+ typename traits::arg3_type,
+ typename traits::arg4_type,
+ typename traits::arg5_type,
+ typename traits::arg6_type,
+ typename traits::arg7_type,
+ typename traits::arg8_type,
+ typename traits::arg9_type,
+ typename traits::arg10_type,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction> type;
+ };
+
+ template<typename Signature,
+ typename Combiner,
+ typename Group,
+ typename GroupCompare,
+ typename SlotFunction>
+ struct get_signal_impl :
+ public real_get_signal_impl<(function_traits<Signature>::arity),
+ Signature,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction>
+ {
+ };
+
+ } // end namespace detail
+ } // end namespace BOOST_SIGNALS_NAMESPACE
+
+ // Very lightweight wrapper around the signalN classes that allows signals to
+ // be created where the number of arguments does not need to be part of the
+ // class name.
+ template<
+ typename Signature, // function type R (T1, T2, ..., TN)
+ typename Combiner = last_value<typename function_traits<Signature>::result_type>,
+ typename Group = int,
+ typename GroupCompare = std::less<Group>,
+ typename SlotFunction = function<Signature>
+ >
+ class signal :
+ public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<Signature,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction>::type
+ {
+ typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<
+ Signature,
+ Combiner,
+ Group,
+ GroupCompare,
+ SlotFunction>::type base_type;
+
+ public:
+ explicit signal(const Combiner& combiner = Combiner(),
+ const GroupCompare& group_compare = GroupCompare()) :
+ base_type(combiner, group_compare)
+ {
+ }
+ };
+#endif // ndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
+
+} // end namespace boost
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_SIGNAL_HPP
--- /dev/null
+// Boost.Signals library
+
+// Copyright Douglas Gregor 2003-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)
+
+// For more information, see http://www.boost.org/libs/signals
+#include <boost/signal.hpp>
+
--- /dev/null
+#ifndef BOOST_SMART_CAST_HPP
+#define BOOST_SMART_CAST_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
+// smart_cast.hpp:
+
+// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// 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 for updates, documentation, and revision history.
+
+// casting of pointers and references.
+
+// In casting between different C++ classes, there are a number of
+// rules that have to be kept in mind in deciding whether to use
+// static_cast or dynamic_cast.
+
+// a) dynamic casting can only be applied when one of the types is polymorphic
+// Otherwise static_cast must be used.
+// b) only dynamic casting can do runtime error checking
+// use of static_cast is generally un checked even when compiled for debug
+// c) static_cast would be considered faster than dynamic_cast.
+
+// If casting is applied to a template parameter, there is no apriori way
+// to know which of the two casting methods will be permitted or convenient.
+
+// smart_cast uses C++ type_traits, and program debug mode to select the
+// most convenient cast to use.
+
+#include <exception>
+#include <typeinfo>
+
+#include <boost/config.hpp>
+#include <boost/static_assert.hpp>
+
+#include <boost/type_traits/is_base_and_derived.hpp>
+#include <boost/type_traits/is_polymorphic.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/identity.hpp>
+
+namespace boost {
+namespace smart_cast_impl {
+
+ template<class T>
+ struct reference {
+
+ struct polymorphic {
+
+ struct linear {
+ template<class U>
+ static T cast(U & u){
+ return static_cast<T>(u);
+ }
+ };
+
+ struct cross {
+ template<class U>
+ static T cast(U & u){
+ return dynamic_cast<T>(u);
+ }
+ };
+
+ template<class U>
+ static T cast(U & u){
+ // if we're in debug mode
+ #if ! defined(NDEBUG) \
+ || defined(__BORLANDC__) && (__BORLANDC__ <= 0x560) \
+ || defined(__MWERKS__)
+ // do a checked dynamic cast
+ return cross::cast(u);
+ #else
+ // borland 5.51 chokes here so we can't use it
+ // note: if remove_reference isn't function for these types
+ // cross casting will be selected this will work but will
+ // not be the most efficient method. This will conflict with
+ // the original smart_cast motivation.
+ typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
+ BOOST_DEDUCED_TYPENAME mpl::and_<
+ mpl::not_<is_base_and_derived<
+ BOOST_DEDUCED_TYPENAME remove_reference<T>::type,
+ U
+ > >,
+ mpl::not_<is_base_and_derived<
+ U,
+ BOOST_DEDUCED_TYPENAME remove_reference<T>::type
+ > >
+ >,
+ // borland chokes w/o full qualification here
+ mpl::identity<cross>,
+ mpl::identity<linear>
+ >::type typex;
+ // typex works around gcc 2.95 issue
+ return typex::cast(u);
+ #endif
+ }
+ };
+
+ struct non_polymorphic {
+ template<class U>
+ static T cast(U & u){
+ return static_cast<T>(u);
+ }
+ };
+ template<class U>
+ static T cast(U & u){
+ #if defined(__BORLANDC__)
+ return mpl::eval_if<
+ boost::is_polymorphic<U>,
+ mpl::identity<polymorphic>,
+ mpl::identity<non_polymorphic>
+ >::type::cast(u);
+ #else
+ typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
+ boost::is_polymorphic<U>,
+ mpl::identity<polymorphic>,
+ mpl::identity<non_polymorphic>
+ >::type typex;
+ return typex::cast(u);
+ #endif
+ }
+ };
+
+ template<class T>
+ struct pointer {
+
+ struct polymorphic {
+ // unfortunately, this below fails to work for virtual base
+ // classes. need has_virtual_base to do this.
+ // Subject for further study
+ #if 0
+ struct linear {
+ template<class U>
+ static T cast(U * u){
+ return static_cast<T>(u);
+ }
+ };
+
+ struct cross {
+ template<class U>
+ static T cast(U * u){
+ T tmp = dynamic_cast<T>(u);
+ #ifndef NDEBUG
+ if ( tmp == 0 ) throw std::bad_cast();
+ #endif
+ return tmp;
+ }
+ };
+
+ template<class U>
+ static T cast(U * u){
+ // if we're in debug mode
+ #if ! defined(NDEBUG) || defined(__BORLANDC__) && (__BORLANDC__ <= 0x560)
+ // do a checked dynamic cast
+ return cross::cast(u);
+ #else
+ // borland 5.51 chokes here so we can't use it
+ // note: if remove_pointer isn't function for these types
+ // cross casting will be selected this will work but will
+ // not be the most efficient method. This will conflict with
+ // the original smart_cast motivation.
+ typedef
+ BOOST_DEDUCED_TYPENAME mpl::eval_if<
+ BOOST_DEDUCED_TYPENAME mpl::and_<
+ mpl::not_<is_base_and_derived<
+ BOOST_DEDUCED_TYPENAME remove_pointer<T>::type,
+ U
+ > >,
+ mpl::not_<is_base_and_derived<
+ U,
+ BOOST_DEDUCED_TYPENAME remove_pointer<T>::type
+ > >
+ >,
+ // borland chokes w/o full qualification here
+ mpl::identity<cross>,
+ mpl::identity<linear>
+ >::type typex;
+ return typex::cast(u);
+ #endif
+ }
+ #else
+ template<class U>
+ static T cast(U * u){
+ T tmp = dynamic_cast<T>(u);
+ #ifndef NDEBUG
+ if ( tmp == 0 ) throw std::bad_cast();
+ #endif
+ return tmp;
+ }
+ #endif
+ };
+
+ struct non_polymorphic {
+ template<class U>
+ static T cast(U * u){
+ return static_cast<T>(u);
+ }
+ };
+
+ template<class U>
+ static T cast(U * u){
+ #if defined(__BORLANDC__)
+ return mpl::eval_if<
+ boost::is_polymorphic<U>,
+ mpl::identity<polymorphic>,
+ mpl::identity<non_polymorphic>
+ >::type::cast(u);
+ #else
+ typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
+ boost::is_polymorphic<U>,
+ mpl::identity<polymorphic>,
+ mpl::identity<non_polymorphic>
+ >::type typex;
+ return typex::cast(u);
+ #endif
+ }
+
+ };
+
+ template<class TPtr>
+ struct void_pointer {
+ template<class UPtr>
+ static TPtr cast(UPtr uptr){
+ return static_cast<TPtr>(uptr);
+ }
+ };
+
+ template<class T>
+ struct error {
+ // if we get here, its because we are using one argument in the
+ // cast on a system which doesn't support partial template
+ // specialization
+ template<class U>
+ static T cast(U u){
+ BOOST_STATIC_ASSERT(sizeof(T)==0);
+ return * static_cast<T *>(NULL);
+ }
+ };
+
+} // smart_cast_impl
+
+// this implements:
+// smart_cast<Target *, Source *>(Source * s)
+// smart_cast<Target &, Source &>(s)
+// note that it will fail with
+// smart_cast<Target &>(s)
+template<class T, class U>
+T smart_cast(U u) {
+ typedef
+ BOOST_DEDUCED_TYPENAME mpl::eval_if<
+ BOOST_DEDUCED_TYPENAME mpl::or_<
+ boost::is_same<void *, U>,
+ boost::is_same<void *, T>,
+ boost::is_same<const void *, U>,
+ boost::is_same<const void *, T>
+ >,
+ mpl::identity<smart_cast_impl::void_pointer<T> >,
+ // else
+ BOOST_DEDUCED_TYPENAME mpl::eval_if<boost::is_pointer<U>,
+ mpl::identity<smart_cast_impl::pointer<T> >,
+ // else
+ BOOST_DEDUCED_TYPENAME mpl::eval_if<boost::is_reference<U>,
+ mpl::identity<smart_cast_impl::reference<T> >,
+ // else
+ mpl::identity<smart_cast_impl::error<T>
+ >
+ >
+ >
+ >::type typex;
+ return typex::cast(u);
+}
+
+// this implements:
+// smart_cast_reference<Target &>(Source & s)
+template<class T, class U>
+T smart_cast_reference(U & u) {
+ return smart_cast_impl::reference<T>::cast(u);
+}
+
+} // namespace boost
+
+#endif // BOOST_SMART_CAST_HPP
--- /dev/null
+//
+// smart_ptr.hpp
+//
+// For convenience, this header includes the rest of the smart
+// pointer library headers.
+//
+// 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)
+//
+// http://www.boost.org/libs/smart_ptr/smart_ptr.htm
+//
+
+#include <boost/config.hpp>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/scoped_array.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+# include <boost/weak_ptr.hpp>
+# include <boost/intrusive_ptr.hpp>
+# include <boost/enable_shared_from_this.hpp>
+#endif
--- /dev/null
+/*=============================================================================
+ Copyright (c) 1998-2003 Joel de Guzman
+ Copyright (c) 2001-2003 Daniel Nuffer
+ Copyright (c) 2001-2003 Hartmut Kaiser
+ Copyright (c) 2002-2003 Martin Wille
+ Copyright (c) 2002 Juan Carlos Arevalo-Baeza
+ Copyright (c) 2002 Raghavendra Satish
+ Copyright (c) 2002 Jeff Westfahl
+ Copyright (c) 2001 Bruce Florman
+ Copyright (c) 2003 Giovanni Bajo
+ Copyright (c) 2003 Vaclav Vesely
+ Copyright (c) 2003 Jonathan de Halleux
+ http://spirit.sourceforge.net/
+
+ 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)
+=============================================================================*/
+#if !defined(SPIRIT_HPP)
+#define SPIRIT_HPP
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// If BOOST_SPIRIT_DEBUG is defined, the following header includes the
+// Spirit.Debug layer, otherwise the non-debug Spirit.Core is included.
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/core.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Spirit.Meta
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/meta.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Spirit.ErrorHandling
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/error_handling.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Spirit.Iterators
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/iterator.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Spirit.Symbols
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/symbols.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Spirit.Utilities
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/utility.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Spirit.Attributes
+//
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/attribute.hpp>
+
+#endif // !defined(SPIRIT_HPP)
--- /dev/null
+#ifndef BOOST_STATE_SAVER_HPP
+#define BOOST_STATE_SAVER_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
+// state_saver.hpp:
+
+// (C) Copyright 2003-4 Pavel Vozenilek and Robert Ramey - http://www.rrsd.com.
+// 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 for updates, documentation, and revision history.
+
+// Inspired by Daryle Walker's iostate_saver concept. This saves the original
+// value of a variable when a state_saver is constructed and restores
+// upon destruction. Useful for being sure that state is restored to
+// variables upon exit from scope.
+
+
+#include <boost/config.hpp>
+#ifndef BOOST_NO_EXCEPTIONS
+ #include <exception>
+#endif
+
+#include <boost/call_traits.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/type_traits/has_nothrow_copy.hpp>
+#include <boost/detail/no_exceptions_support.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+
+namespace boost {
+
+template<class T>
+// T requirements:
+// - POD or object semantic (cannot be reference, function, ...)
+// - copy constructor
+// - operator = (no-throw one preferred)
+class state_saver : private boost::noncopyable
+{
+private:
+ const T previous_value;
+ T & previous_ref;
+
+ struct restore {
+ static void invoke(T & previous_ref, const T & previous_value){
+ previous_ref = previous_value; // won't throw
+ }
+ };
+
+ struct restore_with_exception {
+ static void invoke(T & previous_ref, const T & previous_value){
+ BOOST_TRY{
+ previous_ref = previous_value;
+ }
+ BOOST_CATCH(::std::exception &) {
+ // we must ignore it - we are in destructor
+ }
+ BOOST_CATCH_END
+ }
+ };
+
+public:
+ state_saver(
+ T & object
+ ) :
+ previous_value(object),
+ previous_ref(object)
+ {}
+
+ ~state_saver() {
+ #ifndef BOOST_NO_EXCEPTIONS
+ typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
+ has_nothrow_copy<T>,
+ mpl::identity<restore>,
+ mpl::identity<restore_with_exception>
+ >::type typex;
+ typex::invoke(previous_ref, previous_value);
+ #else
+ previous_ref = previous_value;
+ #endif
+ }
+
+}; // state_saver<>
+
+} // boost
+
+#endif //BOOST_STATE_SAVER_HPP
--- /dev/null
+#ifndef BOOST_STATIC_WARNING_HPP
+#define BOOST_STATIC_WARNING_HPP
+
+// (C) Copyright Robert Ramey 2003. Jonathan Turkanis 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
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/static_assert for documentation.
+
+/*
+ Revision history:
+ 15 June 2003 - Initial version.
+ 31 March 2004 - improved diagnostic messages and portability
+ (Jonathan Turkanis)
+ 03 April 2004 - works on VC6 at class and namespace scope
+ - ported to DigitalMars
+ - static warnings disabled by default; when enabled,
+ uses pragmas to enable required compiler warnings
+ on MSVC, Intel, Metrowerks and Borland 5.x.
+ (Jonathan Turkanis)
+ 30 May 2004 - tweaked for msvc 7.1 and gcc 3.3
+ - static warnings ENabled by default; when enabled,
+ (Robert Ramey)
+*/
+
+#include <boost/config.hpp>
+
+//
+// Implementation
+// Makes use of the following warnings:
+// 1. GCC prior to 3.3: division by zero.
+// 2. BCC 6.0 preview: unreferenced local variable.
+// 3. DigitalMars: returning address of local automatic variable.
+// 4. VC6: class previously seen as struct (as in 'boost/mpl/print.hpp')
+// 5. All others: deletion of pointer to incomplete type.
+//
+// The trick is to find code which produces warnings containing the name of
+// a structure or variable. Details, with same numbering as above:
+// 1. static_warning_impl<B>::value is zero iff B is false, so diving an int
+// by this value generates a warning iff B is false.
+// 2. static_warning_impl<B>::type has a constructor iff B is true, so an
+// unreferenced variable of this type generates a warning iff B is false.
+// 3. static_warning_impl<B>::type overloads operator& to return a dynamically
+// allocated int pointer only is B is true, so returning the address of an
+// automatic variable of this type generates a warning iff B is fasle.
+// 4. static_warning_impl<B>::STATIC_WARNING is decalred as a struct iff B is
+// false.
+// 5. static_warning_impl<B>::type is incomplete iff B is false, so deleting a
+// pointer to this type generates a warning iff B is false.
+//
+
+//------------------Enable selected warnings----------------------------------//
+
+// Enable the warnings relied on by BOOST_STATIC_WARNING, where possible. The
+// only pragma which is absolutely necessary here is for Borland 5.x, since
+// W8073 is disabled by default. If enabling selected warnings is considered
+// unacceptable, this section can be replaced with:
+// #if defined(__BORLANDC__) && (__BORLANDC__ <= 0x600)
+// pragma warn +stu
+// #endif
+
+# if defined(BOOST_MSVC)
+# pragma warning(2:4150) // C4150: deletion of pointer to incomplete type 'type'.
+# elif defined(BOOST_INTEL) && (defined(__WIN32__) || defined(WIN32))
+# pragma warning(2:457) // #457: delete of pointer to incomplete class.
+# elif defined(__BORLANDC__) && (__BORLANDC__ <= 0x600)
+# pragma warn +stu // W8073: Undefined structure 'structure'.
+# elif defined(__MWERKS__)
+# pragma extended_errorcheck on // Enable 'extended error checking'.
+# endif
+
+//------------------Configure-------------------------------------------------//
+
+# if defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)
+# define BOOST_HAS_DESCRIPTIVE_UNREFERENCED_VARIABLE_WARNING
+# elif defined(__GNUC__) && !defined(BOOST_INTEL) // && (__GNUC__ * 100 + __GNUC_MINOR__ <= 302)
+# define BOOST_HAS_DESCRIPTIVE_DIVIDE_BY_ZERO_WARNING
+# elif defined(__DMC__)
+# define BOOST_HAS_DESCRIPTIVE_RETURNING_ADDRESS_OF_TEMPORARY_WARNING
+# elif defined(BOOST_MSVC) // && (BOOST_MSVC < 1300)
+# define BOOST_NO_PREDEFINED_LINE_MACRO
+# pragma warning(disable:4094) // C4094: untagged 'stuct' declared no symbols
+#endif
+
+//------------------Helper templates------------------------------------------//
+
+namespace boost {
+
+struct STATIC_WARNING;
+
+template<bool>
+struct static_warning_impl;
+
+template<>
+struct static_warning_impl<false> {
+ enum { value = 0 };
+ #if !defined(BOOST_HAS_DESCRIPTIVE_UNREFERENCED_VARIABLE_WARNING) && \
+ !defined(BOOST_HAS_DESCRIPTIVE_RETURNING_ADDRESS_OF_TEMPORARY_WARNING)
+ typedef boost::STATIC_WARNING type;
+ #else
+ typedef int type;
+ #endif
+ #if defined(BOOST_NO_PREDEFINED_LINE_MACRO)
+ struct STATIC_WARNING { };
+ #endif
+};
+
+template<>
+struct static_warning_impl<true> {
+ enum { value = 1 };
+ struct type { type() { } int* operator&() { return new int; } };
+ #if defined(BOOST_NO_PREDEFINED_LINE_MACRO)
+ class STATIC_WARNING { };
+ #endif
+};
+
+} // namespace boost
+
+//------------------Definition of BOOST_STATIC_WARNING------------------------//
+
+#if defined(BOOST_HAS_DESCRIPTIVE_UNREFERENCED_VARIABLE_WARNING)
+# define BOOST_STATIC_WARNING_IMPL(B) \
+ struct BOOST_JOIN(STATIC_WARNING, __LINE__) { \
+ void f() { \
+ ::boost::static_warning_impl<(bool)( B )>::type \
+ STATIC_WARNING; \
+ } \
+ } \
+ /**/
+#elif defined(BOOST_HAS_DESCRIPTIVE_RETURNING_ADDRESS_OF_TEMPORARY_WARNING)
+# define BOOST_STATIC_WARNING_IMPL(B) \
+ struct BOOST_JOIN(STATIC_WARNING, __LINE__) { \
+ int* f() { \
+ ::boost::static_warning_impl<(bool)( B )>::type \
+ STATIC_WARNING; \
+ return &STATIC_WARNING; \
+ } \
+ } \
+ /**/
+#elif defined(BOOST_HAS_DESCRIPTIVE_DIVIDE_BY_ZERO_WARNING)
+# define BOOST_STATIC_WARNING_IMPL(B) \
+ struct BOOST_JOIN(STATIC_WARNING, __LINE__) { \
+ int f() { int STATIC_WARNING = 1; \
+ return STATIC_WARNING / \
+ boost::static_warning_impl<(bool)( B )>::value; } \
+ } \
+ /**/
+#elif defined(BOOST_NO_PREDEFINED_LINE_MACRO)
+ // VC6; __LINE__ macro broken when -ZI is used see Q199057, so
+ // non-conforming workaround is used.
+# define BOOST_STATIC_WARNING_IMPL(B) \
+ struct { \
+ struct S { \
+ typedef boost::static_warning_impl<(bool)( B )> f; \
+ friend class f::STATIC_WARNING; \
+ }; \
+ } \
+ /**/
+#else // Deletion of pointer to incomplete type.
+# define BOOST_STATIC_WARNING_IMPL(B) \
+ struct BOOST_JOIN(STATIC_WARNING, __LINE__) { \
+ ::boost::static_warning_impl<(bool)( B )>::type* p; \
+ void f() { delete p; } \
+ } \
+ /**/
+#endif
+
+#ifndef BOOST_DISABLE_STATIC_WARNINGS
+# define BOOST_STATIC_WARNING(B) BOOST_STATIC_WARNING_IMPL(B)
+#else // #ifdef BOOST_ENABLE_STATIC_WARNINGS //-------------------------------//
+# define BOOST_STATIC_WARNING(B) BOOST_STATIC_WARNING_IMPL(true)
+#endif
+
+#endif // BOOST_STATIC_WARNING_HPP
--- /dev/null
+#ifndef BOOST_STRONG_TYPEDEF_HPP
+#define BOOST_STRONG_TYPEDEF_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
+// strong_typedef.hpp:
+
+// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// 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 for updates, documentation, and revision history.
+
+// macro used to implement a strong typedef. strong typedef
+// guarentees that two types are distinguised even though the
+// share the same underlying implementation. typedef does not create
+// a new type. BOOST_STRONG_TYPEDEF(T, D) creates a new type named D
+// that operates as a type T.
+
+#include <boost/operators.hpp>
+
+#define BOOST_STRONG_TYPEDEF(T, D) \
+struct D \
+ : boost::totally_ordered1< D \
+ , boost::totally_ordered2< D, T \
+ > > \
+{ \
+ T t; \
+ explicit D(const T t_) : t(t_) {}; \
+ D(){}; \
+ D(const D & t_) : t(t_.t){} \
+ D & operator=(const D & rhs) { t = rhs.t; return *this;} \
+ D & operator=(const T & rhs) { t = rhs; return *this;} \
+ operator const T & () const {return t; } \
+ operator T & () { return t; } \
+ bool operator==(const D & rhs) const { return t == rhs.t; } \
+ bool operator<(const D & rhs) const { return t < rhs.t; } \
+};
+
+#endif // BOOST_STRONG_TYPEDEF_HPP
--- /dev/null
+// Copyright (C) 2001-2003
+// William E. Kempf
+//
+// 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. William E. Kempf makes no representations
+// about the suitability of this software for any purpose.
+// It is provided "as is" without express or implied warranty.
+
+#if !defined(BOOST_THREAD_WEK01082003_HPP)
+#define BOOST_THREAD_WEK01082003_HPP
+
+#include <boost/thread/thread.hpp>
+#include <boost/thread/condition.hpp>
+#include <boost/thread/exceptions.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/once.hpp>
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/tss.hpp>
+#include <boost/thread/xtime.hpp>
+
+#endif
--- /dev/null
+// boost timer.hpp header file ---------------------------------------------//
+
+// Copyright Beman Dawes 1994-99. 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/timer for documentation.
+
+// Revision History
+// 01 Apr 01 Modified to use new <boost/limits.hpp> header. (JMaddock)
+// 12 Jan 01 Change to inline implementation to allow use without library
+// builds. See docs for more rationale. (Beman Dawes)
+// 25 Sep 99 elapsed_max() and elapsed_min() added (John Maddock)
+// 16 Jul 99 Second beta
+// 6 Jul 99 Initial boost version
+
+#ifndef BOOST_TIMER_HPP
+#define BOOST_TIMER_HPP
+
+#include <boost/config.hpp>
+#include <ctime>
+#include <boost/limits.hpp>
+
+# ifdef BOOST_NO_STDC_NAMESPACE
+ namespace std { using ::clock_t; using ::clock; }
+# endif
+
+
+namespace boost {
+
+// timer -------------------------------------------------------------------//
+
+// A timer object measures elapsed time.
+
+// It is recommended that implementations measure wall clock rather than CPU
+// time since the intended use is performance measurement on systems where
+// total elapsed time is more important than just process or CPU time.
+
+// Warnings: The maximum measurable elapsed time may well be only 596.5+ hours
+// due to implementation limitations. The accuracy of timings depends on the
+// accuracy of timing information provided by the underlying platform, and
+// this varies a great deal from platform to platform.
+
+class timer
+{
+ public:
+ timer() { _start_time = std::clock(); } // postcondition: elapsed()==0
+// timer( const timer& src ); // post: elapsed()==src.elapsed()
+// ~timer(){}
+// timer& operator=( const timer& src ); // post: elapsed()==src.elapsed()
+ void restart() { _start_time = std::clock(); } // post: elapsed()==0
+ double elapsed() const // return elapsed time in seconds
+ { return double(std::clock() - _start_time) / CLOCKS_PER_SEC; }
+
+ double elapsed_max() const // return estimated maximum value for elapsed()
+ // Portability warning: elapsed_max() may return too high a value on systems
+ // where std::clock_t overflows or resets at surprising values.
+ {
+ return (double((std::numeric_limits<std::clock_t>::max)())
+ - double(_start_time)) / double(CLOCKS_PER_SEC);
+ }
+
+ double elapsed_min() const // return minimum value for elapsed()
+ { return double(1)/double(CLOCKS_PER_SEC); }
+
+ private:
+ std::clock_t _start_time;
+}; // timer
+
+} // namespace boost
+
+#endif // BOOST_TIMER_HPP
--- /dev/null
+// Boost token_functions.hpp ------------------------------------------------//
+
+// Copyright John R. Bandela 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/tokenizer for documentation.
+
+// Revision History:
+// 01 Oct 2004 Joaquín M López Muñoz
+// Workaround for a problem with string::assign in msvc-stlport
+// 06 Apr 2004 John Bandela
+// Fixed a bug involving using char_delimiter with a true input iterator
+// 28 Nov 2003 Robert Zeh and John Bandela
+// Converted into "fast" functions that avoid using += when
+// the supplied iterator isn't an input_iterator; based on
+// some work done at Archelon and a version that was checked into
+// the boost CVS for a short period of time.
+// 20 Feb 2002 John Maddock
+// Removed using namespace std declarations and added
+// workaround for BOOST_NO_STDC_NAMESPACE (the library
+// can be safely mixed with regex).
+// 06 Feb 2002 Jeremy Siek
+// Added char_separator.
+// 02 Feb 2002 Jeremy Siek
+// Removed tabs and a little cleanup.
+
+
+#ifndef BOOST_TOKEN_FUNCTIONS_JRB120303_HPP_
+#define BOOST_TOKEN_FUNCTIONS_JRB120303_HPP_
+
+#include <vector>
+#include <stdexcept>
+#include <cassert>
+#include <string>
+#include <cctype>
+#include <algorithm> // for find_if
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/mpl/if.hpp>
+
+//
+// the following must not be macros if we are to prefix them
+// with std:: (they shouldn't be macros anyway...)
+//
+#ifdef ispunct
+# undef ispunct
+#endif
+#ifdef isspace
+# undef isspace
+#endif
+//
+// fix namespace problems:
+//
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::ispunct;
+ using ::isspace;
+}
+#endif
+
+namespace boost{
+
+ //===========================================================================
+ // The escaped_list_separator class. Which is a model of TokenizerFunction
+ // An escaped list is a super-set of what is commonly known as a comma
+ // separated value (csv) list.It is separated into fields by a comma or
+ // other character. If the delimiting character is inside quotes, then it is
+ // counted as a regular character.To allow for embedded quotes in a field,
+ // there can be escape sequences using the \ much like C.
+ // The role of the comma, the quotation mark, and the escape
+ // character (backslash \), can be assigned to other characters.
+
+ struct escaped_list_error : public std::runtime_error{
+ escaped_list_error(const std::string& what):std::runtime_error(what) { }
+ };
+
+
+// The out of the box GCC 2.95 on cygwin does not have a char_traits class.
+// MSVC does not like the following typename
+#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
+ template <class Char,
+ class Traits = typename std::basic_string<Char>::traits_type >
+#else
+ template <class Char,
+ class Traits = std::basic_string<Char>::traits_type >
+#endif
+ class escaped_list_separator {
+
+ private:
+ typedef std::basic_string<Char,Traits> string_type;
+ struct char_eq {
+ Char e_;
+ char_eq(Char e):e_(e) { }
+ bool operator()(Char c) {
+ return Traits::eq(e_,c);
+ }
+ };
+ string_type escape_;
+ string_type c_;
+ string_type quote_;
+ bool last_;
+
+ bool is_escape(Char e) {
+ char_eq f(e);
+ return std::find_if(escape_.begin(),escape_.end(),f)!=escape_.end();
+ }
+ bool is_c(Char e) {
+ char_eq f(e);
+ return std::find_if(c_.begin(),c_.end(),f)!=c_.end();
+ }
+ bool is_quote(Char e) {
+ char_eq f(e);
+ return std::find_if(quote_.begin(),quote_.end(),f)!=quote_.end();
+ }
+ template <typename iterator, typename Token>
+ void do_escape(iterator& next,iterator end,Token& tok) {
+ if (++next == end)
+ throw escaped_list_error(std::string("cannot end with escape"));
+ if (Traits::eq(*next,'n')) {
+ tok+='\n';
+ return;
+ }
+ else if (is_quote(*next)) {
+ tok+=*next;
+ return;
+ }
+ else if (is_c(*next)) {
+ tok+=*next;
+ return;
+ }
+ else if (is_escape(*next)) {
+ tok+=*next;
+ return;
+ }
+ else
+ throw escaped_list_error(std::string("unknown escape sequence"));
+ }
+
+ public:
+
+ explicit escaped_list_separator(Char e = '\\',
+ Char c = ',',Char q = '\"')
+ : escape_(1,e), c_(1,c), quote_(1,q), last_(false) { }
+
+ escaped_list_separator(string_type e, string_type c, string_type q)
+ : escape_(e), c_(c), quote_(q), last_(false) { }
+
+ void reset() {last_=false;}
+
+ template <typename InputIterator, typename Token>
+ bool operator()(InputIterator& next,InputIterator end,Token& tok) {
+ bool bInQuote = false;
+ tok = Token();
+
+ if (next == end) {
+ if (last_) {
+ last_ = false;
+ return true;
+ }
+ else
+ return false;
+ }
+ last_ = false;
+ for (;next != end;++next) {
+ if (is_escape(*next)) {
+ do_escape(next,end,tok);
+ }
+ else if (is_c(*next)) {
+ if (!bInQuote) {
+ // If we are not in quote, then we are done
+ ++next;
+ // The last character was a c, that means there is
+ // 1 more blank field
+ last_ = true;
+ return true;
+ }
+ else tok+=*next;
+ }
+ else if (is_quote(*next)) {
+ bInQuote=!bInQuote;
+ }
+ else {
+ tok += *next;
+ }
+ }
+ return true;
+ }
+ };
+
+ //===========================================================================
+ // The classes here are used by offset_separator and char_separator to implement
+ // faster assigning of tokens using assign instead of +=
+
+ namespace tokenizer_detail {
+
+ // The assign_or_plus_equal struct contains functions that implement
+ // assign, +=, and clearing based on the iterator type. The
+ // generic case does nothing for plus_equal and clearing, while
+ // passing through the call for assign.
+ //
+ // When an input iterator is being used, the situation is reversed.
+ // The assign method does nothing, plus_equal invokes operator +=,
+ // and the clearing method sets the supplied token to the default
+ // token constructor's result.
+ //
+
+ template<class IteratorTag>
+ struct assign_or_plus_equal {
+ template<class Iterator, class Token>
+ static void assign(Iterator b, Iterator e, Token &t) {
+
+#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) &&\
+ BOOST_WORKAROUND(__SGI_STL_PORT, < 0x500) &&\
+ defined(_STLP_DEBUG) &&\
+ (defined(_STLP_USE_DYNAMIC_LIB) || defined(_DLL))
+ // Problem with string::assign for msvc-stlport in debug mode: the
+ // linker tries to import the templatized version of this memfun,
+ // which is obviously not exported.
+ // See http://www.stlport.com/dcforum/DCForumID6/1763.html for details.
+
+ t = Token();
+ while(b != e) t += *b++;
+#else
+ t.assign(b, e);
+#endif
+
+ }
+
+ template<class Token, class Value>
+ static void plus_equal(Token &, const Value &) {
+
+ }
+
+ // If we are doing an assign, there is no need for the
+ // the clear.
+ //
+ template<class Token>
+ static void clear(Token &) {
+
+ }
+ };
+
+ template <>
+ struct assign_or_plus_equal<std::input_iterator_tag> {
+ template<class Iterator, class Token>
+ static void assign(Iterator b, Iterator e, Token &t) {
+
+ }
+ template<class Token, class Value>
+ static void plus_equal(Token &t, const Value &v) {
+ t += v;
+ }
+ template<class Token>
+ static void clear(Token &t) {
+ t = Token();
+ }
+ };
+
+
+ template<class Iterator>
+ struct pointer_iterator_category{
+ typedef std::random_access_iterator_tag type;
+ };
+
+
+ template<class Iterator>
+ struct class_iterator_category{
+ typedef typename Iterator::iterator_category type;
+ };
+
+
+
+ // This portably gets the iterator_tag without partial template specialization
+ template<class Iterator>
+ struct get_iterator_category{
+ typedef typename mpl::if_<is_pointer<Iterator>,
+ pointer_iterator_category<Iterator>,
+ class_iterator_category<Iterator>
+ >::type cat;
+
+ typedef typename cat::type iterator_category;
+ };
+
+
+}
+
+
+ //===========================================================================
+ // The offset_separator class, which is a model of TokenizerFunction.
+ // Offset breaks a string into tokens based on a range of offsets
+
+ class offset_separator {
+ private:
+
+ std::vector<int> offsets_;
+ unsigned int current_offset_;
+ bool wrap_offsets_;
+ bool return_partial_last_;
+
+ public:
+ template <typename Iter>
+ offset_separator(Iter begin, Iter end, bool wrap_offsets = true,
+ bool return_partial_last = true)
+ : offsets_(begin,end), current_offset_(0),
+ wrap_offsets_(wrap_offsets),
+ return_partial_last_(return_partial_last) { }
+
+ offset_separator()
+ : offsets_(1,1), current_offset_(),
+ wrap_offsets_(true), return_partial_last_(true) { }
+
+ void reset() {
+ current_offset_ = 0;
+ }
+
+ template <typename InputIterator, typename Token>
+ bool operator()(InputIterator& next, InputIterator end, Token& tok)
+ {
+ typedef tokenizer_detail::assign_or_plus_equal<
+#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
+ typename
+#endif
+ tokenizer_detail::get_iterator_category<
+ InputIterator>::iterator_category> assigner;
+
+
+ assert(!offsets_.empty());
+
+ assigner::clear(tok);
+ InputIterator start(next);
+
+ if (next == end)
+ return false;
+
+ if (current_offset_ == offsets_.size())
+ if (wrap_offsets_)
+ current_offset_=0;
+ else
+ return false;
+
+ int c = offsets_[current_offset_];
+ int i = 0;
+ for (; i < c; ++i) {
+ if (next == end)break;
+ assigner::plus_equal(tok,*next++);
+ }
+ assigner::assign(start,next,tok);
+
+ if (!return_partial_last_)
+ if (i < (c-1) )
+ return false;
+
+ ++current_offset_;
+ return true;
+ }
+ };
+
+
+ //===========================================================================
+ // The char_separator class breaks a sequence of characters into
+ // tokens based on the character delimiters (very much like bad old
+ // strtok). A delimiter character can either be kept or dropped. A
+ // kept delimiter shows up as an output token, whereas a dropped
+ // delimiter does not.
+
+ // This class replaces the char_delimiters_separator class. The
+ // constructor for the char_delimiters_separator class was too
+ // confusing and needed to be deprecated. However, because of the
+ // default arguments to the constructor, adding the new constructor
+ // would cause ambiguity, so instead I deprecated the whole class.
+ // The implementation of the class was also simplified considerably.
+
+ enum empty_token_policy { drop_empty_tokens, keep_empty_tokens };
+
+ // The out of the box GCC 2.95 on cygwin does not have a char_traits class.
+#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
+ template <typename Char,
+ typename Traits = typename std::basic_string<Char>::traits_type >
+#else
+ template <typename Char,
+ typename Traits = std::basic_string<Char>::traits_type >
+#endif
+ class char_separator
+ {
+ typedef std::basic_string<Char,Traits> string_type;
+ public:
+ explicit
+ char_separator(const Char* dropped_delims,
+ const Char* kept_delims = 0,
+ empty_token_policy empty_tokens = drop_empty_tokens)
+ : m_dropped_delims(dropped_delims),
+ m_use_ispunct(false),
+ m_use_isspace(false),
+ m_empty_tokens(empty_tokens),
+ m_output_done(false)
+ {
+ // Borland workaround
+ if (kept_delims)
+ m_kept_delims = kept_delims;
+ }
+
+ // use ispunct() for kept delimiters and isspace for dropped.
+ explicit
+ char_separator()
+ : m_use_ispunct(true),
+ m_use_isspace(true),
+ m_empty_tokens(drop_empty_tokens) { }
+
+ void reset() { }
+
+ template <typename InputIterator, typename Token>
+ bool operator()(InputIterator& next, InputIterator end, Token& tok)
+ {
+ typedef tokenizer_detail::assign_or_plus_equal<
+#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
+ typename
+#endif
+ tokenizer_detail::get_iterator_category<
+ InputIterator>::iterator_category> assigner;
+
+ assigner::clear(tok);
+
+ // skip past all dropped_delims
+ if (m_empty_tokens == drop_empty_tokens)
+ for (; next != end && is_dropped(*next); ++next)
+ { }
+
+ InputIterator start(next);
+
+ if (m_empty_tokens == drop_empty_tokens) {
+
+ if (next == end)
+ return false;
+
+
+ // if we are on a kept_delims move past it and stop
+ if (is_kept(*next)) {
+ assigner::plus_equal(tok,*next);
+ ++next;
+ } else
+ // append all the non delim characters
+ for (; next != end && !is_dropped(*next) && !is_kept(*next); ++next)
+ assigner::plus_equal(tok,*next);
+ }
+ else { // m_empty_tokens == keep_empty_tokens
+
+ // Handle empty token at the end
+ if (next == end)
+ if (m_output_done == false) {
+ m_output_done = true;
+ assigner::assign(start,next,tok);
+ return true;
+ } else
+ return false;
+
+ if (is_kept(*next)) {
+ if (m_output_done == false)
+ m_output_done = true;
+ else {
+ assigner::plus_equal(tok,*next);
+ ++next;
+ m_output_done = false;
+ }
+ }
+ else if (m_output_done == false && is_dropped(*next)) {
+ m_output_done = true;
+ }
+ else {
+ if (is_dropped(*next))
+ start=++next;
+ for (; next != end && !is_dropped(*next) && !is_kept(*next); ++next)
+ assigner::plus_equal(tok,*next);
+ m_output_done = true;
+ }
+ }
+ assigner::assign(start,next,tok);
+ return true;
+ }
+
+ private:
+ string_type m_kept_delims;
+ string_type m_dropped_delims;
+ bool m_use_ispunct;
+ bool m_use_isspace;
+ empty_token_policy m_empty_tokens;
+ bool m_output_done;
+
+ bool is_kept(Char E) const
+ {
+ if (m_kept_delims.length())
+ return m_kept_delims.find(E) != string_type::npos;
+ else if (m_use_ispunct) {
+ return std::ispunct(E) != 0;
+ } else
+ return false;
+ }
+ bool is_dropped(Char E) const
+ {
+ if (m_dropped_delims.length())
+ return m_dropped_delims.find(E) != string_type::npos;
+ else if (m_use_isspace) {
+ return std::isspace(E) != 0;
+ } else
+ return false;
+ }
+ };
+
+ //===========================================================================
+ // The following class is DEPRECATED, use class char_separators instead.
+ //
+ // The char_delimiters_separator class, which is a model of
+ // TokenizerFunction. char_delimiters_separator breaks a string
+ // into tokens based on character delimiters. There are 2 types of
+ // delimiters. returnable delimiters can be returned as
+ // tokens. These are often punctuation. nonreturnable delimiters
+ // cannot be returned as tokens. These are often whitespace
+
+ // The out of the box GCC 2.95 on cygwin does not have a char_traits class.
+#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
+ template <class Char,
+ class Traits = typename std::basic_string<Char>::traits_type >
+#else
+ template <class Char,
+ class Traits = std::basic_string<Char>::traits_type >
+#endif
+ class char_delimiters_separator {
+ private:
+
+ typedef std::basic_string<Char,Traits> string_type;
+ string_type returnable_;
+ string_type nonreturnable_;
+ bool return_delims_;
+ bool no_ispunct_;
+ bool no_isspace_;
+
+ bool is_ret(Char E)const
+ {
+ if (returnable_.length())
+ return returnable_.find(E) != string_type::npos;
+ else{
+ if (no_ispunct_) {return false;}
+ else{
+ int r = std::ispunct(E);
+ return r != 0;
+ }
+ }
+ }
+ bool is_nonret(Char E)const
+ {
+ if (nonreturnable_.length())
+ return nonreturnable_.find(E) != string_type::npos;
+ else{
+ if (no_isspace_) {return false;}
+ else{
+ int r = std::isspace(E);
+ return r != 0;
+ }
+ }
+ }
+
+ public:
+ explicit char_delimiters_separator(bool return_delims = false,
+ const Char* returnable = 0,
+ const Char* nonreturnable = 0)
+ : returnable_(returnable ? returnable : string_type().c_str()),
+ nonreturnable_(nonreturnable ? nonreturnable:string_type().c_str()),
+ return_delims_(return_delims), no_ispunct_(returnable!=0),
+ no_isspace_(nonreturnable!=0) { }
+
+ void reset() { }
+
+ public:
+
+ template <typename InputIterator, typename Token>
+ bool operator()(InputIterator& next, InputIterator end,Token& tok) {
+ tok = Token();
+
+ // skip past all nonreturnable delims
+ // skip past the returnable only if we are not returning delims
+ for (;next!=end && ( is_nonret(*next) || (is_ret(*next)
+ && !return_delims_ ) );++next) { }
+
+ if (next == end) {
+ return false;
+ }
+
+ // if we are to return delims and we are one a returnable one
+ // move past it and stop
+ if (is_ret(*next) && return_delims_) {
+ tok+=*next;
+ ++next;
+ }
+ else
+ // append all the non delim characters
+ for (;next!=end && !is_nonret(*next) && !is_ret(*next);++next)
+ tok+=*next;
+
+
+ return true;
+ }
+ };
+
+
+} //namespace boost
+
+
+#endif
+
+
+
+
+
--- /dev/null
+// Boost token_iterator.hpp -------------------------------------------------//
+
+// Copyright John R. Bandela 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/tokenizer for documentation.
+
+// Revision History:
+// 16 Jul 2003 John Bandela
+// Allowed conversions from convertible base iterators
+// 03 Jul 2003 John Bandela
+// Converted to new iterator adapter
+
+
+
+#ifndef BOOST_TOKENIZER_POLICY_JRB070303_HPP_
+#define BOOST_TOKENIZER_POLICY_JRB070303_HPP_
+
+#include<boost/iterator/iterator_adaptor.hpp>
+#include<boost/iterator/detail/minimum_category.hpp>
+#include<boost/token_functions.hpp>
+#include<utility>
+#include<cassert>
+
+
+namespace boost
+{
+ template <class TokenizerFunc, class Iterator, class Type>
+ class token_iterator
+ : public iterator_facade<
+ token_iterator<TokenizerFunc, Iterator, Type>
+ , Type
+ , typename detail::minimum_category<
+ forward_traversal_tag
+ , typename iterator_traversal<Iterator>::type
+ >::type
+ , const Type&
+ >
+ {
+
+ friend class iterator_core_access;
+
+ TokenizerFunc f_;
+ Iterator begin_;
+ Iterator end_;
+ bool valid_;
+ Type tok_;
+
+ void increment(){
+ assert(valid_);
+ valid_ = f_(begin_,end_,tok_);
+ }
+
+ const Type& dereference() const {
+ assert(valid_);
+ return tok_;
+ }
+ template<class Other>
+ bool equal(const Other& a) const{
+ return (a.valid_ && valid_)
+ ?( (a.begin_==begin_) && (a.end_ == end_) )
+ :(a.valid_==valid_);
+
+ }
+
+ void initialize(){
+ if(valid_) return;
+ f_.reset();
+ valid_ = (begin_ != end_)?
+ f_(begin_,end_,tok_):false;
+ }
+ public:
+ token_iterator():begin_(),end_(),valid_(false),tok_() { }
+
+ token_iterator(TokenizerFunc f, Iterator begin, Iterator e = Iterator())
+ : f_(f),begin_(begin),end_(e),valid_(false),tok_(){ initialize(); }
+
+ token_iterator(Iterator begin, Iterator e = Iterator())
+ : f_(),begin_(begin),end_(e),valid_(false),tok_() {initialize();}
+
+ template<class OtherIter>
+ token_iterator(
+ token_iterator<TokenizerFunc, OtherIter,Type> const& t
+ , typename enable_if_convertible<OtherIter, Iterator>::type* = 0)
+ : f_(t.tokenizer_function()),begin_(t.base())
+ ,end_(t.end()),valid_(t.at_end()),tok_(t.current_token()) {}
+
+ Iterator base()const{return begin_;}
+
+ Iterator end()const{return end_;};
+
+ TokenizerFunc tokenizer_function()const{return f_;}
+
+ Type current_token()const{return tok_;}
+
+ bool at_end()const{return valid_;}
+
+
+
+
+ };
+ template <
+ class TokenizerFunc = char_delimiters_separator<char>,
+ class Iterator = std::string::const_iterator,
+ class Type = std::string
+ >
+ class token_iterator_generator {
+
+ private:
+ public:
+ typedef token_iterator<TokenizerFunc,Iterator,Type> type;
+ };
+
+
+ // Type has to be first because it needs to be explicitly specified
+ // because there is no way the function can deduce it.
+ template<class Type, class Iterator, class TokenizerFunc>
+ typename token_iterator_generator<TokenizerFunc,Iterator,Type>::type
+ make_token_iterator(Iterator begin, Iterator end,const TokenizerFunc& fun){
+ typedef typename
+ token_iterator_generator<TokenizerFunc,Iterator,Type>::type ret_type;
+ return ret_type(fun,begin,end);
+ }
+
+} // namespace boost
+
+#endif
--- /dev/null
+// Boost tokenizer.hpp -----------------------------------------------------//
+
+// © Copyright Jeremy Siek and John R. Bandela 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/tokenizer for documenation
+
+// Revision History:
+// 03 Jul 2003 John Bandela
+// Converted to new iterator adapter
+// 02 Feb 2002 Jeremy Siek
+// Removed tabs and a little cleanup.
+
+#ifndef BOOST_TOKENIZER_JRB070303_HPP_
+#define BOOST_TOKENIZER_JRB070303_HPP_
+
+#include <boost/token_iterator.hpp>
+#include <cassert>
+namespace boost {
+
+
+ //===========================================================================
+ // A container-view of a tokenized "sequence"
+ template <
+ typename TokenizerFunc = char_delimiters_separator<char>,
+ typename Iterator = std::string::const_iterator,
+ typename Type = std::string
+ >
+ class tokenizer {
+ private:
+ typedef token_iterator_generator<TokenizerFunc,Iterator,Type> TGen;
+
+ // It seems that MSVC does not like the unqualified use of iterator,
+ // Thus we use iter internally when it is used unqualified and
+ // the users of this class will always qualify iterator.
+ typedef typename TGen::type iter;
+
+ public:
+
+ typedef iter iterator;
+ typedef iter const_iterator;
+ typedef Type value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef value_type* pointer;
+ typedef const pointer const_pointer;
+ typedef void size_type;
+ typedef void difference_type;
+
+ tokenizer(Iterator first, Iterator last,
+ const TokenizerFunc& f = TokenizerFunc())
+ : first_(first), last_(last), f_(f) { }
+
+ template <typename Container>
+ tokenizer(const Container& c)
+ : first_(c.begin()), last_(c.end()), f_() { }
+
+ template <typename Container>
+ tokenizer(const Container& c,const TokenizerFunc& f)
+ : first_(c.begin()), last_(c.end()), f_(f) { }
+
+ void assign(Iterator first, Iterator last){
+ first_ = first;
+ last_ = last;
+ }
+
+ void assign(Iterator first, Iterator last, const TokenizerFunc& f){
+ assign(first,last);
+ f_ = f;
+ }
+
+ template <typename Container>
+ void assign(const Container& c){
+ assign(c.begin(),c.end());
+ }
+
+
+ template <typename Container>
+ void assign(const Container& c, const TokenizerFunc& f){
+ assign(c.begin(),c.end(),f);
+ }
+
+ iter begin() const { return iter(f_,first_,last_); }
+ iter end() const { return iter(f_,last_,last_); }
+
+ private:
+ Iterator first_;
+ Iterator last_;
+ TokenizerFunc f_;
+ };
+
+
+} // namespace boost
+
+#endif
--- /dev/null
+// (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)
+
+#ifndef BOOST_TYPE_DWA20010120_HPP
+# define BOOST_TYPE_DWA20010120_HPP
+
+namespace boost {
+
+ // Just a simple "type envelope". Useful in various contexts, mostly to work
+ // around some MSVC deficiencies.
+ template <class T>
+ struct type {};
+
+}
+
+#endif // BOOST_TYPE_DWA20010120_HPP
--- /dev/null
+// Boost utility.hpp header file -------------------------------------------//
+
+// Copyright 1999-2003 Aleksey Gurtovoy. Use, modification, and distribution are
+// subject to the Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
+
+// See <http://www.boost.org/libs/utility/> for the library's home page.
+
+#ifndef BOOST_UTILITY_HPP
+#define BOOST_UTILITY_HPP
+
+#include <boost/utility/addressof.hpp>
+#include <boost/utility/base_from_member.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/next_prior.hpp>
+#include <boost/noncopyable.hpp>
+
+#endif // BOOST_UTILITY_HPP
--- /dev/null
+//-----------------------------------------------------------------------------
+// boost variant.hpp header file
+// See http://www.boost.org for updates, documentation, and revision history.
+//-----------------------------------------------------------------------------
+//
+// Copyright (c) 2003
+// Eric Friedman, Itay Maman
+//
+// 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_VARIANT_HPP
+#define BOOST_VARIANT_HPP
+
+// variant "main"
+#include "boost/variant/variant.hpp"
+#include "boost/variant/recursive_variant.hpp"
+#include "boost/variant/recursive_wrapper.hpp"
+
+// common applications
+#include "boost/variant/get.hpp"
+#include "boost/variant/apply_visitor.hpp"
+#include "boost/variant/static_visitor.hpp"
+#include "boost/variant/visitor_ptr.hpp"
+
+#endif // BOOST_VARIANT_HPP
--- /dev/null
+// Copyright (C) Vladimir Prus 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)
+//
+// See http://www.boost.org/libs/graph/vector_property_map.html for
+// documentation.
+//
+
+#ifndef VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04
+#define VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04
+
+#include <boost/property_map.hpp>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+namespace boost {
+ template<typename T, typename IndexMap = identity_property_map>
+ class vector_property_map
+ : public boost::put_get_helper<
+ typename std::iterator_traits<
+ typename std::vector<T>::iterator >::reference,
+ vector_property_map<T, IndexMap> >
+ {
+ public:
+ typedef typename property_traits<IndexMap>::key_type key_type;
+ typedef T value_type;
+ typedef typename std::iterator_traits<
+ typename std::vector<T>::iterator >::reference reference;
+ typedef boost::lvalue_property_map_tag category;
+
+ vector_property_map(const IndexMap& index = IndexMap())
+ : store(new std::vector<T>()), index(index)
+ {}
+
+ vector_property_map(unsigned initial_size,
+ const IndexMap& index = IndexMap())
+ : store(new std::vector<T>(initial_size)), index(index)
+ {}
+
+ typename std::vector<T>::iterator storage_begin()
+ {
+ return store->begin();
+ }
+
+ typename std::vector<T>::iterator storage_end()
+ {
+ return store->end();
+ }
+
+ typename std::vector<T>::const_iterator storage_begin() const
+ {
+ return store->begin();
+ }
+
+ typename std::vector<T>::const_iterator storage_end() const
+ {
+ return store->end();
+ }
+
+ public:
+ // Copy ctor absent, default semantics is OK.
+ // Assignment operator absent, default semantics is OK.
+ // CONSIDER: not sure that assignment to 'index' is correct.
+
+ reference operator[](const key_type& v) const {
+ typename property_traits<IndexMap>::value_type i = get(index, v);
+ if (static_cast<unsigned>(i) >= store->size()) {
+ store->resize(i + 1, T());
+ }
+ return (*store)[i];
+ }
+ private:
+ // Conceptually, we have a vector of infinite size. For practical
+ // purposes, we start with an empty vector and grow it as needed.
+ // Note that we cannot store pointer to vector here -- we cannot
+ // store pointer to data, because if copy of property map resizes
+ // the vector, the pointer to data will be invalidated.
+ // I wonder if class 'pmap_ref' is simply needed.
+ shared_ptr< std::vector<T> > store;
+ IndexMap index;
+ };
+
+ template<typename T, typename IndexMap>
+ vector_property_map<T, IndexMap>
+ make_vector_property_map(IndexMap index)
+ {
+ return vector_property_map<T, IndexMap>(index);
+ }
+}
+
+#endif
--- /dev/null
+// Boost.Signals library
+
+// Copyright Douglas Gregor 2001-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)
+
+// For more information, see http://www.boost.org/libs/signals
+
+#ifndef BOOST_VISIT_EACH_HPP
+#define BOOST_VISIT_EACH_HPP
+
+#include <boost/config.hpp>
+
+namespace boost {
+ template<typename Visitor, typename T>
+ inline void visit_each(Visitor& visitor, const T& t, long)
+ {
+ visitor(t);
+ }
+
+ template<typename Visitor, typename T>
+ inline void visit_each(Visitor& visitor, const T& t)
+ {
+ visit_each(visitor, t, 0);
+ }
+}
+
+#endif // BOOST_VISIT_EACH_HPP
--- /dev/null
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+
+ http://www.boost.org/
+
+ Copyright (c) 2001-2005 Hartmut Kaiser. 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)
+=============================================================================*/
+
+#if !defined(WAVE_HPP_DCA0EA51_EF5B_4BF1_88A8_461DBC5F292B_INCLUDED)
+#define WAVE_HPP_DCA0EA51_EF5B_4BF1_88A8_461DBC5F292B_INCLUDED
+
+#include <boost/wave/wave_config.hpp>
+#include <boost/wave/cpp_exceptions.hpp>
+#include <boost/wave/cpplexer/cpplexer_exceptions.hpp>
+
+#include <boost/wave/token_ids.hpp>
+#include <boost/wave/cpp_context.hpp>
+
+#endif // !defined(WAVE_HPP_DCA0EA51_EF5B_4BF1_88A8_461DBC5F292B_INCLUDED)
--- /dev/null
+#ifndef BOOST_WEAK_PTR_HPP_INCLUDED
+#define BOOST_WEAK_PTR_HPP_INCLUDED
+
+//
+// weak_ptr.hpp
+//
+// Copyright (c) 2001, 2002, 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)
+//
+// See http://www.boost.org/libs/smart_ptr/weak_ptr.htm for documentation.
+//
+
+#include <boost/shared_ptr.hpp>
+
+#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
+# pragma warning(push)
+# pragma warning(disable:4284) // odd return type for operator->
+#endif
+
+namespace boost
+{
+
+template<class T> class weak_ptr
+{
+private:
+
+ // Borland 5.5.1 specific workarounds
+ typedef weak_ptr<T> this_type;
+
+public:
+
+ typedef T element_type;
+
+ weak_ptr(): px(0), pn() // never throws in 1.30+
+ {
+ }
+
+// generated copy constructor, assignment, destructor are fine
+
+
+//
+// The "obvious" converting constructor implementation:
+//
+// template<class Y>
+// weak_ptr(weak_ptr<Y> const & r): px(r.px), pn(r.pn) // never throws
+// {
+// }
+//
+// has a serious problem.
+//
+// r.px may already have been invalidated. The px(r.px)
+// conversion may require access to *r.px (virtual inheritance).
+//
+// It is not possible to avoid spurious access violations since
+// in multithreaded programs r.px may be invalidated at any point.
+//
+
+ template<class Y>
+ weak_ptr(weak_ptr<Y> const & r): pn(r.pn) // never throws
+ {
+ px = r.lock().get();
+ }
+
+ template<class Y>
+ weak_ptr(shared_ptr<Y> const & r): px(r.px), pn(r.pn) // never throws
+ {
+ }
+
+#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200)
+
+ template<class Y>
+ weak_ptr & operator=(weak_ptr<Y> const & r) // never throws
+ {
+ px = r.lock().get();
+ pn = r.pn;
+ return *this;
+ }
+
+ template<class Y>
+ weak_ptr & operator=(shared_ptr<Y> const & r) // never throws
+ {
+ px = r.px;
+ pn = r.pn;
+ return *this;
+ }
+
+#endif
+
+ shared_ptr<T> lock() const // never throws
+ {
+#if defined(BOOST_HAS_THREADS)
+
+ // optimization: avoid throw overhead
+ if(expired())
+ {
+ return shared_ptr<element_type>();
+ }
+
+ try
+ {
+ return shared_ptr<element_type>(*this);
+ }
+ catch(bad_weak_ptr const &)
+ {
+ // Q: how can we get here?
+ // A: another thread may have invalidated r after the use_count test above.
+ return shared_ptr<element_type>();
+ }
+
+#else
+
+ // optimization: avoid try/catch overhead when single threaded
+ return expired()? shared_ptr<element_type>(): shared_ptr<element_type>(*this);
+
+#endif
+ }
+
+ long use_count() const // never throws
+ {
+ return pn.use_count();
+ }
+
+ bool expired() const // never throws
+ {
+ return pn.use_count() == 0;
+ }
+
+ void reset() // never throws in 1.30+
+ {
+ this_type().swap(*this);
+ }
+
+ void swap(this_type & other) // never throws
+ {
+ std::swap(px, other.px);
+ pn.swap(other.pn);
+ }
+
+ void _internal_assign(T * px2, detail::shared_count const & pn2)
+ {
+ px = px2;
+ pn = pn2;
+ }
+
+ template<class Y> bool _internal_less(weak_ptr<Y> const & rhs) const
+ {
+ return pn < rhs.pn;
+ }
+
+// Tasteless as this may seem, making all members public allows member templates
+// to work in the absence of member template friends. (Matthew Langston)
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+
+private:
+
+ template<class Y> friend class weak_ptr;
+ template<class Y> friend class shared_ptr;
+
+#endif
+
+ T * px; // contained pointer
+ detail::weak_count pn; // reference counter
+
+}; // weak_ptr
+
+template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b)
+{
+ return a._internal_less(b);
+}
+
+template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b)
+{
+ a.swap(b);
+}
+
+// deprecated, provided for backward compatibility
+template<class T> shared_ptr<T> make_shared(weak_ptr<T> const & r)
+{
+ return r.lock();
+}
+
+} // namespace boost
+
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
+#endif // #ifndef BOOST_WEAK_PTR_HPP_INCLUDED