From: hartmann Date: Tue, 21 Mar 2006 07:05:12 +0000 (+0000) Subject: Add all header files of the boost top directory. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e56c9b83e4f7aecc5086ad7b780fe0702dae64b8;p=dealii-svn.git Add all header files of the boost top directory. git-svn-id: https://svn.dealii.org/trunk@12648 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/contrib/boost/include/boost/any.hpp b/deal.II/contrib/boost/include/boost/any.hpp new file mode 100644 index 0000000000..fe8553201b --- /dev/null +++ b/deal.II/contrib/boost/include/boost/any.hpp @@ -0,0 +1,238 @@ +// 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 +#include + +#include "boost/config.hpp" +#include +#include +#include +#include + +namespace boost +{ + class any + { + public: // structors + + any() + : content(0) + { + } + + template + any(const ValueType & value) + : content(new holder(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 + 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 + 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 + friend ValueType * any_cast(any *); + + template + 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 + ValueType * any_cast(any * operand) + { + return operand && operand->type() == typeid(ValueType) + ? &static_cast *>(operand->content)->held + : 0; + } + + template + const ValueType * any_cast(const any * operand) + { + return any_cast(const_cast(operand)); + } + + template + ValueType any_cast(const any & operand) + { + typedef BOOST_DEDUCED_TYPENAME remove_reference::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::value); +#endif + + const nonref * result = any_cast(&operand); + if(!result) + boost::throw_exception(bad_any_cast()); + return *result; + } + + template + ValueType any_cast(any & operand) + { + typedef BOOST_DEDUCED_TYPENAME remove_reference::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::value); +#endif + + nonref * result = any_cast(&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 + ValueType * unsafe_any_cast(any * operand) + { + return &static_cast *>(operand->content)->held; + } + + template + const ValueType * unsafe_any_cast(const any * operand) + { + return any_cast(const_cast(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 diff --git a/deal.II/contrib/boost/include/boost/array.hpp b/deal.II/contrib/boost/include/boost/array.hpp new file mode 100644 index 0000000000..ce9eda7b53 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/array.hpp @@ -0,0 +1,198 @@ +/* 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 +#include +#include + +// Handles broken standard libraries better than +#include +#include + +// FIXES for broken compilers +#include + + +namespace boost { + + template + 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 reverse_iterator; + typedef std::reverse_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 > reverse_iterator; + typedef std::reverse_iterator > const_reverse_iterator; +#else + // workaround for broken reverse_iterator implementations + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator 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& 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 + array& operator= (const array& 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 + bool operator== (const array& x, const array& y) { + return std::equal(x.begin(), x.end(), y.begin()); + } + template + bool operator< (const array& x, const array& y) { + return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()); + } + template + bool operator!= (const array& x, const array& y) { + return !(x==y); + } + template + bool operator> (const array& x, const array& y) { + return y + bool operator<= (const array& x, const array& y) { + return !(y + bool operator>= (const array& x, const array& y) { + return !(x + inline void swap (array& x, array& y) { + x.swap(y); + } + +} /* namespace boost */ + +#endif /*BOOST_ARRAY_HPP*/ diff --git a/deal.II/contrib/boost/include/boost/assign.hpp b/deal.II/contrib/boost/include/boost/assign.hpp new file mode 100644 index 0000000000..d74a56601c --- /dev/null +++ b/deal.II/contrib/boost/include/boost/assign.hpp @@ -0,0 +1,24 @@ +// 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 +#include +#include +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost/bind.hpp b/deal.II/contrib/boost/include/boost/bind.hpp new file mode 100644 index 0000000000..3eba772a69 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/bind.hpp @@ -0,0 +1,1636 @@ +#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 +#include +#include +#include +#include +#include + +// 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 struct result_traits +{ + typedef R type; +}; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +struct unspecified {}; + +template struct result_traits +{ + typedef typename F::result_type type; +}; + +template struct result_traits< unspecified, reference_wrapper > +{ + typedef typename F::result_type type; +}; + +#endif + +// ref_compare + +template bool ref_compare(T const & a, T const & b, long) +{ + return a == b; +} + +template bool ref_compare(reference_wrapper const & a, reference_wrapper const & b, int) +{ + return a.get_pointer() == b.get_pointer(); +} + +// bind_t forward declaration for listN + +template class bind_t; + +// value + +template 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 type {}; + +// unwrap + +template inline F & unwrap(F * f, long) +{ + return *f; +} + +template inline F & unwrap(reference_wrapper * f, int) +{ + return f->get(); +} + +template inline F & unwrap(reference_wrapper const * f, int) +{ + return f->get(); +} + +#if !( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, <= 0x3004) ) + +template inline _mfi::dm unwrap(R T::* * pm, int) +{ + return _mfi::dm(*pm); +} + +#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) +// IBM/VisualAge 6.0 is not able to handle this overload. +template inline _mfi::dm unwrap(R T::* const * pm, int) +{ + return _mfi::dm(*pm); +} +#endif + + +#endif + +// listN + +class list0 +{ +public: + + list0() {} + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A &, long) + { + return unwrap(&f, 0)(); + } + + template R operator()(type, F const & f, A &, long) const + { + return unwrap(&f, 0)(); + } + + template void operator()(type, F & f, A &, int) + { + unwrap(&f, 0)(); + } + + template void operator()(type, F const & f, A &, int) const + { + unwrap(&f, 0)(); + } + + template void accept(V &) const + { + } + + bool operator==(list0 const &) const + { + return true; + } +}; + +template 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 T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrap(&f, 0)(a[a1_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrap(&f, 0)(a[a1_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrap(&f, 0)(a[a1_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrap(&f, 0)(a[a1_]); + } + + template 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 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 T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrap(&f, 0)(a[a1_], a[a2_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrap(&f, 0)(a[a1_], a[a2_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrap(&f, 0)(a[a1_], a[a2_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrap(&f, 0)(a[a1_], a[a2_]); + } + + template 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 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 T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); + } + + template 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 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 T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); + } + + template 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 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 T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); + } + + template 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 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 T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); + } + + template 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 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 T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); + } + + template R operator()(type, 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 void operator()(type, F & f, A & a, int) + { + unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); + } + + template void operator()(type, 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 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 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 T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, 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 R operator()(type, 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 void operator()(type, 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 void operator()(type, 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 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 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 T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, 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 R operator()(type, 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 void operator()(type, 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 void operator()(type, 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 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 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 +#undef BOOST_BIND_RETURN + +}; + +#else + +template struct bind_t_generator +{ + +template class implementation +{ +public: + + typedef implementation this_type; + + implementation(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN return +#include +#undef BOOST_BIND_RETURN + +}; + +}; + +template<> struct bind_t_generator +{ + +template 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 +#undef BOOST_BIND_RETURN + +}; + +}; + +template class bind_t: public bind_t_generator::BOOST_NESTED_TEMPLATE implementation +{ +public: + + bind_t(F f, L const & l): bind_t_generator::BOOST_NESTED_TEMPLATE implementation(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 bool function_equal( bind_t const & a, bind_t const & b ) +{ + return a.compare(b); +} + +# else + +template bool function_equal_impl( bind_t const & a, bind_t 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 bool function_equal( _bi::bind_t const & a, _bi::bind_t const & b ) +{ + return a.compare(b); +} + +# else + +template bool function_equal_impl( _bi::bind_t const & a, _bi::bind_t 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 struct add_value +{ + typedef _bi::value type; +}; + +template struct add_value< value > +{ + typedef _bi::value type; +}; + +template struct add_value< reference_wrapper > +{ + typedef reference_wrapper type; +}; + +template struct add_value< arg > +{ + typedef boost::arg type; +}; + +template struct add_value< arg (*) () > +{ + typedef boost::arg (*type) (); +}; + +template struct add_value< bind_t > +{ + typedef bind_t type; +}; + +#else + +template struct _avt_0; + +template<> struct _avt_0<1> +{ + template struct inner + { + typedef T type; + }; +}; + +template<> struct _avt_0<2> +{ + template struct inner + { + typedef value type; + }; +}; + +typedef char (&_avt_r1) [1]; +typedef char (&_avt_r2) [2]; + +template _avt_r1 _avt_f(value); +template _avt_r1 _avt_f(reference_wrapper); +template _avt_r1 _avt_f(arg); +template _avt_r1 _avt_f(arg (*) ()); +template _avt_r1 _avt_f(bind_t); + +_avt_r2 _avt_f(...); + +template struct add_value +{ + static T t(); + typedef typename _avt_0::template inner::type type; +}; + +#endif + +// list_av_N + +template struct list_av_1 +{ + typedef typename add_value::type B1; + typedef list1 type; +}; + +template struct list_av_2 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef list2 type; +}; + +template struct list_av_3 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef list3 type; +}; + +template struct list_av_4 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef list4 type; +}; + +template struct list_av_5 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef list5 type; +}; + +template struct list_av_6 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef list6 type; +}; + +template struct list_av_7 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef list7 type; +}; + +template struct list_av_8 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef typename add_value::type B8; + typedef list8 type; +}; + +template struct list_av_9 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef typename add_value::type B8; + typedef typename add_value::type B9; + typedef list9 type; +}; + +// operator! + +struct logical_not +{ + template bool operator()(V const & v) const { return !v; } +}; + +template + bind_t< bool, logical_not, list1< bind_t > > + operator! (bind_t const & f) +{ + typedef list1< bind_t > list_type; + return bind_t ( logical_not(), list_type(f) ); +} + +// relational operators + +#define BOOST_BIND_OPERATOR( op, name ) \ +\ +struct name \ +{ \ + template bool operator()(V const & v, W const & w) const { return v op w; } \ +}; \ + \ +template \ + bind_t< bool, name, list2< bind_t, typename add_value::type > > \ + operator op (bind_t const & f, A2 a2) \ +{ \ + typedef typename add_value::type B2; \ + typedef list2< bind_t, B2> list_type; \ + return bind_t ( 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 \ + bind_t< bool, name, list2< bind_t, bind_t > > \ + operator op (bind_t const & f, bind_t const & g) \ +{ \ + typedef list2< bind_t, bind_t > list_type; \ + return bind_t ( 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 void visit_each(V & v, _bi::value const & t, int) +{ + BOOST_BIND_VISIT_EACH(v, t.get(), 0); +} + +template void visit_each(V & v, _bi::bind_t const & t, int) +{ + t.accept(v); +} + +// bind + +#ifndef BOOST_BIND +#define BOOST_BIND bind +#endif + +// generic function objects + +template + _bi::bind_t + BOOST_BIND(F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::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::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::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::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::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::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +// generic function objects, alternative syntax + +template + _bi::bind_t + BOOST_BIND(boost::type, F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, 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::type list_type; + return _bi::bind_t(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 + _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 + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1::type> + BOOST_BIND(F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2::type> + BOOST_BIND(F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7::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::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8::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::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9::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::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 + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST + +#ifdef BOOST_BIND_ENABLE_STDCALL + +#define BOOST_BIND_CC __stdcall +#define BOOST_BIND_ST + +#include + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST + +#endif + +#ifdef BOOST_BIND_ENABLE_FASTCALL + +#define BOOST_BIND_CC __fastcall +#define BOOST_BIND_ST + +#include + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST + +#endif + +#ifdef BOOST_BIND_ENABLE_PASCAL + +#define BOOST_BIND_ST pascal +#define BOOST_BIND_CC + +#include + +#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 + +#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 + +#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 + +#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 + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC + +#endif + +// data member pointers + +/* + +#if defined(__GNUC__) && (__GNUC__ == 2) + +namespace _bi +{ + +template struct add_cref +{ + typedef T const & type; +}; + +template struct add_cref< T & > +{ + typedef T const & type; +}; + +template<> struct add_cref +{ + typedef void type; +}; + +} // namespace _bi + +template +_bi::bind_t< typename _bi::add_cref::type, _mfi::dm, typename _bi::list_av_1::type > + BOOST_BIND(R T::*f, A1 a1) +{ + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t::type, F, list_type>(F(f), list_type(a1)); +} + +#else + +template +_bi::bind_t< R const &, _mfi::dm, typename _bi::list_av_1::type > + BOOST_BIND(R T::*f, A1 a1) +{ + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +#endif + +*/ + +template +_bi::bind_t< R, _mfi::dm, typename _bi::list_av_1::type > + BOOST_BIND(R T::*f, A1 a1) +{ + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t( F(f), list_type(a1) ); +} + +} // namespace boost + +#ifndef BOOST_BIND_NO_PLACEHOLDERS + +# include + +#endif + +#ifdef BOOST_MSVC +# pragma warning(default: 4512) // assignment operator could not be generated +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_BIND_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/blank.hpp b/deal.II/contrib/boost/include/boost/blank.hpp new file mode 100644 index 0000000000..338fc68188 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/blank.hpp @@ -0,0 +1,80 @@ +//----------------------------------------------------------------------------- +// 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 // 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 diff --git a/deal.II/contrib/boost/include/boost/blank_fwd.hpp b/deal.II/contrib/boost/include/boost/blank_fwd.hpp new file mode 100644 index 0000000000..8bfe97c469 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/blank_fwd.hpp @@ -0,0 +1,22 @@ +//----------------------------------------------------------------------------- +// 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 diff --git a/deal.II/contrib/boost/include/boost/call_traits.hpp b/deal.II/contrib/boost/include/boost/call_traits.hpp new file mode 100644 index 0000000000..5253a6de58 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/call_traits.hpp @@ -0,0 +1,24 @@ +// (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 +#endif + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else +#include +#endif + +#endif // BOOST_CALL_TRAITS_HPP diff --git a/deal.II/contrib/boost/include/boost/cast.hpp b/deal.II/contrib/boost/include/boost/cast.hpp new file mode 100644 index 0000000000..c4ce8d3c08 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/cast.hpp @@ -0,0 +1,105 @@ +// 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 +// 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 +# include +# include +# include +# include +# include + +// 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* = 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 + inline Target polymorphic_cast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET) + { + Target tmp = dynamic_cast(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 + inline Target polymorphic_downcast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET) + { + assert( dynamic_cast(x) == x ); // detect logic error + return static_cast(x); + } + +# undef BOOST_EXPLICIT_DEFAULT_TARGET + +} // namespace boost + +# include + +#endif // BOOST_CAST_HPP diff --git a/deal.II/contrib/boost/include/boost/compressed_pair.hpp b/deal.II/contrib/boost/include/boost/compressed_pair.hpp new file mode 100644 index 0000000000..e6cd6a074a --- /dev/null +++ b/deal.II/contrib/boost/include/boost/compressed_pair.hpp @@ -0,0 +1,24 @@ +// (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 +#endif + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else +#include +#endif + +#endif // BOOST_COMPRESSED_PAIR_HPP diff --git a/deal.II/contrib/boost/include/boost/concept_archetype.hpp b/deal.II/contrib/boost/include/boost/concept_archetype.hpp new file mode 100644 index 0000000000..f21c817384 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/concept_archetype.hpp @@ -0,0 +1,669 @@ +// +// (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 +#include +#include +#include + +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 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 + 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 static_object + { + public: + static T& get() + { +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + return *reinterpret_cast(0); +#else + static char d[sizeof(T)]; + return *reinterpret_cast(d); +#endif + } + }; + + template > + class default_constructible_archetype : public Base { + public: + default_constructible_archetype() + : Base(static_object::get()) { } + default_constructible_archetype(detail::dummy_constructor x) : Base(x) { } + }; + + template > + 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 copy_constructible_archetype : public Base { + public: + copy_constructible_archetype() + : Base(static_object::get()) { } + copy_constructible_archetype(const copy_constructible_archetype&) + : Base(static_object::get()) { } + copy_constructible_archetype(detail::dummy_constructor x) : Base(x) { } + }; + + template > + class sgi_assignable_archetype : public Base { + public: + sgi_assignable_archetype(const sgi_assignable_archetype&) + : Base(static_object::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 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::get(); } + }; + + template + 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 equality_comparable_archetype : public Base { + public: + equality_comparable_archetype(detail::dummy_constructor x) : Base(x) { } + }; + template + boolean_archetype + operator==(const equality_comparable_archetype&, + const equality_comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator!=(const equality_comparable_archetype&, + const equality_comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + + + template > + class equality_comparable2_first_archetype : public Base { + public: + equality_comparable2_first_archetype(detail::dummy_constructor x) + : Base(x) { } + }; + template > + class equality_comparable2_second_archetype : public Base { + public: + equality_comparable2_second_archetype(detail::dummy_constructor x) + : Base(x) { } + }; + template + boolean_archetype + operator==(const equality_comparable2_first_archetype&, + const equality_comparable2_second_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator!=(const equality_comparable2_first_archetype&, + const equality_comparable2_second_archetype&) + { + return boolean_archetype(static_object::get()); + } + + + template > + class less_than_comparable_archetype : public Base { + public: + less_than_comparable_archetype(detail::dummy_constructor x) : Base(x) { } + }; + template + boolean_archetype + operator<(const less_than_comparable_archetype&, + const less_than_comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + + + + template > + class comparable_archetype : public Base { + public: + comparable_archetype(detail::dummy_constructor x) : Base(x) { } + }; + template + boolean_archetype + operator<(const comparable_archetype&, + const comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator<=(const comparable_archetype&, + const comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator>(const comparable_archetype&, + const comparable_archetype&) + { + return boolean_archetype(static_object::get()); + } + template + boolean_archetype + operator>=(const comparable_archetype&, + const comparable_archetype&) + { + return boolean_archetype(static_object::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 Tag = optag1 > \ + class NAME##_first_archetype : public Base { \ + public: \ + NAME##_first_archetype(detail::dummy_constructor x) : Base(x) { } \ + }; \ + \ + template , class Tag = optag1 > \ + class NAME##_second_archetype : public Base { \ + public: \ + NAME##_second_archetype(detail::dummy_constructor x) : Base(x) { } \ + }; \ + \ + template \ + boolean_archetype \ + operator OP (const NAME##_first_archetype&, \ + const NAME##_second_archetype&) \ + { \ + return boolean_archetype(static_object::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 NAME##_archetype : public Base { \ + public: \ + NAME##_archetype(detail::dummy_constructor x) : Base(x) { } \ + NAME##_archetype(const NAME##_archetype&) \ + : Base(static_object::get()) { } \ + NAME##_archetype& operator=(const NAME##_archetype&) { return *this; } \ + }; \ + template \ + NAME##_archetype \ + operator OP (const NAME##_archetype&,\ + const NAME##_archetype&) \ + { \ + return \ + NAME##_archetype(static_object::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 NAME##_first_archetype : public Base { \ + public: \ + NAME##_first_archetype(detail::dummy_constructor x) : Base(x) { } \ + }; \ + \ + template > \ + class NAME##_second_archetype : public Base { \ + public: \ + NAME##_second_archetype(detail::dummy_constructor x) : Base(x) { } \ + }; \ + \ + template \ + Return \ + operator OP (const NAME##_first_archetype&, \ + const NAME##_second_archetype&) \ + { \ + return Return(static_object::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 generator_archetype { + public: + const Return& operator()() { + return static_object::get(); + } + }; + + class void_generator_archetype { + public: + void operator()() { } + }; + + template + class unary_function_archetype { + private: + unary_function_archetype() { } + public: + unary_function_archetype(detail::dummy_constructor) { } + const Return& operator()(const Arg&) const { + return static_object::get(); + } + }; + + template + 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::get(); + } + }; + + template + 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::get(); + } + }; + + template > + 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::get(); + } + }; + + //=========================================================================== + // Iterator Archetype Classes + + template + 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::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 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::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + }; + + template + struct output_proxy { + output_proxy& operator=(const T&) { return *this; } + }; + + template + class output_iterator_archetype + { + public: + typedef output_iterator_archetype self; + public: + typedef std::output_iterator_tag iterator_category; + typedef output_proxy value_type; + typedef output_proxy 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(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + private: + output_iterator_archetype() { } + }; + + template + 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::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 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::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + }; + + template + 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::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + }; + + template + 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::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + self& operator--() { return *this; } + self operator--(int) { return *this; } + }; + + template + 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::get(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } + self& operator--() { return *this; } + self operator--(int) { return *this; } + }; + + template + 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::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::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 + random_access_iterator_archetype + operator+(typename random_access_iterator_archetype::difference_type, + const random_access_iterator_archetype& x) + { return x; } + + + template + 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::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::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 + mutable_random_access_iterator_archetype + operator+ + (typename mutable_random_access_iterator_archetype::difference_type, + const mutable_random_access_iterator_archetype& x) + { return x; } + +} // namespace boost + +#endif // BOOST_CONCEPT_ARCHETYPES_H diff --git a/deal.II/contrib/boost/include/boost/concept_check.hpp b/deal.II/contrib/boost/include/boost/concept_check.hpp new file mode 100644 index 0000000000..8b090d0232 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/concept_check.hpp @@ -0,0 +1,1056 @@ +// +// (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 header. (JMaddock) +// + +// See http://www.boost.org/libs/concept_check for documentation. + +#ifndef BOOST_CONCEPT_CHECKS_HPP +#define BOOST_CONCEPT_CHECKS_HPP + +#include +#include +#include +#include +#include +#include +#include + + +#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 inline void ignore_unused_variable_warning(const T&) { } + +// the unused, defaulted parameter is a workaround for MSVC and Compaq C++ +template +inline void function_requires(mpl::identity* = 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 ::* func##type_var##concept)(); \ + template \ + struct concept_checking_##type_var##concept { }; \ + typedef concept_checking_##type_var##concept< \ + BOOST_FPTR ns::concept::constraints> \ + concept_checking_typedef_##type_var##concept + +#define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \ + typedef void (ns::concept ::* \ + func##type_var1##type_var2##concept)(); \ + template \ + struct concept_checking_##type_var1##type_var2##concept { }; \ + typedef concept_checking_##type_var1##type_var2##concept< \ + BOOST_FPTR ns::concept::constraints> \ + concept_checking_typedef_##type_var1##type_var2##concept + +#define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \ + typedef void (ns::concept ::* \ + func##tv1##tv2##tv3##concept)(); \ + template \ + struct concept_checking_##tv1##tv2##tv3##concept { }; \ + typedef concept_checking_##tv1##tv2##tv3##concept< \ + BOOST_FPTR ns::concept::constraints> \ + concept_checking_typedef_##tv1##tv2##tv3##concept + +#define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \ + typedef void (ns::concept ::* \ + func##tv1##tv2##tv3##tv4##concept)(); \ + template \ + struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \ + typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \ + BOOST_FPTR ns::concept::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 ::* func##type_var##concept)(); \ + template \ + struct concept_checking_##type_var##concept { }; \ + typedef concept_checking_##type_var##concept< \ + BOOST_FPTR concept ::constraints> \ + concept_checking_typedef_##type_var##concept + +#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept) \ + typedef void (concept ::* func##type_var1##type_var2##concept)(); \ + template \ + struct concept_checking_##type_var1##type_var2##concept { }; \ + typedef concept_checking_##type_var1##type_var2##concept< \ + BOOST_FPTR concept ::constraints> \ + concept_checking_typedef_##type_var1##type_var2##concept + +#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept) \ + typedef void (concept ::* func##type_var1##type_var2##type_var3##concept)(); \ + template \ + struct concept_checking_##type_var1##type_var2##type_var3##concept { }; \ + typedef concept_checking_##type_var1##type_var2##type_var3##concept< \ + BOOST_FPTR concept ::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 ::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \ + template \ + 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 ::constraints> \ + concept_checking_typedef_##type_var1##type_var2##type_var3##type_var4##concept + + +#endif + +#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct require_same { }; + +template +struct require_same { typedef T type; }; +#else +// This version does not perform checking, but will not do any harm. +template +struct require_same { typedef T type; }; +#endif + + template + 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 { void constraints() {} }; + template <> struct IntegerConcept { void constraints() {} }; + template <> struct IntegerConcept { void constraints() {} }; + template <> struct IntegerConcept { void constraints() {} }; + template <> struct IntegerConcept { void constraints() {} }; + template <> struct IntegerConcept { void constraints() {} }; + // etc. +#endif + + template + 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 { void constraints() {} }; + template <> struct SignedIntegerConcept { void constraints() {} }; + template <> struct SignedIntegerConcept { void constraints() {} }; +# if defined(BOOST_HAS_LONG_LONG) + template <> struct SignedIntegerConcept< ::boost::long_long_type> { void constraints() {} }; +# endif + // etc. +#endif + + template + 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 + { void constraints() {} }; + template <> struct UnsignedIntegerConcept + { void constraints() {} }; + template <> struct UnsignedIntegerConcept + { void constraints() {} }; + // etc. +#endif + + //=========================================================================== + // Basic Concepts + + template + struct DefaultConstructibleConcept + { + void constraints() { + TT a; // require default constructor + ignore_unused_variable_warning(a); + } + }; + + template + 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 + 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 + 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 + 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 + void require_boolean_expr(const TT& t) { + bool x = t; + ignore_unused_variable_warning(x); + } + + template + struct EqualityComparableConcept + { + void constraints() { + require_boolean_expr(a == b); + require_boolean_expr(a != b); + } + TT a, b; + }; + + template + struct LessThanComparableConcept + { + void constraints() { + require_boolean_expr(a < b); + } + TT a, b; + }; + + // This is equivalent to SGI STL's LessThanComparable. + template + 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 \ + 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 \ + 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 + 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 + struct GeneratorConcept + { + void constraints() { + f(); // require operator() member function + } + Func f; + }; +#endif + + template + 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 + struct UnaryFunctionConcept { + void constraints() { + f(arg); // require operator() + } + Func f; + Arg arg; + }; +#endif + + template + 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 + struct BinaryFunctionConcept + { + void constraints() { + f(first, second); // require operator() + } + Func f; + First first; + Second second; + }; +#endif + + template + struct UnaryPredicateConcept + { + void constraints() { + require_boolean_expr(f(arg)); // require operator() returning bool + } + Func f; + Arg arg; + }; + + template + 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 + struct Const_BinaryPredicateConcept { + void constraints() { + const_constraints(f); + } + void const_constraints(const Func& fun) { + function_requires >(); + // operator() must be a const member function + require_boolean_expr(fun(a, b)); + } + Func f; + First a; + Second b; + }; + + template + struct AdaptableGeneratorConcept + { + void constraints() { + typedef typename Func::result_type result_type; + BOOST_STATIC_ASSERT((is_convertible::value)); + function_requires< GeneratorConcept >(); + } + }; + + template + struct AdaptableUnaryFunctionConcept + { + void constraints() { + typedef typename Func::argument_type argument_type; + typedef typename Func::result_type result_type; + BOOST_STATIC_ASSERT((is_convertible::value)); + BOOST_STATIC_ASSERT((is_convertible::value)); + function_requires< UnaryFunctionConcept >(); + } + }; + + template + 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::value)); + BOOST_STATIC_ASSERT((is_convertible::value)); + BOOST_STATIC_ASSERT((is_convertible::value)); + function_requires< BinaryFunctionConcept >(); + } + }; + + template + struct AdaptablePredicateConcept + { + void constraints() { + function_requires< UnaryPredicateConcept >(); + function_requires< AdaptableUnaryFunctionConcept >(); + } + }; + + template + struct AdaptableBinaryPredicateConcept + { + void constraints() { + function_requires< BinaryPredicateConcept >(); + function_requires< AdaptableBinaryFunctionConcept >(); + } + }; + + //=========================================================================== + // Iterator Concepts + + template + struct InputIteratorConcept + { + void constraints() { + function_requires< AssignableConcept >(); + function_requires< EqualityComparableConcept >(); + TT j(i); + (void)*i; // require dereference operator +#ifndef BOOST_NO_STD_ITERATOR_TRAITS + // require iterator_traits typedef's + typedef typename std::iterator_traits::difference_type D; + // Hmm, the following is a bit fragile + //function_requires< SignedIntegerConcept >(); + typedef typename std::iterator_traits::reference R; + typedef typename std::iterator_traits::pointer P; + typedef typename std::iterator_traits::iterator_category C; + function_requires< ConvertibleConcept >(); +#endif + ++j; // require preincrement operator + i++; // require postincrement operator + } + TT i; + }; + + template + struct OutputIteratorConcept + { + void constraints() { + function_requires< AssignableConcept >(); + ++i; // require preincrement operator + i++; // require postincrement operator + *i++ = t; // require postincrement and assignment + } + TT i, j; + ValueT t; + }; + + template + struct ForwardIteratorConcept + { + void constraints() { + function_requires< InputIteratorConcept >(); +#ifndef BOOST_NO_STD_ITERATOR_TRAITS + typedef typename std::iterator_traits::iterator_category C; + function_requires< ConvertibleConcept >(); + typedef typename std::iterator_traits::reference reference; + reference r = *i; + ignore_unused_variable_warning(r); +#endif + } + TT i; + }; + + template + struct Mutable_ForwardIteratorConcept + { + void constraints() { + function_requires< ForwardIteratorConcept >(); + *i++ = *i; // require postincrement and assignment + } + TT i; + }; + + template + struct BidirectionalIteratorConcept + { + void constraints() { + function_requires< ForwardIteratorConcept >(); +#ifndef BOOST_NO_STD_ITERATOR_TRAITS + typedef typename std::iterator_traits::iterator_category C; + function_requires< ConvertibleConcept >(); +#endif + --i; // require predecrement operator + i--; // require postdecrement operator + } + TT i; + }; + + template + struct Mutable_BidirectionalIteratorConcept + { + void constraints() { + function_requires< BidirectionalIteratorConcept >(); + function_requires< Mutable_ForwardIteratorConcept >(); + *i-- = *i; // require postdecrement and assignment + } + TT i; + }; + + + template + struct RandomAccessIteratorConcept + { + void constraints() { + function_requires< BidirectionalIteratorConcept >(); + function_requires< ComparableConcept >(); +#ifndef BOOST_NO_STD_ITERATOR_TRAITS + typedef typename std::iterator_traits::iterator_category C; + function_requires< ConvertibleConcept< C, + std::random_access_iterator_tag> >(); + typedef typename std::iterator_traits::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::difference_type n; +#else + std::ptrdiff_t n; +#endif + }; + + template + struct Mutable_RandomAccessIteratorConcept + { + void constraints() { + function_requires< RandomAccessIteratorConcept >(); + function_requires< Mutable_BidirectionalIteratorConcept >(); + i[n] = *i; // require element access and assignment + } + TT i; +#ifndef BOOST_NO_STD_ITERATOR_TRAITS + typename std::iterator_traits::difference_type n; +#else + std::ptrdiff_t n; +#endif + }; + + //=========================================================================== + // Container Concepts + + template + 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 >(); + function_requires< AssignableConcept >(); + 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 + 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 >(); + function_requires< AssignableConcept >(); + function_requires< InputIteratorConcept >(); + + i = c.begin(); + i = c.end(); + c.swap(c2); + } + iterator i; + Container c, c2; + }; + + template + struct ForwardContainerConcept + { + void constraints() { + function_requires< ContainerConcept >(); + typedef typename ForwardContainer::const_iterator const_iterator; + function_requires< ForwardIteratorConcept >(); + } + }; + + template + struct Mutable_ForwardContainerConcept + { + void constraints() { + function_requires< ForwardContainerConcept >(); + function_requires< Mutable_ContainerConcept >(); + typedef typename ForwardContainer::iterator iterator; + function_requires< Mutable_ForwardIteratorConcept >(); + } + }; + + template + struct ReversibleContainerConcept + { + typedef typename ReversibleContainer::const_iterator const_iterator; + typedef typename ReversibleContainer::const_reverse_iterator + const_reverse_iterator; + + void constraints() { + function_requires< ForwardContainerConcept >(); + function_requires< BidirectionalIteratorConcept >(); + function_requires< + BidirectionalIteratorConcept >(); + const_constraints(c); + } + void const_constraints(const ReversibleContainer& cc) { + const_reverse_iterator i = cc.rbegin(); + i = cc.rend(); + } + ReversibleContainer c; + }; + + template + struct Mutable_ReversibleContainerConcept + { + typedef typename ReversibleContainer::iterator iterator; + typedef typename ReversibleContainer::reverse_iterator reverse_iterator; + + void constraints() { + function_requires< ReversibleContainerConcept >(); + function_requires< + Mutable_ForwardContainerConcept >(); + function_requires< Mutable_BidirectionalIteratorConcept >(); + function_requires< + Mutable_BidirectionalIteratorConcept >(); + + reverse_iterator i = c.rbegin(); + i = c.rend(); + } + ReversibleContainer c; + }; + + template + 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 >(); + function_requires< RandomAccessIteratorConcept >(); + function_requires< + RandomAccessIteratorConcept >(); + + 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 + 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 >(); + function_requires< + Mutable_ReversibleContainerConcept >(); + function_requires< Mutable_RandomAccessIteratorConcept >(); + function_requires< + Mutable_RandomAccessIteratorConcept >(); + + reference r = c[i]; + ignore_unused_variable_warning(r); + } + size_type i; + RandomAccessContainer c; + }; + + // A Sequence is inherently mutable + template + 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 >(); + function_requires< Mutable_ForwardContainerConcept >(); + function_requires< DefaultConstructibleConcept >(); + + 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 + struct FrontInsertionSequenceConcept + { + void constraints() { + function_requires< SequenceConcept >(); + + c.push_front(t); + c.pop_front(); + } + FrontInsertionSequence c; + typename FrontInsertionSequence::value_type t; + }; + + template + struct BackInsertionSequenceConcept + { + typedef typename BackInsertionSequence::reference reference; + typedef typename BackInsertionSequence::const_reference const_reference; + + void constraints() { + function_requires< SequenceConcept >(); + + 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 + struct AssociativeContainerConcept + { + void constraints() { + function_requires< ForwardContainerConcept >(); + function_requires< DefaultConstructibleConcept >(); + + 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 r; + const_iterator ci; + std::pair cr; + typename AssociativeContainer::key_type k; + typename AssociativeContainer::size_type n; + }; + + template + struct UniqueAssociativeContainerConcept + { + void constraints() { + function_requires< AssociativeContainerConcept >(); + + UniqueAssociativeContainer c(first, last); + + pos_flag = c.insert(t); + c.insert(first, last); + + ignore_unused_variable_warning(c); + } + std::pair pos_flag; + typename UniqueAssociativeContainer::value_type t; + typename UniqueAssociativeContainer::value_type* first, *last; + }; + + template + struct MultipleAssociativeContainerConcept + { + void constraints() { + function_requires< AssociativeContainerConcept >(); + + 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 + struct SimpleAssociativeContainerConcept + { + void constraints() { + function_requires< AssociativeContainerConcept >(); + typedef typename SimpleAssociativeContainer::key_type key_type; + typedef typename SimpleAssociativeContainer::value_type value_type; + typedef typename require_same::type req; + } + }; + + template + struct PairAssociativeContainerConcept + { + void constraints() { + function_requires< AssociativeContainerConcept >(); + typedef typename SimpleAssociativeContainer::key_type key_type; + typedef typename SimpleAssociativeContainer::value_type value_type; + typedef typename SimpleAssociativeContainer::mapped_type mapped_type; + typedef std::pair required_value_type; + typedef typename require_same::type req; + } + }; + + template + struct SortedAssociativeContainerConcept + { + void constraints() { + function_requires< AssociativeContainerConcept >(); + function_requires< ReversibleContainerConcept >(); + + 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 r; + std::pair cr; + typename SortedAssociativeContainer::value_type* first, *last; + }; + + // HashedAssociativeContainer + +} // namespace boost + +#endif // BOOST_CONCEPT_CHECKS_HPP + diff --git a/deal.II/contrib/boost/include/boost/crc.hpp b/deal.II/contrib/boost/include/boost/crc.hpp new file mode 100644 index 0000000000..e70c834033 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/crc.hpp @@ -0,0 +1,1106 @@ +// 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 .) + +// See for the library's home page. + +#ifndef BOOST_CRC_HPP +#define BOOST_CRC_HPP + +#include // for BOOST_STATIC_CONSTANT, etc. +#include // for boost::uint_t + +#include // for CHAR_BIT, etc. +#include // for std::size_t + +#include // 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::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 *p_ +#define BOOST_CRC_DUMMY_INIT BOOST_CRC_DUMMY_PARM_TYPE = 0 +#define BOOST_ACRC_DUMMY_PARM_TYPE , detail::dummy_crc_argument *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::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::fast augmented_crc( void const *buffer, + std::size_t byte_count, typename uint_t::fast initial_remainder + BOOST_ACRC_DUMMY_PARM_TYPE ); + +template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly > + typename uint_t::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::digits >; + + #if USHRT_MAX > UCHAR_MAX + template < > + struct mask_uint_t< std::numeric_limits::digits >; + #endif + + #if UINT_MAX > USHRT_MAX + template < > + struct mask_uint_t< std::numeric_limits::digits >; + #endif + + #if ULONG_MAX > UINT_MAX + template < > + struct mask_uint_t< std::numeric_limits::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 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 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 crc_table_type; + typedef detail::crc_helper helper_type; + typedef detail::crc_helper 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 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::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::value_type + reflector::reflect + ( + typename reflector::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 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(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::digits > + : high_uint_t< std::numeric_limits::digits > + { + typedef high_uint_t::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::digits > + : high_uint_t< std::numeric_limits::digits > + { + typedef high_uint_t::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::digits > + : high_uint_t< std::numeric_limits::digits > + { + typedef high_uint_t::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::digits > + : high_uint_t< std::numeric_limits::digits > + { + typedef high_uint_t::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 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::table_type + crc_table_t::table_ + = { 0 }; + + // Populate CRC lookup table + template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, bool Reflect > + void + crc_table_t::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::reflect(dividend) ] + = crc_helper::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::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::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::fast value_type; + + #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // Possibly reflect a remainder + static value_type reflect( value_type x ) + { return detail::reflector::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::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 + { + public: + // Type + typedef typename uint_t::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 ^ remainderCHAR_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::crc_basic +( + typename crc_basic::value_type truncated_polynominal, + typename crc_basic::value_type initial_remainder, // = 0 + typename crc_basic::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::value_type +crc_basic::get_truncated_polynominal +( +) const +{ + return poly_; +} + +template < std::size_t Bits > +inline +typename crc_basic::value_type +crc_basic::get_initial_remainder +( +) const +{ + return init_; +} + +template < std::size_t Bits > +inline +typename crc_basic::value_type +crc_basic::get_final_xor_value +( +) const +{ + return final_; +} + +template < std::size_t Bits > +inline +bool +crc_basic::get_reflect_input +( +) const +{ + return rft_in_; +} + +template < std::size_t Bits > +inline +bool +crc_basic::get_reflect_remainder +( +) const +{ + return rft_out_; +} + +template < std::size_t Bits > +inline +typename crc_basic::value_type +crc_basic::get_interim_remainder +( +) const +{ + return rem_ & masking_type::sig_bits; +} + +template < std::size_t Bits > +inline +void +crc_basic::reset +( + typename crc_basic::value_type new_rem +) +{ + rem_ = new_rem; +} + +template < std::size_t Bits > +inline +void +crc_basic::reset +( +) +{ + this->reset( this->get_initial_remainder() ); +} + +template < std::size_t Bits > +inline +void +crc_basic::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( 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::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(bits & high_bit_mask) ); + } +} + +template < std::size_t Bits > +inline +void +crc_basic::process_byte +( + unsigned char byte +) +{ + process_bits( (rft_in_ ? detail::reflector::reflect(byte) + : byte), CHAR_BIT ); +} + +template < std::size_t Bits > +void +crc_basic::process_block +( + void const * bytes_begin, + void const * bytes_end +) +{ + for ( unsigned char const * p + = static_cast(bytes_begin) ; p < bytes_end ; ++p ) + { + process_byte( *p ); + } +} + +template < std::size_t Bits > +inline +void +crc_basic::process_bytes +( + void const * buffer, + std::size_t byte_count +) +{ + unsigned char const * const b = static_cast( + buffer ); + + process_block( b, b + byte_count ); +} + +template < std::size_t Bits > +inline +typename crc_basic::value_type +crc_basic::checksum +( +) const +{ + return ( (rft_out_ ? detail::reflector::reflect( rem_ ) : rem_) + ^ final_ ) & masking_type::sig_bits; +} + + +// Optimized CRC class function definitions --------------------------------// + +// Macro to compact code +#define BOOST_CRC_OPTIMAL_NAME 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 > +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(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( + 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::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::fast +augmented_crc +( + void const * buffer, + std::size_t byte_count, + typename uint_t::fast initial_remainder + BOOST_ACRC_DUMMY_INIT +) +{ + typedef unsigned char byte_type; + typedef detail::mask_uint_t masking_type; + typedef detail::crc_table_t crc_table_type; + + typename masking_type::fast rem = initial_remainder; + byte_type const * const b = static_cast( 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::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( buffer, byte_count, + static_cast::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 + diff --git a/deal.II/contrib/boost/include/boost/cregex.hpp b/deal.II/contrib/boost/include/boost/cregex.hpp new file mode 100644 index 0000000000..b7a918eb8e --- /dev/null +++ b/deal.II/contrib/boost/include/boost/cregex.hpp @@ -0,0 +1,39 @@ +/* + * + * 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 + * 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 +#endif + +#include + +#endif /* include guard */ + + + + + + + + + + diff --git a/deal.II/contrib/boost/include/boost/cstdint.hpp b/deal.II/contrib/boost/include/boost/cstdint.hpp new file mode 100644 index 0000000000..698c149f58 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/cstdint.hpp @@ -0,0 +1,445 @@ +// 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 (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 + + +#ifdef BOOST_HAS_STDINT_H + +// The following #include is an implementation artifact; not part of interface. +# ifdef __hpux +// HP-UX has a vaguely nice in a non-standard location +# include +# 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 +# else +# include + +// 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 that contains much of what we need. +# include + +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 // 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 ). + +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(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(value) +# define UINT8_C(value) static_cast(value##u) +# endif + +// 16-bit types -----------------------------------------------------------// + +# if USHRT_MAX == 0xffff +# define INT16_C(value) static_cast(value) +# define UINT16_C(value) static_cast(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. + + + + diff --git a/deal.II/contrib/boost/include/boost/cstdlib.hpp b/deal.II/contrib/boost/include/boost/cstdlib.hpp new file mode 100644 index 0000000000..6322146354 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/cstdlib.hpp @@ -0,0 +1,41 @@ +// 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 + +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 + diff --git a/deal.II/contrib/boost/include/boost/current_function.hpp b/deal.II/contrib/boost/include/boost/current_function.hpp new file mode 100644 index 0000000000..40e3abdca2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/current_function.hpp @@ -0,0 +1,63 @@ +#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 diff --git a/deal.II/contrib/boost/include/boost/dynamic_bitset.hpp b/deal.II/contrib/boost/include/boost/dynamic_bitset.hpp new file mode 100644 index 0000000000..6486186afc --- /dev/null +++ b/deal.II/contrib/boost/include/boost/dynamic_bitset.hpp @@ -0,0 +1,19 @@ +// -------------------------------------------------- +// +// (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 diff --git a/deal.II/contrib/boost/include/boost/dynamic_bitset_fwd.hpp b/deal.II/contrib/boost/include/boost/dynamic_bitset_fwd.hpp new file mode 100644 index 0000000000..9062cfa063 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/dynamic_bitset_fwd.hpp @@ -0,0 +1,28 @@ +// -------------------------------------------------- +// +// (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 + +namespace boost { + +template > +class dynamic_bitset; + +} // namespace boost + +#endif // include guard diff --git a/deal.II/contrib/boost/include/boost/dynamic_property_map.hpp b/deal.II/contrib/boost/include/boost/dynamic_property_map.hpp new file mode 100644 index 0000000000..f968833a3f --- /dev/null +++ b/deal.II/contrib/boost/include/boost/dynamic_property_map.hpp @@ -0,0 +1,362 @@ +#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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +namespace detail { + + // read_value - + // A wrapper around lexical_cast, which does not behave as + // desired for std::string types. + template + inline Value read_value(const std::string& value) + { return boost::lexical_cast(value); } + + template<> + inline std::string read_value(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 +class dynamic_property_map_adaptor : public dynamic_property_map +{ + typedef typename property_traits::key_type key_type; + typedef typename property_traits::value_type value_type; + typedef typename property_traits::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_) + { +#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)) + using boost::put; +#endif + + key_type key = any_cast(in_key); + if (in_value.type() == typeid(value_type)) { +#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 95) + boost::put(property_map, key, any_cast(in_value)); +#else + put(property_map, key, any_cast(in_value)); +#endif + } else { + // if in_value is an empty string, put a default constructed value_type. + std::string v = any_cast(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(v)); +#else + put(property_map, key, detail::read_value(v)); +#endif + } + } + } + + void do_put(const any&, const any&, mpl::bool_) + { + 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)); +#else + using boost::get; + + return get(property_map, any_cast(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)); + return out.str(); +#else + using boost::get; + + std::ostringstream out; + out << get(property_map, any_cast(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::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 + property_maps_type; + typedef boost::function3, + 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 + dynamic_properties& + property(const std::string& name, PropertyMap property_map) + { + // Tbd: exception safety + std::auto_ptr pm( + new detail::dynamic_property_map_adaptor(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 pm) + { + property_maps.insert(property_maps_type::value_type(name, pm.release())); + } + + template + std::auto_ptr + 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 +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 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 +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(i->second->get(key)); + } + + throw dynamic_get_failure(name); +} +#endif + +template +Value +get(const std::string& name, const dynamic_properties& dp, const Key& key, type) +{ + 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(i->second->get(key)); + } + + throw dynamic_get_failure(name); +} + +template +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 diff --git a/deal.II/contrib/boost/include/boost/enable_shared_from_this.hpp b/deal.II/contrib/boost/include/boost/enable_shared_from_this.hpp new file mode 100644 index 0000000000..0cf7854ccc --- /dev/null +++ b/deal.II/contrib/boost/include/boost/enable_shared_from_this.hpp @@ -0,0 +1,67 @@ +#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 +#include +#include +#include + +namespace boost +{ + +template 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 shared_from_this() + { + shared_ptr p(_internal_weak_this); + BOOST_ASSERT(p.get() == this); + return p; + } + + shared_ptr shared_from_this() const + { + shared_ptr 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 diff --git a/deal.II/contrib/boost/include/boost/format.hpp b/deal.II/contrib/boost/include/boost/format.hpp new file mode 100644 index 0000000000..73464a819f --- /dev/null +++ b/deal.II/contrib/boost/include/boost/format.hpp @@ -0,0 +1,59 @@ +// ---------------------------------------------------------------------------- +// 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 +#include +#include +#include + +#ifndef BOOST_NO_STD_LOCALE +#include +#endif + +// *** Compatibility framework +#include + +#ifdef BOOST_NO_LOCALE_ISIDIGIT +#include // we'll use the non-locale 's std::isdigit(int) +#endif + +// **** Forward declarations ---------------------------------- +#include // basic_format, and other frontends +#include // misc forward declarations for internal use + +// **** Auxiliary structs (stream_format_state , and format_item ) +#include + +// **** Format class interface -------------------------------- +#include + +// **** Exceptions ----------------------------------------------- +#include + +// **** Implementation ------------------------------------------- +#include // member functions +#include // class for grouping arguments +#include // argument-feeding functions +#include // format-string parsing (member-)functions + +// **** Implementation of the free functions ---------------------- +#include + + +// *** Undefine 'local' macros : +#include + +#endif // BOOST_FORMAT_HPP diff --git a/deal.II/contrib/boost/include/boost/function.hpp b/deal.II/contrib/boost/include/boost/function.hpp new file mode 100644 index 0000000000..1a5cca2b4e --- /dev/null +++ b/deal.II/contrib/boost/include/boost/function.hpp @@ -0,0 +1,64 @@ +// 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 +#include + +#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 + +// Visual Age C++ doesn't handle the file iteration well +#if BOOST_WORKAROUND(__IBMCPP__, >= 500) +# if BOOST_FUNCTION_MAX_ARGS >= 0 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 1 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 2 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 3 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 4 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 5 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 6 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 7 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 8 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 9 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 10 +# include +# endif +#else +// What is the '3' for? +# define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_FUNCTION_MAX_ARGS,)) +# include BOOST_PP_ITERATE() +# undef BOOST_PP_ITERATION_PARAMS_1 +#endif diff --git a/deal.II/contrib/boost/include/boost/function_equal.hpp b/deal.II/contrib/boost/include/boost/function_equal.hpp new file mode 100644 index 0000000000..2d76c75bc9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/function_equal.hpp @@ -0,0 +1,28 @@ +// 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 + 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 + bool function_equal(const F& f, const G& g) + { return function_equal_impl(f, g, 0); } + +} // end namespace boost + +#endif // BOOST_FUNCTION_EQUAL_HPP diff --git a/deal.II/contrib/boost/include/boost/function_output_iterator.hpp b/deal.II/contrib/boost/include/boost/function_output_iterator.hpp new file mode 100644 index 0000000000..9720f3f3d1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/function_output_iterator.hpp @@ -0,0 +1,56 @@ +// (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 + +namespace boost { + + template + 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 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 + inline function_output_iterator + make_function_output_iterator(const UnaryFunction& f = UnaryFunction()) { + return function_output_iterator(f); + } + +} // namespace boost + +#endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost/functional.hpp b/deal.II/contrib/boost/include/boost/functional.hpp new file mode 100644 index 0000000000..39ccc302f0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/functional.hpp @@ -0,0 +1,556 @@ +// ------------------------------------------------------------------------------ +// 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 +#include +#include + +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 + struct unary_traits_imp; + + template + struct unary_traits_imp + { + 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 + struct unary_traits_imp + { + typedef R (*function_type)(A); + typedef R (*param_type)(A); + typedef R result_type; + typedef A argument_type; + }; + + template + struct binary_traits_imp; + + template + struct binary_traits_imp + { + 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 + struct binary_traits_imp + { + 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 + struct unary_traits + { + typedef typename detail::unary_traits_imp::function_type function_type; + typedef typename detail::unary_traits_imp::param_type param_type; + typedef typename detail::unary_traits_imp::result_type result_type; + typedef typename detail::unary_traits_imp::argument_type argument_type; + }; + + template + struct unary_traits + { + typedef R (*function_type)(A); + typedef R (*param_type)(A); + typedef R result_type; + typedef A argument_type; + }; + + template + struct binary_traits + { + typedef typename detail::binary_traits_imp::function_type function_type; + typedef typename detail::binary_traits_imp::param_type param_type; + typedef typename detail::binary_traits_imp::result_type result_type; + typedef typename detail::binary_traits_imp::first_argument_type first_argument_type; + typedef typename detail::binary_traits_imp::second_argument_type second_argument_type; + }; + + template + struct binary_traits + { + 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 + 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 + 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 unary_negate + : public std::unary_function::argument_type,bool> + { + public: + explicit unary_negate(typename unary_traits::param_type x) + : + pred(x) + {} + bool operator()(typename call_traits::argument_type>::param_type x) const + { + return !pred(x); + } + private: + typename unary_traits::function_type pred; + }; + + template + unary_negate 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((typename unary_traits::param_type)pred); + } + + template + unary_negate not1(Predicate &pred) + { + return unary_negate(pred); + } + + // -------------------------------------------------------------------------- + // binary_negate, not2 + // -------------------------------------------------------------------------- + template + class binary_negate + : public std::binary_function::first_argument_type, + typename binary_traits::second_argument_type, + bool> + { + public: + explicit binary_negate(typename binary_traits::param_type x) + : + pred(x) + {} + bool operator()(typename call_traits::first_argument_type>::param_type x, + typename call_traits::second_argument_type>::param_type y) const + { + return !pred(x,y); + } + private: + typename binary_traits::function_type pred; + }; + + template + binary_negate 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((typename binary_traits::param_type)pred); + } + + template + binary_negate not2(Predicate &pred) + { + return binary_negate(pred); + } + + // -------------------------------------------------------------------------- + // binder1st, bind1st + // -------------------------------------------------------------------------- + template + class binder1st + : public std::unary_function::second_argument_type, + typename binary_traits::result_type> + { + public: + binder1st(typename binary_traits::param_type x, + typename call_traits::first_argument_type>::param_type y) + : + op(x), value(y) + {} + + typename binary_traits::result_type + operator()(typename call_traits::second_argument_type>::param_type x) const + { + return op(value, x); + } + + protected: + typename binary_traits::function_type op; + typename binary_traits::first_argument_type value; + }; + + template + inline binder1st bind1st(const Operation &op, + typename call_traits< + typename binary_traits::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((typename binary_traits::param_type)op, x); + } + + template + inline binder1st bind1st(Operation &op, + typename call_traits< + typename binary_traits::first_argument_type + >::param_type x) + { + return binder1st(op, x); + } + + // -------------------------------------------------------------------------- + // binder2nd, bind2nd + // -------------------------------------------------------------------------- + template + class binder2nd + : public std::unary_function::first_argument_type, + typename binary_traits::result_type> + { + public: + binder2nd(typename binary_traits::param_type x, + typename call_traits::second_argument_type>::param_type y) + : + op(x), value(y) + {} + + typename binary_traits::result_type + operator()(typename call_traits::first_argument_type>::param_type x) const + { + return op(x, value); + } + + protected: + typename binary_traits::function_type op; + typename binary_traits::second_argument_type value; + }; + + template + inline binder2nd bind2nd(const Operation &op, + typename call_traits< + typename binary_traits::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((typename binary_traits::param_type)op, x); + } + + template + inline binder2nd bind2nd(Operation &op, + typename call_traits< + typename binary_traits::second_argument_type + >::param_type x) + { + return binder2nd(op, x); + } + + // -------------------------------------------------------------------------- + // mem_fun, etc + // -------------------------------------------------------------------------- + template + class mem_fun_t : public std::unary_function + { + public: + explicit mem_fun_t(S (T::*p)()) + : + ptr(p) + {} + S operator()(T* p) const + { + return (p->*ptr)(); + } + private: + S (T::*ptr)(); + }; + + template + class mem_fun1_t : public std::binary_function + { + public: + explicit mem_fun1_t(S (T::*p)(A)) + : + ptr(p) + {} + S operator()(T* p, typename call_traits::param_type x) const + { + return (p->*ptr)(x); + } + private: + S (T::*ptr)(A); + }; + + template + class const_mem_fun_t : public std::unary_function + { + 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 const_mem_fun1_t : public std::binary_function + { + public: + explicit const_mem_fun1_t(S (T::*p)(A) const) + : + ptr(p) + {} + S operator()(const T* p, typename call_traits::param_type x) const + { + return (p->*ptr)(x); + } + private: + S (T::*ptr)(A) const; + }; + + template + inline mem_fun_t mem_fun(S (T::*f)()) + { + return mem_fun_t(f); + } + + template + inline mem_fun1_t mem_fun(S (T::*f)(A)) + { + return mem_fun1_t(f); + } + +#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST + template + inline const_mem_fun_t mem_fun(S (T::*f)() const) + { + return const_mem_fun_t(f); + } + + template + inline const_mem_fun1_t mem_fun(S (T::*f)(A) const) + { + return const_mem_fun1_t(f); + } +#endif // BOOST_NO_POINTER_TO_MEMBER_CONST + + // -------------------------------------------------------------------------- + // mem_fun_ref, etc + // -------------------------------------------------------------------------- + template + class mem_fun_ref_t : public std::unary_function + { + 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 mem_fun1_ref_t : public std::binary_function + { + public: + explicit mem_fun1_ref_t(S (T::*p)(A)) + : + ptr(p) + {} + S operator()(T& p, typename call_traits::param_type x) const + { + return (p.*ptr)(x); + } + private: + S (T::*ptr)(A); + }; + + template + class const_mem_fun_ref_t : public std::unary_function + { + 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 const_mem_fun1_ref_t : public std::binary_function + { + public: + explicit const_mem_fun1_ref_t(S (T::*p)(A) const) + : + ptr(p) + {} + + S operator()(const T& p, typename call_traits::param_type x) const + { + return (p.*ptr)(x); + } + private: + S (T::*ptr)(A) const; + }; + + template + inline mem_fun_ref_t mem_fun_ref(S (T::*f)()) + { + return mem_fun_ref_t(f); + } + + template + inline mem_fun1_ref_t mem_fun_ref(S (T::*f)(A)) + { + return mem_fun1_ref_t(f); + } + +#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST + template + inline const_mem_fun_ref_t mem_fun_ref(S (T::*f)() const) + { + return const_mem_fun_ref_t(f); + } + + template + inline const_mem_fun1_ref_t mem_fun_ref(S (T::*f)(A) const) + { + return const_mem_fun1_ref_t(f); + } +#endif // BOOST_NO_POINTER_TO_MEMBER_CONST + + // -------------------------------------------------------------------------- + // ptr_fun + // -------------------------------------------------------------------------- + template + class pointer_to_unary_function : public std::unary_function + { + public: + explicit pointer_to_unary_function(Result (*f)(Arg)) + : + func(f) + {} + + Result operator()(typename call_traits::param_type x) const + { + return func(x); + } + + private: + Result (*func)(Arg); + }; + + template + inline pointer_to_unary_function ptr_fun(Result (*f)(Arg)) + { + return pointer_to_unary_function(f); + } + + template + class pointer_to_binary_function : public std::binary_function + { + public: + explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2)) + : + func(f) + {} + + Result operator()(typename call_traits::param_type x, typename call_traits::param_type y) const + { + return func(x,y); + } + + private: + Result (*func)(Arg1, Arg2); + }; + + template + inline pointer_to_binary_function ptr_fun(Result (*f)(Arg1, Arg2)) + { + return pointer_to_binary_function(f); + } +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost/include/boost/generator_iterator.hpp b/deal.II/contrib/boost/include/boost/generator_iterator.hpp new file mode 100644 index 0000000000..ebf478b25b --- /dev/null +++ b/deal.II/contrib/boost/include/boost/generator_iterator.hpp @@ -0,0 +1,80 @@ +// (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 +#include + +namespace boost { + +template +class generator_iterator + : public iterator_facade< + generator_iterator + , typename Generator::result_type + , single_pass_traversal_tag + , typename Generator::result_type const& + > +{ + typedef iterator_facade< + generator_iterator + , 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 +struct generator_iterator_generator +{ + typedef generator_iterator type; +}; + +template +inline generator_iterator +make_generator_iterator(Generator & gen) +{ + typedef generator_iterator result_t; + return result_t(&gen); +} + +} // namespace boost + + +#endif // BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP + diff --git a/deal.II/contrib/boost/include/boost/get_pointer.hpp b/deal.II/contrib/boost/include/boost/get_pointer.hpp new file mode 100644 index 0000000000..17d11b8fef --- /dev/null +++ b/deal.II/contrib/boost/include/boost/get_pointer.hpp @@ -0,0 +1,29 @@ +// 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 + +namespace boost { + +// get_pointer(p) extracts a ->* capable pointer from p + +template T * get_pointer(T * p) +{ + return p; +} + +// get_pointer(shared_ptr const & p) has been moved to shared_ptr.hpp + +template T * get_pointer(std::auto_ptr const& p) +{ + return p.get(); +} + + +} // namespace boost + +#endif // GET_POINTER_DWA20021219_HPP diff --git a/deal.II/contrib/boost/include/boost/implicit_cast.hpp b/deal.II/contrib/boost/include/boost/implicit_cast.hpp new file mode 100644 index 0000000000..2593cb4b3d --- /dev/null +++ b/deal.II/contrib/boost/include/boost/implicit_cast.hpp @@ -0,0 +1,35 @@ +// 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 + +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 +inline T implicit_cast (typename mpl::identity::type x) { + return x; +} + +// incomplete return type now is here +//template +//void implicit_cast (...); + +// Macro for when you need a constant expression (Gennaro Prota) +#define BOOST_IMPLICIT_CAST(dst_type, expr) \ + ( sizeof( implicit_cast(expr) ) \ + , \ + static_cast(expr) \ + ) + +} // namespace boost + +#endif // IMPLICIT_CAST_DWA200356_HPP diff --git a/deal.II/contrib/boost/include/boost/indirect_reference.hpp b/deal.II/contrib/boost/include/boost/indirect_reference.hpp new file mode 100644 index 0000000000..5fbb342319 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/indirect_reference.hpp @@ -0,0 +1,43 @@ +#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

::type provides the type of *p. +// +// http://www.boost.org/libs/iterator/doc/pointee.html +// + +# include +# include +# include +# include +# include + +namespace boost { + +namespace detail +{ + template + struct smart_ptr_reference + { + typedef typename boost::pointee

::type& type; + }; +} + +template +struct indirect_reference + : mpl::eval_if< + detail::is_incrementable

+ , iterator_reference

+ , detail::smart_ptr_reference

+ > +{ +}; + +} // namespace boost + +#endif // INDIRECT_REFERENCE_DWA200415_HPP diff --git a/deal.II/contrib/boost/include/boost/integer.hpp b/deal.II/contrib/boost/include/boost/integer.hpp new file mode 100644 index 0000000000..aa8b22c508 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/integer.hpp @@ -0,0 +1,127 @@ +// 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 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 // self include + +#include // for boost::integer_traits +#include // 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::digits) + + (Bits-1 <= std::numeric_limits::digits) + + (Bits-1 <= std::numeric_limits::digits) + + (Bits-1 <= std::numeric_limits::digits) + >::least least; + typedef typename int_fast_t::fast fast; + }; + + // unsigned + template< int Bits > // bits required + struct uint_t + { + typedef typename int_least_helper + < + 5 + + (Bits <= std::numeric_limits::digits) + + (Bits <= std::numeric_limits::digits) + + (Bits <= std::numeric_limits::digits) + + (Bits <= std::numeric_limits::digits) + >::least least; + typedef typename int_fast_t::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::const_max) + + (MaxValue <= integer_traits::const_max) + + (MaxValue <= integer_traits::const_max) + + (MaxValue <= integer_traits::const_max) + >::least least; + typedef typename int_fast_t::fast fast; + }; + + template< long MinValue > // minimum value to require support + struct int_min_value_t + { + typedef typename int_least_helper + < + (MinValue >= integer_traits::const_min) + + (MinValue >= integer_traits::const_min) + + (MinValue >= integer_traits::const_min) + + (MinValue >= integer_traits::const_min) + >::least least; + typedef typename int_fast_t::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::const_max) + + (Value <= integer_traits::const_max) + + (Value <= integer_traits::const_max) + + (Value <= integer_traits::const_max) + >::least least; + typedef typename int_fast_t::fast fast; + }; + + +} // namespace boost + +#endif // BOOST_INTEGER_HPP diff --git a/deal.II/contrib/boost/include/boost/integer_fwd.hpp b/deal.II/contrib/boost/include/boost/integer_fwd.hpp new file mode 100644 index 0000000000..33cfc9986f --- /dev/null +++ b/deal.II/contrib/boost/include/boost/integer_fwd.hpp @@ -0,0 +1,152 @@ +// 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 // for UCHAR_MAX, etc. +#include // for std::size_t + +#include // for BOOST_NO_INTRINSIC_WCHAR_T +#include // for std::numeric_limits + + +namespace boost +{ + + +// From ------------------------------------------------// + +// Only has typedefs or using statements, with #conditionals + + +// From -----------------------------------------// + +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 ------------------------------------------------// + +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 -----------------------------------// + +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::digits >; + +#if USHRT_MAX > UCHAR_MAX +template < > + struct low_bits_mask_t< ::std::numeric_limits::digits >; +#endif + +#if UINT_MAX > USHRT_MAX +template < > + struct low_bits_mask_t< ::std::numeric_limits::digits >; +#endif + +#if ULONG_MAX > UINT_MAX +template < > + struct low_bits_mask_t< ::std::numeric_limits::digits >; +#endif + + +// From ------------------------------------// + +template < unsigned long Value > + struct static_log2; + +template < > + struct static_log2< 0ul >; + + +// From ---------------------------------// + +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 diff --git a/deal.II/contrib/boost/include/boost/integer_traits.hpp b/deal.II/contrib/boost/include/boost/integer_traits.hpp new file mode 100644 index 0000000000..ef6ec516b1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/integer_traits.hpp @@ -0,0 +1,236 @@ +/* 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 +#include + +// These are an implementation detail and not part of the interface +#include +// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it, +// and some may have but not ... +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun)) +#include +#endif + + +namespace boost { +template +class integer_traits : public std::numeric_limits +{ +public: + BOOST_STATIC_CONSTANT(bool, is_integral = false); +}; + +namespace detail { +template +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 +const bool integer_traits_base::is_integral; + +template +const T integer_traits_base::const_min; + +template +const T integer_traits_base::const_max; +#endif + +} // namespace detail + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<> +class integer_traits + : public std::numeric_limits, + // 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 +#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 +#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 +#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 appears to return the wrong values). + public detail::integer_traits_base +#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 + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +#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 */ + + + diff --git a/deal.II/contrib/boost/include/boost/intrusive_ptr.hpp b/deal.II/contrib/boost/include/boost/intrusive_ptr.hpp new file mode 100644 index 0000000000..7efbadeea3 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/intrusive_ptr.hpp @@ -0,0 +1,272 @@ +#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 + +#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 +#include + +#include // for std::less +#include // 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 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 intrusive_ptr(intrusive_ptr 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 intrusive_ptr & operator=(intrusive_ptr 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 inline bool operator==(intrusive_ptr const & a, intrusive_ptr const & b) +{ + return a.get() == b.get(); +} + +template inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b) +{ + return a.get() != b.get(); +} + +template inline bool operator==(intrusive_ptr const & a, T * b) +{ + return a.get() == b; +} + +template inline bool operator!=(intrusive_ptr const & a, T * b) +{ + return a.get() != b; +} + +template inline bool operator==(T * a, intrusive_ptr const & b) +{ + return a == b.get(); +} + +template inline bool operator!=(T * a, intrusive_ptr 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 inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b) +{ + return a.get() != b.get(); +} + +#endif + +template inline bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) +{ + return std::less()(a.get(), b.get()); +} + +template void swap(intrusive_ptr & lhs, intrusive_ptr & rhs) +{ + lhs.swap(rhs); +} + +// mem_fn support + +template T * get_pointer(intrusive_ptr const & p) +{ + return p.get(); +} + +template intrusive_ptr static_pointer_cast(intrusive_ptr const & p) +{ + return static_cast(p.get()); +} + +template intrusive_ptr const_pointer_cast(intrusive_ptr const & p) +{ + return const_cast(p.get()); +} + +template intrusive_ptr dynamic_pointer_cast(intrusive_ptr const & p) +{ + return dynamic_cast(p.get()); +} + +// operator<< + +#if defined(__GNUC__) && (__GNUC__ < 3) + +template std::ostream & operator<< (std::ostream & os, intrusive_ptr 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 basic_ostream & operator<< (basic_ostream & os, intrusive_ptr const & p) +# else +template std::basic_ostream & operator<< (std::basic_ostream & os, intrusive_ptr 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 diff --git a/deal.II/contrib/boost/include/boost/io_fwd.hpp b/deal.II/contrib/boost/include/boost/io_fwd.hpp new file mode 100644 index 0000000000..417b81e3e1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/io_fwd.hpp @@ -0,0 +1,67 @@ +// 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 .) + +// See for the library's home page. + +#ifndef BOOST_IO_FWD_HPP +#define BOOST_IO_FWD_HPP + +#include // for std::char_traits (declaration) + + +namespace boost +{ +namespace io +{ + + +// From -------------------------------------------// + +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 > + class basic_ios_iostate_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_exception_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_tie_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_rdbuf_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_fill_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_locale_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_all_saver; + +typedef basic_ios_iostate_saver ios_iostate_saver; +typedef basic_ios_iostate_saver wios_iostate_saver; +typedef basic_ios_exception_saver ios_exception_saver; +typedef basic_ios_exception_saver wios_exception_saver; +typedef basic_ios_tie_saver ios_tie_saver; +typedef basic_ios_tie_saver wios_tie_saver; +typedef basic_ios_rdbuf_saver ios_rdbuf_saver; +typedef basic_ios_rdbuf_saver wios_rdbuf_saver; +typedef basic_ios_fill_saver ios_fill_saver; +typedef basic_ios_fill_saver wios_fill_saver; +typedef basic_ios_locale_saver ios_locale_saver; +typedef basic_ios_locale_saver wios_locale_saver; +typedef basic_ios_all_saver ios_all_saver; +typedef basic_ios_all_saver 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 diff --git a/deal.II/contrib/boost/include/boost/iterator.hpp b/deal.II/contrib/boost/include/boost/iterator.hpp new file mode 100644 index 0000000000..d3844e71c0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/iterator.hpp @@ -0,0 +1,59 @@ +// 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 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 +#include // std::ptrdiff_t +#include + +namespace boost +{ +# if defined(BOOST_NO_STD_ITERATOR) && !defined(BOOST_MSVC_STD_ITERATOR) + template + 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 +# if !defined(BOOST_MSVC_STD_ITERATOR) + struct iterator_base : std::iterator {}; +# else + struct iterator_base : std::iterator + { + typedef Reference reference; + typedef Pointer pointer; + typedef Distance difference_type; + }; +# endif + } + + template + struct iterator : detail::iterator_base {}; +# endif +} // namespace boost + +#endif // BOOST_ITERATOR_HPP diff --git a/deal.II/contrib/boost/include/boost/iterator_adaptors.hpp b/deal.II/contrib/boost/include/boost/iterator_adaptors.hpp new file mode 100644 index 0000000000..7058153be0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/iterator_adaptors.hpp @@ -0,0 +1,10 @@ +// 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 + +#endif // ITERATOR_ADAPTORS_DWA2004725_HPP diff --git a/deal.II/contrib/boost/include/boost/last_value.hpp b/deal.II/contrib/boost/include/boost/last_value.hpp new file mode 100644 index 0000000000..392e238564 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/last_value.hpp @@ -0,0 +1,48 @@ +// 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 + +namespace boost { + template + struct last_value { + typedef T result_type; + + template + T operator()(InputIterator first, InputIterator last) const + { + assert(first != last); + T value = *first++; + while (first != last) + value = *first++; + return value; + } + }; + + template<> + struct last_value { + struct unusable {}; + + public: + typedef unusable result_type; + + template + result_type + operator()(InputIterator first, InputIterator last) const + { + while (first != last) + *first++; + return result_type(); + } + }; +} +#endif // BOOST_SIGNALS_LAST_VALUE_HPP diff --git a/deal.II/contrib/boost/include/boost/lexical_cast.hpp b/deal.II/contrib/boost/include/boost/lexical_cast.hpp new file mode 100644 index 0000000000..926b95e430 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/lexical_cast.hpp @@ -0,0 +1,252 @@ +#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 +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_NO_STRINGSTREAM +#include +#else +#include +#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 + struct stream_char + { + typedef char type; + }; + + #ifndef DISABLE_WIDE_CHAR_SUPPORT +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + template<> + struct stream_char + { + typedef wchar_t type; + }; +#endif + + template<> + struct stream_char + { + typedef wchar_t type; + }; + + template<> + struct stream_char + { + typedef wchar_t type; + }; + + template<> + struct stream_char + { + typedef wchar_t type; + }; + #endif + + template + struct widest_char + { + typedef TargetChar type; + }; + + template<> + struct widest_char + { + typedef wchar_t type; + }; + } + + namespace detail // stream wrapper for handling lexical conversions + { + template + class lexical_stream + { + private: + typedef typename widest_char< + typename stream_char::type, + typename stream_char::type>::type char_type; + + public: + lexical_stream() + { + stream.unsetf(std::ios::skipws); + + if(std::numeric_limits::is_specialized) + stream.precision(std::numeric_limits::digits10 + 1); + else if(std::numeric_limits::is_specialized) + stream.precision(std::numeric_limits::digits10 + 1); + } + ~lexical_stream() + { + #if defined(BOOST_NO_STRINGSTREAM) + stream.freeze(false); + #endif + } + bool operator<<(const Source &input) + { + return !(stream << input).fail(); + } + template + bool operator>>(InputStreamable &output) + { + return !is_pointer::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::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 stream; + #endif + }; + } + + #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // call-by-const reference version + + namespace detail + { + template + struct array_to_pointer_decay + { + typedef T type; + }; + + template + struct array_to_pointer_decay + { + typedef const T * type; + }; + } + + template + Target lexical_cast(const Source &arg) + { + typedef typename detail::array_to_pointer_decay::type NewSource; + + detail::lexical_stream 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 + Target lexical_cast(Source arg) + { + detail::lexical_stream 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 diff --git a/deal.II/contrib/boost/include/boost/limits.hpp b/deal.II/contrib/boost/include/boost/limits.hpp new file mode 100644 index 0000000000..f468dbce73 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/limits.hpp @@ -0,0 +1,143 @@ + +// (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 + +// See http://www.boost.org/libs/utility/limits.html for documentation. + +#ifndef BOOST_LIMITS +#define BOOST_LIMITS + +#include + +#ifdef BOOST_NO_LIMITS +# include +#else +# include +#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 + { + 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 + { + 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 diff --git a/deal.II/contrib/boost/include/boost/math_fwd.hpp b/deal.II/contrib/boost/include/boost/math_fwd.hpp new file mode 100644 index 0000000000..9ae83ba805 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/math_fwd.hpp @@ -0,0 +1,101 @@ +// 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 ----------------------------------------// + +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 ------------------------------------------// + +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 ---------------------------// + +// Only has function template + + +// From ---------------------------// + +// Only has function template + + +// From ---------------------------// + +// Only has function template + + +// From ----------------------------// + +// Only has function templates + + +// From ---------------------------// + +// Only has function templates + + +// From -------------------------------------// + +// Only #includes other headers + + +// From ----------------------------------// + +template < unsigned long Value1, unsigned long Value2 > + struct static_gcd; +template < unsigned long Value1, unsigned long Value2 > + struct static_lcm; + + +// From ----------------------------------// + +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 diff --git a/deal.II/contrib/boost/include/boost/mem_fn.hpp b/deal.II/contrib/boost/include/boost/mem_fn.hpp new file mode 100644 index 0000000000..7097d43bec --- /dev/null +++ b/deal.II/contrib/boost/include/boost/mem_fn.hpp @@ -0,0 +1,394 @@ +#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 +#include +#include + +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 struct mf +{ + +#define BOOST_MEM_FN_RETURN return + +#define BOOST_MEM_FN_NAME(X) inner_##X +#define BOOST_MEM_FN_CC + +#include + +#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 + +#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 + +#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 + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#undef BOOST_MEM_FN_RETURN + +}; // struct mf + +template<> struct mf +{ + +#define BOOST_MEM_FN_RETURN + +#define BOOST_MEM_FN_NAME(X) inner_##X +#define BOOST_MEM_FN_CC + +#include + +#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 + +#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 + +#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 + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#undef BOOST_MEM_FN_RETURN + +}; // struct mf + +#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 + +#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 + +#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 + +#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 + +#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 + +#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 + +#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 + +#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 + +#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 + +#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 + +#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 + +#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 + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC + +#endif + +// data member support + +namespace _mfi +{ + +template class dm +{ +public: + + typedef R const & result_type; + typedef T const * argument_type; + +private: + + typedef R (T::*F); + F f_; + + template R const & call(U & u, T const *) const + { + return (u.*f_); + } + + template R & call(U & u, T *) const + { + return (u.*f_); + } + + template 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 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 _mfi::dm mem_fn(R T::*f) +{ + return _mfi::dm(f); +} + +} // namespace boost + +#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/multi_array.hpp b/deal.II/contrib/boost/include/boost/multi_array.hpp new file mode 100644 index 0000000000..1fa737a1d2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/multi_array.hpp @@ -0,0 +1,480 @@ +// 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 +#include +#include +#include +#include + + + +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 +char is_multi_array_impl_help(const_multi_array_view&); +template +char is_multi_array_impl_help(const_sub_array&); +template +char is_multi_array_impl_help(const_multi_array_ref&); + +char ( &is_multi_array_impl_help(...) )[2]; + +template +struct is_multi_array_impl +{ + static T x; + BOOST_STATIC_CONSTANT(bool, value = sizeof((is_multi_array_impl_help)(x)) == 1); + + typedef mpl::bool_ type; +}; + +template +struct disable_multi_array_impl_impl +{ + typedef int type; +}; + +template <> +struct disable_multi_array_impl_impl +{ + // forming a pointer to a reference triggers SFINAE + typedef int& type; +}; + + +template +struct disable_multi_array_impl : + disable_multi_array_impl_impl::value> +{ }; + + +template <> +struct disable_multi_array_impl +{ + typedef int type; +}; + + +#endif + + } //namespace multi_array + } // namespace detail + +template +class multi_array : + public multi_array_ref +{ + typedef multi_array_ref 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 + struct const_array_view { + typedef boost::detail::multi_array::const_multi_array_view type; + }; + + template + struct array_view { + typedef boost::detail::multi_array::multi_array_view type; + }; + + explicit multi_array() : + super_type((T*)initial_base_,c_storage_order(), + /*index_bases=*/0, /*extents=*/0) { + allocate_space(); + } + + template + explicit multi_array( + ExtentList const& extents +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + , typename mpl::if_< + detail::multi_array::is_multi_array_impl, + int&,int>::type* = 0 +#endif + ) : + super_type((T*)initial_base_,extents) { + boost::function_requires< + detail::multi_array::CollectionConcept >(); + allocate_space(); + } + + + template + explicit multi_array(ExtentList const& extents, + const general_storage_order& so) : + super_type((T*)initial_base_,extents,so) { + boost::function_requires< + detail::multi_array::CollectionConcept >(); + allocate_space(); + } + + template + explicit multi_array(ExtentList const& extents, + const general_storage_order& so, + Allocator const& alloc) : + super_type((T*)initial_base_,extents,so), allocator_(alloc) { + boost::function_requires< + detail::multi_array::CollectionConcept >(); + allocate_space(); + } + + + explicit multi_array(const detail::multi_array + ::extent_gen& ranges) : + super_type((T*)initial_base_,ranges) { + + allocate_space(); + } + + + explicit multi_array(const detail::multi_array + ::extent_gen& ranges, + const general_storage_order& so) : + super_type((T*)initial_base_,ranges,so) { + + allocate_space(); + } + + + explicit multi_array(const detail::multi_array + ::extent_gen& ranges, + const general_storage_order& 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 + multi_array(const const_multi_array_ref& rhs, + const general_storage_order& 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 + multi_array(const detail::multi_array:: + const_sub_array& rhs, + const general_storage_order& so = c_storage_order()) + : super_type(0,so,rhs.index_bases(),rhs.shape()) + { + allocate_space(); + std::copy(rhs.begin(),rhs.end(),this->begin()); + } + + + template + multi_array(const detail::multi_array:: + const_multi_array_view& rhs, + const general_storage_order& 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& 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& rhs, + const general_storage_order& 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& 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& rhs, + const general_storage_order& 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& 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& rhs, + const general_storage_order& 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& 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& rhs, + const general_storage_order& 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& 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& rhs, + const general_storage_order& 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& 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& rhs, + const general_storage_order& 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 + 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& 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 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_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 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::type view_old = (*this)[old_idxes]; + typename + multi_array::BOOST_NESTED_TEMPLATE array_view::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_list; + typedef boost::array index_list; + + Allocator allocator_; + T* base_; + size_type allocated_elements_; + enum {initial_base_ = 0}; +}; + +} // namespace boost + +#endif // BOOST_MULTI_ARRAY_RG071801_HPP diff --git a/deal.II/contrib/boost/include/boost/multi_index_container.hpp b/deal.II/contrib/boost/include/boost/multi_index_container.hpp new file mode 100644 index 0000000000..d91faba162 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/multi_index_container.hpp @@ -0,0 +1,999 @@ +/* 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 /* keep it first to prevent nasty warns in MSVC */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include +#include +#include +#include +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) +#include +#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 +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 >, + 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 friend class detail::index_base; + template friend class detail::header_holder; + template 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::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::type:: + ctor_args_list(), + const allocator_type& al= + typename mpl::identity::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 + 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::type:: + ctor_args_list(), + const allocator_type& al= + typename mpl::identity::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& 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& operator=( + const multi_index_container& x) + { + BOOST_MULTI_INDEX_CHECK_INVARIANT; + multi_index_container 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 + struct nth_index + { + BOOST_STATIC_ASSERT(N>=0&&N::type::value); + typedef typename mpl::at_c::type type; + }; + + template + typename nth_index::type& get(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int,N)) + { + BOOST_STATIC_ASSERT(N>=0&&N::type::value); + return *this; + } + + template + const typename nth_index::type& get( + BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int,N))const + { + BOOST_STATIC_ASSERT(N>=0&&N::type::value); + return *this; + } +#endif + + /* retrieval of indices by tag */ + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) + template + struct index + { + typedef typename mpl::find_if< + index_type_list, + detail::has_tag + >::type iter; + + BOOST_STATIC_CONSTANT( + bool,index_found=!(is_same::type >::value)); + BOOST_STATIC_ASSERT(index_found); + + typedef typename mpl::deref::type type; + }; + + template + typename index::type& get(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag)) + { + return *this; + } + + template + const typename index::type& get( + BOOST_EXPLICIT_TEMPLATE_TYPE(Tag))const + { + return *this; + } +#endif + + /* projection of iterators by number */ + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) + template + struct nth_index_iterator + { + typedef typename nth_index::type::iterator type; + }; + + template + struct nth_index_const_iterator + { + typedef typename nth_index::type::const_iterator type; + }; + + template + typename nth_index_iterator::type project( + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N)) + { + typedef typename nth_index::type index; + + BOOST_STATIC_ASSERT( + (mpl::contains::value)); + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + BOOST_MULTI_INDEX_CHECK_IS_OWNER( + it,static_cast(*this)); + + return index::make_iterator(static_cast(it.get_node())); + } + + template + typename nth_index_const_iterator::type project( + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N))const + { + typedef typename nth_index::type index; + + BOOST_STATIC_ASSERT(( + mpl::contains::value|| + mpl::contains::value)); + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + BOOST_MULTI_INDEX_CHECK_IS_OWNER( + it,static_cast(*this)); + return index::make_iterator(static_cast(it.get_node())); + } +#endif + + /* projection of iterators by tag */ + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) + template + struct index_iterator + { + typedef typename index::type::iterator type; + }; + + template + struct index_const_iterator + { + typedef typename index::type::const_iterator type; + }; + + template + typename index_iterator::type project( + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag)) + { + typedef typename index::type index; + + BOOST_STATIC_ASSERT( + (mpl::contains::value)); + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + BOOST_MULTI_INDEX_CHECK_IS_OWNER( + it,static_cast(*this)); + return index::make_iterator(static_cast(it.get_node())); + } + + template + typename index_const_iterator::type project( + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))const + { + typedef typename index::type index; + + BOOST_STATIC_ASSERT(( + mpl::contains::value|| + mpl::contains::value)); + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + BOOST_MULTI_INDEX_CHECK_IS_OWNER( + it,static_cast(*this)); + return index::make_iterator(static_cast(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(-1); + } + + std::pair 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(res,true); + } + else{ + deallocate_node(x); + return std::pair(res,false); + } + } + BOOST_CATCH(...){ + deallocate_node(x); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + std::pair 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(res,true); + } + else{ + deallocate_node(x); + return std::pair(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& 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 + bool modify_(Modifier mod,node_type* x) + { + mod(const_cast(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 + void save(Archive& ar,const unsigned int version)const + { + const std::size_t s=size_(); + ar< + 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 value("item",ar,version); + std::pair 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 +struct nth_index +{ + BOOST_STATIC_CONSTANT( + int, + M=mpl::size::type::value); + BOOST_STATIC_ASSERT(N>=0&&N::type type; +}; + +template +typename nth_index< + multi_index_container,N>::type& +get( + multi_index_container& 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::index(m); +} + +template +const typename nth_index< + multi_index_container,N>::type& +get( + const multi_index_container& 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::index(m); +} + +/* retrieval of indices by tag */ + +template +struct index +{ + typedef typename MultiIndexContainer::index_type_list index_type_list; + + typedef typename mpl::find_if< + index_type_list, + detail::has_tag + >::type iter; + + BOOST_STATIC_CONSTANT( + bool,index_found=!(is_same::type >::value)); + BOOST_STATIC_ASSERT(index_found); + + typedef typename mpl::deref::type type; +}; + +template< + typename Tag,typename Value,typename IndexSpecifierList,typename Allocator +> +typename ::boost::multi_index::index< + multi_index_container,Tag>::type& +get( + multi_index_container& 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::index(m); +} + +template< + typename Tag,typename Value,typename IndexSpecifierList,typename Allocator +> +const typename ::boost::multi_index::index< + multi_index_container,Tag>::type& +get( + const multi_index_container& 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::index(m); +} + +/* projection of iterators by number */ + +template +struct nth_index_iterator +{ + typedef typename detail::prevent_eti< + nth_index, + typename nth_index::type>::type::iterator type; +}; + +template +struct nth_index_const_iterator +{ + typedef typename detail::prevent_eti< + nth_index, + typename nth_index::type + >::type::const_iterator type; +}; + +template< + int N,typename IteratorType, + typename Value,typename IndexSpecifierList,typename Allocator> +typename nth_index_iterator< + multi_index_container,N>::type +project( + multi_index_container& 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::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::iterator( + m,static_cast(it.get_node())); +} + +template< + int N,typename IteratorType, + typename Value,typename IndexSpecifierList,typename Allocator> +typename nth_index_const_iterator< + multi_index_container,N>::type +project( + const multi_index_container& 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::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::const_iterator( + m,static_cast(it.get_node())); +} + +/* projection of iterators by tag */ + +template +struct index_iterator +{ + typedef typename ::boost::multi_index::index< + MultiIndexContainer,Tag>::type::iterator type; +}; + +template +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,Tag>::type +project( + multi_index_container& 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::iterator( + m,static_cast(it.get_node())); +} + +template< + typename Tag,typename IteratorType, + typename Value,typename IndexSpecifierList,typename Allocator> +typename index_const_iterator< + multi_index_container,Tag>::type +project( + const multi_index_container& 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::const_iterator( + m,static_cast(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& x, + const multi_index_container& 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& x, + const multi_index_container& y) +{ + return get<0>(x)(y); +} + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator!=( + const multi_index_container& x, + const multi_index_container& 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& x, + const multi_index_container& 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& x, + const multi_index_container& 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& x, + const multi_index_container& y) +{ + return get<0>(x)<=get<0>(y); +} + +/* specialized algorithms */ + +template +void swap( + multi_index_container& x, + multi_index_container& 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 diff --git a/deal.II/contrib/boost/include/boost/multi_index_container_fwd.hpp b/deal.II/contrib/boost/include/boost/multi_index_container_fwd.hpp new file mode 100644 index 0000000000..6e377edcd9 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/multi_index_container_fwd.hpp @@ -0,0 +1,121 @@ +/* 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 /* keep it first to prevent nasty warns in MSVC */ +#include +#include +#include +#include + +namespace boost{ + +namespace multi_index{ + +/* Default value for IndexSpecifierList specifies a container + * equivalent to std::set. + */ + +template< + typename Value, + typename IndexSpecifierList=indexed_by > >, + typename Allocator=std::allocator > +class multi_index_container; + +template +struct nth_index; + +template +struct index; + +template +struct nth_index_iterator; + +template +struct nth_index_const_iterator; + +template +struct index_iterator; + +template +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& x, + const multi_index_container& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator<( + const multi_index_container& x, + const multi_index_container& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator!=( + const multi_index_container& x, + const multi_index_container& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator>( + const multi_index_container& x, + const multi_index_container& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator>=( + const multi_index_container& x, + const multi_index_container& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator<=( + const multi_index_container& x, + const multi_index_container& y); + +template +void swap( + multi_index_container& x, + multi_index_container& 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 diff --git a/deal.II/contrib/boost/include/boost/next_prior.hpp b/deal.II/contrib/boost/include/boost/next_prior.hpp new file mode 100644 index 0000000000..e1d2e42891 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/next_prior.hpp @@ -0,0 +1,51 @@ +// 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 + +namespace boost { + +// Helper functions for classes like bidirectional iterators not supporting +// operator+ and operator- +// +// Usage: +// const std::list::iterator p = get_some_iterator(); +// const std::list::iterator prev = boost::prior(p); +// const std::list::iterator next = boost::next(prev, 2); + +// Contributed by Dave Abrahams + +template +inline T next(T x) { return ++x; } + +template +inline T next(T x, Distance n) +{ + std::advance(x, n); + return x; +} + +template +inline T prior(T x) { return --x; } + +template +inline T prior(T x, Distance n) +{ + std::advance(x, -n); + return x; +} + +} // namespace boost + +#endif // BOOST_NEXT_PRIOR_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/non_type.hpp b/deal.II/contrib/boost/include/boost/non_type.hpp new file mode 100644 index 0000000000..896aed4d34 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/non_type.hpp @@ -0,0 +1,27 @@ +// ------------------------------------- +// +// (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 + struct non_type { }; + + +} + + +#endif // include guard diff --git a/deal.II/contrib/boost/include/boost/noncopyable.hpp b/deal.II/contrib/boost/include/boost/noncopyable.hpp new file mode 100644 index 0000000000..7770bdbd37 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/noncopyable.hpp @@ -0,0 +1,36 @@ +// 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 diff --git a/deal.II/contrib/boost/include/boost/nondet_random.hpp b/deal.II/contrib/boost/include/boost/nondet_random.hpp new file mode 100644 index 0000000000..d30402e5be --- /dev/null +++ b/deal.II/contrib/boost/include/boost/nondet_random.hpp @@ -0,0 +1,64 @@ +/* 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 // std::abs +#include // std::min +#include +#include +#include // noncopyable +#include // 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::const_min); + BOOST_STATIC_CONSTANT(result_type, max_value = integer_traits::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 */ diff --git a/deal.II/contrib/boost/include/boost/none.hpp b/deal.II/contrib/boost/include/boost/none.hpp new file mode 100644 index 0000000000..693dbdf3d8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/none.hpp @@ -0,0 +1,31 @@ +// 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 + diff --git a/deal.II/contrib/boost/include/boost/none_t.hpp b/deal.II/contrib/boost/include/boost/none_t.hpp new file mode 100644 index 0000000000..4b97e20992 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/none_t.hpp @@ -0,0 +1,24 @@ +// 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 + diff --git a/deal.II/contrib/boost/include/boost/operators.hpp b/deal.II/contrib/boost/include/boost/operators.hpp new file mode 100644 index 0000000000..fbba602384 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/operators.hpp @@ -0,0 +1,941 @@ +// 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 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 +#include +#include + +#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 +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 +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 +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 +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 \ +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 \ +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 \ +struct NAME##2 : B \ +{ \ + friend T operator OP( const T& lhs, const U& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +}; \ + \ +template \ +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 \ +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 \ +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 \ +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 \ +struct NAME##2 : B \ +{ \ + friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ +}; \ + \ +template \ +struct BOOST_OPERATOR2_LEFT(NAME) : B \ +{ \ + friend T operator OP( const U& lhs, const T& rhs ) \ + { return T( lhs ) OP##= rhs; } \ +}; \ + \ +template \ +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 +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 +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 +struct dereferenceable : B +{ + P operator->() const + { + return &*static_cast(*this); + } +}; + +template +struct indexable : B +{ + R operator[](I n) const + { + return *(static_cast(*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 \ +struct NAME##2 : B \ +{ \ + friend T operator OP( const T& lhs, const U& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +}; \ + \ +template \ +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 \ +struct NAME##2 : B \ +{ \ + friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ +}; \ + \ +template \ +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 +struct equivalent2 : B +{ + friend bool operator==(const T& x, const U& y) + { + return !(x < y) && !(x > y); + } +}; + +template +struct equivalent1 : B +{ + friend bool operator==(const T&x, const T&y) + { + return !(x < y) && !(y < x); + } +}; + +template +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 +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 +struct totally_ordered2 + : less_than_comparable2 > {}; + +template +struct totally_ordered1 + : less_than_comparable1 > {}; + +template +struct additive2 + : addable2 > {}; + +template +struct additive1 + : addable1 > {}; + +template +struct multiplicative2 + : multipliable2 > {}; + +template +struct multiplicative1 + : multipliable1 > {}; + +template +struct integer_multiplicative2 + : multiplicative2 > {}; + +template +struct integer_multiplicative1 + : multiplicative1 > {}; + +template +struct arithmetic2 + : additive2 > {}; + +template +struct arithmetic1 + : additive1 > {}; + +template +struct integer_arithmetic2 + : additive2 > {}; + +template +struct integer_arithmetic1 + : additive1 > {}; + +template +struct bitwise2 + : xorable2 > > {}; + +template +struct bitwise1 + : xorable1 > > {}; + +template +struct unit_steppable + : incrementable > {}; + +template +struct shiftable2 + : left_shiftable2 > {}; + +template +struct shiftable1 + : left_shiftable1 > {}; + +template +struct ring_operators2 + : additive2 > > {}; + +template +struct ring_operators1 + : additive1 > {}; + +template +struct ordered_ring_operators2 + : ring_operators2 > {}; + +template +struct ordered_ring_operators1 + : ring_operators1 > {}; + +template +struct field_operators2 + : ring_operators2 > > {}; + +template +struct field_operators1 + : ring_operators1 > {}; + +template +struct ordered_field_operators2 + : field_operators2 > {}; + +template +struct ordered_field_operators1 + : field_operators1 > {}; + +template +struct euclidian_ring_operators2 + : ring_operators2 > > > > {}; + +template +struct euclidian_ring_operators1 + : ring_operators1 > > {}; + +template +struct ordered_euclidian_ring_operators2 + : totally_ordered2 > {}; + +template +struct ordered_euclidian_ring_operators1 + : totally_ordered1 > {}; + +template +struct input_iteratable + : equality_comparable1 > > {}; + +template +struct output_iteratable + : incrementable {}; + +template +struct forward_iteratable + : input_iteratable {}; + +template +struct bidirectional_iteratable + : forward_iteratable > {}; + +// 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 +struct random_access_iteratable + : bidirectional_iteratable > > > {}; + +#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 \ + struct template_name : ::template_name {}; + +# define BOOST_IMPORT_TEMPLATE3(template_name) \ + template \ + struct template_name : ::template_name {}; + +# define BOOST_IMPORT_TEMPLATE2(template_name) \ + template \ + struct template_name : ::template_name {}; + +# define BOOST_IMPORT_TEMPLATE1(template_name) \ + template \ + struct template_name : ::template_name {}; + +# 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 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 \ + struct is_chained_base< ::boost::template_name4 > { \ + 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 \ + struct is_chained_base< ::boost::template_name3 > { \ + 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 \ + struct is_chained_base< ::boost::template_name2 > { \ + 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 \ + struct is_chained_base< ::boost::template_name1 > { \ + 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 '1' +// and '2' which must implement the corresponding 1- and 2- +// argument forms. +// +// The template type parameter O == is_chained_base::value is used to +// distinguish whether the 2nd argument to 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 '1' or '2'. +// + +# define BOOST_OPERATOR_TEMPLATE(template_name) \ +template ::value \ + > \ +struct template_name : template_name##2 {}; \ + \ +template \ +struct template_name \ + : template_name##1 {}; \ + \ +template \ +struct template_name \ + : template_name##1 {}; \ + \ +template \ +struct is_chained_base< ::boost::template_name > { \ + 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 \ + struct template_name : template_name##1 {}; + +#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 +struct operators2 + : totally_ordered2 > > {}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct operators : operators2 {}; + +template struct operators +#else +template struct operators +#endif + : totally_ordered > > > {}; + +// 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 +struct input_iterator_helper + : input_iteratable > {}; + +template +struct output_iterator_helper + : output_iteratable > +{ + T& operator*() { return static_cast(*this); } + T& operator++() { return static_cast(*this); } +}; + +template +struct forward_iterator_helper + : forward_iteratable > {}; + +template +struct bidirectional_iterator_helper + : bidirectional_iteratable > {}; + +template +struct random_access_iterator_helper + : random_access_iteratable > +{ + 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 diff --git a/deal.II/contrib/boost/include/boost/optional.hpp b/deal.II/contrib/boost/include/boost/optional.hpp new file mode 100644 index 0000000000..bc5c5d30a0 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/optional.hpp @@ -0,0 +1,18 @@ +// 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 + diff --git a/deal.II/contrib/boost/include/boost/parameter.hpp b/deal.II/contrib/boost/include/boost/parameter.hpp new file mode 100644 index 0000000000..100ebf32c8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/parameter.hpp @@ -0,0 +1,16 @@ +// 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 +#include +#include +#include +#include + +#endif // BOOST_PARAMETER_050401_HPP + diff --git a/deal.II/contrib/boost/include/boost/pfto.hpp b/deal.II/contrib/boost/include/boost/pfto.hpp new file mode 100644 index 0000000000..00ef1715b7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/pfto.hpp @@ -0,0 +1,74 @@ +#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 + +// 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 +struct pfto_wrapper { + const T & t; + operator const T & (){ + return t; + } + pfto_wrapper (const T & rhs) : t(rhs) {} +}; + +template +pfto_wrapper make_pfto_wrapper(const T & t, BOOST_PFTO int){ + return pfto_wrapper(t); +} + +template +pfto_wrapper make_pfto_wrapper(const pfto_wrapper & t, int){ + return t; +} + +} // namespace boost + +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + #define BOOST_PFTO_WRAPPER(T) boost::pfto_wrapper + #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 diff --git a/deal.II/contrib/boost/include/boost/pointee.hpp b/deal.II/contrib/boost/include/boost/pointee.hpp new file mode 100644 index 0000000000..9794b8e7db --- /dev/null +++ b/deal.II/contrib/boost/include/boost/pointee.hpp @@ -0,0 +1,74 @@ +#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

::type provides the pointee type of P. +// +// For example, it is T for T* and X for shared_ptr. +// +// http://www.boost.org/libs/iterator/doc/pointee.html +// + +# include +# include +# include +# include +# include +# include + +namespace boost { + +namespace detail +{ + template + struct smart_ptr_pointee + { + typedef typename P::element_type type; + }; + + template + struct iterator_pointee + { + typedef typename iterator_traits::value_type value_type; + + struct impl + { + template + 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::is_constant +# else + is_constant +# endif + , typename add_const::type + , value_type + >::type type; + }; +} + +template +struct pointee + : mpl::eval_if< + detail::is_incrementable

+ , detail::iterator_pointee

+ , detail::smart_ptr_pointee

+ > +{ +}; + +} // namespace boost + +#endif // POINTEE_DWA200415_HPP diff --git a/deal.II/contrib/boost/include/boost/preprocessor.hpp b/deal.II/contrib/boost/include/boost/preprocessor.hpp new file mode 100644 index 0000000000..6f5c822f85 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/preprocessor.hpp @@ -0,0 +1,19 @@ +# /* 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 +# +# endif diff --git a/deal.II/contrib/boost/include/boost/program_options.hpp b/deal.II/contrib/boost/include/boost/program_options.hpp new file mode 100644 index 0000000000..57cc820c27 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/program_options.hpp @@ -0,0 +1,23 @@ +// 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost/progress.hpp b/deal.II/contrib/boost/include/boost/progress.hpp new file mode 100644 index 0000000000..bac280b0e1 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/progress.hpp @@ -0,0 +1,143 @@ +// 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 +#include // for noncopyable +#include // for uintmax_t +#include // for ostream, cout, etc +#include // 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( + (static_cast(_count)/_expected_count)*50.0 ); + do { m_os << '*' << std::flush; } while ( ++_tic < tics_needed ); + _next_tic_count = + static_cast((_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 diff --git a/deal.II/contrib/boost/include/boost/property_map.hpp b/deal.II/contrib/boost/include/boost/property_map.hpp new file mode 100644 index 0000000000..9077ea37cd --- /dev/null +++ b/deal.II/contrib/boost/include/boost/property_map.hpp @@ -0,0 +1,546 @@ +// (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 +#include +#include +#include +#include +#include + +namespace boost { + + //========================================================================= + // property_traits class + + template + 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 { \ + typedef TYPE value_type; \ + typedef value_type& reference; \ + typedef std::ptrdiff_t key_type; \ + typedef lvalue_property_map_tag category; \ + }; \ + template <> \ + struct property_traits { \ + 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 { + 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 { + 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 + struct property_traits { + typedef T value_type; + typedef value_type& reference; + typedef std::ptrdiff_t key_type; + typedef lvalue_property_map_tag category; + }; + template + struct property_traits { + 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 + inline void put(T* pa, std::ptrdiff_t k, const V& val) { pa[k] = val; } + + template + 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 + struct ReadablePropertyMapConcept + { + typedef typename property_traits::key_type key_type; + typedef typename property_traits::reference reference; + typedef typename property_traits::category Category; + typedef boost::readable_property_map_tag ReadableTag; + void constraints() { + function_requires< ConvertibleConcept >(); + + val = get(pmap, k); + } + PMap pmap; + Key k; + typename property_traits::value_type val; + }; + template + struct readable_property_map_archetype { + typedef KeyArchetype key_type; + typedef ValueArchetype value_type; + typedef convertible_to_archetype reference; + typedef readable_property_map_tag category; + }; + template + const typename readable_property_map_archetype::reference& + get(const readable_property_map_archetype&, + const typename readable_property_map_archetype::key_type&) + { + typedef typename readable_property_map_archetype::reference R; + return static_object::get(); + } + + + template + struct WritablePropertyMapConcept + { + typedef typename property_traits::key_type key_type; + typedef typename property_traits::category Category; + typedef boost::writable_property_map_tag WritableTag; + void constraints() { + function_requires< ConvertibleConcept >(); + put(pmap, k, val); + } + PMap pmap; + Key k; + typename property_traits::value_type val; + }; + template + struct writable_property_map_archetype { + typedef KeyArchetype key_type; + typedef ValueArchetype value_type; + typedef void reference; + typedef writable_property_map_tag category; + }; + template + void put(const writable_property_map_archetype&, + const typename writable_property_map_archetype::key_type&, + const typename writable_property_map_archetype::value_type&) { } + + + template + struct ReadWritePropertyMapConcept + { + typedef typename property_traits::category Category; + typedef boost::read_write_property_map_tag ReadWriteTag; + void constraints() { + function_requires< ReadablePropertyMapConcept >(); + function_requires< WritablePropertyMapConcept >(); + function_requires< ConvertibleConcept >(); + } + }; + template + struct read_write_property_map_archetype + : public readable_property_map_archetype, + public writable_property_map_archetype + { + typedef KeyArchetype key_type; + typedef ValueArchetype value_type; + typedef convertible_to_archetype reference; + typedef read_write_property_map_tag category; + }; + + + template + struct LvaluePropertyMapConcept + { + typedef typename property_traits::category Category; + typedef boost::lvalue_property_map_tag LvalueTag; + typedef typename property_traits::reference reference; + + void constraints() { + function_requires< ReadablePropertyMapConcept >(); + function_requires< ConvertibleConcept >(); + + typedef typename property_traits::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 + struct lvalue_property_map_archetype + : public readable_property_map_archetype + { + 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::get(); + } + }; + + template + struct Mutable_LvaluePropertyMapConcept + { + typedef typename property_traits::category Category; + typedef boost::lvalue_property_map_tag LvalueTag; + typedef typename property_traits::reference reference; + void constraints() { + boost::function_requires< ReadWritePropertyMapConcept >(); + boost::function_requires >(); + + typedef typename property_traits::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 + struct mutable_lvalue_property_map_archetype + : public readable_property_map_archetype, + public writable_property_map_archetype + { + 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::get(); + } + }; + + struct identity_property_map; + + // A helper class for constructing a property map + // from a class that implements operator[] + + template + struct put_get_helper { }; + + template + inline Reference + get(const put_get_helper& pa, const K& k) + { + Reference v = static_cast(pa)[k]; + return v; + } + template + inline void + put(const put_get_helper& pa, K k, const V& v) + { + static_cast(pa)[k] = v; + } + + //========================================================================= + // Adapter to turn a RandomAccessIterator into a property map + + template ::value_type + , class R = typename std::iterator_traits::reference +#endif + > + class iterator_property_map + : public boost::put_get_helper< R, + iterator_property_map > + { + public: + typedef typename property_traits::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 + inline iterator_property_map< + RAIter, ID, + typename std::iterator_traits::value_type, + typename std::iterator_traits::reference> + make_iterator_property_map(RAIter iter, ID id) { + function_requires< RandomAccessIteratorConcept >(); + typedef iterator_property_map< + RAIter, ID, + typename std::iterator_traits::value_type, + typename std::iterator_traits::reference> PA; + return PA(iter, id); + } +#endif + template + inline iterator_property_map + make_iterator_property_map(RAIter iter, ID id, Value) { + function_requires< RandomAccessIteratorConcept >(); + typedef iterator_property_map PMap; + return PMap(iter, id); + } + + template ::value_type + , class R = typename std::iterator_traits::reference +#endif + > + class safe_iterator_property_map + : public boost::put_get_helper< R, + safe_iterator_property_map > + { + public: + typedef typename property_traits::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::value_type size() const { return n; } + protected: + RandomAccessIterator iter; + typename property_traits::value_type n; + IndexMap index; + }; + +#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template + inline safe_iterator_property_map< + RAIter, ID, + typename boost::detail::iterator_traits::value_type, + typename boost::detail::iterator_traits::reference> + make_safe_iterator_property_map(RAIter iter, std::size_t n, ID id) { + function_requires< RandomAccessIteratorConcept >(); + typedef safe_iterator_property_map< + RAIter, ID, + typename boost::detail::iterator_traits::value_type, + typename boost::detail::iterator_traits::reference> PA; + return PA(iter, n, id); + } +#endif + template + inline safe_iterator_property_map + make_safe_iterator_property_map(RAIter iter, std::size_t n, ID id, Value) { + function_requires< RandomAccessIteratorConcept >(); + typedef safe_iterator_property_map 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 + class associative_property_map + : public boost::put_get_helper< + typename UniquePairAssociativeContainer::value_type::second_type&, + associative_property_map > + { + 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 + associative_property_map + make_assoc_property_map(UniquePairAssociativeContainer& c) + { + return associative_property_map(c); + } + + template + class const_associative_property_map + : public boost::put_get_helper< + const typename UniquePairAssociativeContainer::value_type::second_type&, + const_associative_property_map > + { + 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 + const_associative_property_map + make_assoc_property_map(const UniquePairAssociativeContainer& c) + { + return const_associative_property_map(c); + } + + //========================================================================= + // A property map that applies the identity function to integers + struct identity_property_map + : public boost::put_get_helper + { + 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 + dummy_pmap_reference& operator=(const T&) { return *this; } + operator int() { return 0; } + }; + } + class dummy_property_map + : public boost::put_get_helper + { + 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 + inline reference operator[](Vertex) const { return reference(); } + protected: + value_type c; + }; + + +} // namespace boost + + +#endif /* BOOST_PROPERTY_MAP_HPP */ + diff --git a/deal.II/contrib/boost/include/boost/property_map_iterator.hpp b/deal.II/contrib/boost/include/boost/property_map_iterator.hpp new file mode 100644 index 0000000000..56d5954584 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/property_map_iterator.hpp @@ -0,0 +1,113 @@ +// (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 +#include +#include +#include + +namespace boost { + + //====================================================================== + // property iterator, generalized from ideas by François Faure + + namespace detail { + + template + class lvalue_pmap_iter + : public iterator_adaptor< lvalue_pmap_iter< Iterator, LvaluePropertyMap >, + Iterator, + typename property_traits::value_type, + use_default, + typename property_traits::reference> + { + friend class boost::iterator_core_access; + + typedef iterator_adaptor< lvalue_pmap_iter< Iterator, LvaluePropertyMap >, + Iterator, + typename property_traits::value_type, + use_default, + typename property_traits::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 readable_pmap_iter : + public iterator_adaptor< readable_pmap_iter< Iterator, ReadablePropertyMap >, + Iterator, + typename property_traits::value_type, + use_default, + typename property_traits::value_type> + + + { + friend class iterator_core_access; + + typedef iterator_adaptor< readable_pmap_iter< Iterator, ReadablePropertyMap >, + Iterator, + typename property_traits::value_type, + use_default, + typename property_traits::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 + struct property_map_iterator_generator : + mpl::if_< is_same< typename property_traits::category, lvalue_property_map_tag>, + detail::lvalue_pmap_iter, + detail::readable_pmap_iter > + {}; + + template + typename property_map_iterator_generator::type + make_property_map_iterator(PropertyMap pmap, Iterator iter) + { + typedef typename property_map_iterator_generator::type Iter; + return Iter(iter, pmap); + } + +} // namespace boost + +#endif // BOOST_PROPERTY_MAP_ITERATOR_HPP + diff --git a/deal.II/contrib/boost/include/boost/python.hpp b/deal.II/contrib/boost/include/boost/python.hpp new file mode 100644 index 0000000000..5205d40de2 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/python.hpp @@ -0,0 +1,70 @@ +// 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 +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +#endif // PYTHON_DWA2002810_HPP diff --git a/deal.II/contrib/boost/include/boost/random.hpp b/deal.II/contrib/boost/include/boost/random.hpp new file mode 100644 index 0000000000..782b532b12 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/random.hpp @@ -0,0 +1,72 @@ +/* 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 +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + typedef random::xor_combine, 0, + random::linear_feedback_shift, 0, 0>, 0, + random::linear_feedback_shift, 0, 0> taus88; +} // namespace boost + +// misc +#include + +// distributions +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_RANDOM_HPP diff --git a/deal.II/contrib/boost/include/boost/range.hpp b/deal.II/contrib/boost/include/boost/range.hpp new file mode 100644 index 0000000000..948c3d75e4 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/range.hpp @@ -0,0 +1,33 @@ +// 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 +#include +#include + +#else + +#include +#include +#include +#include + +#endif // _MSC_VER == 1300 // experiment + +#endif diff --git a/deal.II/contrib/boost/include/boost/rational.hpp b/deal.II/contrib/boost/include/boost/rational.hpp new file mode 100644 index 0000000000..1d969abeda --- /dev/null +++ b/deal.II/contrib/boost/include/boost/rational.hpp @@ -0,0 +1,523 @@ +// 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 (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 // for std::istream and std::ostream +#include // for std::noskipws +#include // for std::domain_error +#include // for std::string implicit constructor +#include // for boost::addable etc +#include // for std::abs +#include // for boost::call_traits +#include // 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 +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 +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 +class rational; + +template +rational abs(const rational& r); + +template +class rational : + less_than_comparable < rational, + equality_comparable < rational, + less_than_comparable2 < rational, IntType, + equality_comparable2 < rational, IntType, + addable < rational, + subtractable < rational, + multipliable < rational, + dividable < rational, + addable2 < rational, IntType, + subtractable2 < rational, IntType, + subtractable2_left < rational, IntType, + multipliable2 < rational, IntType, + dividable2 < rational, IntType, + dividable2_left < rational, IntType, + incrementable < rational, + decrementable < rational + > > > > > > > > > > > > > > > > +{ + typedef typename boost::call_traits::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 +inline rational& rational::assign(param_type n, param_type d) +{ + num = n; + den = d; + normalize(); + return *this; +} + +// Unary plus and minus +template +inline rational operator+ (const rational& r) +{ + return r; +} + +template +inline rational operator- (const rational& r) +{ + return rational(-r.numerator(), r.denominator()); +} + +// Arithmetic assignment operators +template +rational& rational::operator+= (const rational& 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 +rational& rational::operator-= (const rational& 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 +rational& rational::operator*= (const rational& r) +{ + // Protect against self-modification + IntType r_num = r.num; + IntType r_den = r.den; + + // Avoid overflow and preserve normalization + IntType gcd1 = gcd(num, r_den); + IntType gcd2 = gcd(r_num, den); + num = (num/gcd1) * (r_num/gcd2); + den = (den/gcd2) * (r_den/gcd1); + return *this; +} + +template +rational& rational::operator/= (const rational& 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(num, r_num); + IntType gcd2 = gcd(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 +inline rational& +rational::operator+= (param_type i) +{ + return operator+= (rational(i)); +} + +template +inline rational& +rational::operator-= (param_type i) +{ + return operator-= (rational(i)); +} + +template +inline rational& +rational::operator*= (param_type i) +{ + return operator*= (rational(i)); +} + +template +inline rational& +rational::operator/= (param_type i) +{ + return operator/= (rational(i)); +} + +// Increment and decrement +template +inline const rational& rational::operator++() +{ + // This can never denormalise the fraction + num += den; + return *this; +} + +template +inline const rational& rational::operator--() +{ + // This can never denormalise the fraction + num -= den; + return *this; +} + +// Comparison operators +template +bool rational::operator< (const rational& 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(num, r.num); + IntType gcd2 = gcd(r.den, den); + return (num/gcd1) * (r.den/gcd2) < (den/gcd2) * (r.num/gcd1); +} + +template +bool rational::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 +bool rational::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 +inline bool rational::operator== (const rational& r) const +{ + return ((num == r.num) && (den == r.den)); +} + +template +inline bool rational::operator== (param_type i) const +{ + return ((den == IntType(1)) && (num == i)); +} + +// Normalisation +template +void rational::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(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 +std::istream& operator>> (std::istream& is, rational& 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 +std::ostream& operator<< (std::ostream& os, const rational& r) +{ + os << r.numerator() << '/' << r.denominator(); + return os; +} + +// Type conversion +template +inline T rational_cast(const rational& src) +{ + return static_cast(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 +inline rational abs(const rational& r) +{ + if (r.numerator() >= IntType(0)) + return r; + + return rational(-r.numerator(), r.denominator()); +} + +} // namespace boost + +#endif // BOOST_RATIONAL_HPP + diff --git a/deal.II/contrib/boost/include/boost/regex.hpp b/deal.II/contrib/boost/include/boost/regex.hpp new file mode 100644 index 0000000000..6dc3dfbd42 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/regex.hpp @@ -0,0 +1,37 @@ +/* + * + * 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 + * 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 +#endif + +#include + +#endif // include + + + + diff --git a/deal.II/contrib/boost/include/boost/regex_fwd.hpp b/deal.II/contrib/boost/include/boost/regex_fwd.hpp new file mode 100644 index 0000000000..2ee4a2495f --- /dev/null +++ b/deal.II/contrib/boost/include/boost/regex_fwd.hpp @@ -0,0 +1,33 @@ +/* + * + * 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 + * 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 +#endif + +#include + +#endif + + + + diff --git a/deal.II/contrib/boost/include/boost/scoped_array.hpp b/deal.II/contrib/boost/include/boost/scoped_array.hpp new file mode 100644 index 0000000000..667dfffcb6 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/scoped_array.hpp @@ -0,0 +1,135 @@ +#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 +#include +#include // in case ptrdiff_t not in std + +#include + +#include // 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 scoped_array // noncopyable +{ +private: + + T * ptr; + + scoped_array(scoped_array const &); + scoped_array & operator=(scoped_array const &); + + typedef scoped_array 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 inline void swap(scoped_array & a, scoped_array & b) // never throws +{ + a.swap(b); +} + +} // namespace boost + +#endif // #ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/scoped_ptr.hpp b/deal.II/contrib/boost/include/boost/scoped_ptr.hpp new file mode 100644 index 0000000000..651deed690 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/scoped_ptr.hpp @@ -0,0 +1,157 @@ +#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 +#include +#include + +#ifndef BOOST_NO_AUTO_PTR +# include // 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 scoped_ptr // noncopyable +{ +private: + + T * ptr; + + scoped_ptr(scoped_ptr const &); + scoped_ptr & operator=(scoped_ptr const &); + + typedef scoped_ptr 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 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 inline void swap(scoped_ptr & a, scoped_ptr & b) // never throws +{ + a.swap(b); +} + +// get_pointer(p) is a generic way to say p.get() + +template inline T * get_pointer(scoped_ptr const & p) +{ + return p.get(); +} + +} // namespace boost + +#endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/shared_array.hpp b/deal.II/contrib/boost/include/boost/shared_array.hpp new file mode 100644 index 0000000000..9216e89c42 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/shared_array.hpp @@ -0,0 +1,175 @@ +#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 // for broken compiler workarounds + +#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) +#include +#else + +#include +#include + +#include +#include + +#include // for std::ptrdiff_t +#include // for std::swap +#include // 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 shared_array +{ +private: + + // Borland 5.5.1 specific workarounds + typedef checked_array_deleter deleter; + typedef shared_array 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 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 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 & 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 inline bool operator==(shared_array const & a, shared_array const & b) // never throws +{ + return a.get() == b.get(); +} + +template inline bool operator!=(shared_array const & a, shared_array const & b) // never throws +{ + return a.get() != b.get(); +} + +template inline bool operator<(shared_array const & a, shared_array const & b) // never throws +{ + return std::less()(a.get(), b.get()); +} + +template void swap(shared_array & a, shared_array & 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 diff --git a/deal.II/contrib/boost/include/boost/shared_container_iterator.hpp b/deal.II/contrib/boost/include/boost/shared_container_iterator.hpp new file mode 100644 index 0000000000..7d8ecd3e51 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/shared_container_iterator.hpp @@ -0,0 +1,62 @@ +// (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 + +namespace boost { + +template +class shared_container_iterator : public iterator_adaptor< + shared_container_iterator, + typename Container::iterator> { + + typedef iterator_adaptor< + shared_container_iterator, + typename Container::iterator> super_t; + + typedef typename Container::iterator iterator_t; + typedef boost::shared_ptr 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 +shared_container_iterator +make_shared_container_iterator(typename Container::iterator iter, + boost::shared_ptr const& container) { + typedef shared_container_iterator iterator; + return iterator(iter,container); +} + + + +template +std::pair< + shared_container_iterator, + shared_container_iterator > +make_shared_container_range(boost::shared_ptr 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 diff --git a/deal.II/contrib/boost/include/boost/signal.hpp b/deal.II/contrib/boost/include/boost/signal.hpp new file mode 100644 index 0000000000..2268397117 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/signal.hpp @@ -0,0 +1,356 @@ +// 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 + class real_get_signal_impl; + + template + class real_get_signal_impl<0, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal0 type; + }; + + template + class real_get_signal_impl<1, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal1 type; + }; + + template + class real_get_signal_impl<2, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal2 type; + }; + + template + class real_get_signal_impl<3, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal3 type; + }; + + template + class real_get_signal_impl<4, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal4 type; + }; + + template + class real_get_signal_impl<5, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal5 type; + }; + + template + class real_get_signal_impl<6, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal6 type; + }; + + template + class real_get_signal_impl<7, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal7 type; + }; + + template + class real_get_signal_impl<8, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal8 type; + }; + + template + class real_get_signal_impl<9, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal9 type; + }; + + template + class real_get_signal_impl<10, Signature, Combiner, Group, GroupCompare, + SlotFunction> + { + typedef function_traits traits; + + public: + typedef signal10 type; + }; + + template + struct get_signal_impl : + public real_get_signal_impl<(function_traits::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::result_type>, + typename Group = int, + typename GroupCompare = std::less, + typename SlotFunction = function + > + class signal : + public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl::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 diff --git a/deal.II/contrib/boost/include/boost/signals.hpp b/deal.II/contrib/boost/include/boost/signals.hpp new file mode 100644 index 0000000000..7e83ed55d8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/signals.hpp @@ -0,0 +1,10 @@ +// 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 + diff --git a/deal.II/contrib/boost/include/boost/smart_cast.hpp b/deal.II/contrib/boost/include/boost/smart_cast.hpp new file mode 100644 index 0000000000..756afc3a08 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/smart_cast.hpp @@ -0,0 +1,298 @@ +#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 +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace smart_cast_impl { + + template + struct reference { + + struct polymorphic { + + struct linear { + template + static T cast(U & u){ + return static_cast(u); + } + }; + + struct cross { + template + static T cast(U & u){ + return dynamic_cast(u); + } + }; + + template + 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_::type, + U + > >, + mpl::not_::type + > > + >, + // borland chokes w/o full qualification here + mpl::identity, + mpl::identity + >::type typex; + // typex works around gcc 2.95 issue + return typex::cast(u); + #endif + } + }; + + struct non_polymorphic { + template + static T cast(U & u){ + return static_cast(u); + } + }; + template + static T cast(U & u){ + #if defined(__BORLANDC__) + return mpl::eval_if< + boost::is_polymorphic, + mpl::identity, + mpl::identity + >::type::cast(u); + #else + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + boost::is_polymorphic, + mpl::identity, + mpl::identity + >::type typex; + return typex::cast(u); + #endif + } + }; + + template + 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 + static T cast(U * u){ + return static_cast(u); + } + }; + + struct cross { + template + static T cast(U * u){ + T tmp = dynamic_cast(u); + #ifndef NDEBUG + if ( tmp == 0 ) throw std::bad_cast(); + #endif + return tmp; + } + }; + + template + 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_::type, + U + > >, + mpl::not_::type + > > + >, + // borland chokes w/o full qualification here + mpl::identity, + mpl::identity + >::type typex; + return typex::cast(u); + #endif + } + #else + template + static T cast(U * u){ + T tmp = dynamic_cast(u); + #ifndef NDEBUG + if ( tmp == 0 ) throw std::bad_cast(); + #endif + return tmp; + } + #endif + }; + + struct non_polymorphic { + template + static T cast(U * u){ + return static_cast(u); + } + }; + + template + static T cast(U * u){ + #if defined(__BORLANDC__) + return mpl::eval_if< + boost::is_polymorphic, + mpl::identity, + mpl::identity + >::type::cast(u); + #else + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + boost::is_polymorphic, + mpl::identity, + mpl::identity + >::type typex; + return typex::cast(u); + #endif + } + + }; + + template + struct void_pointer { + template + static TPtr cast(UPtr uptr){ + return static_cast(uptr); + } + }; + + template + 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 + static T cast(U u){ + BOOST_STATIC_ASSERT(sizeof(T)==0); + return * static_cast(NULL); + } + }; + +} // smart_cast_impl + +// this implements: +// smart_cast(Source * s) +// smart_cast(s) +// note that it will fail with +// smart_cast(s) +template +T smart_cast(U u) { + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + BOOST_DEDUCED_TYPENAME mpl::or_< + boost::is_same, + boost::is_same, + boost::is_same, + boost::is_same + >, + mpl::identity >, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if, + mpl::identity >, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if, + mpl::identity >, + // else + mpl::identity + > + > + > + >::type typex; + return typex::cast(u); +} + +// this implements: +// smart_cast_reference(Source & s) +template +T smart_cast_reference(U & u) { + return smart_cast_impl::reference::cast(u); +} + +} // namespace boost + +#endif // BOOST_SMART_CAST_HPP diff --git a/deal.II/contrib/boost/include/boost/smart_ptr.hpp b/deal.II/contrib/boost/include/boost/smart_ptr.hpp new file mode 100644 index 0000000000..98e08948af --- /dev/null +++ b/deal.II/contrib/boost/include/boost/smart_ptr.hpp @@ -0,0 +1,25 @@ +// +// 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 + +#include +#include +#include +#include + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) +# include +# include +# include +#endif diff --git a/deal.II/contrib/boost/include/boost/spirit.hpp b/deal.II/contrib/boost/include/boost/spirit.hpp new file mode 100644 index 0000000000..cae9ad1552 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/spirit.hpp @@ -0,0 +1,72 @@ +/*============================================================================= + 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 + +/////////////////////////////////////////////////////////////////////////////// +// +// Spirit.Meta +// +/////////////////////////////////////////////////////////////////////////////// +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// Spirit.ErrorHandling +// +/////////////////////////////////////////////////////////////////////////////// +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// Spirit.Iterators +// +/////////////////////////////////////////////////////////////////////////////// +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// Spirit.Symbols +// +/////////////////////////////////////////////////////////////////////////////// +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// Spirit.Utilities +// +/////////////////////////////////////////////////////////////////////////////// +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// Spirit.Attributes +// +/////////////////////////////////////////////////////////////////////////////// +#include + +#endif // !defined(SPIRIT_HPP) diff --git a/deal.II/contrib/boost/include/boost/state_saver.hpp b/deal.II/contrib/boost/include/boost/state_saver.hpp new file mode 100644 index 0000000000..aa15feafa8 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/state_saver.hpp @@ -0,0 +1,94 @@ +#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 +#ifndef BOOST_NO_EXCEPTIONS + #include +#endif + +#include +#include +#include +#include + +#include +#include + +namespace boost { + +template +// 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, + mpl::identity, + mpl::identity + >::type typex; + typex::invoke(previous_ref, previous_value); + #else + previous_ref = previous_value; + #endif + } + +}; // state_saver<> + +} // boost + +#endif //BOOST_STATE_SAVER_HPP diff --git a/deal.II/contrib/boost/include/boost/static_warning.hpp b/deal.II/contrib/boost/include/boost/static_warning.hpp new file mode 100644 index 0000000000..24a662a643 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/static_warning.hpp @@ -0,0 +1,180 @@ +#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 + +// +// 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::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::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::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::STATIC_WARNING is decalred as a struct iff B is +// false. +// 5. static_warning_impl::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 +struct static_warning_impl; + +template<> +struct static_warning_impl { + 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 { + 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 diff --git a/deal.II/contrib/boost/include/boost/strong_typedef.hpp b/deal.II/contrib/boost/include/boost/strong_typedef.hpp new file mode 100644 index 0000000000..e1f351671d --- /dev/null +++ b/deal.II/contrib/boost/include/boost/strong_typedef.hpp @@ -0,0 +1,45 @@ +#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 + +#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 diff --git a/deal.II/contrib/boost/include/boost/thread.hpp b/deal.II/contrib/boost/include/boost/thread.hpp new file mode 100644 index 0000000000..56cc8a65ba --- /dev/null +++ b/deal.II/contrib/boost/include/boost/thread.hpp @@ -0,0 +1,24 @@ +// 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 +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost/timer.hpp b/deal.II/contrib/boost/include/boost/timer.hpp new file mode 100644 index 0000000000..1e3571e417 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/timer.hpp @@ -0,0 +1,72 @@ +// 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 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 +#include +#include + +# 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::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 diff --git a/deal.II/contrib/boost/include/boost/token_functions.hpp b/deal.II/contrib/boost/include/boost/token_functions.hpp new file mode 100644 index 0000000000..afa36fe33a --- /dev/null +++ b/deal.II/contrib/boost/include/boost/token_functions.hpp @@ -0,0 +1,615 @@ +// 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 +#include +#include +#include +#include +#include // for find_if +#include +#include +#include + +// +// 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 ::traits_type > +#else + template ::traits_type > +#endif + class escaped_list_separator { + + private: + typedef std::basic_string 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 + 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 + 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 + struct assign_or_plus_equal { + template + 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 + static void plus_equal(Token &, const Value &) { + + } + + // If we are doing an assign, there is no need for the + // the clear. + // + template + static void clear(Token &) { + + } + }; + + template <> + struct assign_or_plus_equal { + template + static void assign(Iterator b, Iterator e, Token &t) { + + } + template + static void plus_equal(Token &t, const Value &v) { + t += v; + } + template + static void clear(Token &t) { + t = Token(); + } + }; + + + template + struct pointer_iterator_category{ + typedef std::random_access_iterator_tag type; + }; + + + template + struct class_iterator_category{ + typedef typename Iterator::iterator_category type; + }; + + + + // This portably gets the iterator_tag without partial template specialization + template + struct get_iterator_category{ + typedef typename mpl::if_, + pointer_iterator_category, + class_iterator_category + >::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 offsets_; + unsigned int current_offset_; + bool wrap_offsets_; + bool return_partial_last_; + + public: + template + 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 + 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 ::traits_type > +#else + template ::traits_type > +#endif + class char_separator + { + typedef std::basic_string 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 + 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 ::traits_type > +#else + template ::traits_type > +#endif + class char_delimiters_separator { + private: + + typedef std::basic_string 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 + 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 + + + + + diff --git a/deal.II/contrib/boost/include/boost/token_iterator.hpp b/deal.II/contrib/boost/include/boost/token_iterator.hpp new file mode 100644 index 0000000000..41d2cdea5c --- /dev/null +++ b/deal.II/contrib/boost/include/boost/token_iterator.hpp @@ -0,0 +1,129 @@ +// 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 +#include +#include +#include +#include + + +namespace boost +{ + template + class token_iterator + : public iterator_facade< + token_iterator + , Type + , typename detail::minimum_category< + forward_traversal_tag + , typename iterator_traversal::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 + 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 + token_iterator( + token_iterator const& t + , typename enable_if_convertible::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, + class Iterator = std::string::const_iterator, + class Type = std::string + > + class token_iterator_generator { + + private: + public: + typedef token_iterator type; + }; + + + // Type has to be first because it needs to be explicitly specified + // because there is no way the function can deduce it. + template + typename token_iterator_generator::type + make_token_iterator(Iterator begin, Iterator end,const TokenizerFunc& fun){ + typedef typename + token_iterator_generator::type ret_type; + return ret_type(fun,begin,end); + } + +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost/include/boost/tokenizer.hpp b/deal.II/contrib/boost/include/boost/tokenizer.hpp new file mode 100644 index 0000000000..d026466847 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/tokenizer.hpp @@ -0,0 +1,98 @@ +// 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 +#include +namespace boost { + + + //=========================================================================== + // A container-view of a tokenized "sequence" + template < + typename TokenizerFunc = char_delimiters_separator, + typename Iterator = std::string::const_iterator, + typename Type = std::string + > + class tokenizer { + private: + typedef token_iterator_generator 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 + tokenizer(const Container& c) + : first_(c.begin()), last_(c.end()), f_() { } + + template + 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 + void assign(const Container& c){ + assign(c.begin(),c.end()); + } + + + template + 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 diff --git a/deal.II/contrib/boost/include/boost/type.hpp b/deal.II/contrib/boost/include/boost/type.hpp new file mode 100644 index 0000000000..ab81c916d7 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/type.hpp @@ -0,0 +1,18 @@ +// (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 + struct type {}; + +} + +#endif // BOOST_TYPE_DWA20010120_HPP diff --git a/deal.II/contrib/boost/include/boost/utility.hpp b/deal.II/contrib/boost/include/boost/utility.hpp new file mode 100644 index 0000000000..211d89d67e --- /dev/null +++ b/deal.II/contrib/boost/include/boost/utility.hpp @@ -0,0 +1,19 @@ +// 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 .) + +// See for the library's home page. + +#ifndef BOOST_UTILITY_HPP +#define BOOST_UTILITY_HPP + +#include +#include +#include +#include +#include +#include + +#endif // BOOST_UTILITY_HPP diff --git a/deal.II/contrib/boost/include/boost/variant.hpp b/deal.II/contrib/boost/include/boost/variant.hpp new file mode 100644 index 0000000000..ef51639afc --- /dev/null +++ b/deal.II/contrib/boost/include/boost/variant.hpp @@ -0,0 +1,27 @@ +//----------------------------------------------------------------------------- +// 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 diff --git a/deal.II/contrib/boost/include/boost/vector_property_map.hpp b/deal.II/contrib/boost/include/boost/vector_property_map.hpp new file mode 100644 index 0000000000..ab619ded4d --- /dev/null +++ b/deal.II/contrib/boost/include/boost/vector_property_map.hpp @@ -0,0 +1,92 @@ +// 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 +#include +#include + +namespace boost { + template + class vector_property_map + : public boost::put_get_helper< + typename std::iterator_traits< + typename std::vector::iterator >::reference, + vector_property_map > + { + public: + typedef typename property_traits::key_type key_type; + typedef T value_type; + typedef typename std::iterator_traits< + typename std::vector::iterator >::reference reference; + typedef boost::lvalue_property_map_tag category; + + vector_property_map(const IndexMap& index = IndexMap()) + : store(new std::vector()), index(index) + {} + + vector_property_map(unsigned initial_size, + const IndexMap& index = IndexMap()) + : store(new std::vector(initial_size)), index(index) + {} + + typename std::vector::iterator storage_begin() + { + return store->begin(); + } + + typename std::vector::iterator storage_end() + { + return store->end(); + } + + typename std::vector::const_iterator storage_begin() const + { + return store->begin(); + } + + typename std::vector::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::value_type i = get(index, v); + if (static_cast(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 > store; + IndexMap index; + }; + + template + vector_property_map + make_vector_property_map(IndexMap index) + { + return vector_property_map(index); + } +} + +#endif diff --git a/deal.II/contrib/boost/include/boost/visit_each.hpp b/deal.II/contrib/boost/include/boost/visit_each.hpp new file mode 100644 index 0000000000..1fc8a50088 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/visit_each.hpp @@ -0,0 +1,29 @@ +// 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 + +namespace boost { + template + inline void visit_each(Visitor& visitor, const T& t, long) + { + visitor(t); + } + + template + inline void visit_each(Visitor& visitor, const T& t) + { + visit_each(visitor, t, 0); + } +} + +#endif // BOOST_VISIT_EACH_HPP diff --git a/deal.II/contrib/boost/include/boost/wave.hpp b/deal.II/contrib/boost/include/boost/wave.hpp new file mode 100644 index 0000000000..34889efd8c --- /dev/null +++ b/deal.II/contrib/boost/include/boost/wave.hpp @@ -0,0 +1,21 @@ +/*============================================================================= + 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 +#include +#include + +#include +#include + +#endif // !defined(WAVE_HPP_DCA0EA51_EF5B_4BF1_88A8_461DBC5F292B_INCLUDED) diff --git a/deal.II/contrib/boost/include/boost/weak_ptr.hpp b/deal.II/contrib/boost/include/boost/weak_ptr.hpp new file mode 100644 index 0000000000..c238500793 --- /dev/null +++ b/deal.II/contrib/boost/include/boost/weak_ptr.hpp @@ -0,0 +1,192 @@ +#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 + +#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 weak_ptr +{ +private: + + // Borland 5.5.1 specific workarounds + typedef weak_ptr 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 +// weak_ptr(weak_ptr 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 + weak_ptr(weak_ptr const & r): pn(r.pn) // never throws + { + px = r.lock().get(); + } + + template + weak_ptr(shared_ptr const & r): px(r.px), pn(r.pn) // never throws + { + } + +#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) + + template + weak_ptr & operator=(weak_ptr const & r) // never throws + { + px = r.lock().get(); + pn = r.pn; + return *this; + } + + template + weak_ptr & operator=(shared_ptr const & r) // never throws + { + px = r.px; + pn = r.pn; + return *this; + } + +#endif + + shared_ptr lock() const // never throws + { +#if defined(BOOST_HAS_THREADS) + + // optimization: avoid throw overhead + if(expired()) + { + return shared_ptr(); + } + + try + { + return shared_ptr(*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(); + } + +#else + + // optimization: avoid try/catch overhead when single threaded + return expired()? shared_ptr(): shared_ptr(*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 bool _internal_less(weak_ptr 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 friend class weak_ptr; + template friend class shared_ptr; + +#endif + + T * px; // contained pointer + detail::weak_count pn; // reference counter + +}; // weak_ptr + +template inline bool operator<(weak_ptr const & a, weak_ptr const & b) +{ + return a._internal_less(b); +} + +template void swap(weak_ptr & a, weak_ptr & b) +{ + a.swap(b); +} + +// deprecated, provided for backward compatibility +template shared_ptr make_shared(weak_ptr const & r) +{ + return r.lock(); +} + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_WEAK_PTR_HPP_INCLUDED