From: Lars Gullik Bjønnes Date: Thu, 5 Feb 2004 09:14:22 +0000 (+0000) Subject: Boost 1.31.0 X-Git-Tag: 1.6.10~15528 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=786216c0899498434cab9f33780f9c178a0a4006;p=features.git Boost 1.31.0 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8404 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/boost/ChangeLog b/boost/ChangeLog index 9eb0bca777..532d8aec47 100644 --- a/boost/ChangeLog +++ b/boost/ChangeLog @@ -1,3 +1,7 @@ +2004-02-05 Lars Gullik Bjonnes + + * update boost to version 1.31.0 + 2004-01-26 Lars Gullik Bjonnes * libs/regex/src/Makefile.am: remove trailing backslash diff --git a/boost/boost/any.hpp b/boost/boost/any.hpp index 013a83fec9..d837ce9d81 100644 --- a/boost/boost/any.hpp +++ b/boost/boost/any.hpp @@ -14,7 +14,7 @@ #include #include "boost/config.hpp" -#include "boost/throw_exception.hpp" +#include namespace boost { @@ -172,7 +172,7 @@ namespace boost { const ValueType * result = any_cast(&operand); if(!result) - throw_exception(bad_any_cast()); + boost::throw_exception(bad_any_cast()); return *result; } diff --git a/boost/boost/bind.hpp b/boost/boost/bind.hpp index 3aeb5f8472..0613a89693 100644 --- a/boost/boost/bind.hpp +++ b/boost/boost/bind.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_BIND_HPP_INCLUDED #define BOOST_BIND_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // @@ -141,6 +143,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A &) + { + return unwrap(f, 0)(); + } + template R operator()(type, F f, A &) const { return unwrap(f, 0)(); @@ -181,6 +188,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A & a) + { + return unwrap(f, 0)(a[a1_]); + } + template R operator()(type, F f, A & a) const { return unwrap(f, 0)(a[a1_]); @@ -229,6 +241,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A & a) + { + return unwrap(f, 0)(a[a1_], a[a2_]); + } + template R operator()(type, F f, A & a) const { return unwrap(f, 0)(a[a1_], a[a2_]); @@ -281,6 +298,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A & a) + { + return unwrap(f, 0)(a[a1_], a[a2_], a[a3_]); + } + template R operator()(type, F f, A & a) const { return unwrap(f, 0)(a[a1_], a[a2_], a[a3_]); @@ -337,6 +359,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A & a) + { + return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); + } + template R operator()(type, F f, A & a) const { return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); @@ -397,6 +424,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A & a) + { + return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); + } + template R operator()(type, F f, A & a) const { return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); @@ -461,6 +493,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A & a) + { + return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); + } + template R operator()(type, F f, A & a) const { return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); @@ -529,6 +566,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A & a) + { + return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); + } + template R operator()(type, F f, A & a) const { return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); @@ -601,6 +643,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A & a) + { + 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 f, A & a) const { return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]); @@ -677,6 +724,11 @@ public: template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + template R operator()(type, F f, A & a) + { + 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 f, A & a) const { return unwrap(f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]); @@ -724,7 +776,7 @@ private: template struct evaluator0 { template - static R eval(L const&, F f, A &) + static R eval(L &, F f, A &) { return unwrap(f, 0)(); } @@ -733,7 +785,7 @@ template struct evaluator0 template <> struct evaluator0 { template - static void eval(L const&, F f, A &) + static void eval(L &, F f, A &) { unwrap(f, 0)(); } @@ -742,7 +794,7 @@ template <> struct evaluator0 template struct evaluator1 { template - static R eval(L const& l, F f, A & a) + static R eval(L & l, F f, A & a) { return unwrap(f, 0)(a[l.a1_]); } @@ -751,7 +803,7 @@ template struct evaluator1 template <> struct evaluator1 { template - static void eval(L const& l, F f, A & a) + static void eval(L & l, F f, A & a) { unwrap(f, 0)(a[l.a1_]); } @@ -760,7 +812,7 @@ template <> struct evaluator1 template struct evaluator2 { template - static R eval(L const& l, F f, A & a) + static R eval(L & l, F f, A & a) { return unwrap(f, 0)(a[l.a1_], a[l.a2_]); } @@ -769,7 +821,7 @@ template struct evaluator2 template <> struct evaluator2 { template - static void eval(L const& l, F f, A & a) + static void eval(L & l, F f, A & a) { unwrap(f, 0)(a[l.a1_], a[l.a2_]); } @@ -778,7 +830,7 @@ template <> struct evaluator2 template struct evaluator3 { template - static R eval(L const& l, F f, A & a) + static R eval(L & l, F f, A & a) { return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_]); } @@ -787,7 +839,7 @@ template struct evaluator3 template <> struct evaluator3 { template - static void eval(L const& l, F f, A & a) + static void eval(L & l, F f, A & a) { unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_]); } @@ -796,7 +848,7 @@ template <> struct evaluator3 template struct evaluator4 { template - static R eval(L const& l, F f, A & a) + static R eval(L & l, F f, A & a) { return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_]); } @@ -805,7 +857,7 @@ template struct evaluator4 template <> struct evaluator4 { template - static void eval(L const& l, F f, A & a) + static void eval(L & l, F f, A & a) { unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_]); } @@ -814,7 +866,7 @@ template <> struct evaluator4 template struct evaluator5 { template - static R eval(L const& l, F f, A & a) + static R eval(L & l, F f, A & a) { return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_]); } @@ -823,7 +875,7 @@ template struct evaluator5 template <> struct evaluator5 { template - static void eval(L const& l, F f, A & a) + static void eval(L & l, F f, A & a) { unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_]); } @@ -832,7 +884,7 @@ template <> struct evaluator5 template struct evaluator6 { template - static R eval(L const& l, F f, A & a) + static R eval(L & l, F f, A & a) { return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_]); } @@ -841,7 +893,7 @@ template struct evaluator6 template <> struct evaluator6 { template - static void eval(L const& l, F f, A & a) + static void eval(L & l, F f, A & a) { unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_]); } @@ -850,7 +902,7 @@ template <> struct evaluator6 template struct evaluator7 { template - static R eval(L const& l, F f, A & a) + static R eval(L & l, F f, A & a) { return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_]); } @@ -859,7 +911,7 @@ template struct evaluator7 template <> struct evaluator7 { template - static void eval(L const& l, F f, A & a) + static void eval(L & l, F f, A & a) { unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_]); } @@ -868,7 +920,7 @@ template <> struct evaluator7 template struct evaluator8 { template - static R eval(L const& l, F f, A & a) + static R eval(L & l, F f, A & a) { return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_], a[l.a8_]); } @@ -877,7 +929,7 @@ template struct evaluator8 template <> struct evaluator8 { template - static void eval(L const& l, F f, A & a) + static void eval(L & l, F f, A & a) { unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_], a[l.a8_]); } @@ -886,7 +938,7 @@ template <> struct evaluator8 template struct evaluator9 { template - static R eval(L const& l, F f, A & a) + static R eval(L & l, F f, A & a) { return unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_], a[l.a8_], a[l.a9_]); } @@ -895,7 +947,7 @@ template struct evaluator9 template <> struct evaluator9 { template - static void eval(L const& l, F f, A & a) + static void eval(L & l, F f, A & a) { unwrap(f, 0)(a[l.a1_], a[l.a2_], a[l.a3_], a[l.a4_], a[l.a5_], a[l.a6_], a[l.a7_], a[l.a8_], a[l.a9_]); } diff --git a/boost/boost/bind/apply.hpp b/boost/boost/bind/apply.hpp index d903581b7f..6c38d617b2 100644 --- a/boost/boost/bind/apply.hpp +++ b/boost/boost/bind/apply.hpp @@ -4,7 +4,7 @@ // // apply.hpp // -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. @@ -19,52 +19,52 @@ template struct apply { typedef R result_type; - template result_type operator()(F f) const + template result_type operator()(F & f) const { return f(); } - template result_type operator()(F f, A1 & a1) const + template result_type operator()(F & f, A1 & a1) const { return f(a1); } - template result_type operator()(F f, A1 & a1, A2 & a2) const + template result_type operator()(F & f, A1 & a1, A2 & a2) const { return f(a1, a2); } - template result_type operator()(F f, A1 & a1, A2 & a2, A3 & a3) const + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3) const { return f(a1, a2, a3); } - template result_type operator()(F f, A1 & a1, A2 & a2, A3 & a3, A4 & a4) const + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4) const { return f(a1, a2, a3, a4); } - template result_type operator()(F f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const { return f(a1, a2, a3, a4, a5); } - template result_type operator()(F f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const { return f(a1, a2, a3, a4, a5, a6); } - template result_type operator()(F f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const { return f(a1, a2, a3, a4, a5, a6, a7); } - template result_type operator()(F f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const { return f(a1, a2, a3, a4, a5, a6, a7, a8); } - template result_type operator()(F f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const + template result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const { return f(a1, a2, a3, a4, a5, a6, a7, a8, a9); } diff --git a/boost/boost/bind/arg.hpp b/boost/boost/bind/arg.hpp index c0c32d2dc6..a31615d43c 100644 --- a/boost/boost/bind/arg.hpp +++ b/boost/boost/bind/arg.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_BIND_ARG_HPP_INCLUDED #define BOOST_BIND_ARG_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // diff --git a/boost/boost/bind/placeholders.hpp b/boost/boost/bind/placeholders.hpp index 3d4ed27453..cf40c7809f 100644 --- a/boost/boost/bind/placeholders.hpp +++ b/boost/boost/bind/placeholders.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED #define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // diff --git a/boost/boost/call_traits.hpp b/boost/boost/call_traits.hpp index b8022579b1..5253a6de58 100644 --- a/boost/boost/call_traits.hpp +++ b/boost/boost/call_traits.hpp @@ -1,9 +1,10 @@ -// (C) Copyright Boost.org 2000. 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. +// (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 http://www.boost.org/libs/utility/call_traits.htm for Documentation. // See boost/detail/call_traits.hpp and boost/detail/ob_call_traits.hpp // for full copyright notices. diff --git a/boost/boost/cast.hpp b/boost/boost/cast.hpp index b26172bd81..21322f4dce 100644 --- a/boost/boost/cast.hpp +++ b/boost/boost/cast.hpp @@ -175,7 +175,7 @@ namespace boost # ifdef LONGLONG_MIN return LONGLONG_MIN; # else - return -9223372036854775808LL; // hope this is portable + return -( 9223372036854775807LL )-1; // hope this is portable # endif } }; diff --git a/boost/boost/checked_delete.hpp b/boost/boost/checked_delete.hpp index 480c041837..d7f52122de 100644 --- a/boost/boost/checked_delete.hpp +++ b/boost/boost/checked_delete.hpp @@ -1,6 +1,8 @@ #ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED #define BOOST_CHECKED_DELETE_HPP_INCLUDED +// MS compatible compilers support #pragma once + #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif diff --git a/boost/boost/compose.hpp b/boost/boost/compose.hpp deleted file mode 100644 index a3fbc81b3c..0000000000 --- a/boost/boost/compose.hpp +++ /dev/null @@ -1,229 +0,0 @@ -/* supplementing compose function objects - * Fri Jul 16 21:01:58 MEST 1999 - */ -/* The following code example is taken from the book - * "The C++ Standard Library - A Tutorial and Reference" - * by Nicolai M. Josuttis, Addison-Wesley, 1999 - * - * (C) Copyright Nicolai M. Josuttis 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/compose for Documentation. - -#ifndef BOOST_COMPOSE_HPP -#define BOOST_COMPOSE_HPP - -#include - -namespace boost { - -/********************************************************** - * type nullary_function - * - as supplement to unary_function and binary_function - **********************************************************/ -template -struct nullary_function { - typedef Result result_type; -}; - -/********************************************************** - * ptr_fun for functions with no argument - **********************************************************/ -template -class pointer_to_nullary_function : public nullary_function -{ - protected: - Result (*ptr)(); - public: - pointer_to_nullary_function() { - } - explicit pointer_to_nullary_function(Result (*x)()) : ptr(x) { - } - Result operator()() const { - return ptr(); - } -}; - -template -inline pointer_to_nullary_function ptr_fun(Result (*x)()) -{ - return pointer_to_nullary_function(x); -} - -/*********** compose_f_gx_t and compose_f_gx **********************/ - -/* class for the compose_f_gx adapter - */ -template -class compose_f_gx_t - : public std::unary_function -{ - private: - OP1 op1; // process: op1(op2(x)) - OP2 op2; - public: - // constructor - compose_f_gx_t(const OP1& o1, const OP2& o2) - : op1(o1), op2(o2) { - } - - // function call - typename OP1::result_type - operator()(const typename OP2::argument_type& x) const { - return op1(op2(x)); - } -}; - -/* convenience functions for the compose_f_gx adapter - */ -template -inline compose_f_gx_t -compose_f_gx (const OP1& o1, const OP2& o2) { - return compose_f_gx_t(o1,o2); -} - -/*********** compose_f_gx_hx_t and compose_f_gx_hx **********************/ - -/* class for the compose_f_gx_hx adapter - */ -template -class compose_f_gx_hx_t - : public std::unary_function -{ - private: - OP1 op1; // process: op1(op2(x),op3(x)) - OP2 op2; - OP3 op3; - public: - // constructor - compose_f_gx_hx_t (const OP1& o1, const OP2& o2, const OP3& o3) - : op1(o1), op2(o2), op3(o3) { - } - - // function call - typename OP1::result_type - operator()(const typename OP2::argument_type& x) const { - return op1(op2(x),op3(x)); - } -}; - -/* convenience functions for the compose_f_gx_hx adapter - */ -template -inline compose_f_gx_hx_t -compose_f_gx_hx (const OP1& o1, const OP2& o2, const OP3& o3) { - return compose_f_gx_hx_t(o1,o2,o3); -} - -/*********** compose_f_gxy_t and compose_f_gxy **********************/ - -/* class for the compose_f_gxy adapter - */ -template -class compose_f_gxy_t - : public std::binary_function -{ - private: - OP1 op1; // process: op1(op2(x,y)) - OP2 op2; - public: - // constructor - compose_f_gxy_t (const OP1& o1, const OP2& o2) - : op1(o1), op2(o2) { - } - - // function call - typename OP1::result_type - operator()(const typename OP2::first_argument_type& x, - const typename OP2::second_argument_type& y) const { - return op1(op2(x,y)); - } -}; - -/* convenience function for the compose_f_gxy adapter - */ -template -inline compose_f_gxy_t -compose_f_gxy (const OP1& o1, const OP2& o2) { - return compose_f_gxy_t(o1,o2); -} - -/*********** compose_f_gx_hy_t and compose_f_gx_hy **********************/ - -/* class for the compose_f_gx_hy adapter - */ -template -class compose_f_gx_hy_t - : public std::binary_function -{ - private: - OP1 op1; // process: op1(op2(x),op3(y)) - OP2 op2; - OP3 op3; - public: - // constructor - compose_f_gx_hy_t (const OP1& o1, const OP2& o2, const OP3& o3) - : op1(o1), op2(o2), op3(o3) { - } - - // function call - typename OP1::result_type - operator()(const typename OP2::argument_type& x, - const typename OP3::argument_type& y) const { - return op1(op2(x),op3(y)); - } -}; - -/* convenience function for the compose_f_gx_hy adapter - */ -template -inline compose_f_gx_hy_t -compose_f_gx_hy (const OP1& o1, const OP2& o2, const OP3& o3) { - return compose_f_gx_hy_t(o1,o2,o3); -} - -/*********** compose_f_g_t and compose_f_g **********************/ - -/* class for the compose_f_g adapter - */ -template -class compose_f_g_t - : public boost::nullary_function -{ - private: - OP1 op1; // process: op1(op2()) - OP2 op2; - public: - // constructor - compose_f_g_t(const OP1& o1, const OP2& o2) - : op1(o1), op2(o2) { - } - - // function call - typename OP1::result_type - operator()() const { - return op1(op2()); - } -}; - -/* convenience functions for the compose_f_g adapter - */ -template -inline compose_f_g_t -compose_f_g (const OP1& o1, const OP2& o2) { - return compose_f_g_t(o1,o2); -} - -} /* namespace boost */ - -#endif /*BOOST_COMPOSE_HPP*/ diff --git a/boost/boost/compressed_pair.hpp b/boost/boost/compressed_pair.hpp index c55ca2d441..e6cd6a074a 100644 --- a/boost/boost/compressed_pair.hpp +++ b/boost/boost/compressed_pair.hpp @@ -1,9 +1,10 @@ -// (C) Copyright Boost.org 2000. 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. +// (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 http://www.boost.org for most recent version including documentation. // See boost/detail/compressed_pair.hpp and boost/detail/ob_compressed_pair.hpp // for full copyright notices. diff --git a/boost/boost/concept_archetype.hpp b/boost/boost/concept_archetype.hpp index 3bf72e4470..9981ebfab6 100644 --- a/boost/boost/concept_archetype.hpp +++ b/boost/boost/concept_archetype.hpp @@ -17,6 +17,7 @@ #include #include +#include #include namespace boost { @@ -51,12 +52,18 @@ namespace boost { // is really quite innocent. The name of this class needs to be // changed. template - class static_object { + class static_object + { public: - static T& get() { - static char d[sizeof(T)]; - return *reinterpret_cast(d); - } + 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 > @@ -258,25 +265,25 @@ namespace boost { 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()); \ +#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) @@ -403,89 +410,37 @@ namespace boost { // Iterator Archetype Classes template - struct input_proxy { - operator const T&() { return static_object::get(); } - }; - template - class trivial_iterator_archetype - { - typedef trivial_iterator_archetype self; - public: -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - typedef T value_type; - typedef void reference; - typedef void pointer; - typedef void difference_type; - typedef void iterator_category; -#endif - trivial_iterator_archetype() { } - self& operator=(const self&) { return *this; } - bool operator==(const self&) const { return true; } - bool operator!=(const self&) const { return true; } - input_proxy operator*() const { return input_proxy(); } - }; -} // namespace boost - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) -namespace std { - template - struct iterator_traits< boost::trivial_iterator_archetype > - { - typedef T value_type; - }; -} -#endif - -namespace boost { - template - struct input_output_proxy { - input_output_proxy& operator=(const T&) { return *this; } - operator const T&() { return static_object::get(); } - }; - template - class mutable_trivial_iterator_archetype + class input_iterator_archetype { - typedef mutable_trivial_iterator_archetype self; + private: + typedef input_iterator_archetype self; public: -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + typedef std::input_iterator_tag iterator_category; typedef T value_type; - typedef void reference; - typedef void pointer; - typedef void difference_type; - typedef void iterator_category; -#endif - mutable_trivial_iterator_archetype() { } + struct reference { + operator 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; } - input_output_proxy operator*() const { return input_output_proxy(); } - }; -} // namespace boost - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) -namespace std { - template - struct iterator_traits< boost::mutable_trivial_iterator_archetype > - { - typedef T value_type; + reference operator*() const { return reference(); } + self& operator++() { return *this; } + self operator++(int) { return *this; } }; -} -#endif - -namespace boost { template - class input_iterator_archetype + class input_iterator_archetype_no_proxy { - public: - typedef input_iterator_archetype self; + 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; - input_iterator_archetype() { } self& operator=(const self&) { return *this; } bool operator==(const self&) const { return true; } bool operator!=(const self&) const { return true; } @@ -494,7 +449,7 @@ namespace boost { self operator++(int) { return *this; } }; - template + template struct output_proxy { output_proxy& operator=(const T&) { return *this; } }; @@ -522,6 +477,30 @@ namespace boost { 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 { @@ -531,7 +510,7 @@ namespace boost { typedef std::forward_iterator_tag iterator_category; typedef T value_type; typedef const T& reference; - typedef T* pointer; + typedef T const* pointer; typedef std::ptrdiff_t difference_type; forward_iterator_archetype() { } self& operator=(const self&) { return *this; } diff --git a/boost/boost/concept_check.hpp b/boost/boost/concept_check.hpp index 146ffd9793..4914351fb6 100644 --- a/boost/boost/concept_check.hpp +++ b/boost/boost/concept_check.hpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__) @@ -43,7 +43,7 @@ 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(type* = 0) +inline void function_requires(mpl::identity* = 0) { #if !defined(NDEBUG) void (Concept::*x)() = BOOST_FPTR Concept::constraints; @@ -53,7 +53,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRE(type_var, ns, concept) \ typedef void (ns::concept ::* func##type_var##concept)(); \ - template \ + template \ struct concept_checking_##type_var##concept { }; \ typedef concept_checking_##type_var##concept< \ BOOST_FPTR ns::concept::constraints> \ @@ -62,7 +62,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \ typedef void (ns::concept ::* \ func##type_var1##type_var2##concept)(); \ - template \ + template \ struct concept_checking_##type_var1##type_var2##concept { }; \ typedef concept_checking_##type_var1##type_var2##concept< \ BOOST_FPTR ns::concept::constraints> \ @@ -71,7 +71,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \ typedef void (ns::concept ::* \ func##tv1##tv2##tv3##concept)(); \ - template \ + template \ struct concept_checking_##tv1##tv2##tv3##concept { }; \ typedef concept_checking_##tv1##tv2##tv3##concept< \ BOOST_FPTR ns::concept::constraints> \ @@ -80,7 +80,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \ typedef void (ns::concept ::* \ func##tv1##tv2##tv3##tv4##concept)(); \ - template \ + template \ struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \ typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \ BOOST_FPTR ns::concept::constraints> \ @@ -102,7 +102,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRES(type_var, concept) \ typedef void (concept ::* func##type_var##concept)(); \ - template \ + template \ struct concept_checking_##type_var##concept { }; \ typedef concept_checking_##type_var##concept< \ BOOST_FPTR concept ::constraints> \ @@ -110,7 +110,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept) \ typedef void (concept ::* func##type_var1##type_var2##concept)(); \ - template \ + template \ struct concept_checking_##type_var1##type_var2##concept { }; \ typedef concept_checking_##type_var1##type_var2##concept< \ BOOST_FPTR concept ::constraints> \ @@ -118,7 +118,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept) \ typedef void (concept ::* func##type_var1##type_var2##type_var3##concept)(); \ - template \ + 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> \ @@ -126,7 +126,7 @@ inline void function_requires(type* = 0) #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 \ + 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> \ @@ -536,34 +536,15 @@ struct require_same { typedef T type; }; // Iterator Concepts template - struct TrivialIteratorConcept + struct InputIteratorConcept { void constraints() { function_requires< AssignableConcept >(); - function_requires< DefaultConstructibleConcept >(); function_requires< EqualityComparableConcept >(); + TT j(i); (void)*i; // require dereference operator - } - TT i; - }; - - template - struct Mutable_TrivialIteratorConcept - { - void constraints() { - function_requires< TrivialIteratorConcept >(); - *i = *j; // require dereference and assignment - } - TT i, j; - }; - - template - struct InputIteratorConcept - { - void constraints() { - function_requires< TrivialIteratorConcept >(); - // require iterator_traits typedef's #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 >(); @@ -572,7 +553,7 @@ struct require_same { typedef T type; }; typedef typename std::iterator_traits::iterator_category C; function_requires< ConvertibleConcept >(); #endif - ++i; // require preincrement operator + ++j; // require preincrement operator i++; // require postincrement operator } TT i; diff --git a/boost/boost/config.hpp b/boost/boost/config.hpp index 8e37a39e96..055a27855b 100644 --- a/boost/boost/config.hpp +++ b/boost/boost/config.hpp @@ -1,9 +1,9 @@ // Boost config.hpp configuration header file ------------------------------// -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2002. +// 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/config for most recent version. @@ -67,3 +67,4 @@ + diff --git a/boost/boost/config/abi_prefix.hpp b/boost/boost/config/abi_prefix.hpp new file mode 100644 index 0000000000..1733dc036b --- /dev/null +++ b/boost/boost/config/abi_prefix.hpp @@ -0,0 +1,20 @@ +// abi_prefix header -------------------------------------------------------// + +// © Copyright John Maddock 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). + +#ifndef BOOST_CONFIG_ABI_PREFIX_HPP +# define BOOST_CONFIG_ABI_PREFIX_HPP +#else +# error double inclusion of header boost/config/abi_prefix.hpp is an error +#endif + +#include + +// this must occur after all other includes and before any code appears: +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_PREFIX +#endif diff --git a/boost/boost/config/abi_suffix.hpp b/boost/boost/config/abi_suffix.hpp new file mode 100644 index 0000000000..6339da6311 --- /dev/null +++ b/boost/boost/config/abi_suffix.hpp @@ -0,0 +1,23 @@ +// abi_sufffix header -------------------------------------------------------// + +// © Copyright John Maddock 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). + +// This header should be #included AFTER code that was preceded by a #include +// . + +#ifndef BOOST_CONFIG_ABI_PREFIX_HPP +# error Header boost/config/abi_prefix.hpp must only be used after boost/config/abi_prefix.hpp +#else +# undef BOOST_CONFIG_ABI_PREFIX_HPP +#endif + +// the suffix header occurs after all of our code: +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_SUFFIX +#endif + + diff --git a/boost/boost/config/auto_link.hpp b/boost/boost/config/auto_link.hpp new file mode 100644 index 0000000000..fc2e3b8136 --- /dev/null +++ b/boost/boost/config/auto_link.hpp @@ -0,0 +1,331 @@ +// (C) Copyright John Maddock 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) + + /* + * LOCATION: see http://www.boost.org for most recent version. + * FILE auto_link.hpp + * VERSION see + * DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers. + */ + +/************************************************************************* + +USAGE: +~~~~~~ + +Before including this header you must define one or more of define the following macros: + +BOOST_LIB_NAME: Required: A string containing the basename of the library, + for example boost_regex. +BOOST_DYN_LINK: Optional: when set link to dll rather than static library. +BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name + of the library selected (useful for debugging). + +These macros will be undef'ed at the end of the header, further this header +has no include guards - so be sure to include it only once from your library! + +Algorithm: +~~~~~~~~~~ + +Libraries for Borland and Microsoft compilers are automatically +selected here, the name of the lib is selected according to the following +formula: + +BOOST_LIB_PREFIX + + BOOST_LIB_NAME + + "_" + + BOOST_LIB_TOOLSET + + BOOST_LIB_THREAD_OPT + + BOOST_LIB_RT_OPT + "-" + + BOOST_LIB_VERSION + +These are defined as: + +BOOST_LIB_PREFIX: "lib" for static libraries otherwise "". + +BOOST_LIB_NAME: The base name of the lib ( for example boost_regex). + +BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc). + +BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing. + +BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used, + contains one or more of the following letters after + a hiphen: + + s static runtime (dynamic if not present). + d debug build (release if not present). + g debug/diagnostic runtime (release if not present). + p STLPort Build. + +BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. + + +***************************************************************************/ + +#ifdef __cplusplus +# ifndef BOOST_CONFIG_HPP +# include +# endif +#elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__) +// +// C language compatability (no, honestly) +// +# define BOOST_MSVC _MSC_VER +# define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) +# define BOOST_DO_STRINGIZE(X) #X +#endif +// +// Only include what follows for known and supported compilers: +// +#if (defined(BOOST_MSVC) && defined(_MSC_EXTENSIONS)) \ + || defined(__BORLANDC__) \ + || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \ + || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) + +#ifndef BOOST_VERSION_HPP +# include +#endif + +#ifndef BOOST_LIB_NAME +# error "Macro BOOST_LIB_NAME not set (internal error)" +#endif + +// +// error check: +// +#if defined(__MSVC_RUNTIME_CHECKS) && !defined(_DEBUG) +# pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors") +# pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes") +# error "Incompatible build options" +#endif +// +// select toolset: +// +#if defined(BOOST_MSVC) && (BOOST_MSVC == 1200) + + // vc6: +# define BOOST_LIB_TOOLSET "vc6" + +#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) + + // vc7: +# define BOOST_LIB_TOOLSET "vc7" + +#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1310) + + // vc71: +# define BOOST_LIB_TOOLSET "vc71" + +#elif defined(__BORLANDC__) + + // CBuilder 6: +# define BOOST_LIB_TOOLSET "bcb" + +#elif defined(__ICL) + + // Intel C++, no version number: +# define BOOST_LIB_TOOLSET "iw" + +#elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF ) + + // Metrowerks CodeWarrior 8.x +# define BOOST_LIB_TOOLSET "cw8" + +#elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF ) + + // Metrowerks CodeWarrior 9.x +# define BOOST_LIB_TOOLSET "cw9" + +#endif + +// +// select thread opt: +// +#if defined(_MT) || defined(__MT__) +# define BOOST_LIB_THREAD_OPT "-mt" +#else +# define BOOST_LIB_THREAD_OPT +#endif + +#if defined(_MSC_VER) || defined(__MWERKS__) + +# ifdef _DLL + +# if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) + +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# define BOOST_LIB_RT_OPT "-gdp" +# elif defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-gdp" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" +# else +# define BOOST_LIB_RT_OPT "-p" +# endif + +# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) + +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# define BOOST_LIB_RT_OPT "-gdpn" +# elif defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-gdpn" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" +# else +# define BOOST_LIB_RT_OPT "-pn" +# endif + +# else + +# if defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-gd" +# else +# define BOOST_LIB_RT_OPT +# endif + +# endif + +# else + +# if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && (defined(_STLP_OWN_IOSTREAMS) || defined(__STL_OWN_IOSTREAMS)) + +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# define BOOST_LIB_RT_OPT "-sgdp" +# elif defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-sgdp" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" +# else +# define BOOST_LIB_RT_OPT "-sp" +# endif + +# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) + +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# define BOOST_LIB_RT_OPT "-sgdpn" +# elif defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-sgdpn" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" +# else +# define BOOST_LIB_RT_OPT "-spn" +# endif + +# else + +# if defined(_DEBUG) +# define BOOST_LIB_RT_OPT "-sgd" +# else +# define BOOST_LIB_RT_OPT "-s" +# endif + +# endif + +# endif + +#elif defined(__BORLANDC__) + +// +// figure out whether we want the debug builds or not: +// +#pragma defineonoption BOOST_BORLAND_DEBUG -v +// +// sanity check: +// +#if defined(__STL_DEBUG) || defined(_STLP_DEBUG) +#error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form" +#endif + +# ifdef _RTLDLL + +# ifdef BOOST_BORLAND_DEBUG +# define BOOST_LIB_RT_OPT "-d" +# else +# define BOOST_LIB_RT_OPT +# endif + +# else + +# ifdef BOOST_BORLAND_DEBUG +# define BOOST_LIB_RT_OPT "-sd" +# else +# define BOOST_LIB_RT_OPT "-s" +# endif + +# endif + +#endif + +// +// select linkage opt: +// +#if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK) +# define BOOST_LIB_PREFIX +#elif defined(BOOST_DYN_LINK) +# error "Mixing a dll boost library with a static runtime is a really bad idea..." +#else +# define BOOST_LIB_PREFIX "lib" +#endif + +// +// now include the lib: +// +#if defined(BOOST_LIB_NAME) \ + && defined(BOOST_LIB_PREFIX) \ + && defined(BOOST_LIB_TOOLSET) \ + && defined(BOOST_LIB_THREAD_OPT) \ + && defined(BOOST_LIB_RT_OPT) \ + && defined(BOOST_LIB_VERSION) + +# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") +#ifdef BOOST_LIB_DIAGNOSTIC +# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") +#endif + +#else +# error "some required macros where not defined (internal logic error)." +#endif + + +#endif // _MSC_VER || __BORLANDC__ + +// +// finally undef any macros we may have set: +// +#ifdef BOOST_LIB_PREFIX +# undef BOOST_LIB_PREFIX +#endif +#if defined(BOOST_LIB_NAME) +# undef BOOST_LIB_NAME +#endif +#if defined(BOOST_LIB_TOOLSET) +# undef BOOST_LIB_TOOLSET +#endif +#if defined(BOOST_LIB_THREAD_OPT) +# undef BOOST_LIB_THREAD_OPT +#endif +#if defined(BOOST_LIB_RT_OPT) +# undef BOOST_LIB_RT_OPT +#endif +#if defined(BOOST_LIB_LINK_OPT) +# undef BOOST_LIB_LINK_OPT +#endif +#if defined(BOOST_LIB_DEBUG_OPT) +# undef BOOST_LIB_DEBUG_OPT +#endif +#if defined(BOOST_DYN_LINK) +# undef BOOST_DYN_LINK +#endif + + + + + + + + + diff --git a/boost/boost/config/compiler/borland.hpp b/boost/boost/config/compiler/borland.hpp index 9ab4aaf540..66cb1f3f97 100644 --- a/boost/boost/config/compiler/borland.hpp +++ b/boost/boost/config/compiler/borland.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002. +// 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 for most recent version. @@ -22,23 +24,35 @@ # define BOOST_NO_CV_SPECIALIZATIONS # define BOOST_NO_CV_VOID_SPECIALIZATIONS # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# define BOOST_NO_DEDUCED_TYPENAME +#endif + +#if (__BORLANDC__ <= 0x564) +# define BOOST_NO_SFINAE #endif // Version 7.0 (Kylix) and below: -#if (__BORLANDC__ <= 0x570) || !defined(BOOST_STRICT_CONFIG) +#if (__BORLANDC__ <= 0x570) # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_PRIVATE_IN_AGGREGATE # define BOOST_NO_USING_TEMPLATE # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG # define BOOST_NO_TEMPLATE_TEMPLATES +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE // we shouldn't really need this - but too many things choke // without it, this needs more investigation: # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +# ifdef NDEBUG + // fix broken so that Boost.test works: +# include +# undef strcmp +# endif // // new bug in 5.61: -#if __BORLANDC__ >= 0x561 +#if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x570) // this seems to be needed by the command line compiler, but not the IDE: # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS #endif @@ -57,7 +71,9 @@ // // Post 0x561 we have long long and stdint.h: #if __BORLANDC__ >= 0x561 -# define BOOST_HAS_LONG_LONG +# ifndef __NO_LONG_LONG +# define BOOST_HAS_LONG_LONG +# endif // On non-Win32 platforms let the platform config figure this out: # ifdef _WIN32 # define BOOST_HAS_STDINT_H @@ -76,23 +92,53 @@ // // __int64: // -#if __BORLANDC__ >= 0x530 +#if (__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__) # define BOOST_HAS_MS_INT64 #endif // // check for exception handling support: // -#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) +#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // // all versions have a : // -#define BOOST_HAS_DIRENT_H +#ifndef __STRICT_ANSI__ +# define BOOST_HAS_DIRENT_H +#endif +// +// all versions support __declspec: +// +#ifndef __STRICT_ANSI__ +# define BOOST_HAS_DECLSPEC +#endif +// +// ABI fixing headers: +// +#if __BORLANDC__ < 0x600 // not implemented for version 6 compiler yet +#ifndef BOOST_ABI_PREFIX +# define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp" +#endif +#ifndef BOOST_ABI_SUFFIX +# define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp" +#endif +#endif // // Disable Win32 support in ANSI mode: // -#pragma defineonoption BOOST_DISABLE_WIN32 -A +#if __BORLANDC__ < 0x600 +# pragma defineonoption BOOST_DISABLE_WIN32 -A +#elif defined(__STRICT_ANSI__) +# define BOOST_DISABLE_WIN32 +#endif +// +// MSVC compatibility mode does some nasty things: +// +#if defined(_MSC_VER) && (_MSC_VER <= 1200) +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# define BOOST_NO_VOID_RETURNS +#endif #define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) @@ -103,8 +149,8 @@ # error "Compiler not supported or configured - please reconfigure" #endif // -// last known and checked version is 5.7 (Kylix 3): -#if (__BORLANDC__ > 0x570) +// last known and checked version is 1536 (Builder X preview): +#if (__BORLANDC__ > 1536) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else @@ -117,3 +163,5 @@ + + diff --git a/boost/boost/config/compiler/comeau.hpp b/boost/boost/config/compiler/comeau.hpp index 14ec038e79..9f6ed76b4b 100644 --- a/boost/boost/config/compiler/comeau.hpp +++ b/boost/boost/config/compiler/comeau.hpp @@ -1,7 +1,12 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// (C) Copyright Douglas Gregor 2001. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright Aleksey Gurtovoy 2003. +// (C) Copyright Beman Dawes 2003. +// (C) Copyright Jens Maurer 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 for most recent version. @@ -10,9 +15,13 @@ #include "boost/config/compiler/common_edg.hpp" #if (__COMO_VERSION__ <= 4245) || !defined(BOOST_STRICT_CONFIG) + +# ifdef _WIN32 +# define BOOST_NO_SWPRINTF +# endif + # if defined(_MSC_VER) && _MSC_VER <= 1300 # define BOOST_NO_STDC_NAMESPACE -# define BOOST_NO_SWPRINTF # if _MSC_VER > 100 // only set this in non-strict mode: # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP @@ -52,3 +61,4 @@ + diff --git a/boost/boost/config/compiler/common_edg.hpp b/boost/boost/config/compiler/common_edg.hpp index 9b785af2c6..c7c0b56ee2 100644 --- a/boost/boost/config/compiler/common_edg.hpp +++ b/boost/boost/config/compiler/common_edg.hpp @@ -1,7 +1,10 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2002. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright David Abrahams 2002. +// (C) Copyright Aleksey Gurtovoy 2002. +// 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 for most recent version. @@ -16,6 +19,7 @@ #if (__EDG_VERSION__ <= 238) # define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_SFINAE #endif #if (__EDG_VERSION__ <= 240) @@ -46,3 +50,4 @@ #endif + diff --git a/boost/boost/config/compiler/compaq_cxx.hpp b/boost/boost/config/compiler/compaq_cxx.hpp index 8d09ff4648..a52e66a29c 100644 --- a/boost/boost/config/compiler/compaq_cxx.hpp +++ b/boost/boost/config/compiler/compaq_cxx.hpp @@ -1,7 +1,7 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 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 for most recent version. @@ -16,3 +16,4 @@ // Nothing to do here? + diff --git a/boost/boost/config/compiler/gcc.hpp b/boost/boost/config/compiler/gcc.hpp index 3655cdd59a..4dc3f608bc 100644 --- a/boost/boost/config/compiler/gcc.hpp +++ b/boost/boost/config/compiler/gcc.hpp @@ -1,7 +1,13 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001 - 2002. +// (C) Copyright Jens Maurer 2001 - 2002. +// (C) Copyright Beman Dawes 2001 - 2003. +// (C) Copyright Douglas Gregor 2002. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Synge Todo 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 for most recent version. @@ -23,6 +29,10 @@ # endif # endif +# if __GNUC__ == 2 && __GNUC_MINOR__ < 96 +# define BOOST_NO_SFINAE +# endif + # if __GNUC__ == 2 && __GNUC_MINOR__ <= 97 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_OPERATORS_IN_NAMESPACE @@ -30,6 +40,7 @@ # if __GNUC__ < 3 # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # endif #ifndef __EXCEPTIONS @@ -48,9 +59,9 @@ // those platforms where we can know for sure). It will get turned off again // later if no threading API is detected. // -#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(linux) && !defined(__linux) && !defined(__linux__) +#if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__) # define BOOST_HAS_THREADS -#endif +#endif // // gcc has "long long" @@ -73,7 +84,7 @@ # error "Compiler not configured - please reconfigure" #endif // -// last known and checked version is 3.3: +// last known and checked version is 3.4: #if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 4)) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" @@ -81,3 +92,5 @@ # warning "Unknown compiler version - please run the configure tests and report the results" # endif #endif + + diff --git a/boost/boost/config/compiler/greenhills.hpp b/boost/boost/config/compiler/greenhills.hpp index 793ef5228e..038b6b2b52 100644 --- a/boost/boost/config/compiler/greenhills.hpp +++ b/boost/boost/config/compiler/greenhills.hpp @@ -1,7 +1,7 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// 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 for most recent version. @@ -25,3 +25,4 @@ # endif #endif + diff --git a/boost/boost/config/compiler/hp_acc.hpp b/boost/boost/config/compiler/hp_acc.hpp index 2ca5d30fe0..d6cc9fff19 100644 --- a/boost/boost/config/compiler/hp_acc.hpp +++ b/boost/boost/config/compiler/hp_acc.hpp @@ -1,7 +1,11 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Toon Knapen 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 for most recent version. @@ -20,6 +24,7 @@ // member templates are sufficiently broken that we disable them for now # define BOOST_NO_MEMBER_TEMPLATES # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE #endif #if (__HP_aCC <= 33900) || !defined(BOOST_STRICT_CONFIG) @@ -37,6 +42,10 @@ # define BOOST_HAS_PARTIAL_STD_ALLOCATOR #endif +#if (__HP_aCC <= 53800 ) +# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD +#endif + #define BOOST_COMPILER "HP aCC version " BOOST_STRINGIZE(__HP_aCC) // @@ -47,7 +56,7 @@ #endif // // last known and checked version is 0: -#if (__HP_aCC > 33900) +#if (__HP_aCC > 53800) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif @@ -55,3 +64,4 @@ + diff --git a/boost/boost/config/compiler/intel.hpp b/boost/boost/config/compiler/intel.hpp index 680f6e828a..22890ca7cd 100644 --- a/boost/boost/config/compiler/intel.hpp +++ b/boost/boost/config/compiler/intel.hpp @@ -1,7 +1,14 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002 - 2003. +// (C) Copyright Guillaume Melquiond 2002 - 2003. +// (C) Copyright Beman Dawes 2003. +// (C) Copyright Martin Wille 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 for most recent version. @@ -65,6 +72,10 @@ # endif #endif +#if (BOOST_INTEL_CXX_VERSION <= 800) || !defined(BOOST_STRICT_CONFIG) +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#endif + #if _MSC_VER+0 >= 1000 # if _MSC_VER >= 1200 # define BOOST_HAS_MS_INT64 @@ -100,3 +111,4 @@ + diff --git a/boost/boost/config/compiler/kai.hpp b/boost/boost/config/compiler/kai.hpp index a745193688..de16f1a675 100644 --- a/boost/boost/config/compiler/kai.hpp +++ b/boost/boost/config/compiler/kai.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// (C) Copyright David Abrahams 2002. +// (C) Copyright Aleksey Gurtovoy 2002. +// 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 for most recent version. @@ -30,3 +32,4 @@ #endif + diff --git a/boost/boost/config/compiler/metrowerks.hpp b/boost/boost/config/compiler/metrowerks.hpp index 9346def3f0..b334cee727 100644 --- a/boost/boost/config/compiler/metrowerks.hpp +++ b/boost/boost/config/compiler/metrowerks.hpp @@ -1,7 +1,11 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// (C) Copyright Darin Adler 2001. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright David Abrahams 2001 - 2002. +// (C) Copyright Beman Dawes 2001 - 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 for most recent version. @@ -29,6 +33,10 @@ # endif # if(__MWERKS__ <= 0x3003) // 8.x +# define BOOST_NO_SFINAE +# endif + +# if(__MWERKS__ <= 0x3202) // 9.2 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # endif @@ -40,6 +48,7 @@ # define BOOST_NO_EXCEPTIONS #endif +#if (__INTEL__ && _WIN32) || (__POWERPC__ && macintosh) # if __MWERKS__ == 0x3000 # define BOOST_COMPILER_VERSION 8.0 # elif __MWERKS__ == 0x3001 @@ -48,9 +57,18 @@ # define BOOST_COMPILER_VERSION 8.2 # elif __MWERKS__ == 0x3003 # define BOOST_COMPILER_VERSION 8.3 +# elif __MWERKS__ == 0x3200 +# define BOOST_COMPILER_VERSION 9.0 +# elif __MWERKS__ == 0x3201 +# define BOOST_COMPILER_VERSION 9.1 +# elif __MWERKS__ == 0x3202 +# define BOOST_COMPILER_VERSION 9.2 # else # define BOOST_COMPILER_VERSION __MWERKS__ -# endif +# endif +#else +# define BOOST_COMPILER_VERSION __MWERKS__ +#endif #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) @@ -62,7 +80,7 @@ #endif // // last known and checked version: -#if (__MWERKS__ > 0x3003) +#if (__MWERKS__ > 0x3202) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif @@ -73,3 +91,4 @@ + diff --git a/boost/boost/config/compiler/mpw.hpp b/boost/boost/config/compiler/mpw.hpp index 3cd979a0b1..8ab2aacb6e 100644 --- a/boost/boost/config/compiler/mpw.hpp +++ b/boost/boost/config/compiler/mpw.hpp @@ -1,7 +1,8 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2002. +// (C) Copyright Aleksey Gurtovoy 2002. +// 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 for most recent version. @@ -47,3 +48,4 @@ # endif #endif + diff --git a/boost/boost/config/compiler/sgi_mipspro.hpp b/boost/boost/config/compiler/sgi_mipspro.hpp index 51e9f6fe79..689b67eeb1 100644 --- a/boost/boost/config/compiler/sgi_mipspro.hpp +++ b/boost/boost/config/compiler/sgi_mipspro.hpp @@ -1,7 +1,7 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2002. +// 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 for most recent version. @@ -21,3 +21,4 @@ // version check: // probably nothing to do here? + diff --git a/boost/boost/config/compiler/sunpro_cc.hpp b/boost/boost/config/compiler/sunpro_cc.hpp index f91c02923b..8a61199f8b 100644 --- a/boost/boost/config/compiler/sunpro_cc.hpp +++ b/boost/boost/config/compiler/sunpro_cc.hpp @@ -1,7 +1,11 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// (C) Copyright Jens Maurer 2001 - 2003. +// (C) Copyright Peter Dimov 2002. +// (C) Copyright Aleksey Gurtovoy 2002 - 2003. +// (C) Copyright David Abrahams 2002. +// 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 for most recent version. @@ -31,6 +35,14 @@ # endif # if (__SUNPRO_CC <= 0x530) || !defined(BOOST_STRICT_CONFIG) + // Requesting debug info (-g) with Boost.Python results + // in an internal compiler error for "static const" + // initialized in-class. + // >> Assertion: (../links/dbg_cstabs.cc, line 611) + // while processing ../test.cpp at line 0. + // (Jens Maurer according to Gottfried Ganßauge 04 Mar 2002) +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION + // SunPro 5.3 has better support for partial specialization, // but breaks when compiling std::less > // (Jens Maurer 4 Nov 2001). @@ -47,6 +59,11 @@ # if (__SUNPRO_CC <= 0x540) || !defined(BOOST_STRICT_CONFIG) # define BOOST_NO_TEMPLATE_TEMPLATES + // see http://lists.boost.org/MailArchives/boost/msg47184.php + // and http://lists.boost.org/MailArchives/boost/msg47220.php +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_NO_SFINAE +# define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS # endif #define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC) @@ -69,3 +86,4 @@ + diff --git a/boost/boost/config/compiler/vacpp.hpp b/boost/boost/config/compiler/vacpp.hpp index 5398110a05..89d5e7f69c 100644 --- a/boost/boost/config/compiler/vacpp.hpp +++ b/boost/boost/config/compiler/vacpp.hpp @@ -1,7 +1,11 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Toon Knapen 2001 - 2003. +// (C) Copyright Lie-Quan Lee 2001. +// (C) Copyright Markus Schöpflin 2002 - 2003. +// (C) Copyright Beman Dawes 2002 - 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 for most recent version. @@ -49,3 +53,4 @@ + diff --git a/boost/boost/config/compiler/visualc.hpp b/boost/boost/config/compiler/visualc.hpp index 7bd6b34a55..aca7dfea44 100644 --- a/boost/boost/config/compiler/visualc.hpp +++ b/boost/boost/config/compiler/visualc.hpp @@ -1,7 +1,12 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001 - 2002. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright Aleksey Gurtovoy 2002. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Beman Dawes 2002 - 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 for most recent version. @@ -14,25 +19,26 @@ #if _MSC_VER <= 1200 // 1200 == VC++ 6.0 #pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info -# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_VOID_RETURNS # define BOOST_NO_EXCEPTION_STD_NAMESPACE -# define BOOST_NO_DEDUCED_TYPENAME // disable min/max macro defines on vc6: // #endif -#if (_MSC_VER <= 1300) // 1200 == VC++ 7.0 +#if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 #if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS #endif +# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_PRIVATE_IN_AGGREGATE # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_DEDUCED_TYPENAME +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE // VC++ 6/7 has member templates but they have numerous problems including // cases of silent failure, so for safety we define: @@ -47,6 +53,7 @@ # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_SWPRINTF # define BOOST_NO_TEMPLATE_TEMPLATES +# define BOOST_NO_SFINAE # if (_MSC_VER > 1200) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif @@ -74,7 +81,7 @@ // // __int64 support: // -#if (_MSC_VER >= 1200) && defined(_MSC_EXTENSIONS) +#if (_MSC_VER >= 1200) # define BOOST_HAS_MS_INT64 #endif #if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS) @@ -88,6 +95,20 @@ # define BOOST_DISABLE_WIN32 #endif +// +// all versions support __declspec: +// +#define BOOST_HAS_DECLSPEC +// +// prefix and suffix headers: +// +#ifndef BOOST_ABI_PREFIX +# define BOOST_ABI_PREFIX "boost/config/abi/msvc_prefix.hpp" +#endif +#ifndef BOOST_ABI_SUFFIX +# define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" +#endif + # if _MSC_VER == 1200 # define BOOST_COMPILER_VERSION 6.0 # elif _MSC_VER == 1300 @@ -121,3 +142,5 @@ + + diff --git a/boost/boost/config/platform/aix.hpp b/boost/boost/config/platform/aix.hpp index f1bb1b2f2d..894ef42ce9 100644 --- a/boost/boost/config/platform/aix.hpp +++ b/boost/boost/config/platform/aix.hpp @@ -1,7 +1,7 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2002. +// 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 for most recent version. @@ -30,3 +30,4 @@ + diff --git a/boost/boost/config/platform/amigaos.hpp b/boost/boost/config/platform/amigaos.hpp index 7aa85d1928..34bcf4128b 100644 --- a/boost/boost/config/platform/amigaos.hpp +++ b/boost/boost/config/platform/amigaos.hpp @@ -1,8 +1,7 @@ - -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2002. +// 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 for most recent version. @@ -13,3 +12,4 @@ #define BOOST_NO_STD_WSTRING #define BOOST_NO_INTRINSIC_WCHAR_T + diff --git a/boost/boost/config/platform/beos.hpp b/boost/boost/config/platform/beos.hpp index b2c0de5f38..48c3d8dc5b 100644 --- a/boost/boost/config/platform/beos.hpp +++ b/boost/boost/config/platform/beos.hpp @@ -1,7 +1,7 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// 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 for most recent version. @@ -23,3 +23,4 @@ #include + diff --git a/boost/boost/config/platform/bsd.hpp b/boost/boost/config/platform/bsd.hpp index 9adf3a5c77..e83b6433e6 100644 --- a/boost/boost/config/platform/bsd.hpp +++ b/boost/boost/config/platform/bsd.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001. +// (C) Copyright Douglas Gregor 2002. +// 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 for most recent version. @@ -63,3 +65,4 @@ + diff --git a/boost/boost/config/platform/cygwin.hpp b/boost/boost/config/platform/cygwin.hpp index ad5ae94f12..0fd2ebe2d8 100644 --- a/boost/boost/config/platform/cygwin.hpp +++ b/boost/boost/config/platform/cygwin.hpp @@ -1,7 +1,7 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 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 for most recent version. @@ -32,8 +32,17 @@ # define BOOST_HAS_FTIME #endif +// +// find out if we have a stdint.h, there should be a better way to do this: +// +#include +#ifdef _STDINT_H +#define BOOST_HAS_STDINT_H +#endif + // boilerplate code: #include + diff --git a/boost/boost/config/platform/hpux.hpp b/boost/boost/config/platform/hpux.hpp index 6b63d6db6f..21049059e3 100644 --- a/boost/boost/config/platform/hpux.hpp +++ b/boost/boost/config/platform/hpux.hpp @@ -1,7 +1,10 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001 - 2003. +// (C) Copyright David Abrahams 2002. +// (C) Copyright Toon Knapen 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 for most recent version. @@ -56,3 +59,4 @@ # define BOOST_HAS_SIGACTION #endif + diff --git a/boost/boost/config/platform/irix.hpp b/boost/boost/config/platform/irix.hpp index 60059bd914..aeae49c8b4 100644 --- a/boost/boost/config/platform/irix.hpp +++ b/boost/boost/config/platform/irix.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 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 for most recent version. @@ -26,3 +28,4 @@ #include + diff --git a/boost/boost/config/platform/linux.hpp b/boost/boost/config/platform/linux.hpp index 21e375ef23..51ae13347c 100644 --- a/boost/boost/config/platform/linux.hpp +++ b/boost/boost/config/platform/linux.hpp @@ -1,7 +1,8 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001 - 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 for most recent version. @@ -94,3 +95,4 @@ # endif #endif + diff --git a/boost/boost/config/platform/macos.hpp b/boost/boost/config/platform/macos.hpp index 047cbf52fc..edaf1a751c 100644 --- a/boost/boost/config/platform/macos.hpp +++ b/boost/boost/config/platform/macos.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001 - 2002. +// (C) Copyright Bill Kempf 2002. +// 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 for most recent version. @@ -35,7 +37,7 @@ # define BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_SIGACTION -# ifndef __APPLE_CC__ +# if (__GNUC__ < 3) && !defined( __APPLE_CC__) // GCC strange "ignore std" mode works better if you pretend everything // is in the std namespace, for the most part. @@ -64,3 +66,5 @@ #endif + + diff --git a/boost/boost/config/platform/solaris.hpp b/boost/boost/config/platform/solaris.hpp index 3a21a5ea15..700dc3ce67 100644 --- a/boost/boost/config/platform/solaris.hpp +++ b/boost/boost/config/platform/solaris.hpp @@ -1,7 +1,8 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 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 for most recent version. @@ -17,3 +18,4 @@ + diff --git a/boost/boost/config/platform/win32.hpp b/boost/boost/config/platform/win32.hpp index 89e36ba8dd..a637dc3772 100644 --- a/boost/boost/config/platform/win32.hpp +++ b/boost/boost/config/platform/win32.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Bill Kempf 2001. +// (C) Copyright Aleksey Gurtovoy 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 for most recent version. @@ -13,6 +15,15 @@ # define BOOST_NO_SWPRINTF #endif +#if !defined(__GNUC__) && !defined(BOOST_HAS_DECLSPEC) +# define BOOST_HAS_DECLSPEC +#endif + +#if defined(__MINGW32__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2))) +# define BOOST_HAS_STDINT_H +# define __STDC_LIMIT_MACROS +#endif + // // Win32 will normally be using native Win32 threads, // but there is a pthread library avaliable as an option, @@ -46,6 +57,7 @@ #endif #ifdef BOOST_MSVC +#include // for existing std::min and std::max namespace std{ // Apparently, something in the Microsoft libraries requires the "long" // overload, because it calls the min/max functions with arguments of @@ -70,3 +82,5 @@ namespace std{ using std::min; using std::max; # endif + + diff --git a/boost/boost/config/posix_features.hpp b/boost/boost/config/posix_features.hpp index 81979c3ff9..f405aeddbd 100644 --- a/boost/boost/config/posix_features.hpp +++ b/boost/boost/config/posix_features.hpp @@ -1,7 +1,8 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 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 for most recent version. @@ -83,3 +84,4 @@ # endif + diff --git a/boost/boost/config/select_compiler_config.hpp b/boost/boost/config/select_compiler_config.hpp index 8a16a48c04..3453f1a35f 100644 --- a/boost/boost/config/select_compiler_config.hpp +++ b/boost/boost/config/select_compiler_config.hpp @@ -1,9 +1,11 @@ // Boost compiler configuration selection header file -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Martin Wille 2003. +// (C) Copyright Guillaume Melquiond 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 for most recent version. @@ -14,6 +16,10 @@ // Comeau C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp" +#elif defined __DMC__ +// Digital Mars C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/digitalmars.hpp" + #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) // Intel # define BOOST_COMPILER_CONFIG "boost/config/compiler/intel.hpp" @@ -72,7 +78,6 @@ #elif defined (BOOST_ASSERT_CONFIG) // this must come last - generate an error if we don't // recognise the compiler: -# error "Unknown compiler - please configure and report the results to boost.org" +# error "Unknown compiler - please configure (http://www.boost.org/libs/config/config.htm#configuring) and report the results to the main boost mailing list (http://www.boost.org/more/mailing_lists.htm#main)" #endif - diff --git a/boost/boost/config/select_platform_config.hpp b/boost/boost/config/select_platform_config.hpp index 5921cc5e55..5699b2a2ae 100644 --- a/boost/boost/config/select_platform_config.hpp +++ b/boost/boost/config/select_platform_config.hpp @@ -1,9 +1,10 @@ // Boost compiler configuration selection header file -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2002. +// (C) Copyright Jens Maurer 2001. +// 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 for most recent version. @@ -82,3 +83,4 @@ #endif + diff --git a/boost/boost/config/select_stdlib_config.hpp b/boost/boost/config/select_stdlib_config.hpp index 668b97c5fd..111bd93242 100644 --- a/boost/boost/config/select_stdlib_config.hpp +++ b/boost/boost/config/select_stdlib_config.hpp @@ -1,9 +1,11 @@ // Boost compiler configuration selection header file -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001 - 2002. +// 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 for most recent version. @@ -63,3 +65,4 @@ #endif + diff --git a/boost/boost/config/stdlib/dinkumware.hpp b/boost/boost/config/stdlib/dinkumware.hpp index a90e8ca7e7..d3fc190bcf 100644 --- a/boost/boost/config/stdlib/dinkumware.hpp +++ b/boost/boost/config/stdlib/dinkumware.hpp @@ -1,7 +1,11 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright David Abrahams 2002. +// (C) Copyright Guillaume Melquiond 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 for most recent version. @@ -18,14 +22,14 @@ #if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306) // full dinkumware 3.06 and above // fully conforming provided the compiler supports it: -# if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(_STD) && !(defined(__ICC) && (__ICC >= 700)) // can be defined in yvals.h +# if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(__BORLANDC__) && !defined(_STD) && !(defined(__ICC) && (__ICC >= 700)) // can be defined in yvals.h # define BOOST_NO_STDC_NAMESPACE # endif # if !(defined(_HAS_MEMBER_TEMPLATES_REBIND) && (_HAS_MEMBER_TEMPLATES_REBIND+0 > 0)) && !(defined(_MSC_VER) && (_MSC_VER > 1300)) && defined(BOOST_MSVC) # define BOOST_NO_STD_ALLOCATOR # endif # define BOOST_HAS_PARTIAL_STD_ALLOCATOR -# if defined(_MSC_VER) && (_MSC_VER < 1300) +# if (defined(_MSC_VER) && (_MSC_VER < 1300)) && !defined(__BORLANDC__) // if this lib version is set up for vc6 then there is no std::use_facet: # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_TWO_ARG_USE_FACET @@ -38,7 +42,7 @@ # if !defined(_LONGLONG) && (_CPPLIB_VER <= 310) # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # endif -// 3.06 appears to have (non-sgi versions of) & , +// 3.06 appears to have (non-sgi versions of) & , // and no at all #else # define BOOST_MSVC_STD_ITERATOR 1 @@ -58,7 +62,7 @@ #endif -#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306) +#if (defined(_MSC_VER) && (_MSC_VER <= 1300) && !defined(__BORLANDC__)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306) // if we're using a dinkum lib that's // been configured for VC6/7 then there is // no iterator traits (true even for icl) @@ -89,3 +93,4 @@ + diff --git a/boost/boost/config/stdlib/libcomo.hpp b/boost/boost/config/stdlib/libcomo.hpp index ad0d4f6f51..3ec438db97 100644 --- a/boost/boost/config/stdlib/libcomo.hpp +++ b/boost/boost/config/stdlib/libcomo.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2002 - 2003. +// (C) Copyright Jens Maurer 2002 - 2003. +// (C) Copyright Beman Dawes 2002 - 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 for most recent version. @@ -32,3 +34,4 @@ #define BOOST_STDLIB "Comeau standard library " BOOST_STRINGIZE(__LIBCOMO_VERSION__) + diff --git a/boost/boost/config/stdlib/libstdcpp3.hpp b/boost/boost/config/stdlib/libstdcpp3.hpp index e4ddcdf0e5..ccaf83acdf 100644 --- a/boost/boost/config/stdlib/libstdcpp3.hpp +++ b/boost/boost/config/stdlib/libstdcpp3.hpp @@ -1,7 +1,8 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// (C) Copyright Jens Maurer 2001. +// 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 for most recent version. @@ -23,3 +24,4 @@ # undef BOOST_HAS_LONG_LONG #endif + diff --git a/boost/boost/config/stdlib/modena.hpp b/boost/boost/config/stdlib/modena.hpp index 8d68cee511..61e31b7d1c 100644 --- a/boost/boost/config/stdlib/modena.hpp +++ b/boost/boost/config/stdlib/modena.hpp @@ -1,7 +1,7 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright Jens Maurer 2001. +// 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 for most recent version. @@ -27,3 +27,4 @@ + diff --git a/boost/boost/config/stdlib/msl.hpp b/boost/boost/config/stdlib/msl.hpp index 009e779bf2..4c6bad4a9c 100644 --- a/boost/boost/config/stdlib/msl.hpp +++ b/boost/boost/config/stdlib/msl.hpp @@ -1,7 +1,8 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// (C) Copyright Darin Adler 2001. +// 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 for most recent version. @@ -34,7 +35,7 @@ # include #endif -#if _MWMT +#if defined(_MWMT) || _MSL_THREADSAFE # define BOOST_HAS_THREADS #endif @@ -48,3 +49,4 @@ + diff --git a/boost/boost/config/stdlib/roguewave.hpp b/boost/boost/config/stdlib/roguewave.hpp index 4b0a023295..886c30eb30 100644 --- a/boost/boost/config/stdlib/roguewave.hpp +++ b/boost/boost/config/stdlib/roguewave.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright David Abrahams 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 for most recent version. @@ -116,3 +118,4 @@ #endif + diff --git a/boost/boost/config/stdlib/sgi.hpp b/boost/boost/config/stdlib/sgi.hpp index dd086c2c95..67f7a0a4bf 100644 --- a/boost/boost/config/stdlib/sgi.hpp +++ b/boost/boost/config/stdlib/sgi.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001. +// (C) Copyright Jens Maurer 2001 - 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 for most recent version. @@ -56,7 +58,7 @@ // // SGI's new iostreams have missing "const" in messages<>::open // -#if defined(__sgi) && (_COMPILER_VERSION <= 730) && defined(__STL_USE_NEW_IOSTREAMS) +#if defined(__sgi) && (_COMPILER_VERSION <= 740) && defined(__STL_USE_NEW_IOSTREAMS) # define BOOST_NO_STD_MESSAGES #endif @@ -105,3 +107,5 @@ #define BOOST_STDLIB "SGI standard library" + + diff --git a/boost/boost/config/stdlib/stlport.hpp b/boost/boost/config/stdlib/stlport.hpp index c221cbe8e7..94d705bb0d 100644 --- a/boost/boost/config/stdlib/stlport.hpp +++ b/boost/boost/config/stdlib/stlport.hpp @@ -1,7 +1,9 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2002. +// (C) Copyright Darin Adler 2001. +// (C) Copyright Jens Maurer 2001. +// 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 for most recent version. @@ -76,6 +78,10 @@ # define BOOST_NO_STD_ALLOCATOR #endif +#if defined(_STLP_NO_MEMBER_TEMPLATE_KEYWORD) && defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) +# define BOOST_NO_STD_ALLOCATOR +#endif + // // We always have SGI style hash_set, hash_map, and slist: // @@ -93,7 +99,7 @@ // BCB6 does cause problems. If we detect C++ Builder, then don't define // BOOST_NO_STDC_NAMESPACE // -#if !defined(__BORLANDC__) +#if !defined(__BORLANDC__) && !defined(__DMC__) // // If STLport is using it's own namespace, and the real names are in // the global namespace, then we duplicate STLport's using declarations @@ -108,7 +114,7 @@ # define BOOST_NO_STDC_NAMESPACE # define BOOST_NO_EXCEPTION_STD_NAMESPACE # endif -#elif __BORLANDC__ < 0x560 +#elif defined(__BORLANDC__) && __BORLANDC__ < 0x560 // STLport doesn't import std::abs correctly: #include namespace std { using ::abs; } @@ -160,3 +166,4 @@ namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; + diff --git a/boost/boost/config/stdlib/vacpp.hpp b/boost/boost/config/stdlib/vacpp.hpp index 2d5bf5709d..9579039eeb 100644 --- a/boost/boost/config/stdlib/vacpp.hpp +++ b/boost/boost/config/stdlib/vacpp.hpp @@ -1,7 +1,7 @@ -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2002. +// 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 for most recent version. @@ -14,3 +14,4 @@ #define BOOST_STDLIB "Visual Age default standard library" + diff --git a/boost/boost/config/suffix.hpp b/boost/boost/config/suffix.hpp index 6635666bc1..84d9a11749 100644 --- a/boost/boost/config/suffix.hpp +++ b/boost/boost/config/suffix.hpp @@ -1,9 +1,16 @@ // Boost config.hpp configuration header file ------------------------------// -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright Darin Adler 2001. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright Bill Kempf 2002. +// (C) Copyright Jens Maurer 2002. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Gennaro Prota 2003. +// (C) Copyright Eric Friedman 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 for most recent version. @@ -100,6 +107,14 @@ # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG # endif +// +// Without partial specialization, we can't have array-type partial specialisations: +// +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) +# define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS +# endif + // // Without partial specialization, std::iterator_traits can't work: // @@ -128,6 +143,13 @@ # define BOOST_NO_STD_ALLOCATOR # endif +// +// without ADL support then using declarations will break ADL as well: +// +#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#endif + // // If we have a standard allocator, then we have a partial one as well: // @@ -207,6 +229,17 @@ # undef BOOST_HAS_THREADS #endif +// +// Turn threading detail macros off if we don't (want to) use threading +// +#ifndef BOOST_HAS_THREADS +# undef BOOST_HAS_PTHREADS +# undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +# undef BOOST_HAS_WINTHREADS +# undef BOOST_HAS_BETHREADS +# undef BOOST_HAS_MPTASKS +#endif + // // If the compiler claims to be C99 conformant, then it had better // have a : @@ -227,6 +260,17 @@ # define BOOST_NO_HASH # endif +// BOOST_HAS_ABI_HEADERS +// This macro gets set if we have headers that fix the ABI, +// and prevent ODR violations when linking to external libraries: +#if defined(BOOST_ABI_PREFIX) && defined(BOOST_ABI_SUFFIX) && !defined(BOOST_HAS_ABI_HEADERS) +# define BOOST_HAS_ABI_HEADERS +#endif + +#if defined(BOOST_HAS_ABI_HEADERS) && defined(BOOST_DISABLE_ABI_HEADERS) +# undef BOOST_HAS_ABI_HEADERS +#endif + // BOOST_NO_STDC_NAMESPACE workaround --------------------------------------// // Because std::size_t usage is so common, even in boost headers which do not // otherwise use the C library, the workaround is included here so @@ -337,6 +381,86 @@ namespace std { # define BOOST_DEDUCED_TYPENAME #endif +// BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// +// +// Some compilers have problems with function templates whose +// template parameters don't appear in the function parameter +// list (basically they just link one instantiation of the +// template in the final executable). These macros provide a +// uniform way to cope with the problem with no effects on the +// calling syntax. + +// Example: +// +// #include +// #include +// #include +// +// template +// void f() { std::cout << n << ' '; } +// +// template +// void g() { std::cout << typeid(T).name() << ' '; } +// +// int main() { +// f<1>(); +// f<2>(); +// +// g(); +// g(); +// } +// +// With VC++ 6.0 the output is: +// +// 2 2 double double +// +// To fix it, write +// +// template +// void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... } +// +// template +// void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... } +// + + +#if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS + +# include "boost/type.hpp" +# include "boost/non_type.hpp" + +# define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type* = 0 +# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type* +# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type* = 0 +# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type* + +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \ + , BOOST_EXPLICIT_TEMPLATE_TYPE(t) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \ + , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \ + , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \ + , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) + +#else + +// no workaround needed: expand to nothing + +# define BOOST_EXPLICIT_TEMPLATE_TYPE(t) +# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) +# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) +# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) + +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) + + +#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS + + // ---------------------------------------------------------------------------// // @@ -381,3 +505,4 @@ namespace std { #endif + diff --git a/boost/boost/config/user.hpp b/boost/boost/config/user.hpp index cfdf142f35..5a4a9d4776 100644 --- a/boost/boost/config/user.hpp +++ b/boost/boost/config/user.hpp @@ -1,9 +1,9 @@ // boost/config/user.hpp ---------------------------------------------------// -// (C) Copyright Boost.org 2001. 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. +// (C) Copyright John Maddock 2001. +// 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) // Do not check in modified versions of this file, // This file may be customized by the end user, but not by boost. @@ -59,12 +59,66 @@ // define if you want to disable threading support, even // when available: -#define BOOST_DISABLE_THREADS 1 +// #define BOOST_DISABLE_THREADS // define when you want to disable Win32 specific features // even when available: // #define BOOST_DISABLE_WIN32 +// BOOST_DISABLE_ABI_HEADERS: Stops boost headers from including any +// prefix/suffix headers that normally control things like struct +// packing and alignment. +// #define BOOST_DISABLE_ABI_HEADERS + +// BOOST_ABI_PREFIX: A prefix header to include in place of whatever +// boost.config would normally select, any replacement should set up +// struct packing and alignment options as required. +// #define BOOST_ABI_PREFIX my-header-name + +// BOOST_ABI_SUFFIX: A suffix header to include in place of whatever +// boost.config would normally select, any replacement should undo +// the effects of the prefix header. +// #define BOOST_ABI_SUFFIX my-header-name + +// BOOST_ALL_DYN_LINK: Forces all libraries that have separate source, +// to be linked as dll's rather than static libraries on Microsoft Windows +// (this macro is used to turn on __declspec(dllimport) modifiers, so that +// the compiler knows which symbols to look for in a dll rather than in a +// static library). Note that there may be some libraries that can only +// be statically linked (Boost.Test for example) and others which may only +// be dynamically linked (Boost.Threads for example), in these cases this +// macro has no effect. +// #define BOOST_ALL_DYN_LINK + +// BOOST_WHATEVER_DYN_LINK: Forces library "whatever" to be linked as a dll +// rather than a static library on Microsoft Windows: replace the WHATEVER +// part of the macro name with the name of the library that you want to +// dynamically link to, for example use BOOST_DATE_TIME_DYN_LINK or +// BOOST_REGEX_DYN_LINK etc (this macro is used to turn on __declspec(dllimport) +// modifiers, so that the compiler knows which symbols to look for in a dll +// rather than in a static library). +// Note that there may be some libraries that can only be statically linked +// (Boost.Test for example) and others which may only be dynamically linked +// (Boost.Threads for example), in these cases this macro is unsupported. +// #define BOOST_WHATEVER_DYN_LINK + +// BOOST_ALL_NO_LIB: Tells the config system not to automatically select +// which libraries to link against. +// Normally if a compiler supports #pragma lib, then the correct library +// build variant will be automatically selected and linked against, +// simply by the act of including one of that library's headers. +// This macro turns that feature off. +// #define BOOST_ALL_NO_LIB + +// BOOST_WHATEVER_NO_LIB: Tells the config system not to automatically +// select which library to link against for library "whatever", +// replace WHATEVER in the macro name with the name of the library; +// for example BOOST_DATE_TIME_NO_LIB or BOOST_REGEX_NO_LIB. +// Normally if a compiler supports #pragma lib, then the correct library +// build variant will be automatically selected and linked against, simply +// by the act of including one of that library's headers. This macro turns +// that feature off. +// #define BOOST_WHATEVER_NO_LIB + + -#define BOOST_NO_WREGEX 1 -#define BOOST_NO_WSTRING 1 diff --git a/boost/boost/crc.hpp b/boost/boost/crc.hpp index 6e673c7442..bfa81b18ed 100644 --- a/boost/boost/crc.hpp +++ b/boost/boost/crc.hpp @@ -1,11 +1,10 @@ // Boost CRC library crc.hpp header file -----------------------------------// -// (C) Copyright Daryle Walker 2001. 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. +// Copyright 2001 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 http://www.boost.org/libs/crc for documentation. +// See for the library's home page. #ifndef BOOST_CRC_HPP #define BOOST_CRC_HPP @@ -280,10 +279,15 @@ namespace detail 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 @@ -340,7 +344,11 @@ namespace detail 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 BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); }; // boost::detail::mask_uint_t diff --git a/boost/boost/cregex.hpp b/boost/boost/cregex.hpp index e35a6c36ed..b591115efb 100644 --- a/boost/boost/cregex.hpp +++ b/boost/boost/cregex.hpp @@ -3,13 +3,9 @@ * Copyright (c) 1998-2002 * Dr John Maddock * - * 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. Dr John Maddock makes no representations - * about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. + * 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) * */ @@ -24,7 +20,15 @@ #ifndef BOOST_RE_CREGEX_HPP #define BOOST_RE_CREGEX_HPP +#ifndef BOOST_REGEX_CONFIG_HPP +#include +#endif + +#ifdef BOOST_REGEX_V3 #include +#else +#include +#endif #endif // include guard @@ -35,3 +39,5 @@ + + diff --git a/boost/boost/cstdint.hpp b/boost/boost/cstdint.hpp index 69235cd345..5dc83b4a2f 100644 --- a/boost/boost/cstdint.hpp +++ b/boost/boost/cstdint.hpp @@ -131,7 +131,7 @@ namespace boost { #else // BOOST_HAS_STDINT_H -# include // implementation artifact; not part of interface +# include // implementation artifact; not part of interface namespace boost @@ -245,6 +245,15 @@ namespace boost # 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: diff --git a/boost/boost/cstdlib.hpp b/boost/boost/cstdlib.hpp index a757be2d12..2ce9027afc 100644 --- a/boost/boost/cstdlib.hpp +++ b/boost/boost/cstdlib.hpp @@ -1,9 +1,7 @@ // boost/cstdlib.hpp header ------------------------------------------------// -// (C) Copyright Beman Dawes 2001. 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. +// Copyright Beman Dawes 2001. +// See accompanying license for terms and conditions of use. // See http://www.boost.org/libs/utility/cstdlib.html for documentation. diff --git a/boost/boost/current_function.hpp b/boost/boost/current_function.hpp index 66cb729734..4aea5efe39 100644 --- a/boost/boost/current_function.hpp +++ b/boost/boost/current_function.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED #define BOOST_CURRENT_FUNCTION_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // @@ -27,7 +29,7 @@ namespace detail inline void current_function_helper() { -#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) +#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) # define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ @@ -35,6 +37,10 @@ inline void current_function_helper() # 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__ diff --git a/boost/boost/detail/allocator.hpp b/boost/boost/detail/allocator.hpp index 278a2e5af2..458b6d29ce 100644 --- a/boost/boost/detail/allocator.hpp +++ b/boost/boost/detail/allocator.hpp @@ -3,13 +3,9 @@ * Copyright (c) 2001 * Dr John Maddock * - * 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. Dr John Maddock makes no representations - * about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. + * 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) * */ @@ -18,6 +14,8 @@ #include #include +#include +#include #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ using ::ptrdiff_t; @@ -74,7 +72,7 @@ struct rebind_allocator } // namespace detail } // namespace boost -#elif !defined(BOOST_NO_MEMBER_TEMPLATES) +#elif !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__SUNPRO_CC) // no std::allocator, but the compiler supports the necessary syntax, // write our own allocator instead: diff --git a/boost/boost/detail/atomic_count.hpp b/boost/boost/detail/atomic_count.hpp index 5321232349..da4fc69e16 100644 --- a/boost/boost/detail/atomic_count.hpp +++ b/boost/boost/detail/atomic_count.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED #define BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // diff --git a/boost/boost/detail/atomic_count_win32.hpp b/boost/boost/detail/atomic_count_win32.hpp index 0f00c43a2a..c8a4681481 100644 --- a/boost/boost/detail/atomic_count_win32.hpp +++ b/boost/boost/detail/atomic_count_win32.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED #define BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // diff --git a/boost/boost/detail/call_traits.hpp b/boost/boost/detail/call_traits.hpp index c1fd918dc8..a2c2ba3d1e 100644 --- a/boost/boost/detail/call_traits.hpp +++ b/boost/boost/detail/call_traits.hpp @@ -1,10 +1,9 @@ // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// 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 for most recent version including documentation. +// 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. // call_traits: defines typedefs for function usage // (see libs/utility/call_traits.htm) @@ -22,13 +21,10 @@ #ifndef BOOST_CONFIG_HPP #include #endif +#include -#ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP -#include -#endif -#ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP -#include -#endif +#include +#include namespace boost{ @@ -125,7 +121,7 @@ struct call_traits typedef T& param_type; // hh removed const }; #endif -#ifndef __SUNPRO_CC +#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) template struct call_traits { diff --git a/boost/boost/detail/catch_exceptions.hpp b/boost/boost/detail/catch_exceptions.hpp index 3fb2fdea23..065b351df2 100644 --- a/boost/boost/detail/catch_exceptions.hpp +++ b/boost/boost/detail/catch_exceptions.hpp @@ -1,11 +1,9 @@ // boost/catch_exceptions.hpp -----------------------------------------------// -// (C) Copyright Beman Dawes 1995-2001. 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. +// Copyright Beman Dawes 1995-2001. +// See accompanying license for terms and conditions of use. -// See http://www.boost.org for updates, documentation, and revision history. +// See http://www.boost.org/libs/test for documentation. // Revision History // 13 Jun 01 report_exception() made inline. (John Maddock, Jesse Jones) diff --git a/boost/boost/detail/compressed_pair.hpp b/boost/boost/detail/compressed_pair.hpp index 0a74d8adbe..af1e9bd758 100644 --- a/boost/boost/detail/compressed_pair.hpp +++ b/boost/boost/detail/compressed_pair.hpp @@ -1,14 +1,16 @@ // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// 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 for most recent version including documentation. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/utility for most recent version including documentation. // compressed_pair: pair that "compresses" empty members // (see libs/utility/compressed_pair.htm) // +// JM changes 25 Jan 2004: +// For the case where T1 == T2 and both are empty, then first() and second() +// should return different objects. // JM changes 25 Jan 2000: // Removed default arguments from compressed_pair_switch to get // C++ Builder 4 to accept them @@ -19,15 +21,11 @@ #define BOOST_DETAIL_COMPRESSED_PAIR_HPP #include -#ifndef BOOST_OBJECT_TYPE_TRAITS_HPP -#include -#endif -#ifndef BOOST_SAME_TRAITS_HPP -#include -#endif -#ifndef BOOST_CALL_TRAITS_HPP + +#include +#include +#include #include -#endif namespace boost { @@ -273,20 +271,21 @@ namespace details compressed_pair_imp() {} - compressed_pair_imp(first_param_type x, second_param_type) - : first_type(x) {} + compressed_pair_imp(first_param_type x, second_param_type y) + : first_type(x), m_second(y) {} compressed_pair_imp(first_param_type x) - : first_type(x) {} + : first_type(x), m_second(x) {} first_reference first() {return *this;} first_const_reference first() const {return *this;} - second_reference second() {return *this;} - second_const_reference second() const {return *this;} + second_reference second() {return m_second;} + second_const_reference second() const {return m_second;} void swap(::boost::compressed_pair&) {} private: + T2 m_second; }; // 5 T1 == T2 and are not empty: //JM diff --git a/boost/boost/detail/is_incrementable.hpp b/boost/boost/detail/is_incrementable.hpp new file mode 100755 index 0000000000..3054ced159 --- /dev/null +++ b/boost/boost/detail/is_incrementable.hpp @@ -0,0 +1,71 @@ +// Copyright David Abrahams 2004. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef IS_INCREMENTABLE_DWA200415_HPP +# define IS_INCREMENTABLE_DWA200415_HPP + +# include +# include +# include + +namespace boost { namespace detail { + +// is_incrementable metafunction +// +// Requires: Given x of type T&, if the expression ++x is well-formed +// it must have complete type; otherwise, it must neither be ambiguous +// nor violate access. + +// This namespace ensures that ADL doesn't mess things up. +namespace is_incrementable_ +{ + struct tag {}; + + // any soaks up implicit conversions and makes the following + // operator++ less-preferred than any other such operator which + // might be found via ADL. + struct any { template any(T const&); }; + tag operator++(any const&); + + // two check overloads help us identify which operator++ was picked + char (& check(tag) )[2]; + + template + char check(T const&); + + + template + struct +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + impl +# else + is_incrementable +# endif + { + static typename remove_cv::type& x; + + BOOST_STATIC_CONSTANT( + bool + , value = sizeof(is_incrementable_::check(++x)) == 1 + ); + + typedef mpl::bool_<( +# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + ::boost::detail::is_incrementable_::is_incrementable:: +# endif + value)> type; + }; +} + +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +template +struct is_incrementable : is_incrementable_::impl +{ +}; +# else +using is_incrementable_::is_incrementable; +# endif + +}} // namespace boost::detail + +#endif // IS_INCREMENTABLE_DWA200415_HPP diff --git a/boost/boost/detail/iterator.hpp b/boost/boost/detail/iterator.hpp index 40bfd41874..5a692ee4b7 100644 --- a/boost/boost/detail/iterator.hpp +++ b/boost/boost/detail/iterator.hpp @@ -52,17 +52,7 @@ # define ITERATOR_DWA122600_HPP_ # include -# include -# include -# include -# include -# include -# include # include -# include - -// should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" // STLPort 4.0 and betas have a bug when debugging is enabled and there is no // partial specialization: instead of an iterator_category typedef, the standard @@ -81,25 +71,29 @@ # endif // STLPort <= 4.1b4 && no partial specialization -namespace boost { namespace detail { - -BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) -BOOST_MPL_HAS_XXX_TRAIT_DEF(reference) -BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer) -BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type) -BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category) - # if !defined(BOOST_NO_STD_ITERATOR_TRAITS) \ && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_MSVC_STD_ITERATOR) + +namespace boost { namespace detail { + // Define a new template so it can be specialized template struct iterator_traits : std::iterator_traits {}; using std::distance; -# elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_MSVC_STD_ITERATOR) + +}} // namespace boost::detail + +# else + +# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_MSVC_STD_ITERATOR) + +// This is the case where everything conforms except BOOST_NO_STD_ITERATOR_TRAITS + +namespace boost { namespace detail { // Rogue Wave Standard Library fools itself into thinking partial // specialization is missing on some platforms (e.g. Sun), so fails to @@ -134,7 +128,36 @@ struct iterator_traits typedef std::random_access_iterator_tag iterator_category; }; -# else +}} // namespace boost::detail + +# else + +# include +# include +# include + +# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# include +# include +# endif +# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION +# include +# endif + +# include +# include +# include + +// should be the last #include +# include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace boost { namespace detail { + +BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) +BOOST_MPL_HAS_XXX_TRAIT_DEF(reference) +BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer) +BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type) +BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category) // is_mutable_iterator -- // @@ -150,6 +173,13 @@ struct iterator_traits template type_traits::yes_type is_mutable_iterator_helper(T const*, BOOST_DEDUCED_TYPENAME T::value_type*); +// Since you can't take the address of an rvalue, the guts of +// is_mutable_iterator_impl will fail if we use &*t directly. This +// makes sure we can still work with non-lvalue iterators. +template T* mutable_iterator_lvalue_helper(T& x); +int mutable_iterator_lvalue_helper(...); + + // This one detects output iterators such as ostream_iterator which // return references to themselves. template @@ -162,10 +192,14 @@ struct is_mutable_iterator_impl { static T t; - BOOST_STATIC_CONSTANT(bool, value = sizeof( - detail::is_mutable_iterator_helper((T*)0, &*t)) - == sizeof(type_traits::yes_type) - ); + BOOST_STATIC_CONSTANT( + bool, value = sizeof( + detail::is_mutable_iterator_helper( + (T*)0 + , mutable_iterator_lvalue_helper(*t) // like &*t + )) + == sizeof(type_traits::yes_type) + ); }; BOOST_TT_AUX_BOOL_TRAIT_DEF1( @@ -193,7 +227,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1( is_full_iterator_traits,T,::boost::detail::is_full_iterator_traits_impl::value) -# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF +# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF BOOST_MPL_HAS_XXX_TRAIT_DEF(_Iterator_category) // is_stlport_40_debug_iterator -- @@ -225,11 +259,11 @@ struct stlport_40_debug_iterator_traits typedef typename T::difference_type difference_type; typedef typename T::_Iterator_category iterator_category; }; -# endif // BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF +# endif // BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF template struct pointer_iterator_traits; -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template struct pointer_iterator_traits { @@ -239,9 +273,37 @@ struct pointer_iterator_traits typedef std::random_access_iterator_tag iterator_category; typedef std::ptrdiff_t difference_type; }; -# else -template -struct must_manually_specialize_boost_detail_iterator_traits; +# else + +// In case of no template partial specialization, and if T is a +// pointer, iterator_traits::value_type can still be computed. For +// some basic types, remove_pointer is manually defined in +// type_traits/broken_compiler_spec.hpp. For others, do it yourself. + +template class please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee; + +template +struct pointer_value_type + : mpl::if_< + is_same::type> + , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee

+ , typename remove_const< + typename remove_pointer

::type + >::type + > +{ +}; + + +template +struct pointer_reference + : mpl::if_< + is_same::type> + , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee

+ , typename remove_pointer

::type& + > +{ +}; template struct pointer_iterator_traits @@ -250,25 +312,11 @@ struct pointer_iterator_traits typedef std::random_access_iterator_tag iterator_category; typedef std::ptrdiff_t difference_type; - // Makes MSVC6 happy under some circumstances - typedef must_manually_specialize_boost_detail_iterator_traits value_type; - typedef must_manually_specialize_boost_detail_iterator_traits reference; + typedef typename pointer_value_type::type value_type; + typedef typename pointer_reference::type reference; }; -// Use this as a base class in manual iterator_traits specializations -// for pointer types. T should be the value_type. CV should be the -// cv-qualified value_type to which */& is added in order to produce -// pointer/reference. -template -struct ptr_iter_traits -{ - typedef T value_type; - typedef CV* pointer; - typedef CV& reference; - typedef std::random_access_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; -}; -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // We'll sort iterator types into one of these classifications, from which we // can determine the difference_type, pointer, reference, and value_type @@ -300,7 +348,7 @@ struct msvc_stdlib_const_traits typedef const value_type& reference; }; -# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION +# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION template struct is_bad_output_iterator : is_base_and_derived< @@ -317,7 +365,7 @@ struct bad_output_iterator_traits typedef void pointer; typedef void reference; }; -# endif +# endif // If we're looking at an MSVC6 (old Dinkumware) ``standard'' // iterator, this will generate an appropriate traits class. @@ -337,17 +385,17 @@ struct non_pointer_iterator_traits is_full_iterator_traits // Use a standard iterator_traits implementation , standard_iterator_traits -# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF +# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF // Check for STLPort 4.0 broken _Iterator_category type , mpl::if_< is_stlport_40_debug_iterator , stlport_40_debug_iterator_traits -# endif +# endif // Otherwise, assume it's a Dinkum iterator , msvc_stdlib_iterator_traits -# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF +# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF >::type -# endif +# endif >::type { }; @@ -368,16 +416,16 @@ struct iterator_traits // Explicit forwarding from base class needed to keep MSVC6 happy // under some circumstances. private: -# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION +# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION typedef typename mpl::if_< is_bad_output_iterator , bad_output_iterator_traits , iterator_traits_aux >::type base; -# else +# else typedef iterator_traits_aux base; -# endif +# endif public: typedef typename base::value_type value_type; typedef typename base::pointer pointer; @@ -387,7 +435,20 @@ struct iterator_traits }; // This specialization cuts off ETI (Early Template Instantiation) for MSVC. -template <> struct iterator_traits{}; +template <> struct iterator_traits +{ + typedef int value_type; + typedef int pointer; + typedef int reference; + typedef int difference_type; + typedef int iterator_category; +}; + +}} // namespace boost::detail + +# endif // workarounds + +namespace boost { namespace detail { namespace iterator_traits_ { @@ -396,7 +457,7 @@ namespace iterator_traits_ { static Difference execute(Iterator i1, const Iterator i2, ...) { - typename Difference result = 0; + Difference result = 0; while (i1 != i2) { ++i1; @@ -422,9 +483,11 @@ distance(Iterator first, Iterator last) return iterator_traits_::distance_select::execute( first, last, (iterator_category*)0); } -# endif // workarounds -}} // namespace boost::detail +}} + +# endif + # undef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF # undef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION diff --git a/boost/boost/detail/lightweight_mutex.hpp b/boost/boost/detail/lightweight_mutex.hpp index 1310da3755..9155940738 100644 --- a/boost/boost/detail/lightweight_mutex.hpp +++ b/boost/boost/detail/lightweight_mutex.hpp @@ -1,14 +1,16 @@ #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED #define BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // // boost/detail/lightweight_mutex.hpp - lightweight mutex // -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. @@ -64,15 +66,23 @@ // shared_ptr_timing_test.cpp will compile succesfully with a stub do-nothing // pthreads library, since it doesn't create any threads. -#ifndef BOOST_HAS_THREADS -# include +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(BOOST_LWM_USE_CRITICAL_SECTION) && !defined(BOOST_LWM_USE_PTHREADS) +# define BOOST_LWM_WIN32 +#endif + +#if !defined(BOOST_HAS_THREADS) +# if defined(BOOST_LWM_WIN32) +# include +# else +# include +# endif #elif defined(BOOST_LWM_USE_SPINLOCK) && defined(BOOST_USE_ASM_ATOMIC_H) # include #elif defined(BOOST_LWM_USE_CRITICAL_SECTION) # include #elif defined(BOOST_LWM_USE_PTHREADS) # include -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) +#elif defined(BOOST_LWM_WIN32) # include #elif defined(BOOST_LWM_USE_SPINLOCK) && defined(__sgi) # include diff --git a/boost/boost/detail/lwm_irix.hpp b/boost/boost/detail/lwm_irix.hpp index 2a5516182f..6e5e57f143 100644 --- a/boost/boost/detail/lwm_irix.hpp +++ b/boost/boost/detail/lwm_irix.hpp @@ -1,10 +1,6 @@ #ifndef BOOST_DETAIL_LWM_IRIX_HPP_INCLUDED #define BOOST_DETAIL_LWM_IRIX_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once -#endif - // // boost/detail/lwm_irix.hpp // diff --git a/boost/boost/detail/lwm_linux.hpp b/boost/boost/detail/lwm_linux.hpp index 62d8e64260..e4c23c331a 100644 --- a/boost/boost/detail/lwm_linux.hpp +++ b/boost/boost/detail/lwm_linux.hpp @@ -1,10 +1,6 @@ #ifndef BOOST_DETAIL_LWM_LINUX_HPP_INCLUDED #define BOOST_DETAIL_LWM_LINUX_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once -#endif - // // boost/detail/lwm_linux.hpp // diff --git a/boost/boost/detail/lwm_nop.hpp b/boost/boost/detail/lwm_nop.hpp index 671a5b0474..fdc0a3d9ee 100644 --- a/boost/boost/detail/lwm_nop.hpp +++ b/boost/boost/detail/lwm_nop.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_DETAIL_LWM_NOP_HPP_INCLUDED #define BOOST_DETAIL_LWM_NOP_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // diff --git a/boost/boost/detail/lwm_pthreads.hpp b/boost/boost/detail/lwm_pthreads.hpp index 8ee5550e2e..79ea5a7d59 100644 --- a/boost/boost/detail/lwm_pthreads.hpp +++ b/boost/boost/detail/lwm_pthreads.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED #define BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // diff --git a/boost/boost/detail/lwm_win32.hpp b/boost/boost/detail/lwm_win32.hpp index 6d37068e21..22282314fb 100644 --- a/boost/boost/detail/lwm_win32.hpp +++ b/boost/boost/detail/lwm_win32.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_DETAIL_LWM_WIN32_HPP_INCLUDED #define BOOST_DETAIL_LWM_WIN32_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // diff --git a/boost/boost/detail/lwm_win32_cs.hpp b/boost/boost/detail/lwm_win32_cs.hpp index 8b40ae9921..c4547de84e 100644 --- a/boost/boost/detail/lwm_win32_cs.hpp +++ b/boost/boost/detail/lwm_win32_cs.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED #define BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED -#if _MSC_VER >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // diff --git a/boost/boost/detail/none_t.hpp b/boost/boost/detail/none_t.hpp new file mode 100644 index 0000000000..76ba97a02f --- /dev/null +++ b/boost/boost/detail/none_t.hpp @@ -0,0 +1,28 @@ +// 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_DETAIL_NONE_T_17SEP2003_HPP +#define BOOST_DETAIL_NONE_T_17SEP2003_HPP + +namespace boost { + +namespace detail { + +struct none_helper{}; + +typedef int none_helper::*none_t ; + +} // namespace detail + +} // namespace boost + +#endif + diff --git a/boost/boost/detail/ob_call_traits.hpp b/boost/boost/detail/ob_call_traits.hpp index 9cb58adcd3..eb4df7a30f 100644 --- a/boost/boost/detail/ob_call_traits.hpp +++ b/boost/boost/detail/ob_call_traits.hpp @@ -1,10 +1,9 @@ // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// 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 for most recent version including documentation. +// 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. // // Crippled version for crippled compilers: // see libs/utility/call_traits.htm diff --git a/boost/boost/detail/ob_compressed_pair.hpp b/boost/boost/detail/ob_compressed_pair.hpp index a9e7b3ef6f..727acab6da 100644 --- a/boost/boost/detail/ob_compressed_pair.hpp +++ b/boost/boost/detail/ob_compressed_pair.hpp @@ -1,10 +1,9 @@ // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// 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 for most recent version including documentation. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/utility for most recent version including documentation. // see libs/utility/compressed_pair.hpp // /* Release notes: @@ -293,22 +292,24 @@ public: typedef typename call_traits::const_reference second_const_reference; compressed_pair_4() : T1() {} - compressed_pair_4(first_param_type x, second_param_type) : T1(x) {} + compressed_pair_4(first_param_type x, second_param_type y) : T1(x), m_second(y) {} // only one single argument constructor since T1 == T2 - explicit compressed_pair_4(first_param_type x) : T1(x) {} + explicit compressed_pair_4(first_param_type x) : T1(x), m_second(x) {} compressed_pair_4(const ::boost::compressed_pair& x) - : T1(x.first()){} + : T1(x.first()), m_second(x.second()) {} first_reference first() { return *this; } first_const_reference first() const { return *this; } - second_reference second() { return *this; } - second_const_reference second() const { return *this; } + second_reference second() { return m_second; } + second_const_reference second() const { return m_second; } void swap(compressed_pair_4& y) { // no need to swap empty base classes: } +private: + T2 m_second; }; // T1 == T2, not empty diff --git a/boost/boost/detail/reference_content.hpp b/boost/boost/detail/reference_content.hpp new file mode 100644 index 0000000000..382e491526 --- /dev/null +++ b/boost/boost/detail/reference_content.hpp @@ -0,0 +1,145 @@ +//----------------------------------------------------------------------------- +// boost detail/reference_content.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2003 +// Eric Friedman +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP +#define BOOST_DETAIL_REFERENCE_CONTENT_HPP + +#include "boost/config.hpp" + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +# include "boost/mpl/bool.hpp" +# include "boost/type_traits/has_nothrow_copy.hpp" +#else +# include "boost/mpl/if.hpp" +# include "boost/type_traits/is_reference.hpp" +#endif + +#include "boost/mpl/void.hpp" + +namespace boost { + +namespace detail { + +/////////////////////////////////////////////////////////////////////////////// +// (detail) class template reference_content +// +// Non-Assignable wrapper for references. +// +template +class reference_content +{ +private: // representation + + RefT content_; + +public: // structors + + ~reference_content() + { + } + + reference_content(RefT r) + : content_( r ) + { + } + + reference_content(const reference_content& operand) + : content_( operand.content_ ) + { + } + +private: // non-Assignable + + reference_content& operator=(const reference_content&); + +public: // queries + + RefT get() const + { + return content_; + } + +}; + +/////////////////////////////////////////////////////////////////////////////// +// (detail) metafunction make_reference_content +// +// Wraps with reference_content if specified type is reference. +// + +template struct make_reference_content; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template +struct make_reference_content +{ + typedef T type; +}; + +template +struct make_reference_content< T& > +{ + typedef reference_content type; +}; + +#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template +struct make_reference_content + : mpl::if_< + is_reference + , reference_content + , T + > +{ +}; + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround + +template <> +struct make_reference_content< mpl::void_ > +{ + template + struct apply + : make_reference_content + { + }; + + typedef mpl::void_ type; +}; + +} // namespace detail + +/////////////////////////////////////////////////////////////////////////////// +// reference_content type traits specializations +// + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template +struct has_nothrow_copy< + ::boost::detail::reference_content< T& > + > + : mpl::true_ +{ +}; + +#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +} // namespace boost + +#endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP diff --git a/boost/boost/detail/shared_count.hpp b/boost/boost/detail/shared_count.hpp index 39028b4bdd..2d14179ff3 100644 --- a/boost/boost/detail/shared_count.hpp +++ b/boost/boost/detail/shared_count.hpp @@ -1,6 +1,8 @@ #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED #define BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED +// MS compatible compilers support #pragma once + #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif @@ -115,14 +117,21 @@ public: virtual void * get_deleter(std::type_info const & ti) = 0; - void add_ref() + void add_ref_copy() { #if defined(BOOST_HAS_THREADS) mutex_type::scoped_lock lock(mtx_); #endif - if(use_count_ == 0 && weak_count_ != 0) boost::throw_exception(boost::bad_weak_ptr()); ++use_count_; - ++weak_count_; + } + + void add_ref_lock() + { +#if defined(BOOST_HAS_THREADS) + mutex_type::scoped_lock lock(mtx_); +#endif + if(use_count_ == 0) boost::throw_exception(boost::bad_weak_ptr()); + ++use_count_; } void release() // nothrow @@ -133,11 +142,7 @@ public: #endif long new_use_count = --use_count_; - if(new_use_count != 0) - { - --weak_count_; - return; - } + if(new_use_count != 0) return; } dispose(); @@ -182,12 +187,10 @@ private: sp_counted_base(sp_counted_base const &); sp_counted_base & operator= (sp_counted_base const &); - // inv: use_count_ <= weak_count_ + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) - long use_count_; - long weak_count_; - -#if defined(BOOST_HAS_THREADS) +#if defined(BOOST_HAS_THREADS) || defined(BOOST_LWM_WIN32) mutable mutex_type mtx_; #endif }; @@ -369,7 +372,7 @@ public: r.release(); } -#endif +#endif ~shared_count() // nothrow { @@ -384,7 +387,7 @@ public: , id_(shared_count_id) #endif { - if(pi_ != 0) pi_->add_ref(); + if(pi_ != 0) pi_->add_ref_copy(); } explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 @@ -392,7 +395,7 @@ public: shared_count & operator= (shared_count const & r) // nothrow { sp_counted_base * tmp = r.pi_; - if(tmp != 0) tmp->add_ref(); + if(tmp != 0) tmp->add_ref_copy(); if(pi_ != 0) pi_->release(); pi_ = tmp; @@ -532,7 +535,7 @@ inline shared_count::shared_count(weak_count const & r): pi_(r.pi_) { if(pi_ != 0) { - pi_->add_ref(); + pi_->add_ref_lock(); } else { diff --git a/boost/boost/detail/workaround.hpp b/boost/boost/detail/workaround.hpp index 995c53ca85..0d5a2b2bcb 100644 --- a/boost/boost/detail/workaround.hpp +++ b/boost/boost/detail/workaround.hpp @@ -62,7 +62,7 @@ # define BOOST_OPEN_PAREN ( # define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1 # else -# define BOOST_TESTED_AT(value) != 0 +# define BOOST_TESTED_AT(value) != ((value)-(value)) # endif # else diff --git a/boost/boost/enable_shared_from_this.hpp b/boost/boost/enable_shared_from_this.hpp new file mode 100644 index 0000000000..d3f8ab80b8 --- /dev/null +++ b/boost/boost/enable_shared_from_this.hpp @@ -0,0 +1,68 @@ +#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 +// +// 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. +// +// 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 + weak_ptr<_internal_element_type> _internal_weak_this; +}; + +} // namespace boost + +#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED diff --git a/boost/boost/filesystem/config.hpp b/boost/boost/filesystem/config.hpp new file mode 100644 index 0000000000..4c5bf25f11 --- /dev/null +++ b/boost/boost/filesystem/config.hpp @@ -0,0 +1,62 @@ +// boost/filesystem/config.hpp ---------------------------------------------// + +// © Copyright Beman Dawes 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) + +// See library home page at http://www.boost.org/libs/filesystem + +//----------------------------------------------------------------------------// + +#ifndef BOOST_FILESYSTEM_CONFIG_HPP +#define BOOST_FILESYSTEM_CONFIG_HPP + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +#include + +// enable dynamic linking on Windows ---------------------------------------// + +#ifdef BOOST_HAS_DECLSPEC // defined in config system +// we need to import/export our code only if the user has specifically +// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost +// libraries to be dynamically linked, or BOOST_FILESYSTEM_DYN_LINK +// if they want just this one to be dynamically liked: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) +// export if this is our own source, otherwise import: +#ifdef BOOST_FILESYSTEM_SOURCE +# define BOOST_FILESYSTEM_DECL __declspec(dllexport) +#else +# define BOOST_FILESYSTEM_DECL __declspec(dllimport) +#endif // BOOST_FILESYSTEM_SOURCE +#endif // DYN_LINK +#endif // BOOST_HAS_DECLSPEC +// +// if BOOST_FILESYSTEM_DECL isn't defined yet define it now: +#ifndef BOOST_FILESYSTEM_DECL +#define BOOST_FILESYSTEM_DECL +#endif + +// enable automatic library variant selection ------------------------------// + +#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB) +// +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#define BOOST_LIB_NAME boost_filesystem +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include +#endif // auto-linking disabled + +#endif // BOOST_FILESYSTEM_CONFIG_HPP diff --git a/boost/boost/filesystem/convenience.hpp b/boost/boost/filesystem/convenience.hpp index 5a5f428e32..2f50c8751b 100644 --- a/boost/boost/filesystem/convenience.hpp +++ b/boost/boost/filesystem/convenience.hpp @@ -1,23 +1,23 @@ // boost/filesystem/convenience.hpp ----------------------------------------// -// (C) Copyright Beman Dawes, 2002 -// (C) Copyright Vladimir Prus, 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. +// © Copyright Beman Dawes, 2002 +// © Copyright Vladimir Prus, 2002 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/filesystem for documentation. +// See library home page at http://www.boost.org/libs/filesystem //----------------------------------------------------------------------------// #ifndef BOOST_FILESYSTEM_CONVENIENCE_HPP #define BOOST_FILESYSTEM_CONVENIENCE_HPP -#include +#include // includes #include +#include // must be the last header + namespace boost { namespace filesystem @@ -26,13 +26,17 @@ namespace boost // create_directories (contributed by Vladimir Prus) -----------------------// - /** Creates directory 'ph' and all necessary parent directories. - @post exists(directory_ph) && is_directory(directory_ph) && is_empty(directory_ph) - */ - void create_directories(const path& ph); + BOOST_FILESYSTEM_DECL void create_directories(const path& ph); + + BOOST_FILESYSTEM_DECL std::string extension(const path& ph); + + BOOST_FILESYSTEM_DECL std::string basename(const path& ph); + + BOOST_FILESYSTEM_DECL path change_extension(const path& ph, + const std::string& new_extension); } // namespace filesystem } // namespace boost -#endif // BOOST_FILESYSTEM_CONVENIENCE_HPP - +#include // pops abi_suffix.hpp pragmas +#endif // BOOST_FILESYSTEM_CONVENIENCE_HPP diff --git a/boost/boost/filesystem/exception.hpp b/boost/boost/filesystem/exception.hpp index 8f3c9ebda3..884df03129 100644 --- a/boost/boost/filesystem/exception.hpp +++ b/boost/boost/filesystem/exception.hpp @@ -1,29 +1,27 @@ // boost/filesystem/exception.hpp ------------------------------------------// -// < ----------------------------------------------------------------------- > -// < Copyright © 2002 Beman Dawes > -// < Copyright © 2001 Dietmar Kühl, All Rights Reserved > -// < > -// < Permission to use, copy, modify, distribute and sell this > -// < software for any purpose is hereby granted without fee, provided > -// < that the above copyright notice appears in all copies and that > -// < both that copyright notice and this permission notice appear in > -// < supporting documentation. The authors make no representations about > -// < the suitability of this software for any purpose. It is provided > -// < "as is" without express or implied warranty. > -// < ----------------------------------------------------------------------- > - -// See http://www.boost.org/libs/filesystem for documentation. +// Copyright © 2002 Beman Dawes +// Copyright © 2001 Dietmar Kühl +// +// 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 library home page at http://www.boost.org/libs/filesystem //----------------------------------------------------------------------------// #ifndef BOOST_FILESYSTEM_EXCEPTION_HPP #define BOOST_FILESYSTEM_EXCEPTION_HPP +#include #include #include -#include +#include +#include + +#include // must be the last header //----------------------------------------------------------------------------// @@ -33,7 +31,7 @@ namespace boost { namespace detail { - int system_error_code(); // artifact of POSIX and WINDOWS error reporting + BOOST_FILESYSTEM_DECL int system_error_code(); // artifact of POSIX and WINDOWS error reporting } enum error_code @@ -58,7 +56,7 @@ namespace boost }; - class filesystem_error : public std::runtime_error + class BOOST_FILESYSTEM_DECL filesystem_error : public std::exception { public: @@ -84,6 +82,8 @@ namespace boost ~filesystem_error() throw(); + virtual const char * what() const throw(); + int native_error() const { return m_sys_err; } // Note: a value of 0 implies a library (rather than system) error error_code error() const { return m_err; } @@ -92,14 +92,14 @@ namespace boost const path & path2() const; // argument 2 to who; may be empty() private: - int m_sys_err; - error_code m_err; - std::string m_who; - path m_path1; - path m_path2; + class m_imp; + shared_ptr m_imp_ptr; + int m_sys_err; + error_code m_err; }; } // namespace filesystem } // namespace boost +#include // pops abi_suffix.hpp pragmas #endif // BOOST_FILESYSTEM_EXCEPTION_HPP diff --git a/boost/boost/filesystem/fstream.hpp b/boost/boost/filesystem/fstream.hpp index 3c9a4d280d..75fc9b2b2e 100644 --- a/boost/boost/filesystem/fstream.hpp +++ b/boost/boost/filesystem/fstream.hpp @@ -1,22 +1,25 @@ // boost/filesystem/fstream.hpp --------------------------------------------// -// (C) Copyright Beman Dawes 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. +// Copyright Beman Dawes 2002. +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) -// See http://www.boost.org/libs/filesystem for documentation. +// See library home page at http://www.boost.org/libs/filesystem //----------------------------------------------------------------------------// #ifndef BOOST_FILESYSTEM_FSTREAM_HPP #define BOOST_FILESYSTEM_FSTREAM_HPP -#include +#include // includes +#include #include #include +#include // must be the last header + namespace boost { namespace filesystem @@ -26,8 +29,7 @@ namespace boost { public: virtual ~basic_filebuf() {} - -#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 // VC++ 6.0 can't handle this +#if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this std::basic_filebuf * open( const path & file_ph, std::ios_base::openmode mode ) { @@ -47,19 +49,40 @@ namespace boost { public: basic_ifstream() {} +#if !BOOST_WORKAROUND( BOOST_MSVC, == 1310 ) explicit basic_ifstream( const path & file_ph, std::ios_base::openmode mode = std::ios_base::in ) : std::basic_ifstream( file_ph.native_file_string().c_str(), mode ) {} - virtual ~basic_ifstream() {} -#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 // VC++ 6.0 can't handle this +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this void open( const path & file_ph, std::ios_base::openmode mode = std::ios_base::in ) { std::basic_ifstream::open( file_ph.native_file_string().c_str(), mode ); } +# endif +#else // workaround for VC++ 7.1 bug id VSWhidbey 38416 + explicit basic_ifstream( const path & file_ph ) + : std::basic_ifstream( + file_ph.native_file_string().c_str(), std::ios_base::in ) {} + basic_ifstream( const path & file_ph, + std::ios_base::openmode mode ) + : std::basic_ifstream( + file_ph.native_file_string().c_str(), mode ) {} + void open( const path & file_ph ) + { + std::basic_ifstream::open( + file_ph.native_file_string().c_str(), std::ios_base::in ); + } + void open( const path & file_ph, + std::ios_base::openmode mode ) + { + std::basic_ifstream::open( + file_ph.native_file_string().c_str(), mode ); + } #endif + virtual ~basic_ifstream() {} }; typedef basic_ifstream ifstream; @@ -72,19 +95,40 @@ namespace boost { public: basic_ofstream() {} +#if !BOOST_WORKAROUND( BOOST_MSVC, == 1310 ) explicit basic_ofstream( const path & file_ph, std::ios_base::openmode mode = std::ios_base::out ) : std::basic_ofstream( file_ph.native_file_string().c_str(), mode ) {} - virtual ~basic_ofstream() {} -#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 // VC++ 6.0 can't handle this +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this void open( const path & file_ph, std::ios_base::openmode mode = std::ios_base::out ) { std::basic_ofstream::open( file_ph.native_file_string().c_str(), mode ); } +# endif +#else // workaround for VC++ 7.1 bug id VSWhidbey 38416 + explicit basic_ofstream( const path & file_ph ) + : std::basic_ofstream( + file_ph.native_file_string().c_str(), std::ios_base::out ) {} + basic_ofstream( const path & file_ph, + std::ios_base::openmode mode ) + : std::basic_ofstream( + file_ph.native_file_string().c_str(), mode ) {} + void open( const path & file_ph ) + { + std::basic_ofstream::open( + file_ph.native_file_string().c_str(), std::ios_base::out ); + } + void open( const path & file_ph, + std::ios_base::openmode mode ) + { + std::basic_ofstream::open( + file_ph.native_file_string().c_str(), mode ); + } #endif + virtual ~basic_ofstream() {} }; typedef basic_ofstream ofstream; @@ -97,19 +141,42 @@ namespace boost { public: basic_fstream() {} +#if !BOOST_WORKAROUND( BOOST_MSVC, == 1310 ) explicit basic_fstream( const path & file_ph, std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out ) : std::basic_fstream( file_ph.native_file_string().c_str(), mode ) {} - virtual ~basic_fstream() {} -#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 // VC++ 6.0 can't handle this +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this void open( const path & file_ph, std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out ) { std::basic_fstream::open( file_ph.native_file_string().c_str(), mode ); } +# endif +#else // workaround for VC++ 7.1 bug id VSWhidbey 38416 + explicit basic_fstream( const path & file_ph ) + : std::basic_fstream( + file_ph.native_file_string().c_str(), + std::ios_base::in|std::ios_base::out ) {} + basic_fstream( const path & file_ph, + std::ios_base::openmode mode ) + : std::basic_fstream( + file_ph.native_file_string().c_str(), mode ) {} + void open( const path & file_ph ) + { + std::basic_fstream::open( + file_ph.native_file_string().c_str(), + std::ios_base::in|std::ios_base::out ); + } + void open( const path & file_ph, + std::ios_base::openmode mode ) + { + std::basic_fstream::open( + file_ph.native_file_string().c_str(), mode ); + } #endif + virtual ~basic_fstream() {} }; typedef basic_fstream fstream; @@ -120,5 +187,5 @@ namespace boost } // namespace boost +#include // pops abi_suffix.hpp pragmas #endif // BOOST_FILESYSTEM_FSTREAM_HPP - diff --git a/boost/boost/filesystem/operations.hpp b/boost/boost/filesystem/operations.hpp index b5c38b9360..739067d0fa 100644 --- a/boost/boost/filesystem/operations.hpp +++ b/boost/boost/filesystem/operations.hpp @@ -1,32 +1,32 @@ // boost/filesystem/directory.hpp ------------------------------------------// -// < ----------------------------------------------------------------------- > -// < Copyright © 2002 Beman Dawes. > -// < Copyright © 2002 Jan Langer. > -// < Copyright © 2001 Dietmar Kühl, All Rights Reserved > -// < > -// < Permission to use, copy, modify, distribute and sell this > -// < software for any purpose is hereby granted without fee, provided > -// < that the above copyright notice appears in all copies and that > -// < both that copyright notice and this permission notice appear in > -// < supporting documentation. The authors make no representations about > -// < the suitability of this software for any purpose. It is provided > -// < "as is" without express or implied warranty. > -// < ----------------------------------------------------------------------- > - -// See http://www.boost.org/libs/filesystem for documentation. +// Copyright © 2002, 2003 Beman Dawes +// Copyright © 2002 Jan Langer +// Copyright © 2001 Dietmar Kühl +// +// 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 library home page at http://www.boost.org/libs/filesystem //----------------------------------------------------------------------------// #ifndef BOOST_FILESYSTEM_DIRECTORY_HPP #define BOOST_FILESYSTEM_DIRECTORY_HPP -#include -#include +#include // includes #include #include #include +#include + +#include // must be the last header + +# ifdef BOOST_NO_STDC_NAMESPACE + namespace std { using ::time_t; } +# endif //----------------------------------------------------------------------------// @@ -37,62 +37,75 @@ namespace boost // query functions ---------------------------------------------------------// - bool exists( const path & ph ); - - bool is_directory( const path & ph ); + BOOST_FILESYSTEM_DECL bool exists( const path & ph ); + BOOST_FILESYSTEM_DECL bool symbolic_link_exists( const path & ph ); + BOOST_FILESYSTEM_DECL bool is_directory( const path & ph ); // VC++ 7.0 and earlier has a serious namespace bug that causes a clash // between boost::filesystem::is_empty and the unrelated type trait // boost::is_empty. The workaround for those who must use broken versions // of VC++ is to use the function _is_empty. All others should use the // correct is_empty name. - bool _is_empty( const path & ph ); // deprecated + BOOST_FILESYSTEM_DECL bool _is_empty( const path & ph ); // deprecated # if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 inline bool is_empty( const path & ph ) { return _is_empty( ph ); } # endif + BOOST_FILESYSTEM_DECL std::time_t last_write_time( const path & ph ); + BOOST_FILESYSTEM_DECL void last_write_time( const path & ph, const std::time_t new_time ); + // operations --------------------------------------------------------------// - void create_directory( const path & directory_ph ); + BOOST_FILESYSTEM_DECL void create_directory( const path & directory_ph ); - bool remove( const path & ph ); - unsigned long remove_all( const path & ph ); + BOOST_FILESYSTEM_DECL bool remove( const path & ph ); + BOOST_FILESYSTEM_DECL unsigned long remove_all( const path & ph ); - void rename( const path & from_path, + BOOST_FILESYSTEM_DECL void rename( const path & from_path, const path & to_path ); - void copy_file( const path & from_file_ph, + BOOST_FILESYSTEM_DECL void copy_file( const path & from_file_ph, const path & to_file_ph ); - path current_path(); - const path & initial_path(); + BOOST_FILESYSTEM_DECL path current_path(); + BOOST_FILESYSTEM_DECL const path & initial_path(); - path system_complete( const path & ph ); - path complete( const path & ph, const path & base = initial_path() ); + BOOST_FILESYSTEM_DECL path system_complete( const path & ph ); + BOOST_FILESYSTEM_DECL path complete( const path & ph, const path & base = initial_path() ); + +// directory_iterator helpers ----------------------------------------------// +// forwarding functions avoid need for BOOST_FILESYSTEM_DECL for class +// directory_iterator, and so avoid iterator_facade DLL template problems + namespace detail + { + class dir_itr_imp; + // shared_ptr provides shallow-copy semantics required for InputIterators + typedef boost::shared_ptr< dir_itr_imp > dir_itr_imp_ptr; + BOOST_FILESYSTEM_DECL void dir_itr_init( dir_itr_imp_ptr & m_imp, + const path & dir_path ); + BOOST_FILESYSTEM_DECL path & dir_itr_dereference( + const dir_itr_imp_ptr & m_imp ); + BOOST_FILESYSTEM_DECL void dir_itr_increment( dir_itr_imp_ptr & m_imp ); + } // namespace detail // directory_iterator ------------------------------------------------------// class directory_iterator - : public boost::iterator< std::input_iterator_tag, - path, std::ptrdiff_t, const path *, const path & > + : public boost::iterator_facade< + directory_iterator, + path, + boost::single_pass_traversal_tag > { - private: - typedef directory_iterator self; public: - directory_iterator(); // creates the "end" iterator - explicit directory_iterator( const path & p ); - - reference operator*() const { return m_deref(); } - pointer operator->() const { return &m_deref(); } - self & operator++() { m_inc(); return *this; } - - friend bool operator==( const self & x, const self & y ) - { return x.m_imp == y.m_imp; } - friend bool operator!=( const self & x, const self & y ) - { return !(x.m_imp == y.m_imp); } - - struct path_proxy // allows *i++ to work, as required by std + directory_iterator(){} // creates the "end" iterator + explicit directory_iterator( const path & p ) + { detail::dir_itr_init( m_imp, p ); } + +/* +The *r++ requirement doesn't appear to apply to the new single_pass_traversal category +Thus I'm leaving the proxy out pending confirmation from the N1477 authors +struct path_proxy // allows *r++ to work, as required by 24.1.1 { path pv; explicit path_proxy( const path & p ) : pv(p) {} @@ -105,17 +118,21 @@ namespace boost ++*this; return pp; } +*/ private: - class dir_itr_imp; - // shared_ptr provides shallow-copy semantics required for InputIterators - typedef boost::shared_ptr< dir_itr_imp > m_imp_ptr; - m_imp_ptr m_imp; - reference m_deref() const; - void m_inc(); + detail::dir_itr_imp_ptr m_imp; + friend class boost::iterator_core_access; + reference dereference() const + { return detail::dir_itr_dereference( m_imp ); } + void increment() + { detail::dir_itr_increment( m_imp ); } + bool equal( const directory_iterator & rhs ) const + { return m_imp == rhs.m_imp; } }; - } // namespace filesystem } // namespace boost + +#include // pops abi_suffix.hpp pragmas #endif // BOOST_FILESYSTEM_DIRECTORY_HPP diff --git a/boost/boost/filesystem/path.hpp b/boost/boost/filesystem/path.hpp index 42e41d540a..8f8cca47ec 100644 --- a/boost/boost/filesystem/path.hpp +++ b/boost/boost/filesystem/path.hpp @@ -1,57 +1,40 @@ // boost/filesystem/path.hpp -----------------------------------------------// -// (C) Copyright Beman Dawes 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. +// © Copyright Beman Dawes 2002-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) - -// See http://www.boost.org/libs/filesystem for documentation. +// See library home page at http://www.boost.org/libs/filesystem //----------------------------------------------------------------------------// #ifndef BOOST_FILESYSTEM_PATH_HPP #define BOOST_FILESYSTEM_PATH_HPP -#include +#include +#include #include #include +#include // must be the last header + //----------------------------------------------------------------------------// namespace boost { namespace filesystem { - class path; + class directory_iterator; - namespace detail - { - struct path_itr_imp - { - std::string name; // cache current element. - const path * path_ptr; // path being iterated over. - std::string::size_type pos; // position of name in - // path_ptr->string(). The - // end() iterator is indicated by - // pos == path_ptr->string().size() - - const std::string & operator*() const { return name; } - void operator++(); - void operator--(); - bool operator==( const path_itr_imp & rhs ) const - { return path_ptr == rhs.path_ptr && pos == rhs.pos; } - }; - } // detail - - enum path_format { native }; // ugly enough to discourage use - // except when actually needed // path -------------------------------------------------------------------// - class path + class BOOST_FILESYSTEM_DECL path { public: + typedef bool (*name_check)( const std::string & name ); + // compiler generates copy constructor, copy assignment, and destructor path(){} @@ -59,14 +42,17 @@ namespace boost path( const std::string & src ); path( const char * src ); - path( const std::string & src, path_format ); - path( const char * src, path_format ); + path( const std::string & src, name_check checker ); + path( const char * src, name_check checker ); // append operations: path & operator /=( const path & rhs ); path operator /( const path & rhs ) const { return path( *this ) /= rhs; } + // modification functions: + path & normalize(); + // conversion functions: const std::string & string() const { return m_path; } std::string native_file_string() const; @@ -93,25 +79,43 @@ namespace boost bool has_branch_path() const; // iteration over the names in the path: - typedef boost::iterator_adaptor< - detail::path_itr_imp, - boost::default_iterator_policies, - std::string, - const std::string &, - const std::string *, - std::bidirectional_iterator_tag, - std::ptrdiff_t - > iterator; + class iterator : public boost::iterator_facade< + iterator, + std::string const, + boost::single_pass_traversal_tag > + { + private: + friend class boost::iterator_core_access; + friend class boost::filesystem::path; + + reference dereference() const { return m_name; } + bool equal( const iterator & rhs ) const + { return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; } + void increment(); + void decrement(); + + std::string m_name; // cache current element. + const path * m_path_ptr; // path being iterated over. + std::string::size_type m_pos; // position of name in + // path_ptr->string(). The + // end() iterator is indicated by + // pos == path_ptr->string().size() + }; iterator begin() const; iterator end() const { iterator itr; - itr.base().path_ptr = this; - itr.base().pos = m_path.size(); + itr.m_path_ptr = this; + itr.m_pos = m_path.size(); return itr; } + // default name_check mechanism: + static bool default_name_check_writable(); + static void default_name_check( name_check new_check ); + static name_check default_name_check(); + private: // Note: This is an implementation for POSIX and Windows, where there // are only minor differences between generic and system-specific @@ -123,14 +127,12 @@ namespace boost std::string m_path; friend class directory_iterator; - friend struct boost::filesystem::detail::path_itr_imp; - - enum source_context { generic, platform, nocheck }; - - void m_path_append( const std::string & src, - source_context context = generic ); + // Was qualified; como433beta8 reports: + // warning #427-D: qualified name is not allowed in member declaration + friend class iterator; public: // should be private, but friend functions don't work for me + void m_path_append( const std::string & src, name_check checker ); void m_replace_leaf( const char * new_leaf ); }; @@ -142,72 +144,20 @@ namespace boost inline path operator / ( const std::string & lhs, const path & rhs ) { return path( lhs ) /= rhs; } - // error checking --------------------------------------------------------// - -// TODO: write a program that probes valid file and directory names. Ask -// Boost people to report results from many operating systems. Use results -// to adjust generic_name(). - - // generic_name() is extremely permissive; its intent is not to ensure - // general portablity, but rather to detect names so trouble-prone that - // they likely represent coding errors or gross misconceptions. - // - // Any characters are allowed except: - // - // Those characters < ' ', including '\0'. These are the so-called - // control characters, in both ASCII (and its decendents) and EBCDIC. - // Hard to imagine how these could be useful in a generic path name. - // - // < > : " / \ | * ? These have special meaning to enough operating - // systems that use in a generic name would be a serious problem. - // - // The names "." and ".." are not allowed. - // An empty name (null string) is not allowed. - // Names beginning or ending with spaces are not allowed. - // - bool generic_name( const std::string & name ); - - // posix_name() is based on POSIX (IEEE Std 1003.1-2001) - // "Portable Filename Character Set" rules. - // http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap03.html - // - // That character set only allows 0-9, a-z, A-Z, '.', '_', and '-'. - // Note that such names are also portable to other popular operating - // systems, such as Windows. - // - bool posix_name( const std::string & name ); - - const path & check_posix_leaf( const path & ph ); - // Throws: if !posix_name( ph.leaf() ) - // Returns: ph - // Note: Although useful in its own right, check_posix_leaf() also serves - // as an example. A user might provide similar functions; behavior might - // be to assert or warn rather than throw. A user provided function - // could also check the entire path instead of just the leaf; a leaf - // check is often, but not always, the required behavior. - // Rationale: For the "const path &" rather than "void" return is to - // allow (and encourage portability checking) uses like: - // create_directory( check_posix_leaf( "foo" ) ); - // While there is some chance of misuse (by passing through a reference - // to a temporary), the benefits outweigh the costs. - - // For Boost, we often tighten name restrictions for maximum portability: - // - // * The portable POSIX character restrictions, plus - // * Maximum name length 31 characters (for Classic Mac OS). - // * Lowercase only (so code written on case-insensitive platforms like - // Windows works properly when used on case-sensitive systems like - // POSIX. - // * Directory names do not contain '.', as this is not a valid character - // for directory names on some systems. - // - // TODO: provide some check_boost_xxx functions once error handling - // approach ratified. - - bool boost_file_name( const std::string & name ); - bool boost_directory_name( const std::string & name ); + // path::name_checks ---------------------------------------------------// + + BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name ); + BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name ); + BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name ); + BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name ); + BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name ); + BOOST_FILESYSTEM_DECL bool no_check( const std::string & name ); // always returns true + BOOST_FILESYSTEM_DECL bool native( const std::string & name ); + // native(name) must return true for any name which MIGHT be valid + // on the native platform. } // namespace filesystem } // namespace boost +#include // pops abi_suffix.hpp pragmas #endif // BOOST_FILESYSTEM_PATH_HPP diff --git a/boost/boost/format.hpp b/boost/boost/format.hpp index 0cd5023fbd..3736181fd3 100644 --- a/boost/boost/format.hpp +++ b/boost/boost/format.hpp @@ -3,14 +3,11 @@ // See http://www.boost.org for updates, documentation, and revision history. // (C) Samuel Krempp 2001 -// krempp@crans.ens-cachan.fr // 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. -// ideas taken from Rüdiger Loos's format class -// and Karl Nelson's ofstream // ---------------------------------------------------------------------------- // format.hpp : primary header @@ -21,47 +18,20 @@ #include #include -#include -#include #include +#include #ifndef BOOST_NO_STD_LOCALE #include #endif - -// make sure our local macros wont override something : -#if defined(BOOST_NO_LOCALE_ISDIGIT) || defined(BOOST_OVERLOAD_FOR_NON_CONST) \ - || defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION ) -#error "a local macro would overwrite a previously defined macro" -#endif - - -#include // stlport workarounds -#include - -#if defined(BOOST_NO_STD_LOCALE) || \ - ( BOOST_WORKAROUND(__BORLANDC__, <= 0x564) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT( 0x570 ) ) ) -// some future __BORLANDC__ >0x564 versions might not need this -// 0x570 is Borland's kylix branch -#define BOOST_NO_LOCALE_ISIDIGIT -#endif - #ifdef BOOST_NO_LOCALE_ISIDIGIT #include // we'll use the non-locale 's std::isdigit(int) #endif - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570) ) || BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1300)) -#define BOOST_NO_OVERLOAD_FOR_NON_CONST -#endif - - // **** Forward declarations ---------------------------------- -#include // basic_format, and other frontends -#include // misc forward declarations for internal use - +#include // basic_format, and other frontends +#include // misc forward declarations for internal use // **** Auxiliary structs (stream_format_state , and format_item ) #include @@ -74,9 +44,7 @@ // **** Implementation ------------------------------------------- #include // member functions - #include // class for grouping arguments - #include // argument-feeding functions #include // format-string parsing (member-)functions @@ -85,17 +53,6 @@ // *** Undefine 'local' macros : -#ifdef BOOST_NO_OVERLOAD_FOR_NON_CONST -#undef BOOST_NO_OVERLOAD_FOR_NON_CONST -#endif -#ifdef BOOST_NO_LOCALE_ISIDIGIT -#undef BOOST_NO_LOCALE_ISIDIGIT -#endif -#ifdef BOOST_IO_STD -#undef BOOST_IO_STD -#endif -#ifdef BOOST_IO_NEEDS_USING_DECLARATION -#undef BOOST_IO_NEEDS_USING_DECLARATION -#endif +#include #endif // BOOST_FORMAT_HPP diff --git a/boost/boost/format/detail/config_macros.hpp b/boost/boost/format/detail/config_macros.hpp new file mode 100644 index 0000000000..c598fc131d --- /dev/null +++ b/boost/boost/format/detail/config_macros.hpp @@ -0,0 +1,75 @@ +// -*- C++ -*- +// Boost general library 'format' --------------------------- +// See http://www.boost.org for updates, documentation, and revision history. + +// (C) Samuel Krempp 2001 +// 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. + +// ------------------------------------------------------------------------------ +// config_macros.hpp : configuration macros for the format library +// only BOOST_IO_STD is absolutely needed. other are just used to trigger workaround +// codes here and there. +// ------------------------------------------------------------------------------ + +#ifndef BOOST_FORMAT_CONFIG_MACROS_HPP +#define BOOST_FORMAT_CONFIG_MACROS_HPP + +#include +#include + +// make sure our local macros wont override something : +#if defined(BOOST_NO_LOCALE_ISDIGIT) || defined(BOOST_OVERLOAD_FOR_NON_CONST) \ + || defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION ) +#error "boost::format defines a local macro that would overwrite a previously defined macro." +#endif + +// specific workarounds. each header can define BOOS_IO_STD if it +// needs. (e.g. because of IO_NEEDS_USING_DECLARATION) +#include +#include // stlport workarounds + +#ifndef BOOST_IO_STD +# define BOOST_IO_STD std:: +#endif + +#if defined(BOOST_NO_STD_LOCALE) || \ + ( BOOST_WORKAROUND(__BORLANDC__, <= 0x564) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT( 0x570 ) ) ) +// some future __BORLANDC__ >0x564 versions might not need this +// 0x570 is Borland's kylix branch +#define BOOST_NO_LOCALE_ISIDIGIT +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570) ) || BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1300)) +#define BOOST_NO_OVERLOAD_FOR_NON_CONST +#endif + +// gcc-2.95's stringstream is not usable, unless it's the one from STLPORT : +#if BOOST_WORKAROUND(__GNUC__, < 3) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) +#define BOOST_FORMAT_IGNORE_STRINGSTREAM +#endif + + +// **** Workaround for io streams, stlport and msvc. +#ifdef BOOST_IO_NEEDS_USING_DECLARATION +namespace boost { + using std::char_traits; + using std::basic_ostream; + using std::basic_ostringstream; + namespace io { + using std::basic_ostream; + namespace detail { + using std::basic_ios; + using std::basic_ostream; + using std::basic_ostringstream; + } + } +} +#endif + +// ------------------------------------------------------------------------------ + +#endif // BOOST_FORMAT_MACROS_DEFAULT_HPP diff --git a/boost/boost/format/detail/msvc_disambiguater.hpp b/boost/boost/format/detail/msvc_disambiguater.hpp new file mode 100644 index 0000000000..17d96bd080 --- /dev/null +++ b/boost/boost/format/detail/msvc_disambiguater.hpp @@ -0,0 +1,61 @@ +// -*- C++ -*- +// Boost general library 'format' --------------------------- +// See http://www.boost.org for updates, documentation, and revision history. + +// (C) Samuel Krempp 2001 +// krempp@crans.ens-cachan.fr +// 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. + +// ideas taken from Rüdiger Loos's format class +// and Karl Nelson's ofstream + +// ---------------------------------------------------------------------------- +// msvc_disambiguater.hpp : msvc workarounds. (for put_{head|last} overloads) +// the trick was described in boost's list by Aleksey Gurtovoy +// ---------------------------------------------------------------------------- + + +#ifndef BOOST_MSVC_DISAMBIGUATER_HPP +#define BOOST_MSVC_DISAMBIGUATER_HPP + +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) // this whole header is specifically for msvc + +#include +#include + +namespace boost { +namespace io { +namespace detail { + +template< class Ch, class Tr, class T > +struct disambiguater +{ + template< typename U > + static void put_head(BOOST_IO_STD basic_ostream& os, group1 const& x, long) + { + os << group_head(x.a1_); + } + static void put_head(BOOST_IO_STD basic_ostream& os, T const& x, int) + { + } + template< typename U > + static void put_last(BOOST_IO_STD basic_ostream& os, group1 const& x, long) + { + os << group_last(x.a1_); + } + static void put_last(BOOST_IO_STD basic_ostream& os, T const& x, int) + { + os << x; + } +}; + +} // namespace detail +} // namespace io +} // namespace boost + +#endif // -BOOST_MSVC + +#endif // -BOOST_MSVC_DISAMBIGUATER_HPP diff --git a/boost/boost/format/detail/unset_macros.hpp b/boost/boost/format/detail/unset_macros.hpp new file mode 100644 index 0000000000..16929697cf --- /dev/null +++ b/boost/boost/format/detail/unset_macros.hpp @@ -0,0 +1,13 @@ +// *** Undefine 'local' macros : +#ifdef BOOST_NO_OVERLOAD_FOR_NON_CONST +#undef BOOST_NO_OVERLOAD_FOR_NON_CONST +#endif +#ifdef BOOST_NO_LOCALE_ISIDIGIT +#undef BOOST_NO_LOCALE_ISIDIGIT +#endif +#ifdef BOOST_IO_STD +#undef BOOST_IO_STD +#endif +#ifdef BOOST_IO_NEEDS_USING_DECLARATION +#undef BOOST_IO_NEEDS_USING_DECLARATION +#endif diff --git a/boost/boost/format/detail/workarounds_gcc-2.95.hpp b/boost/boost/format/detail/workarounds_gcc-2.95.hpp new file mode 100644 index 0000000000..8d588af0f5 --- /dev/null +++ b/boost/boost/format/detail/workarounds_gcc-2.95.hpp @@ -0,0 +1,87 @@ +// -*- C++ -*- +// Boost general library 'format' --------------------------- +// See http://www.boost.org for updates, documentation, and revision history. + +// (C) Samuel Krempp 2003 +// 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. + + +// workarounds for gcc < 3.0 : +// . defines a few macros +// . supplies template classes basic_foo where gcc only supplies foo : +// - basic_ios from ios +// - basic_ostream from ostream +// - basic_srteambuf from streambuf +// of course, the traits type 'Tr' is not used at all, +// and you instantiating those template with a char type different than char fails. + +#if BOOST_WORKAROUND(__GNUC__, < 3) & defined(__STL_CONFIG_H) // nothing to do else + +#ifndef BOOST_FORMAT_WORKAROUNDS_GCC295_H +#define BOOST_FORMAT_WORKAROUNDS_GCC295_H + +#include // SGI STL doesnt have and others, we need iostream. + + +#ifndef BOOST_IO_STD +# define BOOST_IO_STD std:: +#endif + + + +// *** +// gcc's simple classes turned into standard-like template classes : + +namespace std { + + +template +class char_traits : public string_char_traits { +}; +// only problem : gcc's 'string' is a typedef for basic_string >, +// so strings built using char_traits wont match the type 'string'. +// so it's better to use string_char_traits directly. + +template +class basic_ios; + +template +class basic_ios : virtual public ostream { +public: + char fill() const { return ios::fill(); } // gcc returns wchar.. + char fill(char c) { return ios::fill(c); } // gcc takes wchar.. +}; + +typedef ios ios_base; + + +template +class basic_ostream; + +template +class basic_ostream : public basic_ios { +public: + basic_ostream(streambuf* sb) : ostream(sb) {} + basic_ostream() : ostream() {} + char widen(char c) { return c; } + char narrow(char c, char def) { return c; } +}; + + +template +class basic_streambuf; + +template +class basic_streambuf : public streambuf { +}; + + +} // namespace std + + +#endif // include guard + +#endif // if workaround diff --git a/boost/boost/format/detail/workarounds_stlport.hpp b/boost/boost/format/detail/workarounds_stlport.hpp new file mode 100644 index 0000000000..5cd4df872a --- /dev/null +++ b/boost/boost/format/detail/workarounds_stlport.hpp @@ -0,0 +1,42 @@ +// -*- C++ -*- +// Boost general library 'format' --------------------------- +// See http://www.boost.org for updates, documentation, and revision history. + +// (C) Samuel Krempp 2001 +// 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. + +// ideas taken from Rüdiger Loos's format class +// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing) + +// ------------------------------------------------------------------------------ +// workarounds_stlport.hpp : configuration for the format library +// The contents of this file should be integrated into the boost config system. +// ------------------------------------------------------------------------------ + +#ifndef BOOST_MACROS_STLPORT_HPP +#define BOOST_MACROS_STLPORT_HPP + +// *** This should go to "boost/config/stdlib/stlport.hpp". + +// If the streams are not native and there are problems with using templates +// accross namespaces, we define some macros to enable a workaround for this. + +// STLport 4.5 +#if !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) +# define BOOST_IO_STD +# define BOOST_IO_NEEDS_USING_DECLARATION +#endif + +// STLport 4.0 +#if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_OWN_NAMESPACE) && defined(BOOST_NO_USING_TEMPLATE) +# define BOOST_IO_STD +# define BOOST_IO_NEEDS_USING_DECLARATION +#endif + + +// ------------------------------------------------------------------------------ + +#endif // BOOST_MACROS_STLPORT_HPP diff --git a/boost/boost/format/feed_args.hpp b/boost/boost/format/feed_args.hpp index 5a8870be80..2a28237e64 100644 --- a/boost/boost/format/feed_args.hpp +++ b/boost/boost/format/feed_args.hpp @@ -21,242 +21,240 @@ #ifndef BOOST_FORMAT_FEED_ARGS_HPP #define BOOST_FORMAT_FEED_ARGS_HPP -#include "boost/format/format_class.hpp" -#include "boost/format/group.hpp" +#include +#include -#include "boost/format/msvc_disambiguater.hpp" -#include "boost/throw_exception.hpp" +#include +#include namespace boost { namespace io { namespace detail { namespace { - template inline - void empty_buf(BOOST_IO_STD basic_ostringstream & os) { - static const std::basic_string emptyStr; - os.str(emptyStr); - } - - template - void do_pad( std::basic_string & s, - std::streamsize w, - const Ch c, - std::ios_base::fmtflags f, - bool center) - // applies centered / left / right padding to the string s. - // Effects : string s is padded. - { - std::streamsize n=w-s.size(); - if(n<=0) { - return; + template + void clear_buffer(io::basic_outsstream & os) { + os.clear_buffer(); } - if(center) - { - s.reserve(w); // allocate once for the 2 inserts - const std::streamsize n1 = n /2, n0 = n - n1; - s.insert(s.begin(), n0, c); - s.append(n1, c); - } - else - { - if(f & std::ios_base::left) { - s.append(n, c); + + template + void mk_str( std::basic_string & res, + const Ch * beg, + std::streamsize size, + std::streamsize w, + const Ch fill_char, + std::ios_base::fmtflags f, + const Ch prefix_space, // 0 if no space-padding + bool center) + // applies centered / left / right padding to the string [beg, beg+size[ + // Effects : the result is placed in res. + { + res.resize(0); + std::streamsize n=w-size-!!prefix_space; + std::streamsize n_after = 0, n_before = 0; + + if(n<=0) { // no need to pad. + res.reserve(size + !!prefix_space); } - else { - s.insert(s.begin(), n, c); + else { + res.reserve(w); // allocate once for the 2 inserts + if(center) + n_after = n/2, n_before = n - n_after; + else + if(f & std::ios_base::left) + n_after = n; + else + n_before = n; } - } - } // -do_pad(..) + // now make the res string : + if(n_before) res.append(n_before, fill_char); + if(prefix_space) + res.append(1, prefix_space); + res.append(beg, size); + if(n_after) res.append(n_after, fill_char); + } // -mk_str(..) #if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) // MSVC needs to be tricked to disambiguate this simple overload.. // the trick is in "boost/format/msvc_disambiguater.hpp" - template< class Ch, class Tr, class T> inline - void put_head( BOOST_IO_STD basic_ostream& os, const T& x ) { - disambiguater::put_head(os, x, 1L); - } - template< class Ch, class Tr, class T> inline - void put_last( BOOST_IO_STD basic_ostream& os, const T& x ) { - disambiguater::put_last(os, x, 1L); - } + template< class Ch, class Tr, class T> inline + void put_head( BOOST_IO_STD basic_ostream& os, const T& x ) { + disambiguater::put_head(os, x, 1L); + } + template< class Ch, class Tr, class T> inline + void put_last( BOOST_IO_STD basic_ostream& os, const T& x ) { + disambiguater::put_last(os, x, 1L); + } #else - template< class Ch, class Tr, class T> inline - void put_head(BOOST_IO_STD basic_ostream& , const T& ) { - } + template< class Ch, class Tr, class T> inline + void put_head(BOOST_IO_STD basic_ostream& , const T& ) { + } - template< class Ch, class Tr, class T> inline - void put_head( BOOST_IO_STD basic_ostream& os, const group1& x ) { - os << group_head(x.a1_); // send the first N-1 items, not the last - } + template< class Ch, class Tr, class T> inline + void put_head( BOOST_IO_STD basic_ostream& os, const group1& x ) { + os << group_head(x.a1_); // send the first N-1 items, not the last + } - template< class Ch, class Tr, class T> inline - void put_last( BOOST_IO_STD basic_ostream& os, const T& x ) { - os << x ; - } + template< class Ch, class Tr, class T> inline + void put_last( BOOST_IO_STD basic_ostream& os, const T& x ) { + os << x ; + } - template< class Ch, class Tr, class T> inline - void put_last( BOOST_IO_STD basic_ostream& os, const group1& x ) { - os << group_last(x.a1_); // this selects the last element - } + template< class Ch, class Tr, class T> inline + void put_last( BOOST_IO_STD basic_ostream& os, const group1& x ) { + os << group_last(x.a1_); // this selects the last element + } #ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST - template< class Ch, class Tr, class T> inline - void put_head( BOOST_IO_STD basic_ostream& , T& ) { - } - - template< class Ch, class Tr, class T> inline - void put_last( BOOST_IO_STD basic_ostream& os, T& x ) { - os << x ; - } + template< class Ch, class Tr, class T> inline + void put_head( BOOST_IO_STD basic_ostream& , T& ) { + } + + template< class Ch, class Tr, class T> inline + void put_last( BOOST_IO_STD basic_ostream& os, T& x ) { + os << x ; + } #endif #endif // -msvc workaround + template< class Ch, class Tr, class T> + void put( T x, + const format_item& specs, + std::basic_string & res, + io::basic_outsstream& oss_ ) + { + // does the actual conversion of x, with given params, into a string + // using the *supplied* strinstream. (the stream state is important) - -template< class Ch, class Tr, class T> -void put( T x, - const format_item& specs, - std::basic_string & res, - BOOST_IO_STD basic_ostringstream& oss_ ) -{ - // does the actual conversion of x, with given params, into a string - // using the *supplied* strinstream. (the stream state is important) - - typedef std::basic_string string_t; - typedef format_item format_item_t; - - stream_format_state prev_state(oss_); + typedef std::basic_string string_t; + typedef format_item format_item_t; - specs.state_.apply_on(oss_); - - // in case x is a group, apply the manip part of it, - // in order to find width - put_head( oss_, x ); - empty_buf( oss_); - - const std::streamsize w=oss_.width(); - const std::ios_base::fmtflags fl=oss_.flags(); - const bool internal = (fl & std::ios_base::internal) != 0; - const bool two_stepped_padding = internal - && ! ( specs.pad_scheme_ & format_item_t::spacepad ) - && specs.truncate_ < 0 ; + specs.fmtstate_.apply_on(oss_); + + // the stream format state can be modified by manipulators in the argument : + put_head( oss_, x ); + // in case x is a group, apply the manip part of it, + // in order to find width + // clear_buffer( oss_); // fixme. is it necessary ? + + const std::ios_base::fmtflags fl=oss_.flags(); + const bool internal = (fl & std::ios_base::internal) != 0; + const std::streamsize w = oss_.width(); + const bool two_stepped_padding= internal && (w!=0); - - if(! two_stepped_padding) - { - if(w>0) // handle simple padding via do_pad, not natively in stream - oss_.width(0); - put_last( oss_, x); - res = oss_.str(); - - if (specs.truncate_ >= 0 && static_cast(specs.truncate_) < res.size() ) - res.erase(specs.truncate_); - - // complex pads : - if(specs.pad_scheme_ & format_item_t::spacepad) - { - if( res.size()==0 || ( res[0]!='+' && res[0]!='-' )) - { - res.insert(res.begin(), 1, ' '); // insert 1 space at pos 0 + res.resize(0); + if(! two_stepped_padding) { + if(w>0) // handle padding via mk_str, not natively in stream + oss_.width(0); + put_last( oss_, x); + const Ch * res_beg = oss_.begin(); + Ch prefix_space = 0; + if(specs.pad_scheme_ & format_item_t::spacepad) + if(oss_.pcount()== 0 || + (res_beg[0] !=oss_.widen('+') && res_beg[0] !=oss_.widen('-') )) + prefix_space = oss_.widen(' '); + std::streamsize res_size = std::min( + static_cast(specs.truncate_ - !!prefix_space), + oss_.pcount()); + + mk_str(res, res_beg, res_size, w, oss_.fill(), fl, + prefix_space, (specs.pad_scheme_ & format_item_t::centered) !=0 ); + } + else { // 2-stepped padding + // internal can be implied by zeropad, or user-set. + // left, right, and centered alignment overrule internal, + // but spacepad or truncate might be mixed with internal (using manipulator) + put_last( oss_, x); // may pad + const Ch * res_beg = oss_.begin(); + std::streamsize res_size = oss_.pcount(); + bool prefix_space=false; + if(specs.pad_scheme_ & format_item_t::spacepad) + if(oss_.pcount()== 0 || + (res_beg[0] !=oss_.widen('+') && res_beg[0] !=oss_.widen('-') )) + prefix_space = true; + if(res_size == w && w<=specs.truncate_ && !prefix_space) { + // okay, only one thing was printed and padded, so res is fine + res.assign(res_beg, res_size); } - } - if(w > 0) // need do_pad - { - do_pad(res,w,oss_.fill(), fl, (specs.pad_scheme_ & format_item_t::centered) !=0 ); - } - } - else // 2-stepped padding - { - put_last( oss_, x); // oss_.width() may result in padding. - res = oss_.str(); - - if (specs.truncate_ >= 0) - res.erase(specs.truncate_); - - if( res.size() - w > 0) - { // length w exceeded - // either it was multi-output with first output padding up all width.. - // either it was one big arg and we are fine. - empty_buf( oss_); - oss_.width(0); - put_last(oss_, x ); - string_t tmp = oss_.str(); // minimal-length output - std::streamsize d; - if( (d=w - tmp.size()) <=0 ) - { - // minimal length is already >= w, so no padding (cool!) - res.swap(tmp); - } - else - { // hum.. we need to pad (it was necessarily multi-output) - typedef typename string_t::size_type size_type; - size_type i = 0; - while( i( d ), oss_.fill()); - res.swap( tmp ); + else { // length w exceeded + // either it was multi-output with first output padding up all width.. + // either it was one big arg and we are fine. + //BOOST_ASSERT(res_size > w); //res_size(specs.truncate_)); + std::streamsize d; + if( (d=w - tmp_size) <=0 ) { + // minimal length is already >= w, so no padding (cool!) + res.assign(tmp_beg, tmp_size); + } + else { // hum.. we need to pad (multi_output, or spacepad present) + typedef typename string_t::size_type size_type; + std::streamsize i = prefix_space; + //find where we should pad + //BOOST_ASSERT( static_cast(tmp_size-prefix_space <= res.size() )); + std::streamsize sz = std::min(res_size+prefix_space, tmp_size); + for(; i=tmp_size) i=prefix_space; + res.assign(tmp_beg, i); + if(d>0) res.append(static_cast( d ), oss_.fill()); + res.append(tmp_beg+i, tmp_size-i); + assert(i+(tmp_size-i)+std::max(d,(std::streamsize)0) == w); + assert(res.size() == (std::size_t)w); + } } } - else - { // okay, only one thing was printed and padded, so res is fine. - } - } - - prev_state.apply_on(oss_); - empty_buf( oss_); - oss_.clear(); -} // end- put(..) + clear_buffer( oss_); + } // end- put(..) } // local namespace - - - -template< class Ch, class Tr, class T> -void distribute(basic_format& self, T x) - // call put(x, ..) on every occurence of the current argument : -{ - if(self.cur_arg_ >= self.num_args_) - { - if( self.exceptions() & too_many_args_bit ) - boost::throw_exception(too_many_args()); // too many variables have been supplied ! - else return; - } - for(unsigned long i=0; i < self.items_.size(); ++i) - { - if(self.items_[i].argN_ == self.cur_arg_) - { - put (x, self.items_[i], self.items_[i].res_, self.oss_ ); + template< class Ch, class Tr, class T> + void distribute(basic_format& self, T x) { + // call put(x, ..) on every occurence of the current argument : + if(self.cur_arg_ >= self.num_args_) { + if( self.exceptions() & too_many_args_bit ) + boost::throw_exception(too_many_args()); // too many variables supplied + else return; + } + for(unsigned long i=0; i < self.items_.size(); ++i) { + if(self.items_[i].argN_ == self.cur_arg_) { + put (x, self.items_[i], self.items_[i].res_, self.oss_ ); + } } } -} - -template -basic_format& feed(basic_format& self, T x) -{ - if(self.dumped_) self.clear(); - distribute (self, x); - ++self.cur_arg_; - if(self.bound_.size() != 0) - { - while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] ) + + template + basic_format& feed(basic_format& self, T x) { + if(self.dumped_) self.clear(); + distribute (self, x); ++self.cur_arg_; + if(self.bound_.size() != 0) { + while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] ) + ++self.cur_arg_; + } + return self; } - - // this arg is finished, reset the stream's format state - self.state0_.apply_on(self.oss_); - return self; -} - } // namespace detail } // namespace io } // namespace boost diff --git a/boost/boost/format/format_class.hpp b/boost/boost/format/format_class.hpp index ad34769251..ef509f0f5c 100644 --- a/boost/boost/format/format_class.hpp +++ b/boost/boost/format/format_class.hpp @@ -16,130 +16,111 @@ // format_class.hpp : class interface // ------------------------------------------------------------------------------ - #ifndef BOOST_FORMAT_CLASS_HPP #define BOOST_FORMAT_CLASS_HPP + #include #include #include #include - #include +#include namespace boost { -template -class basic_format -{ -public: - typedef Ch CharT; // those 2 are necessary for borland compatibilty, - typedef Tr Traits; // in the body of the operator% template. - + template + class basic_format + { + public: + typedef Ch CharT; // borland fails if we use Ch and Tr directly + typedef Tr Traits; // in the body of the operator% template. + typedef std::basic_string string_t; + typedef typename std::basic_string::size_type size_type; - typedef std::basic_string string_t; - typedef BOOST_IO_STD basic_ostringstream internal_stream_t; -private: - typedef BOOST_IO_STD basic_ostream stream_t; - typedef io::detail::stream_format_state stream_format_state; - typedef io::detail::format_item format_item_t; + typedef io::basic_outsstream internal_stream_t; -public: - basic_format(const Ch* str); - basic_format(const string_t& s); + explicit basic_format(const Ch* str=NULL); + explicit basic_format(const string_t& s); #ifndef BOOST_NO_STD_LOCALE - basic_format(const Ch* str, const std::locale & loc); - basic_format(const string_t& s, const std::locale & loc); -#endif // no locale - basic_format(const basic_format& x); - basic_format& operator= (const basic_format& x); + explicit basic_format(const Ch* str, const std::locale & loc); + explicit basic_format(const string_t& s, const std::locale & loc); +#endif + basic_format(const basic_format& x); + basic_format& operator= (const basic_format& x); + void swap(basic_format& x); - basic_format& clear(); // empty the string buffers (except bound arguments, see clear_binds() ) + basic_format& clear(); // empty all converted string buffers (except bound items) + basic_format& clear_binds(); // unbind all bound items, and call clear() + basic_format& parse(const string_t&); // resets buffers and parse a new format string - // pass arguments through those operators : - template basic_format& operator%(const T& x) - { - return io::detail::feed(*this,x); - } + // pass arguments through those operators : + template + basic_format& operator%(const T& x) + { return io::detail::feed(*this,x); } #ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST - template basic_format& operator%(T& x) - { - return io::detail::feed(*this,x); - } + template basic_format& operator%(T& x) + { return io::detail::feed(*this,x); } #endif - - - // system for binding arguments : - template - basic_format& bind_arg(int argN, const T& val) - { - return io::detail::bind_arg_body(*this, argN, val); - } - basic_format& clear_bind(int argN); - basic_format& clear_binds(); - - // modify the params of a directive, by applying a manipulator : - template - basic_format& modify_item(int itemN, const T& manipulator) - { - return io::detail::modify_item_body(*this, itemN, manipulator) ; - } - - // Choosing which errors will throw exceptions : - unsigned char exceptions() const; - unsigned char exceptions(unsigned char newexcept); - - // final output - string_t str() const; - friend BOOST_IO_STD basic_ostream& + // modifying a format object + template + basic_format& bind_arg(int argN, const T& val) + { return io::detail::bind_arg_body(*this, argN, val); } + basic_format& clear_bind(int argN); + template + basic_format& modify_item(int itemN, T manipulator) + { return io::detail::modify_item_body (*this, itemN, manipulator);} + + // Choosing which errors will throw exceptions : + unsigned char exceptions() const; + unsigned char exceptions(unsigned char newexcept); + + // final output + size_type size() const; // sum of the current string pieces sizes + string_t str() const; + friend BOOST_IO_STD basic_ostream& #if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) - operator<< ( BOOST_IO_STD basic_ostream& , const basic_format& ); + operator<< (BOOST_IO_STD basic_ostream& , const basic_format& ); #else - operator<< ( BOOST_IO_STD basic_ostream& , const basic_format& ); + operator<< (BOOST_IO_STD basic_ostream&, const basic_format&); #endif - -#if !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570) ) && !BOOST_WORKAROUND( _CRAYC, != 0) - - template friend basic_format& - io::detail::feed(basic_format&, T); - - template friend - void io::detail::distribute(basic_format&, T); - - template friend - basic_format& io::detail::modify_item_body(basic_format&, int, const T&); - - template friend - basic_format& io::detail::bind_arg_body(basic_format&, int, const T&); - -// make the members private only if the friend templates are supported -private: +#if !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) \ + && !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) \ + && !BOOST_WORKAROUND( _CRAYC, != 0) + // use friend templates and private members only if supported + template friend basic_format& + io::detail::feed(basic_format&, T); + template friend + void io::detail::distribute(basic_format&, T); + template friend + basic_format& io::detail::modify_item_body(basic_format&, int, T); + template friend + basic_format& io::detail::bind_arg_body(basic_format&, int, const T&); + + private: #endif - - // flag bits, used for style_ - enum style_values { ordered = 1, // set only if all directives are positional directives - special_needs = 4 }; - - // parse the format string : - void parse(const string_t&); - - int style_; // style of format-string : positional or not, etc - int cur_arg_; // keep track of wich argument will come - int num_args_; // number of expected arguments - mutable bool dumped_; // true only after call to str() or << - std::vector items_; // vector of directives (aka items) - string_t prefix_; // piece of string to insert before first item - - std::vector bound_; // stores which arguments were bound - // size = num_args OR zero - internal_stream_t oss_; // the internal stream. - stream_format_state state0_; // reference state for oss_ - unsigned char exceptions_; -}; // class basic_format - + typedef BOOST_IO_STD basic_ostream stream_t; + typedef io::detail::stream_format_state stream_format_state; + typedef io::detail::format_item format_item_t; + // flag bits, used for style_ + enum style_values { ordered = 1, // set only if all directives are positional + special_needs = 4 }; + + void make_or_reuse_data(std::size_t nbitems);// used for (re-)initialisation + + std::vector items_; // each '%..' directive leads to a format_item + std::vector bound_; // stores which arguments were bound. size() == 0 || num_args + int style_; // style of format-string : positional or not, etc + int cur_arg_; // keep track of wich argument is current + int num_args_; // number of expected arguments + mutable bool dumped_; // true only after call to str() or << + string_t prefix_; // piece of string to insert before first item + internal_stream_t oss_; // the internal stream. + unsigned char exceptions_; + }; // class basic_format } // namespace boost diff --git a/boost/boost/format/format_fwd.hpp b/boost/boost/format/format_fwd.hpp index 85ee1e678f..a5dbde6b04 100644 --- a/boost/boost/format/format_fwd.hpp +++ b/boost/boost/format/format_fwd.hpp @@ -3,7 +3,6 @@ // See http://www.boost.org for updates, documentation, and revision history. // (C) Samuel Krempp 2001 -// krempp@crans.ens-cachan.fr // 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 @@ -22,34 +21,44 @@ #include #include -#include +#include namespace boost { -template > class basic_format; + template > +#else + class Tr = std::string_char_traits > +#endif + class basic_format; + + typedef basic_format format; -typedef basic_format format; -#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF) -typedef basic_format wformat; +#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF) \ + && !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM) + //we use either sstream or strstream, and strstream doesnt support wchar + typedef basic_format wformat; #endif + template + std::basic_string str(const basic_format& ) ; + namespace io { -enum format_error_bits { bad_format_string_bit = 1, - too_few_args_bit = 2, too_many_args_bit = 4, - out_of_range_bit = 8, - all_error_bits = 255, no_error_bits=0 }; - -// Convertion: format to string -template -std::basic_string str(const basic_format& ) ; + using ::boost::str; // it used to bed define in boost::io, keep compatibility + enum format_error_bits { bad_format_string_bit = 1, + too_few_args_bit = 2, too_many_args_bit = 4, + out_of_range_bit = 8, + all_error_bits = 255, no_error_bits=0 }; + } // namespace io -template< class Ch, class Tr> -BOOST_IO_STD basic_ostream& -operator<<( BOOST_IO_STD basic_ostream&, const basic_format&); + template< class Ch, class Tr> + BOOST_IO_STD basic_ostream& + operator<<( BOOST_IO_STD basic_ostream&, const basic_format&); } // namespace boost diff --git a/boost/boost/format/format_implementation.hpp b/boost/boost/format/format_implementation.hpp index a41113a940..c23355879f 100644 --- a/boost/boost/format/format_implementation.hpp +++ b/boost/boost/format/format_implementation.hpp @@ -23,244 +23,241 @@ #include #include #include +#include // std::swap namespace boost { // -------- format:: ------------------------------------------- -template< class Ch, class Tr> -basic_format ::basic_format(const Ch* str) - : style_(0), cur_arg_(0), num_args_(0), dumped_(false), - items_(), oss_(), exceptions_(io::all_error_bits) -{ - state0_.set_by_stream(oss_); - string_t emptyStr; - if( !str) str = emptyStr.c_str(); - parse( str ); -} + template< class Ch, class Tr> + basic_format:: basic_format(const Ch* str) + : style_(0), cur_arg_(0), num_args_(0), dumped_(false), + exceptions_(io::all_error_bits) + { + if( str) + parse( str ); + } #ifndef BOOST_NO_STD_LOCALE -template< class Ch, class Tr> -basic_format ::basic_format(const Ch* str, const std::locale & loc) - : style_(0), cur_arg_(0), num_args_(0), dumped_(false), - items_(), oss_(), exceptions_(io::all_error_bits) -{ - oss_.imbue( loc ); - state0_.set_by_stream(oss_); - string_t emptyStr; - if( !str) str = emptyStr.c_str(); - parse( str ); -} - -template< class Ch, class Tr> -basic_format ::basic_format(const string_t& s, const std::locale & loc) - : style_(0), cur_arg_(0), num_args_(0), dumped_(false), - items_(), oss_(), exceptions_(io::all_error_bits) -{ - oss_.imbue( loc ); - state0_.set_by_stream(oss_); - parse(s); -} + template< class Ch, class Tr> + basic_format:: basic_format(const Ch* str, const std::locale & loc) + : style_(0), cur_arg_(0), num_args_(0), dumped_(false), + exceptions_(io::all_error_bits) + { + oss_.imbue( loc ); + if(str) parse( str ); + } + + template< class Ch, class Tr> + basic_format:: basic_format(const string_t& s, const std::locale & loc) + : style_(0), cur_arg_(0), num_args_(0), dumped_(false), + exceptions_(io::all_error_bits) + { + oss_.imbue( loc ); + parse(s); + } #endif //BOOST_NO_STD_LOCALE -template< class Ch, class Tr> -basic_format ::basic_format(const string_t& s) - : style_(0), cur_arg_(0), num_args_(0), dumped_(false), - items_(), oss_(), exceptions_(io::all_error_bits) -{ - state0_.set_by_stream(oss_); - parse(s); -} - -template< class Ch, class Tr> -basic_format :: basic_format(const basic_format& x) - : style_(x.style_), cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false), - items_(x.items_), prefix_(x.prefix_), bound_(x.bound_), - oss_(), // <- we obviously can't copy x.oss_ - state0_(x.state0_), exceptions_(x.exceptions_) -{ - state0_.apply_on(oss_); -} - -template< class Ch, class Tr> -basic_format& basic_format ::operator= (const basic_format& x) -{ - if(this == &x) - return *this; - state0_ = x.state0_; - state0_.apply_on(oss_); - - // plus all the other (trivial) assignments : - exceptions_ = x.exceptions_; - items_ = x.items_; - prefix_ = x.prefix_; - bound_=x.bound_; - style_=x.style_; - cur_arg_=x.cur_arg_; - num_args_=x.num_args_; - dumped_=x.dumped_; - return *this; -} - - -template< class Ch, class Tr> -unsigned char basic_format ::exceptions() const -{ - return exceptions_; -} - -template< class Ch, class Tr> -unsigned char basic_format ::exceptions(unsigned char newexcept) -{ - unsigned char swp = exceptions_; - exceptions_ = newexcept; - return swp; -} - - -template< class Ch, class Tr> -basic_format& basic_format ::clear() - // empty the string buffers (except bound arguments, see clear_binds() ) - // and make the format object ready for formatting a new set of arguments -{ - BOOST_ASSERT( bound_.size()==0 || num_args_ == static_cast(bound_.size()) ); - - for(unsigned long i=0; i + basic_format:: basic_format(const string_t& s) + : style_(0), cur_arg_(0), num_args_(0), dumped_(false), + exceptions_(io::all_error_bits) + { + parse(s); } - cur_arg_=0; dumped_=false; - // maybe first arg is bound: - if(bound_.size() != 0) - { - while(cur_arg_ < num_args_ && bound_[cur_arg_] ) ++cur_arg_; - } - return *this; -} - -template< class Ch, class Tr> -basic_format& basic_format ::clear_binds() - // cancel all bindings, and clear() -{ - bound_.resize(0); - clear(); - return *this; -} - -template< class Ch, class Tr> -basic_format& basic_format ::clear_bind(int argN) - // cancel the binding of ONE argument, and clear() -{ - if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] ) - { - if( exceptions() & io::out_of_range_bit ) - boost::throw_exception(io::out_of_range()); // arg not in range. - else return *this; - } - bound_[argN-1]=false; - clear(); - return *this; -} - - - -template< class Ch, class Tr> -std::basic_string basic_format ::str() const -{ - dumped_=true; - if(items_.size()==0) - return prefix_; - if( cur_arg_ < num_args_) - if( exceptions() & io::too_few_args_bit ) - boost::throw_exception(io::too_few_args()); // not enough variables have been supplied ! - - unsigned long sz = prefix_.size(); - unsigned long i; - for(i=0; i < items_.size(); ++i) - sz += items_[i].res_.size() + items_[i].appendix_.size(); - string_t res; - res.reserve(sz); - - res += prefix_; - for(i=0; i < items_.size(); ++i) - { - const format_item_t& item = items_[i]; - res += item.res_; - if( item.argN_ == format_item_t::argN_tabulation) + + template< class Ch, class Tr> + basic_format:: basic_format(const basic_format& x) + : items_(x.items_), bound_(x.bound_), style_(x.style_), + cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false), + prefix_(x.prefix_), exceptions_(x.exceptions_) { - BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation); - std::streamsize n = item.state_.width_ - res.size(); - if( n > 0 ) - res.append( n, item.state_.fill_ ); + } + + template< class Ch, class Tr> + void basic_format:: swap (basic_format & x) { + std::swap(exceptions_, x.exceptions_); + std::swap(style_, x.style_); + std::swap(cur_arg_, x.cur_arg_); + std::swap(num_args_, x.num_args_); + std::swap(dumped_, x.dumped_); + + items_.swap(x.items_); + prefix_.swap(x.prefix_); + bound_.swap(x.bound_); + } + + template< class Ch, class Tr> + basic_format& basic_format:: operator= (const basic_format& x) { + if(this == &x) + return *this; + (basic_format(x)).swap(*this); + return *this; + } + + template< class Ch, class Tr> + unsigned char basic_format:: exceptions() const { + return exceptions_; + } + + template< class Ch, class Tr> + unsigned char basic_format:: exceptions(unsigned char newexcept) { + unsigned char swp = exceptions_; + exceptions_ = newexcept; + return swp; + } + + template + void basic_format:: make_or_reuse_data(std::size_t nbitems) { + Ch fill = oss_.widen(' '); + if(items_.size() == 0) + items_.assign( nbitems, format_item_t(fill) ); + else { + bound_.resize(0); + items_.resize(nbitems, format_item_t(fill)); + for(std::size_t i=0; i < nbitems; ++i) + items_[i].reset(fill); // strings are resized to "", instead of reallocated + } + } + + template< class Ch, class Tr> + basic_format& basic_format:: clear() { + // empty the string buffers (except bound arguments) + // and make the format object ready for formatting a new set of arguments + + BOOST_ASSERT( bound_.size()==0 || num_args_ == static_cast(bound_.size()) ); + + for(unsigned long i=0; i + basic_format& basic_format:: clear_binds() { + // remove all binds, then clear() + bound_.resize(0); + clear(); + return *this; + } + + template< class Ch, class Tr> + basic_format& basic_format:: clear_bind(int argN) { + // remove the bind of ONE argument then clear() + + if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] ) { + if( exceptions() & io::out_of_range_bit ) + boost::throw_exception(io::out_of_range()); // arg not in range. + else return *this; + } + bound_[argN-1]=false; + clear(); + return *this; + } + + + + template< class Ch, class Tr> + std::basic_string basic_format:: str() const { + dumped_=true; + if(items_.size()==0) + return prefix_; + if( cur_arg_ < num_args_) + if( exceptions() & io::too_few_args_bit ) + boost::throw_exception(io::too_few_args()); // not enough variables supplied + unsigned long i; + string_t res; + res.reserve(size()); + res += prefix_; + for(i=0; i < items_.size(); ++i) { + const format_item_t& item = items_[i]; + res += item.res_; + if( item.argN_ == format_item_t::argN_tabulation) { + BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation); + std::streamsize n = item.fmtstate_.width_ - res.size(); + if( n > 0 ) + res.append( n, item.fmtstate_.fill_ ); + } + res += item.appendix_; + } + return res; + } + template< class Ch, class Tr> + typename basic_format::size_type basic_format:: + size () const { + std::streamsize sz = prefix_.size(); + unsigned long i; + for(i=0; i < items_.size(); ++i) { + const format_item_t& item = items_[i]; + sz += item.res_.size(); + if( item.argN_ == format_item_t::argN_tabulation) + sz = std::max(sz, item.fmtstate_.width_); + sz += + item.appendix_.size(); + } + return static_cast (sz); } - res += item.appendix_; - } - return res; -} namespace io { namespace detail { -template -basic_format& bind_arg_body( basic_format& self, - int argN, - const T& val) - // bind one argument to a fixed value - // this is persistent over clear() calls, thus also over str() and << -{ - if(self.dumped_) self.clear(); // needed, because we will modify cur_arg_.. - if(argN<1 || argN > self.num_args_) - { - if( self.exceptions() & io::out_of_range_bit ) - boost::throw_exception(io::out_of_range()); // arg not in range. - else return self; - } - if(self.bound_.size()==0) - self.bound_.assign(self.num_args_,false); - else - BOOST_ASSERT( self.num_args_ == static_cast(self.bound_.size()) ); - int o_cur_arg = self.cur_arg_; - self.cur_arg_ = argN-1; // arrays begin at 0 - - self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets.. - self.operator%(val); // put val at the right place, because cur_arg is set + template + basic_format& bind_arg_body( basic_format& self, + int argN, const T& val) { + // bind one argument to a fixed value + // this is persistent over clear() calls, thus also over str() and << + if(self.dumped_) + self.clear(); // needed because we will modify cur_arg_ + if(argN<1 || argN > self.num_args_) { + if( self.exceptions() & io::out_of_range_bit ) + boost::throw_exception(io::out_of_range()); // arg not in range. + else return self; + } + if(self.bound_.size()==0) + self.bound_.assign(self.num_args_,false); + else + BOOST_ASSERT( self.num_args_ == static_cast(self.bound_.size()) ); + int o_cur_arg = self.cur_arg_; + self.cur_arg_ = argN-1; // arrays begin at 0 + + self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets.. + self.operator%(val); // put val at the right place, because cur_arg is set - // Now re-position cur_arg before leaving : - self.cur_arg_ = o_cur_arg; - self.bound_[argN-1]=true; - if(self.cur_arg_ == argN-1 ) - // hum, now this arg is bound, so move to next free arg - { - while(self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_]) ++self.cur_arg_; - } - // In any case, we either have all args, or are on a non-binded arg : - BOOST_ASSERT( self.cur_arg_ >= self.num_args_ || ! self.bound_[self.cur_arg_]); - return self; -} - -template -basic_format& modify_item_body( basic_format& self, - int itemN, - const T& manipulator) - // applies a manipulator to the format_item describing a given directive. - // this is a permanent change, clear or clear_binds won't cancel that. -{ - if(itemN<1 || itemN >= static_cast(self.items_.size() )) - { - if( self.exceptions() & io::out_of_range_bit ) - boost::throw_exception(io::out_of_range()); // item not in range. - else return self; + // Now re-position cur_arg before leaving : + self.cur_arg_ = o_cur_arg; + self.bound_[argN-1]=true; + if(self.cur_arg_ == argN-1 ) { + // hum, now this arg is bound, so move to next free arg + while(self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_]) + ++self.cur_arg_; + } + // In any case, we either have all args, or are on a non-binded arg : + BOOST_ASSERT( self.cur_arg_ >= self.num_args_ || ! self.bound_[self.cur_arg_]); + return self; } - self.items_[itemN-1].ref_state_.apply_manip( manipulator ); - self.items_[itemN-1].state_ = self.items_[itemN-1].ref_state_; - return self; -} -} // namespace detail + template + basic_format& modify_item_body( basic_format& self, + int itemN, T manipulator) { + // applies a manipulator to the format_item describing a given directive. + // this is a permanent change, clear or reset won't cancel that. + if(itemN<1 || itemN > static_cast(self.items_.size() )) { + if( self.exceptions() & io::out_of_range_bit ) + boost::throw_exception(io::out_of_range()); // item not in range. + else return self; + } + self.items_[itemN-1].fmtstate_. template apply_manip ( manipulator ); + return self; + } +} // namespace detail } // namespace io - } // namespace boost diff --git a/boost/boost/format/free_funcs.hpp b/boost/boost/format/free_funcs.hpp index 95bbcc1b1a..5a7771d9a6 100644 --- a/boost/boost/format/free_funcs.hpp +++ b/boost/boost/format/free_funcs.hpp @@ -3,7 +3,6 @@ // See http://www.boost.org for updates, documentation, and revision history. // (C) Samuel Krempp 2001 -// krempp@crans.ens-cachan.fr // 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 @@ -19,52 +18,46 @@ #ifndef BOOST_FORMAT_FUNCS_HPP #define BOOST_FORMAT_FUNCS_HPP -#include "boost/format/format_class.hpp" -#include "boost/throw_exception.hpp" +#include +#include namespace boost { -namespace io { - template inline - std::basic_string str(const basic_format& f) - // adds up all pieces of strings and converted items, and return the formatted string - { - return f.str(); - } -} // - namespace io + template inline + std::basic_string str(const basic_format& f) { + // adds up all pieces of strings and converted items, and return the formatted string + return f.str(); + } -template< class Ch, class Tr> -BOOST_IO_STD basic_ostream& -operator<<( BOOST_IO_STD basic_ostream& os, - const boost::basic_format& f) - // effect: "return os << str(f);" but we can try to do it faster -{ - typedef boost::basic_format format_t; - if(f.items_.size()==0) - os << f.prefix_; - else { - if(f.cur_arg_ < f.num_args_) - if( f.exceptions() & io::too_few_args_bit ) - boost::throw_exception(io::too_few_args()); // not enough variables have been supplied ! - if(f.style_ & format_t::special_needs) - os << f.str(); - else { - // else we dont have to count chars output, so we dump directly to os : - os << f.prefix_; - for(unsigned long i=0; i + BOOST_IO_STD basic_ostream& + operator<<( BOOST_IO_STD basic_ostream& os, + const boost::basic_format& f) + // effect: "return os << str(f);" but we can try to do it faster + { + typedef boost::basic_format format_t; + if(f.items_.size()==0) + os << f.prefix_; + else { + if(f.cur_arg_ < f.num_args_) + if( f.exceptions() & io::too_few_args_bit ) + boost::throw_exception(io::too_few_args()); // not enough variables supplied + if(f.style_ & format_t::special_needs) + os << f.str(); + else { + // else we dont have to count chars output, so we dump directly to os : + os << f.prefix_; + for(unsigned long i=0; i namespace boost { diff --git a/boost/boost/format/internals.hpp b/boost/boost/format/internals.hpp index 52448b731c..6c0647b8af 100644 --- a/boost/boost/format/internals.hpp +++ b/boost/boost/format/internals.hpp @@ -23,144 +23,170 @@ #include -#include + +#include +#include +#include namespace boost { namespace io { namespace detail { -// -------------- -// set of params that define the format state of a stream - -template -struct stream_format_state -{ - typedef BOOST_IO_STD basic_ios basic_ios; - - std::streamsize width_; - std::streamsize precision_; - Ch fill_; - std::ios_base::fmtflags flags_; - - stream_format_state() : width_(-1), precision_(-1), fill_(0), flags_(std::ios_base::dec) {} - stream_format_state(basic_ios& os) {set_by_stream(os); } - - void apply_on(basic_ios & os) const; //- applies format_state to the stream - template void apply_manip(T manipulator) //- modifies state by applying manipulator. - { apply_manip_body( *this, manipulator) ; } - void reset(); //- sets to default state. - void set_by_stream(const basic_ios& os); //- sets to os's state. -}; - - - -// -------------- -// format_item : stores all parameters that can be defined by directives in the format-string - -template -struct format_item -{ - enum pad_values { zeropad = 1, spacepad =2, centered=4, tabulation = 8 }; - - enum arg_values { argN_no_posit = -1, // non-positional directive. argN will be set later. - argN_tabulation = -2, // tabulation directive. (no argument read) - argN_ignored = -3 // ignored directive. (no argument read) - }; - typedef BOOST_IO_STD basic_ios basic_ios; - typedef detail::stream_format_state stream_format_state; - typedef std::basic_string string_t; - typedef BOOST_IO_STD basic_ostringstream internal_stream_t; - - - int argN_; //- argument number (starts at 0, eg : %1 => argN=0) - // negative values are used for items that don't process - // an argument - string_t res_; //- result of the formatting of this item - string_t appendix_; //- piece of string between this item and the next - - stream_format_state ref_state_;// set by parsing the format_string, is only affected by modify_item - stream_format_state state_; // always same as ref_state, _unless_ modified by manipulators 'group(..)' - - // non-stream format-state parameters - signed int truncate_; //- is >=0 for directives like %.5s (take 5 chars from the string) - unsigned int pad_scheme_; //- several possible padding schemes can mix. see pad_values - - format_item() : argN_(argN_no_posit), truncate_(-1), pad_scheme_(0) {} - - void compute_states(); // sets states according to truncate and pad_scheme. -}; - - - -// ----------------------------------------------------------- -// Definitions -// ----------------------------------------------------------- - -// --- stream_format_state:: ------------------------------------------- -template inline -void stream_format_state ::apply_on(basic_ios & os) const - // set the state of this stream according to our params -{ - if(width_ != -1) - os.width(width_); - if(precision_ != -1) - os.precision(precision_); - if(fill_ != 0) - os.fill(fill_); - os.flags(flags_); -} - -template inline -void stream_format_state ::set_by_stream(const basic_ios& os) - // set our params according to the state of this stream -{ - flags_ = os.flags(); - width_ = os.width(); - precision_ = os.precision(); - fill_ = os.fill(); -} - -template inline -void apply_manip_body( stream_format_state& self, - T manipulator) - // modify our params according to the manipulator -{ - BOOST_IO_STD basic_stringstream ss; - self.apply_on( ss ); - ss << manipulator; - self.set_by_stream( ss ); -} - -template inline -void stream_format_state ::reset() - // set our params to standard's default state -{ - width_=-1; precision_=-1; fill_=0; - flags_ = std::ios_base::dec; -} - - -// --- format_items:: ------------------------------------------- -template inline -void format_item ::compute_states() - // reflect pad_scheme_ on state_ and ref_state_ - // because some pad_schemes has complex consequences on several state params. -{ - if(pad_scheme_ & zeropad) - { - if(ref_state_.flags_ & std::ios_base::left) +//----- stream_format_state --------------------------------------------------// + +// set of params that define the format state of a stream + template + struct stream_format_state { - pad_scheme_ = pad_scheme_ & (~zeropad); // ignore zeropad in left alignment + typedef BOOST_IO_STD basic_ios basic_ios; + + stream_format_state(Ch fill) { reset(fill); } + stream_format_state(const basic_ios& os) { set_by_stream(os); } + + void reset(Ch fill); //- sets to default state. + void set_by_stream(const basic_ios& os); //- sets to os's state. + void apply_on(basic_ios & os) const; //- applies format_state to the stream + template + void apply_manip(T manipulator) //- modifies state by applying manipulator + { apply_manip_body( *this, manipulator) ; } + + // --- data --- + std::streamsize width_; + std::streamsize precision_; + Ch fill_; + std::ios_base::fmtflags flags_; + std::ios_base::iostate rdstate_; + std::ios_base::iostate exceptions_; + }; + + +//----- format_item ---------------------------------------------------------// + +// stores all parameters that can be specified in format strings + template + struct format_item + { + enum pad_values { zeropad = 1, spacepad =2, centered=4, tabulation = 8 }; + // 1. if zeropad is set, all other bits are not, + // 2. if tabulation is set, all others are not. + // centered and spacepad can be mixed freely. + enum arg_values { argN_no_posit = -1, // non-positional directive. will set argN later + argN_tabulation = -2, // tabulation directive. (no argument read) + argN_ignored = -3 // ignored directive. (no argument read) + }; + typedef BOOST_IO_STD basic_ios basic_ios; + typedef detail::stream_format_state stream_format_state; + typedef std::basic_string string_t; + + format_item(Ch fill) :argN_(argN_no_posit), fmtstate_(fill), + truncate_(max_streamsize()), pad_scheme_(0) {} + void reset(Ch fill); + void compute_states(); // sets states according to truncate and pad_scheme. + + static std::streamsize max_streamsize() { + return std::numeric_limits::max(); + } + + // --- data --- + int argN_; //- argument number (starts at 0, eg : %1 => argN=0) + // negative values for items that don't process an argument + string_t res_; //- result of the formatting of this item + string_t appendix_; //- piece of string between this item and the next + + stream_format_state fmtstate_;// set by parsing, is only affected by modify_item + + signed int truncate_; //- is set for directives like %.5s that ask truncation + unsigned int pad_scheme_;//- several possible padding schemes can mix. see pad_values + }; + + + +//---- Definitions ------------------------------------------------------------ + +// --- stream_format_state:: ------------------------------------------------- + template + void stream_format_state:: apply_on(basic_ios & os) const { + // set the state of this stream according to our params + if(width_ != -1) + os.width(width_); + if(precision_ != -1) + os.precision(precision_); + if(fill_ != 0) + os.fill(fill_); + os.flags(flags_); + os.clear(rdstate_); + os.exceptions(exceptions_); + } + + template + void stream_format_state:: set_by_stream(const basic_ios& os) { + // set our params according to the state of this stream + flags_ = os.flags(); + width_ = os.width(); + precision_ = os.precision(); + fill_ = os.fill(); + rdstate_ = os.rdstate(); + exceptions_ = os.exceptions(); + } + + + template + void apply_manip_body( stream_format_state& self, + T manipulator) { + // modify our params according to the manipulator + basic_outsstream ss; + self.apply_on( ss ); + ss << manipulator; + self.set_by_stream( ss ); } - else - { - ref_state_.fill_='0'; - ref_state_.flags_ |= std::ios_base::internal; + + template inline + void stream_format_state:: reset(Ch fill) { + // set our params to standard's default state. cf § 27.4.4.1 of the C++ norm + width_=0; precision_=6; + fill_=fill; // default is widen(' '), but we cant compute it without the locale + flags_ = std::ios_base::dec | std::ios_base::skipws; + // the adjust_field part is left equal to 0, which means right. + exceptions_ = std::ios_base::goodbit; + rdstate_ = std::ios_base::goodbit; + } + + +// --- format_item:: -------------------------------------------------------- + + template + void format_item:: + reset(Ch fill) { + argN_=argN_no_posit; truncate_ = max_streamsize(); pad_scheme_ =0; + res_.resize(0); appendix_.resize(0); + fmtstate_.reset(fill); + } + + template + void format_item:: compute_states() { + // reflect pad_scheme_ on fmt_state_ + // because some pad_schemes has complex consequences on several state params. + if(pad_scheme_ & zeropad) { + // ignore zeropad in left alignment : + if(fmtstate_.flags_ & std::ios_base::left) { + BOOST_ASSERT(!(fmtstate_.flags_ &(std::ios_base::adjustfield ^std::ios_base::left))); + // only left bit might be set. (not right, nor internal) + pad_scheme_ = pad_scheme_ & (~zeropad); + } + else { + pad_scheme_ &= ~spacepad; // printf ignores spacepad when zeropadding + fmtstate_.fill_='0'; + fmtstate_.flags_ = (fmtstate_.flags_ & ~std::ios_base::adjustfield) + | std::ios_base::internal; + // removes all adjustfield bits, and adds internal. + } + } + if(pad_scheme_ & spacepad) { + if(fmtstate_.flags_ & std::ios_base::showpos) + pad_scheme_ &= ~spacepad; + } } - } - state_ = ref_state_; -} } } } // namespaces boost :: io :: detail diff --git a/boost/boost/format/internals_fwd.hpp b/boost/boost/format/internals_fwd.hpp index 2bceff8ff8..da5ebf1d37 100644 --- a/boost/boost/format/internals_fwd.hpp +++ b/boost/boost/format/internals_fwd.hpp @@ -19,8 +19,8 @@ #ifndef BOOST_FORMAT_INTERNAL_FWD_HPP #define BOOST_FORMAT_INTERNAL_FWD_HPP -#include "boost/format/format_fwd.hpp" -#include "boost/config.hpp" +#include +#include namespace boost { @@ -40,7 +40,7 @@ namespace detail { // defined in format_implementation.hpp : template basic_format& modify_item_body( basic_format& self, - int itemN, const T& manipulator); + int itemN, T manipulator); template basic_format& bind_arg_body( basic_format& self, diff --git a/boost/boost/format/macros_default.hpp b/boost/boost/format/macros_default.hpp deleted file mode 100644 index f0f2857a20..0000000000 --- a/boost/boost/format/macros_default.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// -*- C++ -*- -// Boost general library 'format' --------------------------- -// See http://www.boost.org for updates, documentation, and revision history. - -// (C) Samuel Krempp 2001 -// krempp@crans.ens-cachan.fr -// 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. - -// ideas taken from Rüdiger Loos's format class -// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing) - -// ------------------------------------------------------------------------------ -// macros_default.hpp : configuration for the format library -// provides default values for the stl workaround macros -// ------------------------------------------------------------------------------ - -#ifndef BOOST_FORMAT_MACROS_DEFAULT_HPP -#define BOOST_FORMAT_MACROS_DEFAULT_HPP - -#include - -// *** This should go to "boost/config/suffix.hpp". - -#ifndef BOOST_IO_STD -# define BOOST_IO_STD std:: -#endif - -// **** Workaround for io streams, stlport and msvc. -#ifdef BOOST_IO_NEEDS_USING_DECLARATION -namespace boost { - using std::char_traits; - using std::basic_ostream; - using std::basic_ostringstream; - namespace io { - using std::basic_ostream; - namespace detail { - using std::basic_ios; - using std::basic_ostream; - using std::basic_ostringstream; - } - } -} -#endif - -// ------------------------------------------------------------------------------ - -#endif // BOOST_FORMAT_MACROS_DEFAULT_HPP diff --git a/boost/boost/format/macros_stlport.hpp b/boost/boost/format/macros_stlport.hpp deleted file mode 100644 index 62f8e8cff7..0000000000 --- a/boost/boost/format/macros_stlport.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- -// Boost general library 'format' --------------------------- -// See http://www.boost.org for updates, documentation, and revision history. - -// (C) Samuel Krempp 2001 -// krempp@crans.ens-cachan.fr -// 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. - -// ideas taken from Rüdiger Loos's format class -// and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing) - -// ------------------------------------------------------------------------------ -// macros_stlport.hpp : configuration for the format library -// The contents of this file should be integrated into the boost config system. -// ------------------------------------------------------------------------------ - -#ifndef BOOST_MACROS_STLPORT_HPP -#define BOOST_MACROS_STLPORT_HPP - -#include - -// *** This should go to "boost/config/stdlib/stlport.hpp". - -// If the streams are not native and there are problems with using templates -// accross namespaces, we define some macros to enable a workaround for this. - -// STLport 4.5 -#if !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) -# define BOOST_IO_STD -# define BOOST_IO_NEEDS_USING_DECLARATION -#endif - -// STLport 4.0 -#if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_OWN_NAMESPACE) && defined(BOOST_NO_USING_TEMPLATE) -# define BOOST_IO_STD -# define BOOST_IO_NEEDS_USING_DECLARATION -#endif - - -// ------------------------------------------------------------------------------ - -#endif // BOOST_MACROS_STLPORT_HPP diff --git a/boost/boost/format/msvc_disambiguater.hpp b/boost/boost/format/msvc_disambiguater.hpp deleted file mode 100644 index c4ad1aacce..0000000000 --- a/boost/boost/format/msvc_disambiguater.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- -// Boost general library 'format' --------------------------- -// See http://www.boost.org for updates, documentation, and revision history. - -// (C) Samuel Krempp 2001 -// krempp@crans.ens-cachan.fr -// 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. - -// ideas taken from Rüdiger Loos's format class -// and Karl Nelson's ofstream - -// ---------------------------------------------------------------------------- -// msvc_disambiguater.hpp : msvc workarounds. (for put_{head|last} overloads) -// the trick was described in boost's list by Aleksey Gurtovoy -// ---------------------------------------------------------------------------- - - -#ifndef BOOST_MSVC_DISAMBIGUATER_HPP -#define BOOST_MSVC_DISAMBIGUATER_HPP - -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) // this whole header is specifically for msvc - -#include "boost/format/group.hpp" -#include - -namespace boost { -namespace io { -namespace detail { - -template< class Ch, class Tr, class T > -struct disambiguater -{ - template< typename U > - static void put_head(BOOST_IO_STD basic_ostream& os, group1 const& x, long) - { - os << group_head(x.a1_); - } - static void put_head(BOOST_IO_STD basic_ostream& os, T const& x, int) - { - } - template< typename U > - static void put_last(BOOST_IO_STD basic_ostream& os, group1 const& x, long) - { - os << group_last(x.a1_); - } - static void put_last(BOOST_IO_STD basic_ostream& os, T const& x, int) - { - os << x; - } -}; - -} // namespace detail -} // namespace io -} // namespace boost - -#endif // -BOOST_MSVC - -#endif // -BOOST_MSVC_DISAMBIGUATER_HPP diff --git a/boost/boost/format/outsstream.hpp b/boost/boost/format/outsstream.hpp new file mode 100644 index 0000000000..60344be3a5 --- /dev/null +++ b/boost/boost/format/outsstream.hpp @@ -0,0 +1,146 @@ +// -*- C++ -*- +// Boost format ---------------------------------------------------- +// See http://www.boost.org for updates, documentation, and revision history. + +// (C) Samuel Krempp 2003 +// 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. + +// ------------------------------------------------------------------------------ +// outsstream is a class extending stringstream by adding : +// clear_buffer() method, and +// access to the [pbase(), pptr()[ part of the 'output sequence' +// (see §27.5.1 of the C++ standard) +// if sstream is not available, it uses strstream and is slightly different. +// ------------------------------------------------------------------------------ + +#ifndef BOOST_FORMAT_OUTSSTREAM_H +#define BOOST_FORMAT_OUTSSTREAM_H + +#include +#include +#include + +#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM) +#include +#else +#include +#include +#endif // BOOST_NO_STRING_STREAM + + +namespace boost { +namespace io { + +#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM) + + +//---- The stringstream way --------------------------------------------------- + + +// --- class steal_basic_stringbuf : steals pbase(), pptr() & co ----------- + template > + class steal_basic_stringbuf : public std::basic_stringbuf + { + typedef std::basic_stringbuf buff_t; + public: + typedef std::basic_string string_type; + + // get [pbase, pptr[ from stringbuf::str(), which returns [pbase, epptr[ : + string_type cur_str() const { return string_type(this->str(), 0, pcount()); } + + // publicize those functions (protected in stringbuf) : + std::streamsize pcount() const { return pptr() - pbase(); } + const Ch * pbase() const { return buff_t::pbase(); } + const Ch * pptr() const { return buff_t::pptr(); } + const Ch * epptr() const { return buff_t::epptr(); } + // added convenience function : + void clear_buffer(); + }; + + +// --- class basic_outsstream ----------------------------------------------- + template > + class basic_outsstream : boost::base_from_member >, + public BOOST_IO_STD basic_ostream + // use stringbuf with its stolen protected members, + // publicly derived from basic_ostream to make this class a stream. + { + public: + typedef std::basic_string string_type; + basic_outsstream() : pbase_type(), + std::basic_ostream( & sb() ) {} + // buffer access via strings + string_type str() const { return sb().str(); } // [begin, end[ + string_type cur_str() const { return sb().cur_str(); } // [begin, cur[ + + // copy-less access (note the pointers can be invalidated when modifying the stream) + std::streamsize pcount() const { return sb().pcount(); } + const Ch * begin() const { return sb().pbase(); } + const Ch * cur() const { return sb().pptr(); } + const Ch * end() const { return sb().epptr(); } + + void clear_buffer() { sb().clear_buffer(); } + private: + typedef boost::base_from_member > pbase_type; + steal_basic_stringbuf & sb() { return pbase_type::member; } + steal_basic_stringbuf const& sb() const { return pbase_type::member; } + }; +#else // BOOST_NO_STRINGSTREAM + + + +//---- The strstream way ------------------------------------------------------ + + template > +#else + class Tr = std::string_char_traits > +#endif + class basic_outsstream; // we define only the specialisaton + + +// --- class basic_outsstream ----------------------------------------------- + template + class basic_outsstream : private BOOST_IO_STD strstreambuf, + public std::basic_ostream + { + public: + typedef char Ch; + typedef std::basic_string string_type; + typedef BOOST_IO_STD strstreambuf buff_t; + typedef std::basic_ostream stream_t; + public: + basic_outsstream(); + + // ! physically copy chars : + string_type str(); + string_type cur_str() const { return string_type(begin(), cur()); } + + int freeze() const { return buff_t::freeze(); } + void freeze(int x) { buff_t::freeze(x); } + + // copy-less access (be careful, the pointer are invalidated when modifying the stream) : + std::streamsize pcount() const { return cur()-begin(); } + const Ch * begin() const { return buff_t::pbase(); } + const Ch * cur() const { return buff_t::pptr(); } + const Ch * end() const { return buff_t::epptr(); } + + void clear_buffer(); + }; + +#endif // BOOST_NO_STRINGSTREAM + + + typedef basic_outsstream outsstream; + +} // namespace boost::io +} // namespace boost + + +#include // implementation + +#endif // BOOST_FORMAT_OUTSSTREAM_H include guard diff --git a/boost/boost/format/outsstream_impl.hpp b/boost/boost/format/outsstream_impl.hpp new file mode 100644 index 0000000000..7e51f0a829 --- /dev/null +++ b/boost/boost/format/outsstream_impl.hpp @@ -0,0 +1,68 @@ +// -*- C++ -*- +// Boost format ---------------------------------------------------- +// See http://www.boost.org for updates, documentation, and revision history. + +// (C) Samuel Krempp 2003 +// 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. + +// ------------------------------------------------------------------------------ +// implementation included by outsstream.hpp. +// ------------------------------------------------------------------------------ + +namespace boost { +namespace io { + +#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_FORMAT_IGNORE_STRINGSTREAM) + +template inline +void steal_basic_stringbuf :: clear_buffer() { + const Ch * p = pptr(); + const Ch * b = pbase(); + if(p != NULL && p != b) { + typedef typename Tr::pos_type pos_type; + pos_type pos = buff_t::seekpos(0, std::ios_base::out); + BOOST_ASSERT( pos != pos_type(std::streamoff(-1)) ); + } +} + + + +#else // BOOST_NO_STRINGSTREAM + + +template inline +basic_outsstream ::basic_outsstream() : + buff_t(), + stream_t(this) +{ + stream_t::init(this); // the strem construction isnt enough with gcc-2.95 +} + + +template +std::basic_string +basic_outsstream ::str() { // ! physically copy chars : + string_type s(buff_t::str(), pcount()); + freeze(false); + return s; +} + +template inline +void +basic_outsstream:: clear_buffer() { + freeze(false); + const Ch * p = cur(); + const Ch * b = begin(); + if(p != NULL && p != b) { + buff_t::seekpos(0, std::ios_base::out); + } + freeze(false); +} + +#endif + +} //namespace io +} //namespace boost diff --git a/boost/boost/format/parsing.hpp b/boost/boost/format/parsing.hpp index 1e75392d9b..cf54ccbbe5 100644 --- a/boost/boost/format/parsing.hpp +++ b/boost/boost/format/parsing.hpp @@ -3,7 +3,6 @@ // See http://www.boost.org for updates, documentation, and revision history. // (C) Samuel Krempp 2001 -// krempp@crans.ens-cachan.fr // 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 @@ -31,425 +30,423 @@ namespace boost { namespace io { namespace detail { - template inline - bool wrap_isdigit(Ch c, Stream &os) - { -#ifndef BOOST_NO_LOCALE_ISIDIGIT - return std::isdigit(c, os.rdbuf()->getloc() ); + template inline + bool wrap_isdigit(Ch c, Stream &os) { +#if ! defined( BOOST_NO_LOCALE_ISIDIGIT ) + return std::isdigit(c, os.rdbuf()->getloc() ); # else - using namespace std; - return isdigit(c); + using namespace std; + return isdigit(c); #endif - } //end- wrap_isdigit(..) - - template inline - Res str2int(const std::basic_string& s, - typename std::basic_string::size_type start, - BOOST_IO_STD basic_ios &os, - const Res = Res(0) ) - // Input : char string, with starting index - // a basic_ios& merely to call its widen/narrow member function in the desired locale. - // Effects : reads s[start:] and converts digits into an integral n, of type Res - // Returns : n - { - Res n = 0; - while(start + Iter wrap_scan_notdigit(Iter beg, Iter end, const Stream & os) { + using namespace std; + for( ; beg!=end && wrap_isdigit(*beg,os); ++beg) ; + return beg; } - return n; - } - - template - void skip_asterisk(const std::basic_string & buf, - typename std::basic_string::size_type * pos_p, - BOOST_IO_STD basic_ios &os) - // skip printf's "asterisk-fields" directives in the format-string buf - // Input : char string, with starting index *pos_p - // a basic_ios& merely to call its widen/narrow member function in the desired locale. - // Effects : advance *pos_p by skipping printf's asterisk fields. - // Returns : nothing - { - using namespace std; - BOOST_ASSERT( pos_p != 0); - if(*pos_p >= buf.size() ) return; - if(buf[ *pos_p]==os.widen('*')) { - ++ (*pos_p); - while (*pos_p < buf.size() && wrap_isdigit(buf[*pos_p],os)) ++(*pos_p); - if(buf[*pos_p]==os.widen('$')) ++(*pos_p); + + + template + Iter str2int(const Iter & start, const Iter & last, Res & res, Stream &os) + // Input : [start, last) iterators range and a + // a basic_ios& merely to use its widen/narrow member function + // Effects : reads sequence and converts digits into an integral n, of type Res + // Returns : n + { + using namespace std; + Iter it; + res=0; + for(it=start; it != last && wrap_isdigit(*it, os); ++it ) { + char cur_ch = os.narrow( *it, 0); // cant fail. + res *= 10; + res += cur_ch - '0'; // 22.2.1.1.2.13 of the C++ standard + } + return it; + } + + template + Iter skip_asterisk(Iter start, Iter last, Stream &os) + // skip printf's "asterisk-fields" directives in the format-string buf + // Input : char string, with starting index *pos_p + // a basic_ios& merely to use its widen/narrow member function + // Effects : advance *pos_p by skipping printf's asterisk fields. + // Returns : nothing + { + using namespace std; + ++ start; + start = wrap_scan_notdigit(start, last, os); + if(start!=last && *start== os.widen('$') ) + ++start; + return start; } - } - inline void maybe_throw_exception( unsigned char exceptions) - // auxiliary func called by parse_printf_directive - // for centralising error handling - // it either throws if user sets the corresponding flag, or does nothing. - { - if(exceptions & io::bad_format_string_bit) - boost::throw_exception(io::bad_format_string()); - } + inline void maybe_throw_exception( unsigned char exceptions) + // auxiliary func called by parse_printf_directive + // for centralising error handling + // it either throws if user sets the corresponding flag, or does nothing. + { + if(exceptions & io::bad_format_string_bit) + boost::throw_exception(io::bad_format_string()); + } - template - bool parse_printf_directive(const std::basic_string & buf, - typename std::basic_string::size_type * pos_p, - detail::format_item * fpar, - BOOST_IO_STD basic_ios &os, - unsigned char exceptions) - // Input : a 'printf-directive' in the format-string, starting at buf[ *pos_p ] - // a basic_ios& merely to call its widen/narrow member function in the desired locale. - // a bitset'excpetions' telling whether to throw exceptions on errors. - // Returns : true if parse somehow succeeded (possibly ignoring errors if exceptions disabled) - // false if it failed so bad that the directive should be printed verbatim - // Effects : - *pos_p is incremented so that buf[*pos_p] is the first char after the directive - // - *fpar is set with the parameters read in the directive - { - typedef format_item format_item_t; - BOOST_ASSERT( pos_p != 0); - typename std::basic_string::size_type &i1 = *pos_p, - i0; - fpar->argN_ = format_item_t::argN_no_posit; // if no positional-directive - - bool in_brackets=false; - if(buf[i1]==os.widen('|')) - { - in_brackets=true; - if( ++i1 >= buf.size() ) { - maybe_throw_exception(exceptions); - return false; + template + bool parse_printf_directive(Iter & start, const Iter& last, + detail::format_item * fpar, + Stream &os, + unsigned char exceptions) + // Input: a 'printf-directive' in the format-string, starting at buf[ *pos_p ] + // a basic_ios& merely to use its widen/narrow member function + // a bitset'excpetions' telling whether to throw exceptions on errors. + // Returns: true if parse somehow succeeded (ignore some errors if exceptions disabled) + // false if it failed so bad that the directive should be printed verbatim + // Effects: *pos_p is incremented so that buf[*pos_p] is the first char after the directive + // *fpar is set with the parameters read in the directive + { + typedef format_item format_item_t; + //BOOST_ASSERT( pos_p != 0); + + fpar->argN_ = format_item_t::argN_no_posit; // if no positional-directive + bool precision_set = false; + bool in_brackets=false; + if(*start== os.widen('|')) { + in_brackets=true; + if( ++start >= last ) { + maybe_throw_exception(exceptions); + return false; + } } - } - - // the flag '0' would be picked as a digit for argument order, but here it's a flag : - if(buf[i1]==os.widen('0')) - goto parse_flags; - - // handle argument order (%2$d) or possibly width specification: %2d - i0 = i1; // save position before digits - while (i1 < buf.size() && wrap_isdigit(buf[i1], os)) - ++i1; - if (i1!=i0) - { - if( i1 >= buf.size() ) { - maybe_throw_exception(exceptions); - return false; + + // the flag '0' would be picked as a digit for argument order, but here it's a flag : + if(*start== os.widen('0')) + goto parse_flags; + + // handle argument order (%2$d) or possibly width specification: %2d + if(wrap_isdigit(*start, os)) { + int n; + start = str2int(start, last, n, os); + if( start >= last ) { + maybe_throw_exception(exceptions); + return false; + } + + // %N% case : this is already the end of the directive + if( *start == os.widen('%') ) { + fpar->argN_ = n-1; + ++start; + if( in_brackets) + maybe_throw_exception(exceptions); + // but don't return. maybe "%" was used in lieu of '$', so we go on. + else + return true; + } + + if ( *start== os.widen('$') ) { + fpar->argN_ = n-1; + ++start; + } + else { + // non-positionnal directive + fpar->fmtstate_.width_ = n; + fpar->argN_ = format_item_t::argN_no_posit; + goto parse_precision; + } } - int n=str2int(buf,i0, os, int(0) ); - - // %N% case : this is already the end of the directive - if( buf[i1] == os.widen('%') ) - { - fpar->argN_ = n-1; - ++i1; - if( in_brackets) - maybe_throw_exception(exceptions); - // but don't return. maybe "%" was used in lieu of '$', so we go on. - else return true; - } - - if ( buf[i1]==os.widen('$') ) - { - fpar->argN_ = n-1; - ++i1; - } - else - { - // non-positionnal directive - fpar->ref_state_.width_ = n; - fpar->argN_ = format_item_t::argN_no_posit; - goto parse_precision; - } - } - parse_flags: - // handle flags - while ( i1 ref_state_.flags_ |= std::ios_base::left; + parse_flags: + // handle flags + while ( start != last) { // as long as char is one of + - = _ # 0 l h or ' ' + // misc switches + switch ( os.narrow(*start, 0)) { + case '\'' : break; // no effect yet. (painful to implement) + case 'l': + case 'h': // short/long modifier : for printf-comaptibility (no action needed) + break; + case '-': + fpar->fmtstate_.flags_ |= std::ios_base::left; + break; + case '=': + fpar->pad_scheme_ |= format_item_t::centered; + break; + case '_': + fpar->fmtstate_.flags_ |= std::ios_base::internal; + break; + case ' ': + fpar->pad_scheme_ |= format_item_t::spacepad; + break; + case '+': + fpar->fmtstate_.flags_ |= std::ios_base::showpos; + break; + case '0': + fpar->pad_scheme_ |= format_item_t::zeropad; + // need to know alignment before really setting flags, + // so just add 'zeropad' flag for now, it will be processed later. + break; + case '#': + fpar->fmtstate_.flags_ |= std::ios_base::showpoint | std::ios_base::showbase; + break; + default: + goto parse_width; + } + ++start; + } // loop on flag. + + if( start>=last) { + maybe_throw_exception(exceptions); + return true; + } + parse_width: + // handle width spec + // first skip 'asterisk fields' : *, or *N$ + if(*start == os.widen('*') ) + start = skip_asterisk(start, last, os); + if(start!=last && wrap_isdigit(*start, os)) + start = str2int(start, last, fpar->fmtstate_.width_, os); + + parse_precision: + if( start>= last) { + maybe_throw_exception(exceptions); + return true; + } + // handle precision spec + if (*start== os.widen('.')) { + ++start; + if(start != last && *start == os.widen('*') ) + start = skip_asterisk(start, last, os); + if(start != last && wrap_isdigit(*start, os)) { + start = str2int(start, last, fpar->fmtstate_.precision_, os); + precision_set = true; + } + else + fpar->fmtstate_.precision_ =0; + } + + // handle formatting-type flags : + while( start != last && + ( *start== os.widen('l') || *start== os.widen('L') || *start== os.widen('h')) ) + ++start; + if( start>=last) { + maybe_throw_exception(exceptions); + return true; + } + + if( in_brackets && *start== os.widen('|') ) { + ++start; + return true; + } + switch ( os.narrow(*start, 0) ) { + case 'X': + fpar->fmtstate_.flags_ |= std::ios_base::uppercase; + case 'p': // pointer => set hex. + case 'x': + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::hex; break; - case '=': - fpar->pad_scheme_ |= format_item_t::centered; + + case 'o': + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::oct; break; - case ' ': - fpar->pad_scheme_ |= format_item_t::spacepad; + + case 'E': + fpar->fmtstate_.flags_ |= std::ios_base::uppercase; + case 'e': + fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; + fpar->fmtstate_.flags_ |= std::ios_base::scientific; + + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::dec; break; - case '+': - fpar->ref_state_.flags_ |= std::ios_base::showpos; + + case 'f': + fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; + fpar->fmtstate_.flags_ |= std::ios_base::fixed; + case 'u': + case 'd': + case 'i': + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::dec; break; - case '0': - fpar->pad_scheme_ |= format_item_t::zeropad; - // need to know alignment before really setting flags, - // so just add 'zeropad' flag for now, it will be processed later. + + case 'T': + ++start; + if( start >= last) + maybe_throw_exception(exceptions); + else + fpar->fmtstate_.fill_ = *start; + fpar->pad_scheme_ |= format_item_t::tabulation; + fpar->argN_ = format_item_t::argN_tabulation; break; - case '#': - fpar->ref_state_.flags_ |= std::ios_base::showpoint | std::ios_base::showbase; + case 't': + fpar->fmtstate_.fill_ = os.widen(' '); + fpar->pad_scheme_ |= format_item_t::tabulation; + fpar->argN_ = format_item_t::argN_tabulation; break; - default: - goto parse_width; - } - ++i1; - } // loop on flag. - if( i1>=buf.size()) { - maybe_throw_exception(exceptions); - return true; - } - parse_width: - // handle width spec - skip_asterisk(buf, &i1, os); // skips 'asterisk fields' : *, or *N$ - i0 = i1; // save position before digits - while (i1ref_state_.width_ = str2int( buf,i0, os, std::streamsize(0) ); } + case 'G': + fpar->fmtstate_.flags_ |= std::ios_base::uppercase; + break; + case 'g': // 'g' conversion is default for floats. + fpar->fmtstate_.flags_ &= ~std::ios_base::basefield; + fpar->fmtstate_.flags_ |= std::ios_base::dec; - parse_precision: - if( i1>=buf.size()) { - maybe_throw_exception(exceptions); - return true; - } - // handle precision spec - if (buf[i1]==os.widen('.')) - { - ++i1; - skip_asterisk(buf, &i1, os); - i0 = i1; // save position before digits - while (i1ref_state_.precision_ = 0; - else - fpar->ref_state_.precision_ = str2int(buf,i0, os, std::streamsize(0) ); - } - - // handle formatting-type flags : - while( i1=buf.size()) { - maybe_throw_exception(exceptions); - return true; - } - - if( in_brackets && buf[i1]==os.widen('|') ) - { - ++i1; + // CLEAR all floatield flags, so stream will CHOOSE + fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; + break; + + case 'C': + case 'c': + fpar->truncate_ = 1; + break; + case 'S': + case 's': + if(precision_set) // handle truncation manually, with own parameter. + fpar->truncate_ = fpar->fmtstate_.precision_; + fpar->fmtstate_.precision_ = 6; // default stream precision. + break; + case 'n' : + fpar->argN_ = format_item_t::argN_ignored; + break; + default: + maybe_throw_exception(exceptions); + } + ++start; + + if( in_brackets ) { + if( start != last && *start== os.widen('|') ) { + ++start; + return true; + } + else maybe_throw_exception(exceptions); + } return true; - } - switch (os.narrow(buf[i1], 0) ) - { - case 'X': - fpar->ref_state_.flags_ |= std::ios_base::uppercase; - case 'p': // pointer => set hex. - case 'x': - fpar->ref_state_.flags_ &= ~std::ios_base::basefield; - fpar->ref_state_.flags_ |= std::ios_base::hex; - break; - - case 'o': - fpar->ref_state_.flags_ &= ~std::ios_base::basefield; - fpar->ref_state_.flags_ |= std::ios_base::oct; - break; - - case 'E': - fpar->ref_state_.flags_ |= std::ios_base::uppercase; - case 'e': - fpar->ref_state_.flags_ &= ~std::ios_base::floatfield; - fpar->ref_state_.flags_ |= std::ios_base::scientific; - - fpar->ref_state_.flags_ &= ~std::ios_base::basefield; - fpar->ref_state_.flags_ |= std::ios_base::dec; - break; - - case 'f': - fpar->ref_state_.flags_ &= ~std::ios_base::floatfield; - fpar->ref_state_.flags_ |= std::ios_base::fixed; - case 'u': - case 'd': - case 'i': - fpar->ref_state_.flags_ &= ~std::ios_base::basefield; - fpar->ref_state_.flags_ |= std::ios_base::dec; - break; - - case 'T': - ++i1; - if( i1 >= buf.size()) - maybe_throw_exception(exceptions); - else - fpar->ref_state_.fill_ = buf[i1]; - fpar->pad_scheme_ |= format_item_t::tabulation; - fpar->argN_ = format_item_t::argN_tabulation; - break; - case 't': - fpar->ref_state_.fill_ = os.widen(' '); - fpar->pad_scheme_ |= format_item_t::tabulation; - fpar->argN_ = format_item_t::argN_tabulation; - break; - - case 'G': - fpar->ref_state_.flags_ |= std::ios_base::uppercase; - break; - case 'g': // 'g' conversion is default for floats. - fpar->ref_state_.flags_ &= ~std::ios_base::basefield; - fpar->ref_state_.flags_ |= std::ios_base::dec; - - // CLEAR all floatield flags, so stream will CHOOSE - fpar->ref_state_.flags_ &= ~std::ios_base::floatfield; - break; - - case 'C': - case 'c': - fpar->truncate_ = 1; - break; - case 'S': - case 's': - fpar->truncate_ = fpar->ref_state_.precision_; - fpar->ref_state_.precision_ = -1; - break; - case 'n' : - fpar->argN_ = format_item_t::argN_ignored; - break; - default: - maybe_throw_exception(exceptions); - } - ++i1; - - if( in_brackets ) - { - if( i1 + int upper_bound_from_fstring(const string_t& buf, + const typename string_t::value_type arg_mark, + Stream& os, // just to carry the locale + unsigned char exceptions) { + // quick-parsing of the format-string to count arguments mark (arg_mark, '%') + // returns : upper bound on the number of format items in the format strings + typename string_t::size_type i1=0; + int num_items=0; + while( (i1=buf.find(arg_mark,i1)) != string_t::npos ) { + if( i1+1 >= buf.size() ) { + if(exceptions & io::bad_format_string_bit) + boost::throw_exception(io::bad_format_string()); // must not end in ".. %" + else break; // stop there, ignore last '%' + } + if(buf[i1+1] == buf[i1] ) {// escaped "%%" + i1+=2; continue; + } + + ++i1; + // in case of %N% directives, dont count it double (wastes allocations..) : + i1 = wrap_scan_notdigit(buf.begin()+i1, buf.end(), os) - buf.begin(); + if( i1 < buf.size() && buf[i1] == arg_mark ) + ++i1; + ++num_items; + } + return num_items; + } } // detail namespace } // io namespace + // ----------------------------------------------- // format :: parse(..) -template -void basic_format ::parse(const string_t & buf) - // parse the format-string -{ - using namespace std; - const Ch arg_mark = oss_.widen('%'); - bool ordered_args=true; - int max_argN=-1; - typename string_t::size_type i1=0; - int num_items=0; - - // A: find upper_bound on num_items and allocates arrays - i1=0; - while( (i1=buf.find(arg_mark,i1)) != string_t::npos ) - { - if( i1+1 >= buf.size() ) { - if(exceptions() & io::bad_format_string_bit) - boost::throw_exception(io::bad_format_string()); // must not end in "bla bla %" - else break; // stop there, ignore last '%' - } - if(buf[i1+1] == buf[i1] ) { i1+=2; continue; } // escaped "%%" / "##" - ++i1; - - // in case of %N% directives, dont count it double (wastes allocations..) : - while(i1 < buf.size() && io::detail::wrap_isdigit(buf[i1],oss_)) ++i1; - if( i1 < buf.size() && buf[i1] == arg_mark ) ++ i1; - - ++num_items; - } - items_.assign( num_items, format_item_t() ); - - // B: Now the real parsing of the format string : - num_items=0; - i1 = 0; - typename string_t::size_type i0 = i1; - bool special_things=false; - int cur_it=0; - while( (i1=buf.find(arg_mark,i1)) != string_t::npos ) - { - string_t & piece = (cur_it==0) ? prefix_ : items_[cur_it-1].appendix_; - - if( buf[i1+1] == buf[i1] ) // escaped mark, '%%' - { - piece += buf.substr(i0, i1-i0) + buf[i1]; - i1+=2; i0=i1; - continue; - } - BOOST_ASSERT( static_cast(cur_it) < items_.size() || cur_it==0); - - if(i1!=i0) piece += buf.substr(i0, i1-i0); - ++i1; - - bool parse_ok; - parse_ok = io::detail::parse_printf_directive(buf, &i1, &items_[cur_it], oss_, exceptions()); - if( ! parse_ok ) continue; // the directive will be printed verbatim - - i0=i1; - items_[cur_it].compute_states(); // process complex options, like zeropad, into stream params. - - int argN=items_[cur_it].argN_; - if(argN == format_item_t::argN_ignored) - continue; - if(argN ==format_item_t::argN_no_posit) - ordered_args=false; - else if(argN == format_item_t::argN_tabulation) special_things=true; - else if(argN > max_argN) max_argN = argN; - ++num_items; - ++cur_it; - } // loop on %'s - BOOST_ASSERT(cur_it == num_items); - - // store the final piece of string - string_t & piece = (cur_it==0) ? prefix_ : items_[cur_it-1].appendix_; - piece += buf.substr(i0); + template + basic_format& basic_format:: parse(const string_t& buf) { + // parse the format-string + using namespace std; + + + const Ch arg_mark = oss_.widen('%'); + bool ordered_args=true; + int max_argN=-1; + + // A: find upper_bound on num_items and allocates arrays + int num_items = io::detail::upper_bound_from_fstring(buf, arg_mark, oss_, exceptions()); + make_or_reuse_data(num_items); + + // B: Now the real parsing of the format string : + num_items=0; + typename string_t::size_type i0=0, i1=0; + typename string_t::const_iterator it; + bool special_things=false; + int cur_item=0; + while( (i1=buf.find(arg_mark,i1)) != string_t::npos ) { + string_t & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_; + if( buf[i1+1] == buf[i1] ) { // escaped mark, '%%' + piece += buf.substr(i0, i1+1-i0); + i1+=2; i0=i1; + continue; + } + BOOST_ASSERT( static_cast(cur_item) < items_.size() || cur_item==0); + + if(i1!=i0) + piece += buf.substr(i0, i1-i0); + ++i1; + it = buf.begin()+i1; + bool parse_ok = io::detail::parse_printf_directive( + it, buf.end(), &items_[cur_item], oss_, exceptions()); + i1 = it - buf.begin(); + if( ! parse_ok ) // the directive will be printed verbatim + continue; + i0=i1; + items_[cur_item].compute_states(); // process complex options, like zeropad, into params + + int argN=items_[cur_item].argN_; + if(argN == format_item_t::argN_ignored) + continue; + if(argN ==format_item_t::argN_no_posit) + ordered_args=false; + else if(argN == format_item_t::argN_tabulation) special_things=true; + else if(argN > max_argN) max_argN = argN; + ++num_items; + ++cur_item; + } // loop on %'s + BOOST_ASSERT(cur_item == num_items); - if( !ordered_args) - { - if(max_argN >= 0 ) // dont mix positional with non-positionnal directives + // store the final piece of string { - if(exceptions() & io::bad_format_string_bit) - boost::throw_exception(io::bad_format_string()); - // else do nothing. => positionnal arguments are processed as non-positionnal + string_t & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_; + piece += buf.substr(i0); + } + + if( !ordered_args) { + if(max_argN >= 0 ) { // dont mix positional with non-positionnal directives + if(exceptions() & io::bad_format_string_bit) + boost::throw_exception(io::bad_format_string()); + // else do nothing. => positionnal arguments are processed as non-positionnal + } + // set things like it would have been with positional directives : + int non_ordered_items = 0; + for(int i=0; i< num_items; ++i) + if(items_[i].argN_ == format_item_t::argN_no_posit) { + items_[i].argN_ = non_ordered_items; + ++non_ordered_items; + } + max_argN = non_ordered_items-1; } - // set things like it would have been with positional directives : - int non_ordered_items = 0; - for(int i=0; i< num_items; ++i) - if(items_[i].argN_ == format_item_t::argN_no_posit) - { - items_[i].argN_ = non_ordered_items; - ++non_ordered_items; - } - max_argN = non_ordered_items-1; - } - // C: set some member data : - items_.resize(num_items); - - if(special_things) style_ |= special_needs; - num_args_ = max_argN + 1; - if(ordered_args) style_ |= ordered; - else style_ &= ~ordered; -} + // C: set some member data : + items_.resize(num_items, format_item_t(oss_.fill()) ); + + if(special_things) style_ |= special_needs; + num_args_ = max_argN + 1; + if(ordered_args) style_ |= ordered; + else style_ &= ~ordered; + return *this; + } } // namespace boost diff --git a/boost/boost/function.hpp b/boost/boost/function.hpp index 5d8bca539d..9203ff9662 100644 --- a/boost/boost/function.hpp +++ b/boost/boost/function.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2001, 2002 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug 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 diff --git a/boost/boost/function/detail/function_iterate.hpp b/boost/boost/function/detail/function_iterate.hpp index 4587b94ac7..7e116a62fa 100644 --- a/boost/boost/function/detail/function_iterate.hpp +++ b/boost/boost/function/detail/function_iterate.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 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 #if !defined(BOOST_PP_IS_ITERATING) diff --git a/boost/boost/function/detail/maybe_include.hpp b/boost/boost/function/detail/maybe_include.hpp index 83d82cb850..df41437d66 100644 --- a/boost/boost/function/detail/maybe_include.hpp +++ b/boost/boost/function/detail/maybe_include.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 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 diff --git a/boost/boost/function/detail/prologue.hpp b/boost/boost/function/detail/prologue.hpp index 5960134ca6..c748f6f659 100644 --- a/boost/boost/function/detail/prologue.hpp +++ b/boost/boost/function/detail/prologue.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 @@ -21,7 +15,7 @@ # include # include # include -# include +# include # include # include # include diff --git a/boost/boost/function/function0.hpp b/boost/boost/function/function0.hpp index 133030a242..672d19ee26 100644 --- a/boost/boost/function/function0.hpp +++ b/boost/boost/function/function0.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function1.hpp b/boost/boost/function/function1.hpp index 6c71d78cdb..a8ba6cae10 100644 --- a/boost/boost/function/function1.hpp +++ b/boost/boost/function/function1.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function10.hpp b/boost/boost/function/function10.hpp index 736d1cde4e..e8a37122da 100644 --- a/boost/boost/function/function10.hpp +++ b/boost/boost/function/function10.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function2.hpp b/boost/boost/function/function2.hpp index ca07250232..cde871121d 100644 --- a/boost/boost/function/function2.hpp +++ b/boost/boost/function/function2.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function3.hpp b/boost/boost/function/function3.hpp index f1047c2bb7..953fb167d9 100644 --- a/boost/boost/function/function3.hpp +++ b/boost/boost/function/function3.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function4.hpp b/boost/boost/function/function4.hpp index bf74976958..d0376a304f 100644 --- a/boost/boost/function/function4.hpp +++ b/boost/boost/function/function4.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function5.hpp b/boost/boost/function/function5.hpp index 8cbc3b09d7..1b92c02415 100644 --- a/boost/boost/function/function5.hpp +++ b/boost/boost/function/function5.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function6.hpp b/boost/boost/function/function6.hpp index 541b205b58..3aab386d2c 100644 --- a/boost/boost/function/function6.hpp +++ b/boost/boost/function/function6.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function7.hpp b/boost/boost/function/function7.hpp index abd56fbdf8..c314eb5037 100644 --- a/boost/boost/function/function7.hpp +++ b/boost/boost/function/function7.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function8.hpp b/boost/boost/function/function8.hpp index 1bce61a4d7..e6bb6b46fd 100644 --- a/boost/boost/function/function8.hpp +++ b/boost/boost/function/function8.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function9.hpp b/boost/boost/function/function9.hpp index 9b87add8f5..6004085d87 100644 --- a/boost/boost/function/function9.hpp +++ b/boost/boost/function/function9.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug Gregor 2002-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 diff --git a/boost/boost/function/function_base.hpp b/boost/boost/function/function_base.hpp index 321ec67f7b..ad7bb99734 100644 --- a/boost/boost/function/function_base.hpp +++ b/boost/boost/function/function_base.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2001-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug 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 @@ -29,6 +23,10 @@ #include #include +#ifndef BOOST_NO_SFINAE +# include "boost/utility/enable_if.hpp" +#endif + #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) # define BOOST_FUNCTION_TARGET_FIX(x) x #else @@ -44,36 +42,13 @@ namespace boost { namespace python { namespace objects { }}} #endif -// GCC 2.95.3 (or earlier) doesn't support enable_if -#if BOOST_WORKAROUND(__GNUC__, < 3) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -// MIPSpro 7.3.1.3m doesn't support enable_if -#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -// MSVC 7.0 doesn't support enable_if -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 && !defined(BOOST_STRICT_CONFIG) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -// Borland C++ 5.6.0 doesn't support enable_if -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -// Metrowerks 7.2 doesn't support enable_if -#if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x540) -# define BOOST_FUNCTION_NO_ENABLE_IF +#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + || defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ + || !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) +# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX #endif -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) namespace boost { #if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) @@ -294,36 +269,6 @@ namespace boost { } }; -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template struct enable_if; - template struct enable_if { typedef T type; }; - template struct enable_if {}; - - template - struct enabled - { - template - struct base - { - typedef T type; - }; - }; - - template<> - struct enabled - { - template - struct base - { - }; - }; - - template - struct enable_if : public enabled::template base - { - }; -#endif - // A type that is only used for comparisons against zero struct useless_clear_type {}; } // end namespace function diff --git a/boost/boost/function/function_template.hpp b/boost/boost/function/function_template.hpp index d0e569a956..9725dc515b 100644 --- a/boost/boost/function/function_template.hpp +++ b/boost/boost/function/function_template.hpp @@ -1,15 +1,9 @@ // Boost.Function library -// Copyright (C) 2001-2003 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// Copyright Doug 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 @@ -240,9 +234,11 @@ namespace boost { > class BOOST_FUNCTION_FUNCTION : public function_base { + public: typedef typename detail::function::function_return_type::type internal_result_type; + private: struct clear_type {}; public: @@ -280,12 +276,12 @@ namespace boost { // one with a default parameter. template BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f -#ifndef BOOST_FUNCTION_NO_ENABLE_IF - ,typename detail::function::enable_if< +#ifndef BOOST_NO_SFINAE + ,typename enable_if_c< (::boost::type_traits::ice_not< - (is_same::value)>::value), + (is_integral::value)>::value), int>::type = 0 -#endif // BOOST_FUNCTION_NO_ENABLE_IF +#endif // BOOST_NO_SFINAE ) : function_base(), invoker(0) @@ -293,7 +289,7 @@ namespace boost { this->assign_to(f); } -#ifndef BOOST_FUNCTION_NO_ENABLE_IF +#ifndef BOOST_NO_SFINAE BOOST_FUNCTION_FUNCTION(clear_type*) : function_base(), invoker(0) {} #else BOOST_FUNCTION_FUNCTION(int zero) : function_base(), invoker(0) @@ -316,7 +312,7 @@ namespace boost { if (this->empty()) boost::throw_exception(bad_function_call()); - internal_result_type result = invoker(function_base::functor + internal_result_type result = invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); @@ -333,10 +329,10 @@ namespace boost { // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to // construct. template -#ifndef BOOST_FUNCTION_NO_ENABLE_IF - typename detail::function::enable_if< +#ifndef BOOST_NO_SFINAE + typename enable_if_c< (::boost::type_traits::ice_not< - (is_same::value)>::value), + (is_integral::value)>::value), BOOST_FUNCTION_FUNCTION&>::type #else BOOST_FUNCTION_FUNCTION& @@ -347,7 +343,7 @@ namespace boost { return *this; } -#ifndef BOOST_FUNCTION_NO_ENABLE_IF +#ifndef BOOST_NO_SFINAE BOOST_FUNCTION_FUNCTION& operator=(clear_type*) { this->clear(); @@ -377,21 +373,20 @@ namespace boost { if (&other == this) return; - std::swap(function_base::manager, other.manager); - std::swap(function_base::functor, other.functor); + std::swap(this->manager, other.manager); + std::swap(this->functor, other.functor); std::swap(invoker, other.invoker); } // Clear out a target, if there is one void clear() { - if (function_base::manager) { + if (this->manager) { function_base::functor = - function_base::manager(function_base::functor, - detail::function::destroy_functor_tag); + this->manager(this->functor, detail::function::destroy_functor_tag); } - function_base::manager = 0; + this->manager = 0; invoker = 0; } @@ -419,8 +414,8 @@ namespace boost { { if (!f.empty()) { invoker = f.invoker; - function_base::manager = f.manager; - function_base::functor = + this->manager = f.manager; + this->functor = f.manager(f.functor, detail::function::clone_functor_tag); } } @@ -446,10 +441,10 @@ namespace boost { invoker_type; invoker = &invoker_type::invoke; - function_base::manager = + this->manager = &detail::function::functor_manager::manage; - function_base::functor = - function_base::manager(detail::function::make_any_pointer( + this->functor = + this->manager(detail::function::make_any_pointer( // should be a reinterpret cast, but some compilers // insist on giving cv-qualifiers to free functions (void (*)())(f) @@ -479,7 +474,7 @@ namespace boost { invoker_type; invoker = &invoker_type::invoke; - function_base::manager = &detail::function::functor_manager< + this->manager = &detail::function::functor_manager< FunctionObj, Allocator>::manage; #ifndef BOOST_NO_STD_ALLOCATOR typedef typename Allocator::template rebind::other @@ -494,7 +489,7 @@ namespace boost { #else FunctionObj* new_f = new FunctionObj(f); #endif // BOOST_NO_STD_ALLOCATOR - function_base::functor = + this->functor = detail::function::make_any_pointer(static_cast(new_f)); } } @@ -513,9 +508,9 @@ namespace boost { invoker_type; invoker = &invoker_type::invoke; - function_base::manager = &detail::function::trivial_manager; - function_base::functor = - function_base::manager( + this->manager = &detail::function::trivial_manager; + this->functor = + this->manager( detail::function::make_any_pointer( const_cast(f.get_pointer())), detail::function::clone_functor_tag); @@ -534,8 +529,8 @@ namespace boost { >::type invoker_type; invoker = &invoker_type::invoke; - function_base::manager = &detail::function::trivial_manager; - function_base::functor = detail::function::make_any_pointer(this); + this->manager = &detail::function::trivial_manager; + this->functor = detail::function::make_any_pointer(this); } typedef internal_result_type (*invoker_type)(detail::function::any_pointer @@ -561,9 +556,7 @@ namespace boost { f1.swap(f2); } -#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ - && (BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) +#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) #if BOOST_FUNCTION_NUM_ARGS == 0 #define BOOST_FUNCTION_PARTIAL_SPEC R (void) @@ -591,10 +584,10 @@ public: template function(Functor f -#ifndef BOOST_FUNCTION_NO_ENABLE_IF - ,typename detail::function::enable_if< +#ifndef BOOST_NO_SFINAE + ,typename enable_if_c< (::boost::type_traits::ice_not< - (is_same::value)>::value), + (is_integral::value)>::value), int>::type = 0 #endif ) : @@ -602,7 +595,7 @@ public: { } -#ifndef BOOST_FUNCTION_NO_ENABLE_IF +#ifndef BOOST_NO_SFINAE function(clear_type*) : base_type() {} #endif @@ -617,10 +610,10 @@ public: } template -#ifndef BOOST_FUNCTION_NO_ENABLE_IF - typename detail::function::enable_if< +#ifndef BOOST_NO_SFINAE + typename enable_if_c< (::boost::type_traits::ice_not< - (is_same::value)>::value), + (is_integral::value)>::value), self_type&>::type #else self_type& @@ -631,7 +624,7 @@ public: return *this; } -#ifndef BOOST_FUNCTION_NO_ENABLE_IF +#ifndef BOOST_NO_SFINAE self_type& operator=(clear_type*) { this->clear(); diff --git a/boost/boost/function/gen_function_N.pl b/boost/boost/function/gen_function_N.pl index 0b20392cd7..d456b5e129 100755 --- a/boost/boost/function/gen_function_N.pl +++ b/boost/boost/function/gen_function_N.pl @@ -2,16 +2,10 @@ # # Boost.Function library # -# Copyright (C) 2001-2003 Doug Gregor (gregod@cs.rpi.edu) -# -# Permission to copy, use, sell and distribute this software is granted -# provided this copyright notice appears in all copies. -# Permission to modify the code and to distribute modified code is granted -# provided this copyright notice appears in all copies, and a notice -# that the code was modified is included with the copyright notice. -# -# This software is provided "as is" without express or implied warranty, -# and with no claim as to its suitability for any purpose. +# Copyright Doug 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 use English; diff --git a/boost/boost/generator_iterator.hpp b/boost/boost/generator_iterator.hpp index e27090cc63..bf8011fbda 100644 --- a/boost/boost/generator_iterator.hpp +++ b/boost/boost/generator_iterator.hpp @@ -14,57 +14,63 @@ #ifndef BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP #define BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP -#include +#include #include namespace boost { template -class generator_iterator_policies +class generator_iterator + : public iterator_facade< + generator_iterator + , typename Generator::result_type + , single_pass_traversal_tag + , typename Generator::result_type const& + > { -public: - generator_iterator_policies() { } - - template - void initialize(Base& base) { - m_value = (*base)(); - } - - // The Iter template argument is necessary for compatibility with a MWCW - // bug workaround - template - void increment(IteratorAdaptor& iter) { - m_value = (*iter.base())(); + 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)(); } - template const typename Generator::result_type& - dereference(const IteratorAdaptor&) const - { return m_value; } + dereference() const + { + return m_value; + } - template - bool equal(const IteratorAdaptor1& x, const IteratorAdaptor2& y) const - { return x.base() == y.base() && - x.policies().m_value == y.policies().m_value; } + bool equal(generator_iterator const& y) const + { + return this->m_g == y.m_g && this->m_value == y.m_value; + } -private: - typename Generator::result_type m_value; + private: + Generator* m_g; + typename Generator::result_type m_value; }; template struct generator_iterator_generator { - typedef iterator_adaptor, - typename Generator::result_type, const typename Generator::result_type&, - const typename Generator::result_type*, std::input_iterator_tag, - long> type; + typedef generator_iterator type; }; template -inline typename generator_iterator_generator::type +inline generator_iterator make_generator_iterator(Generator & gen) { - typedef typename generator_iterator_generator::type result_t; + typedef generator_iterator result_t; return result_t(&gen); } diff --git a/boost/boost/indirect_reference.hpp b/boost/boost/indirect_reference.hpp new file mode 100755 index 0000000000..270cbbd913 --- /dev/null +++ b/boost/boost/indirect_reference.hpp @@ -0,0 +1,39 @@ +// Copyright David Abrahams 2004. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef INDIRECT_REFERENCE_DWA200415_HPP +# define INDIRECT_REFERENCE_DWA200415_HPP + +// dereferenceable_traits provides access to the value_type and +// reference of a Dereferenceable type. + +# 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::apply_if< + detail::is_incrementable

+ , iterator_reference

+ , detail::smart_ptr_reference

+ > +{ +}; + +} // namespace boost + +#endif // INDIRECT_REFERENCE_DWA200415_HPP diff --git a/boost/boost/integer.hpp b/boost/boost/integer.hpp index 3c42772671..c655c92ca8 100644 --- a/boost/boost/integer.hpp +++ b/boost/boost/integer.hpp @@ -1,10 +1,7 @@ // boost integer.hpp header file -------------------------------------------// -// (C) Copyright Beman Dawes 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. +// Copyright Beman Dawes 1999. +// See accompanying license for terms and conditions of use. // See http://www.boost.org/libs/integer for documentation. diff --git a/boost/boost/integer_traits.hpp b/boost/boost/integer_traits.hpp index d867da431b..5510b1112d 100644 --- a/boost/boost/integer_traits.hpp +++ b/boost/boost/integer_traits.hpp @@ -10,7 +10,7 @@ * software for any purpose. It is provided "as is" without express or * implied warranty. * - * $Id: integer_traits.hpp,v 1.22 2002/12/27 16:51:52 beman_dawes Exp $ + * $Id: integer_traits.hpp,v 1.23 2003/08/27 10:30:53 johnmaddock Exp $ * * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers */ @@ -214,3 +214,6 @@ class integer_traits } // namespace boost #endif /* BOOST_INTEGER_TRAITS_HPP */ + + + diff --git a/boost/boost/intrusive_ptr.hpp b/boost/boost/intrusive_ptr.hpp index 24af067483..7db6dcf249 100644 --- a/boost/boost/intrusive_ptr.hpp +++ b/boost/boost/intrusive_ptr.hpp @@ -128,13 +128,21 @@ public: return p_ != 0; } -#else +#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 * (intrusive_ptr::*unspecified_bool_type) () const; + typedef T * this_type::*unspecified_bool_type; operator unspecified_bool_type () const { - return p_ == 0? 0: &intrusive_ptr::get; + return p_ == 0? 0: &this_type::p_; } #endif @@ -220,6 +228,11 @@ template intrusive_ptr static_pointer_cast(intrusive_ptr 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()); diff --git a/boost/boost/iterator/detail/categories.hpp b/boost/boost/iterator/detail/categories.hpp new file mode 100644 index 0000000000..841ac4c143 --- /dev/null +++ b/boost/boost/iterator/detail/categories.hpp @@ -0,0 +1 @@ +#error obsolete diff --git a/boost/boost/iterator/detail/config_def.hpp b/boost/boost/iterator/detail/config_def.hpp new file mode 100644 index 0000000000..0f6ba5bdf1 --- /dev/null +++ b/boost/boost/iterator/detail/config_def.hpp @@ -0,0 +1,137 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 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. + +// no include guard multiple inclusion intended + +// +// This is a temporary workaround until the bulk of this is +// available in boost config. +// 23/02/03 thw +// + +#include // for prior +#include + +#ifdef BOOST_ITERATOR_CONFIG_DEF +# error you have nested config_def #inclusion. +#else +# define BOOST_ITERATOR_CONFIG_DEF +#endif + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) + +// Recall that in general, compilers without partial specialization +// can't strip constness. Consider counting_iterator, which normally +// passes a const Value to iterator_facade. As a result, any code +// which makes a std::vector of the iterator's value_type will fail +// when its allocator declares functions overloaded on reference and +// const_reference (the same type). +// +// Furthermore, Borland 5.5.1 drops constness in enough ways that we +// end up using a proxy for operator[] when we otherwise shouldn't. +// Using reference constness gives it an extra hint that it can +// return the value_type from operator[] directly, but is not +// strictly neccessary. Not sure how best to resolve this one. + +# define BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1 + +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) \ + || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) +# define BOOST_NO_LVALUE_RETURN_DETECTION + +# if 0 // test code + struct v {}; + + typedef char (&no)[3]; + + template + no foo(T const&, ...); + + template + char foo(T&, int); + + + struct value_iterator + { + v operator*() const; + }; + + template + struct lvalue_deref_helper + { + static T& x; + enum { value = (sizeof(foo(*x,0)) == 1) }; + }; + + int z2[(lvalue_deref_helper::value == 1) ? 1 : -1]; + int z[(lvalue_deref_helper::value) == 1 ? -1 : 1 ]; +# endif + +#endif + +#if BOOST_WORKAROUND(__MWERKS__, <=0x2407) +# define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types" +#endif + +#if BOOST_WORKAROUND(__GNUC__, == 2) \ + || BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile: + +# if 0 // test code + #include + template + struct foo + { + foo(T); + + template + foo(foo const& other) : p(other.p) { } + + T p; + }; + + bool x = boost::is_convertible, foo >::value; +# endif + +#endif + +#if BOOST_WORKAROUND(__GNUC__, == 2 && __GNUC_MINOR__ == 95) \ + || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# define BOOST_ITERATOR_NO_MPL_AUX_HAS_XXX // "MPL's has_xxx facility doesn't work" +#endif + +#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE) +# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY +#endif + +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# define BOOST_ARG_DEPENDENT_TYPENAME typename +# else +# define BOOST_ARG_DEPENDENT_TYPENAME +# endif + +# if BOOST_WORKAROUND(__GNUC__, == 2) && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(95)) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + +// GCC-2.95 eagerly instantiates templated constructors and conversion +// operators in convertibility checks, causing premature errors. +// +// Borland's problems are harder to diagnose due to lack of an +// instantiation stack backtrace. They may be due in part to the fact +// that it drops cv-qualification willy-nilly in templates. +# define BOOST_NO_ONE_WAY_ITERATOR_INTEROP +# endif + +// no include guard; multiple inclusion intended diff --git a/boost/boost/iterator/detail/config_undef.hpp b/boost/boost/iterator/detail/config_undef.hpp new file mode 100644 index 0000000000..df44f465b7 --- /dev/null +++ b/boost/boost/iterator/detail/config_undef.hpp @@ -0,0 +1,27 @@ +// (C) Copyright Thomas Witt 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. + +// no include guard multiple inclusion intended + +// +// This is a temporary workaround until the bulk of this is +// available in boost config. +// 23/02/03 thw +// + +#undef BOOST_NO_IS_CONVERTIBLE +#undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE +#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY +#undef BOOST_ARG_DEPENDENT_TYPENAME +#undef BOOST_NO_LVALUE_RETURN_DETECTION +#undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP + +#ifdef BOOST_ITERATOR_CONFIG_DEF +# undef BOOST_ITERATOR_CONFIG_DEF +#else +# error missing or nested #include config_def +#endif diff --git a/boost/boost/iterator/detail/enable_if.hpp b/boost/boost/iterator/detail/enable_if.hpp new file mode 100644 index 0000000000..f0a7bc7fb4 --- /dev/null +++ b/boost/boost/iterator/detail/enable_if.hpp @@ -0,0 +1,88 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 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. +#ifndef BOOST_ENABLE_IF_23022003THW_HPP +#define BOOST_ENABLE_IF_23022003THW_HPP + +#include +#include + +#include + +// +// Boost iterators uses its own enable_if cause we need +// special semantics for deficient compilers. +// 23/02/03 thw +// + +namespace boost +{ + + namespace iterators + { + // + // Base machinery for all kinds of enable if + // + template + struct enabled + { + template + struct base + { + typedef T type; + }; + }; + + // + // For compilers that don't support "Substitution Failure Is Not An Error" + // enable_if falls back to always enabled. See comments + // on operator implementation for consequences. + // + template<> + struct enabled + { + template + struct base + { +#ifdef BOOST_NO_SFINAE + + typedef T type; + + // This way to do it would give a nice error message containing + // invalid overload, but has the big disadvantage that + // there is no reference to user code in the error message. + // + // struct invalid_overload; + // typedef invalid_overload type; + // +#endif + }; + }; + + + template + struct enable_if +# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) + : enabled<(Cond::value)>::template base +# else + : mpl::identity +# endif + { +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + typedef Return type; +# endif + }; + + } // namespace iterators + +} // namespace boost + +#include + +#endif // BOOST_ENABLE_IF_23022003THW_HPP diff --git a/boost/boost/iterator/detail/facade_iterator_category.hpp b/boost/boost/iterator/detail/facade_iterator_category.hpp new file mode 100755 index 0000000000..dd7de98dbb --- /dev/null +++ b/boost/boost/iterator/detail/facade_iterator_category.hpp @@ -0,0 +1,214 @@ +// Copyright David Abrahams 2003. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef FACADE_ITERATOR_CATEGORY_DWA20031118_HPP +# define FACADE_ITERATOR_CATEGORY_DWA20031118_HPP + +# include + +# include + +# include // used in iterator_tag inheritance logic +# include +# include +# include +# include + +# include +# include +# include +# include + +# include + +# include // try to keep this last + +# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY +# include +# endif + +// +// iterator_category deduction for iterator_facade +// + +// forward declaration +namespace boost { struct use_default; } + +namespace boost { namespace detail { + +struct input_output_iterator_tag + : std::input_iterator_tag +{ + // Using inheritance for only input_iterator_tag helps to avoid + // ambiguities when a stdlib implementation dispatches on a + // function which is overloaded on both input_iterator_tag and + // output_iterator_tag, as STLPort does, in its __valid_range + // function. I claim it's better to avoid the ambiguity in these + // cases. + operator std::output_iterator_tag() const + { + return std::output_iterator_tag(); + } +}; + +// +// True iff the user has explicitly disabled writability of this +// iterator. Pass the iterator_facade's Value parameter and its +// nested ::reference type. +// +template +struct iterator_writability_disabled +# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY // Adding Thomas' logic? + : mpl::or_< + is_const + , python::detail::is_reference_to_const + , is_const + > +# else + : is_const +# endif +{}; + + +// +// Convert an iterator_facade's traversal category, Value parameter, +// and ::reference type to an appropriate old-style category. +// +// If writability has been disabled per the above metafunction, the +// result will not be convertible to output_iterator_tag. +// +// Otherwise, if Traversal == single_pass_traversal_tag, the following +// conditions will result in a tag that is convertible both to +// input_iterator_tag and output_iterator_tag: +// +// 1. Reference is a reference to non-const +// 2. Reference is not a reference and is convertible to Value +// +template +struct iterator_facade_default_category + : mpl::apply_if< + mpl::and_< + is_reference + , is_convertible + > + , mpl::apply_if< + is_convertible + , mpl::identity + , mpl::if_< + is_convertible + , std::bidirectional_iterator_tag + , std::forward_iterator_tag + > + > + , typename mpl::apply_if< + mpl::and_< + is_convertible + + // check for readability + , is_convertible + > + , mpl::if_< + iterator_writability_disabled + , std::input_iterator_tag + , input_output_iterator_tag + > + + , mpl::identity + > + > +{ +}; + +// True iff T is convertible to an old-style iterator category. +template +struct is_iterator_category + : mpl::or_< + is_convertible + , is_convertible + > +{ +}; + +template +struct is_iterator_traversal + : is_convertible +{}; + +// +// A composite iterator_category tag convertible to Category (a pure +// old-style category) and Traversal (a pure traversal tag). +// Traversal must be a strict increase of the traversal power given by +// Category. +// +template +struct iterator_category_with_traversal + : Category, Traversal +{ +# if 0 + // Because of limitations on multiple user-defined conversions, + // this should be a good test of whether convertibility is enough + // in the spec, or whether we need to specify inheritance. + operator Category() const { return Category(); } + operator Traversal() const { return Traversal(); } +# endif + +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + // Make sure this isn't used to build any categories where + // convertibility to Traversal is redundant. Should just use the + // Category element in that case. + BOOST_STATIC_ASSERT( + !(is_convertible< + typename iterator_category_to_traversal::type + , Traversal + >::value)); + + BOOST_STATIC_ASSERT(is_iterator_category::value); + BOOST_STATIC_ASSERT(!is_iterator_category::value); + BOOST_STATIC_ASSERT(!is_iterator_traversal::value); +# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) + BOOST_STATIC_ASSERT(is_iterator_traversal::value); +# endif +# endif +}; + +// Computes an iterator_category tag whose traversal is Traversal and +// which is appropriate for an iterator +template +struct facade_iterator_category_impl +{ +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + BOOST_STATIC_ASSERT(!is_iterator_category::value); +# endif + + typedef typename iterator_facade_default_category< + Traversal,ValueParam,Reference + >::type category; + + typedef typename mpl::if_< + is_same< + Traversal + , typename iterator_category_to_traversal::type + > + , category + , iterator_category_with_traversal + >::type type; +}; + +// +// Compute an iterator_category for iterator_facade +// +template +struct facade_iterator_category + : mpl::apply_if< + is_iterator_category + , mpl::identity // old-style categories are fine as-is + , facade_iterator_category_impl + > +{ +}; + +}} // namespace boost::detail + +# include + +#endif // FACADE_ITERATOR_CATEGORY_DWA20031118_HPP diff --git a/boost/boost/iterator/detail/minimum_category.hpp b/boost/boost/iterator/detail/minimum_category.hpp new file mode 100755 index 0000000000..89d79db3b8 --- /dev/null +++ b/boost/boost/iterator/detail/minimum_category.hpp @@ -0,0 +1,110 @@ +// Copyright David Abrahams 2003. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef MINIMUM_CATEGORY_DWA20031119_HPP +# define MINIMUM_CATEGORY_DWA20031119_HPP + +# include +# include + +# include + +namespace boost { namespace detail { +// +// Returns the minimum category type or error_type +// if T1 and T2 are unrelated. +// +// For compilers not supporting is_convertible this only +// works with the new boost return and traversal category +// types. The exact boost _types_ are required. No derived types +// will work. +// +// +template +struct minimum_category_impl +# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +{ + typedef void type; +} +# endif +; + +template +struct error_not_related_by_convertibility; + +template <> +struct minimum_category_impl +{ + template struct apply + { + typedef T2 type; + }; +}; + +template <> +struct minimum_category_impl +{ + template struct apply + { + typedef T1 type; + }; +}; + +template <> +struct minimum_category_impl +{ + template struct apply + { + BOOST_STATIC_ASSERT((is_same::value)); + typedef T1 type; + }; +}; + +template <> +struct minimum_category_impl +{ + template struct apply + : error_not_related_by_convertibility + { + }; +}; + +template +struct minimum_category +{ + typedef minimum_category_impl< +# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround + is_same::value || +# endif + ::boost::is_convertible::value + , ::boost::is_convertible::value +# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround + || is_same::value +# endif + > outer; + + typedef typename outer::template apply inner; + typedef typename inner::type type; + + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2)) +}; + +template <> +struct minimum_category +{ + template + struct apply : minimum_category + {}; +}; + +# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround +template <> +struct minimum_category +{ + typedef int type; +}; +# endif + +}} // namespace boost::detail + +#endif // MINIMUM_CATEGORY_DWA20031119_HPP diff --git a/boost/boost/iterator/filter_iterator.hpp b/boost/boost/iterator/filter_iterator.hpp new file mode 100644 index 0000000000..fee0184771 --- /dev/null +++ b/boost/boost/iterator/filter_iterator.hpp @@ -0,0 +1,137 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 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. +#ifndef BOOST_FILTER_ITERATOR_23022003THW_HPP +#define BOOST_FILTER_ITERATOR_23022003THW_HPP + +#include +#include +#include + +#include +#include + +namespace boost +{ + template + class filter_iterator; + + namespace detail + { + template + struct filter_iterator_base + { + typedef iterator_adaptor< + filter_iterator + , Iterator + , use_default + , typename mpl::if_< + is_convertible< + typename iterator_traversal::type + , bidirectional_traversal_tag + > + , forward_traversal_tag + , use_default + >::type + > type; + }; + } + + template + class filter_iterator + : public detail::filter_iterator_base::type + { + typedef typename detail::filter_iterator_base< + Predicate, Iterator + >::type super_t; + + friend class iterator_core_access; + + public: + filter_iterator() { } + + filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) + : super_t(x), m_predicate(f), m_end(end) + { + satisfy_predicate(); + } + + filter_iterator(Iterator x, Iterator end = Iterator()) + : super_t(x), m_predicate(), m_end(end) + { + // Pro8 is a little too aggressive about instantiating the + // body of this function. +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + // Don't allow use of this constructor if Predicate is a + // function pointer type, since it will be 0. + BOOST_STATIC_ASSERT(is_class::value); +#endif + satisfy_predicate(); + } + + template + filter_iterator( + filter_iterator const& t + , typename enable_if_convertible::type* = 0 + ) + : super_t(t.base()), m_predicate(t.predicate()), m_end(t.end()) {} + + Predicate predicate() const { return m_predicate; } + + Iterator end() const { return m_end; } + + private: + void increment() + { + ++(this->base_reference()); + satisfy_predicate(); + } + + void decrement() + { + while(!this->m_predicate(*--(this->base_reference()))){}; + } + + void satisfy_predicate() + { + while (this->base() != this->m_end && !this->m_predicate(*this->base())) + ++(this->base_reference()); + } + + // Probably should be the initial base class so it can be + // optimized away via EBO if it is an empty class. + Predicate m_predicate; + Iterator m_end; + }; + + template + filter_iterator + make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) + { + return filter_iterator(f,x,end); + } + + template + filter_iterator + make_filter_iterator( + typename iterators::enable_if< + is_class + , Iterator + >::type x + , Iterator end = Iterator() +#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) + , Predicate* = 0 +#endif + ) + { + return filter_iterator(x,end); + } + +} // namespace boost + +#endif // BOOST_FILTER_ITERATOR_23022003THW_HPP diff --git a/boost/boost/iterator/indirect_iterator.hpp b/boost/boost/iterator/indirect_iterator.hpp new file mode 100644 index 0000000000..91c4283e3c --- /dev/null +++ b/boost/boost/iterator/indirect_iterator.hpp @@ -0,0 +1,141 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 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. +#ifndef BOOST_INDIRECT_ITERATOR_23022003THW_HPP +#define BOOST_INDIRECT_ITERATOR_23022003THW_HPP + +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#ifdef BOOST_MPL_NO_AUX_HAS_XXX +# include +# include +# include +# include +#endif + +#include // must be last #include + +namespace boost +{ + template + class indirect_iterator; + + namespace detail + { + template + struct indirect_base + { + typedef typename iterator_traits::value_type dereferenceable; + + typedef iterator_adaptor< + indirect_iterator + , Iter + , typename ia_dflt_help< + Value, pointee + >::type + , Category + , typename ia_dflt_help< + Reference + , mpl::apply_if< + is_same + , indirect_reference + , add_reference + > + >::type + , Difference + > type; + }; + + template <> + struct indirect_base {}; + } // namespace detail + + + template < + class Iterator + , class Value = use_default + , class Category = use_default + , class Reference = use_default + , class Difference = use_default + > + class indirect_iterator + : public detail::indirect_base< + Iterator, Value, Category, Reference, Difference + >::type + { + typedef typename detail::indirect_base< + Iterator, Value, Category, Reference, Difference + >::type super_t; + + friend class iterator_core_access; + + public: + indirect_iterator() {} + + indirect_iterator(Iterator iter) + : super_t(iter) {} + + template < + class Iterator2, class Value2, class Category2 + , class Reference2, class Difference2 + > + indirect_iterator( + indirect_iterator< + Iterator2, Value2, Category2, Reference2, Difference2 + > const& y + , typename enable_if_convertible::type* = 0 + ) + : super_t(y.base()) + {} + + private: + typename super_t::reference dereference() const + { +# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + return const_cast(**this->base()); +# else + return **this->base(); +# endif + } + }; + + template + inline + indirect_iterator make_indirect_iterator(Iter x) + { + return indirect_iterator(x); + } + + template + inline + indirect_iterator make_indirect_iterator(Iter x, Traits* = 0) + { + return indirect_iterator(x); + } + +} // namespace boost + +#include + +#endif // BOOST_INDIRECT_ITERATOR_23022003THW_HPP diff --git a/boost/boost/iterator/interoperable.hpp b/boost/boost/iterator/interoperable.hpp new file mode 100644 index 0000000000..b3262502a6 --- /dev/null +++ b/boost/boost/iterator/interoperable.hpp @@ -0,0 +1,52 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 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. +#ifndef BOOST_INTEROPERABLE_23022003THW_HPP +# define BOOST_INTEROPERABLE_23022003THW_HPP + +# include +# include + +# include + +# include // must appear last + +namespace boost +{ + + // + // Meta function that determines whether two + // iterator types are considered interoperable. + // + // Two iterator types A,B are considered interoperable if either + // A is convertible to B or vice versa. + // This interoperability definition is in sync with the + // standards requirements on constant/mutable container + // iterators (23.1 [lib.container.requirements]). + // + // For compilers that don't support is_convertible + // is_interoperable gives false positives. See comments + // on operator implementation for consequences. + // + template + struct is_interoperable +# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY + : mpl::true_ +# else + : mpl::or_< + is_convertible< A, B > + , is_convertible< B, A > > +# endif + { + }; + +} // namespace boost + +# include + +#endif // BOOST_INTEROPERABLE_23022003THW_HPP diff --git a/boost/boost/iterator/iterator_adaptor.hpp b/boost/boost/iterator/iterator_adaptor.hpp new file mode 100644 index 0000000000..77d9990aa8 --- /dev/null +++ b/boost/boost/iterator/iterator_adaptor.hpp @@ -0,0 +1,345 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 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. +#ifndef BOOST_ITERATOR_ADAPTOR_23022003THW_HPP +#define BOOST_ITERATOR_ADAPTOR_23022003THW_HPP + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY +# include +#else +# include +#endif + +#include + +#include + +namespace boost +{ + // Used as a default template argument internally, merely to + // indicate "use the default", this can also be passed by users + // explicitly in order to specify that the default should be used. + struct use_default; + +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // the incompleteness of use_default causes massive problems for + // is_convertible (naturally). This workaround is fortunately not + // needed for vc6/vc7. + template + struct is_convertible + : mpl::false_ {}; +# endif + + namespace detail + { + + // + // Result type used in enable_if_convertible meta function. + // This can be an incomplete type, as only pointers to + // enable_if_convertible< ... >::type are used. + // We could have used void for this, but conversion to + // void* is just to easy. + // + struct enable_type; + } + + + // + // enable_if for use in adapted iterators constructors. + // + // In order to provide interoperability between adapted constant and + // mutable iterators, adapted iterators will usually provide templated + // conversion constructors of the following form + // + // template + // class adapted_iterator : + // public iterator_adaptor< adapted_iterator, Iterator > + // { + // public: + // + // ... + // + // template + // adapted_iterator( + // OtherIterator const& it + // , typename enable_if_convertible::type* = 0); + // + // ... + // }; + // + // enable_if_convertible is used to remove those overloads from the overload + // set that cannot be instantiated. For all practical purposes only overloads + // for constant/mutable interaction will remain. This has the advantage that + // meta functions like boost::is_convertible do not return false positives, + // as they can only look at the signature of the conversion constructor + // and not at the actual instantiation. + // + // enable_if_interoperable can be safely used in user code. It falls back to + // always enabled for compilers that don't support enable_if or is_convertible. + // There is no need for compiler specific workarounds in user code. + // + // The operators implementation relies on boost::is_convertible not returning + // false positives for user/library defined iterator types. See comments + // on operator implementation for consequences. + // +# if defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE) + + template + struct enable_if_convertible + { + typedef detail::enable_type type; + }; + +# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300 + + // For some reason vc7.1 needs us to "cut off" instantiation + // of is_convertible in a few cases. + template + struct enable_if_convertible + : iterators::enable_if< + mpl::or_< + is_same + , is_convertible + > + , detail::enable_type + > + {}; + +# else + + template + struct enable_if_convertible + : iterators::enable_if< + is_convertible + , detail::enable_type + > + {}; + +# endif + + // + // Default template argument handling for iterator_adaptor + // + namespace detail + { + // If T is use_default, return the result of invoking + // DefaultNullaryFn, otherwise return T. + template + struct ia_dflt_help + : mpl::apply_if< + is_same + , DefaultNullaryFn + , mpl::identity + > + { + }; + + // A metafunction which computes an iterator_adaptor's base class, + // a specialization of iterator_facade. + template < + class Derived + , class Base + , class Value + , class Traversal + , class Reference + , class Difference + > + struct iterator_adaptor_base + { + typedef iterator_facade< + Derived + +# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY + , typename detail::ia_dflt_help< + Value + , mpl::apply_if< + is_same + , iterator_value + , remove_reference + > + >::type +# else + , typename detail::ia_dflt_help< + Value, iterator_value + >::type +# endif + + , typename detail::ia_dflt_help< + Traversal + , iterator_traversal + >::type + + , typename detail::ia_dflt_help< + Reference + , mpl::apply_if< + is_same + , iterator_reference + , add_reference + > + >::type + + , typename detail::ia_dflt_help< + Difference, iterator_difference + >::type + > + type; + }; + template int static_assert_convertible_to(T); + } + + // + // Iterator Adaptor + // + // The parameter ordering changed slightly with respect to former + // versions of iterator_adaptor The idea is that when the user needs + // to fiddle with the reference type it is highly likely that the + // iterator category has to be adjusted as well. Any of the + // following four template arguments may be ommitted or explicitly + // replaced by use_default. + // + // Value - if supplied, the value_type of the resulting iterator, unless + // const. If const, a conforming compiler strips constness for the + // value_type. If not supplied, iterator_traits::value_type is used + // + // Category - the traversal category of the resulting iterator. If not + // supplied, iterator_traversal::type is used. + // + // Reference - the reference type of the resulting iterator, and in + // particular, the result type of operator*(). If not supplied but + // Value is supplied, Value& is used. Otherwise + // iterator_traits::reference is used. + // + // Difference - the difference_type of the resulting iterator. If not + // supplied, iterator_traits::difference_type is used. + // + template < + class Derived + , class Base + , class Value = use_default + , class Traversal = use_default + , class Reference = use_default + , class Difference = use_default + > + class iterator_adaptor + : public detail::iterator_adaptor_base< + Derived, Base, Value, Traversal, Reference, Difference + >::type + { + friend class iterator_core_access; + + typedef typename detail::iterator_adaptor_base< + Derived, Base, Value, Traversal, Reference, Difference + >::type super_t; + + public: + iterator_adaptor() {} + + explicit iterator_adaptor(Base const &iter) + : m_iterator(iter) + { + } + + Base const& base() const + { return m_iterator; } + + protected: + // + // lvalue access to the Base object for Derived + // + Base const& base_reference() const + { return m_iterator; } + + Base& base_reference() + { return m_iterator; } + + private: + // + // Core iterator interface for iterator_facade. This is private + // to prevent temptation for Derived classes to use it, which + // will often result in an error. Derived classes should use + // base_reference(), above, to get direct access to m_iterator. + // + typename super_t::reference dereference() const + { return *m_iterator; } + + template < + class OtherDerived, class OtherIterator, class V, class C, class R, class D + > + bool equal(iterator_adaptor const& x) const + { + // Maybe readd with same_distance + // BOOST_STATIC_ASSERT( + // (detail::same_category_and_difference::value) + // ); + return m_iterator == x.base(); + } + + typedef typename iterator_category_to_traversal< + typename super_t::iterator_category + >::type my_traversal; + +# define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \ + typedef int assertion[sizeof(detail::static_assert_convertible_to(my_traversal()))]; +// BOOST_STATIC_ASSERT((is_convertible::value)); + + void advance(typename super_t::difference_type n) + { + BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag) + m_iterator += n; + } + + void increment() { ++m_iterator; } + + void decrement() + { + BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(bidirectional_traversal_tag) + --m_iterator; + } + + template < + class OtherDerived, class OtherIterator, class V, class C, class R, class D + > + typename super_t::difference_type distance_to( + iterator_adaptor const& y) const + { + BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag) + // Maybe readd with same_distance + // BOOST_STATIC_ASSERT( + // (detail::same_category_and_difference::value) + // ); + return y.base() - m_iterator; + } + +# undef BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL + + private: // data members + Base m_iterator; + }; + +} // namespace boost + +#include + +#endif // BOOST_ITERATOR_ADAPTOR_23022003THW_HPP diff --git a/boost/boost/iterator/iterator_categories.hpp b/boost/boost/iterator/iterator_categories.hpp new file mode 100644 index 0000000000..7b4f9ae69a --- /dev/null +++ b/boost/boost/iterator/iterator_categories.hpp @@ -0,0 +1,165 @@ +// (C) Copyright Jeremy Siek 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. + +#ifndef BOOST_ITERATOR_CATEGORIES_HPP +# define BOOST_ITERATOR_CATEGORIES_HPP + +# include +# include +# include + +# include + +# include +# include +# include +# include + +# include + +# include + +namespace boost { + +// +// Traversal Categories +// +struct incrementable_traversal_tag {}; + +struct single_pass_traversal_tag + : incrementable_traversal_tag {}; + +struct forward_traversal_tag + : single_pass_traversal_tag {}; + +struct bidirectional_traversal_tag + : forward_traversal_tag {}; + +struct random_access_traversal_tag + : bidirectional_traversal_tag {}; + +namespace detail +{ + // + // Convert a "strictly old-style" iterator category to a traversal + // tag. This is broken out into a separate metafunction to reduce + // the cost of instantiating iterator_category_to_traversal, below, + // for new-style types. + // + template + struct old_category_to_traversal + : mpl::apply_if< + is_convertible + , mpl::identity + , mpl::apply_if< + is_convertible + , mpl::identity + , mpl::apply_if< + is_convertible + , mpl::identity + , mpl::apply_if< + is_convertible + , mpl::identity + , mpl::apply_if< + is_convertible + , mpl::identity + , void + > + > + > + > + > + {}; + +# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) + template <> + struct old_category_to_traversal + { + typedef int type; + }; +# endif + + template + struct pure_traversal_tag + : mpl::apply_if< + is_convertible + , mpl::identity + , mpl::apply_if< + is_convertible + , mpl::identity + , mpl::apply_if< + is_convertible + , mpl::identity + , mpl::apply_if< + is_convertible + , mpl::identity + , mpl::apply_if< + is_convertible + , mpl::identity + , void + > + > + > + > + > + { + }; + +# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) + template <> + struct pure_traversal_tag + { + typedef int type; + }; +# endif + +} // namespace detail + + +// +// Convert an iterator category into a traversal tag +// +template +struct iterator_category_to_traversal + : mpl::apply_if< // if already convertible to a traversal tag, we're done. + is_convertible + , mpl::identity + , detail::old_category_to_traversal + > +{}; + +// Trait to get an iterator's traversal category +template +struct iterator_traversal + : iterator_category_to_traversal< + typename boost::detail::iterator_traits::iterator_category + > +{}; + +# ifdef BOOST_MPL_NO_FULL_LAMBDA_SUPPORT +// Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work +// out well. Instantiating the nested apply template also +// requires instantiating iterator_traits on the +// placeholder. Instead we just specialize it as a metafunction +// class. +template <> +struct iterator_traversal +{ + template + struct apply : iterator_traversal + {}; +}; +template <> +struct iterator_traversal + : iterator_traversal +{}; +# endif + +} // namespace boost + +#include + +#endif // BOOST_ITERATOR_CATEGORIES_HPP diff --git a/boost/boost/iterator/iterator_facade.hpp b/boost/boost/iterator/iterator_facade.hpp new file mode 100644 index 0000000000..0e10fc41d0 --- /dev/null +++ b/boost/boost/iterator/iterator_facade.hpp @@ -0,0 +1,664 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 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. +#ifndef BOOST_ITERATOR_FACADE_23022003THW_HPP +#define BOOST_ITERATOR_FACADE_23022003THW_HPP + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# include +#endif + +#include // this goes last + +namespace boost +{ + // This forward declaration is required for the friend declaration + // in iterator_core_access + template class iterator_facade; + + namespace detail + { + // A binary metafunction class that always returns bool. VC6 + // ICEs on mpl::always, probably because of the default + // parameters. + struct always_bool2 + { + template + struct apply + { + typedef bool type; + }; + }; + + // + // enable if for use in operator implementation. + // + template < + class Facade1 + , class Facade2 + , class Return + > + struct enable_if_interoperable + : ::boost::iterators::enable_if< + mpl::or_< + is_convertible + , is_convertible + > + , Return + > + { + }; + + // + // Generates associated types for an iterator_facade with the + // given parameters. + // + template < + class ValueParam + , class CategoryOrTraversal + , class Reference + , class Difference + > + struct iterator_facade_types + { + typedef typename facade_iterator_category< + CategoryOrTraversal, ValueParam, Reference + >::type iterator_category; + + typedef typename remove_const::type value_type; + + typedef typename mpl::apply_if< + detail::iterator_writability_disabled + , add_pointer::type> + , add_pointer + >::type pointer; + +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && (BOOST_WORKAROUND(_STLPORT_VERSION, BOOST_TESTED_AT(0x452)) \ + || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \ + || BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \ + || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 310) + + // To interoperate with some broken library/compiler + // combinations, user-defined iterators must be derived from + // std::iterator. It is possible to implement a standard + // library for broken compilers without this limitation. +# define BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE 1 + + typedef + iterator + base; +# endif + }; + + + // operator->() needs special support for input iterators to strictly meet the + // standard's requirements. If *i is not a reference type, we must still + // produce a (constant) lvalue to which a pointer can be formed. We do that by + // returning an instantiation of this special proxy class template. + + template + struct operator_arrow_proxy + { + operator_arrow_proxy(T const* px) : m_value(*px) {} + const T* operator->() const { return &m_value; } + // This function is needed for MWCW and BCC, which won't call operator-> + // again automatically per 13.3.1.2 para 8 + operator const T*() const { return &m_value; } + T m_value; + }; + + // A metafunction that gets the result type for operator->. Also + // has a static function make() which builds the result from a + // Reference + template + struct operator_arrow_result + { + // CWPro8.3 won't accept "operator_arrow_result::type", and we + // need that type below, so metafunction forwarding would be a + // losing proposition here. + typedef typename mpl::if_< + is_reference + , Pointer + , operator_arrow_proxy + >::type type; + + static type make(Reference x) + { + return type(&x); + } + }; + +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + // Deal with ETI + template<> + struct operator_arrow_result + { + typedef int type; + }; +# endif + + // + // Iterator is actually an iterator_facade, so we do not have to + // go through iterator_traits to access the traits. + // + template + class operator_brackets_proxy + { + typedef typename Iterator::reference reference; + typedef typename Iterator::value_type value_type; + + public: + operator_brackets_proxy(Iterator const& iter) + : m_iter(iter) + {} + + operator reference() const + { + return *m_iter; + } + + operator_brackets_proxy& operator=(value_type const& val) + { + *m_iter = val; + return *this; + } + + private: + Iterator m_iter; + }; + + template + struct use_operator_brackets_proxy + : mpl::and_< + // Really we want an is_copy_constructible trait here, + // but is_POD will have to suffice in the meantime. + boost::is_POD + , iterator_writability_disabled + > + {}; + + template + struct operator_brackets_result + { + typedef typename mpl::if_< + use_operator_brackets_proxy + , Value + , operator_brackets_proxy + >::type type; + }; + + template + operator_brackets_proxy make_operator_brackets_result(Iterator const& iter, mpl::false_) + { + return operator_brackets_proxy(iter); + } + + template + typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::true_) + { + return *iter; + } + + struct choose_difference_type + { + template + struct apply + : +# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP + iterator_difference +# elif BOOST_WORKAROUND(BOOST_MSVC, == 1200) + mpl::if_< + is_convertible + , typename I1::difference_type + , typename I2::difference_type + > +# else + mpl::apply_if< + is_convertible + , iterator_difference + , iterator_difference + > +# endif + {}; + + }; + } // namespace detail + + + // Macros which describe the declarations of binary operators +# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ + template < \ + class Derived1, class V1, class TC1, class R1, class D1 \ + , class Derived2, class V2, class TC2, class R2, class D2 \ + > \ + prefix typename mpl::apply2::type \ + operator op( \ + iterator_facade const& lhs \ + , iterator_facade const& rhs) +# else +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ + template < \ + class Derived1, class V1, class TC1, class R1, class D1 \ + , class Derived2, class V2, class TC2, class R2, class D2 \ + > \ + prefix typename detail::enable_if_interoperable< \ + Derived1, Derived2 \ + , typename mpl::apply2::type \ + >::type \ + operator op( \ + iterator_facade const& lhs \ + , iterator_facade const& rhs) +# endif + +# define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \ + template \ + prefix Derived operator+ args + + // + // Helper class for granting access to the iterator core interface. + // + // The simple core interface is used by iterator_facade. The core + // interface of a user/library defined iterator type should not be made public + // so that it does not clutter the public interface. Instead iterator_core_access + // should be made friend so that iterator_facade can access the core + // interface through iterator_core_access. + // + class iterator_core_access + { +# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + // Tasteless as this may seem, making all members public allows member templates + // to work in the absence of member template friends. + public: +# else + + template friend class iterator_facade; + +# define BOOST_ITERATOR_FACADE_RELATION(op) \ + BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, detail::always_bool2); + + BOOST_ITERATOR_FACADE_RELATION(==) + BOOST_ITERATOR_FACADE_RELATION(!=) + + BOOST_ITERATOR_FACADE_RELATION(<) + BOOST_ITERATOR_FACADE_RELATION(>) + BOOST_ITERATOR_FACADE_RELATION(<=) + BOOST_ITERATOR_FACADE_RELATION(>=) +# undef BOOST_ITERATOR_FACADE_RELATION + + BOOST_ITERATOR_FACADE_INTEROP_HEAD( + friend, -, detail::choose_difference_type) + ; + + BOOST_ITERATOR_FACADE_PLUS_HEAD( + friend + , (iterator_facade const& + , typename Derived::difference_type) + ) + ; + + BOOST_ITERATOR_FACADE_PLUS_HEAD( + friend + , (typename Derived::difference_type + , iterator_facade const&) + ) + ; + +# endif + + template + static typename Facade::reference dereference(Facade const& f) + { + return f.dereference(); + } + + template + static void increment(Facade& f) + { + f.increment(); + } + + template + static void decrement(Facade& f) + { + f.decrement(); + } + + template + static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::true_) + { + return f1.equal(f2); + } + + template + static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::false_) + { + return f2.equal(f1); + } + + template + static void advance(Facade& f, typename Facade::difference_type n) + { + f.advance(n); + } + + template + static typename Facade1::difference_type distance_from( + Facade1 const& f1, Facade2 const& f2, mpl::true_) + { + return -f1.distance_to(f2); + } + + template + static typename Facade2::difference_type distance_from( + Facade1 const& f1, Facade2 const& f2, mpl::false_) + { + return f2.distance_to(f1); + } + + private: + // objects of this class are useless + iterator_core_access(); //undefined + }; + + // + // iterator_facade - use as a public base class for defining new + // standard-conforming iterators. + // + template < + class Derived // The derived iterator type being constructed + , class Value + , class CategoryOrTraversal + , class Reference = Value& + , class Difference = std::ptrdiff_t + > + class iterator_facade +# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE + : public detail::iterator_facade_types< + Value, CategoryOrTraversal, Reference, Difference + >::base +# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE +# endif + { + private: + // + // Curiously Recurring Template interface. + // + typedef Derived derived_t; + + Derived& derived() + { + return static_cast(*this); + } + + Derived const& derived() const + { + return static_cast(*this); + } + + typedef detail::iterator_facade_types< + Value, CategoryOrTraversal, Reference, Difference + > associated_types; + + public: + + typedef typename associated_types::value_type value_type; + typedef Reference reference; + typedef Difference difference_type; + typedef typename associated_types::pointer pointer; + typedef typename associated_types::iterator_category iterator_category; + + reference operator*() const + { + return iterator_core_access::dereference(this->derived()); + } + + typename detail::operator_arrow_result< + value_type + , reference + , pointer + >::type + operator->() const + { + return detail::operator_arrow_result< + value_type + , reference + , pointer + >::make(*this->derived()); + } + + typename detail::operator_brackets_result::type + operator[](difference_type n) const + { + typedef detail::use_operator_brackets_proxy use_proxy; + + return detail::make_operator_brackets_result( + this->derived() + n + , use_proxy() + ); + } + + Derived& operator++() + { + iterator_core_access::increment(this->derived()); + return this->derived(); + } + + Derived operator++(int) + { + Derived tmp(this->derived()); + ++*this; + return tmp; + } + + Derived& operator--() + { + iterator_core_access::decrement(this->derived()); + return this->derived(); + } + + Derived operator--(int) + { + Derived tmp(this->derived()); + --*this; + return tmp; + } + + Derived& operator+=(difference_type n) + { + iterator_core_access::advance(this->derived(), n); + return this->derived(); + } + + Derived& operator-=(difference_type n) + { + iterator_core_access::advance(this->derived(), -n); + return this->derived(); + } + + Derived operator-(difference_type x) const + { + Derived result(this->derived()); + return result -= x; + } + +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + // There appears to be a bug which trashes the data of classes + // derived from iterator_facade when they are assigned unless we + // define this assignment operator. This bug is only revealed + // (so far) in STLPort debug mode, but it's clearly a codegen + // problem so we apply the workaround for all MSVC6. + iterator_facade& operator=(iterator_facade const&) + { + return *this; + } +# endif + }; + + // + // Operator implementation. The library supplied operators + // enables the user to provide fully interoperable constant/mutable + // iterator types. I.e. the library provides all operators + // for all mutable/constant iterator combinations. + // + // Note though that this kind of interoperability for constant/mutable + // iterators is not required by the standard for container iterators. + // All the standard asks for is a conversion mutable -> constant. + // Most standard library implementations nowadays provide fully interoperable + // iterator implementations, but there are still heavily used implementations + // that do not provide them. (Actually it's even worse, they do not provide + // them for only a few iterators.) + // + // ?? Maybe a BOOST_ITERATOR_NO_FULL_INTEROPERABILITY macro should + // enable the user to turn off mixed type operators + // + // The library takes care to provide only the right operator overloads. + // I.e. + // + // bool operator==(Iterator, Iterator); + // bool operator==(ConstIterator, Iterator); + // bool operator==(Iterator, ConstIterator); + // bool operator==(ConstIterator, ConstIterator); + // + // ... + // + // In order to do so it uses c++ idioms that are not yet widely supported + // by current compiler releases. The library is designed to degrade gracefully + // in the face of compiler deficiencies. In general compiler + // deficiencies result in less strict error checking and more obscure + // error messages, functionality is not affected. + // + // For full operation compiler support for "Substitution Failure Is Not An Error" + // (aka. enable_if) and boost::is_convertible is required. + // + // The following problems occur if support is lacking. + // + // Pseudo code + // + // --------------- + // AdaptorA a1; + // AdaptorA a2; + // + // // This will result in a no such overload error in full operation + // // If enable_if or is_convertible is not supported + // // The instantiation will fail with an error hopefully indicating that + // // there is no operator== for Iterator1, Iterator2 + // // The same will happen if no enable_if is used to remove + // // false overloads from the templated conversion constructor + // // of AdaptorA. + // + // a1 == a2; + // ---------------- + // + // AdaptorA a; + // AdaptorB b; + // + // // This will result in a no such overload error in full operation + // // If enable_if is not supported the static assert used + // // in the operator implementation will fail. + // // This will accidently work if is_convertible is not supported. + // + // a == b; + // ---------------- + // + +# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP +# define BOOST_ITERATOR_CONVERTIBLE(a,b) mpl::true_() +# else +# define BOOST_ITERATOR_CONVERTIBLE(a,b) is_convertible() +# endif + +# define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \ + BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \ + { \ + /* For those compilers that do not support enable_if */ \ + BOOST_STATIC_ASSERT(( \ + is_interoperable< Derived1, Derived2 >::value \ + )); \ + return_prefix iterator_core_access::base_op( \ + static_cast(lhs) \ + , static_cast(rhs) \ + , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \ + ); \ + } + +# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \ + BOOST_ITERATOR_FACADE_INTEROP( \ + op \ + , detail::always_bool2 \ + , return_prefix \ + , base_op \ + ) + + BOOST_ITERATOR_FACADE_RELATION(==, return, equal) + BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal) + + BOOST_ITERATOR_FACADE_RELATION(<, return 0 >, distance_from) + BOOST_ITERATOR_FACADE_RELATION(>, return 0 <, distance_from) + BOOST_ITERATOR_FACADE_RELATION(<=, return 0 >=, distance_from) + BOOST_ITERATOR_FACADE_RELATION(>=, return 0 <=, distance_from) +# undef BOOST_ITERATOR_FACADE_RELATION + + // operator- requires an additional part in the static assertion + BOOST_ITERATOR_FACADE_INTEROP( + - + , detail::choose_difference_type + , return + , distance_from + ) +# undef BOOST_ITERATOR_FACADE_INTEROP +# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD + +# define BOOST_ITERATOR_FACADE_PLUS(args) \ + BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \ + { \ + Derived tmp(static_cast(i)); \ + return tmp += n; \ + } + +BOOST_ITERATOR_FACADE_PLUS(( + iterator_facade const& i + , typename Derived::difference_type n +)) + +BOOST_ITERATOR_FACADE_PLUS(( + typename Derived::difference_type n + , iterator_facade const& i +)) +# undef BOOST_ITERATOR_FACADE_PLUS +# undef BOOST_ITERATOR_FACADE_PLUS_HEAD + +} // namespace boost + +#include + +#endif // BOOST_ITERATOR_FACADE_23022003THW_HPP diff --git a/boost/boost/iterator/iterator_traits.hpp b/boost/boost/iterator/iterator_traits.hpp new file mode 100644 index 0000000000..4f0d46f23c --- /dev/null +++ b/boost/boost/iterator/iterator_traits.hpp @@ -0,0 +1,93 @@ +// Copyright David Abrahams 2003. 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. +#ifndef ITERATOR_TRAITS_DWA200347_HPP +# define ITERATOR_TRAITS_DWA200347_HPP + +# include +# include + +namespace boost { + +// Unfortunately, g++ 2.95.x chokes when we define a class template +// iterator_category which has the same name as its +// std::iterator_category() function, probably due in part to the +// "std:: is visible globally" hack it uses. Use +// BOOST_ITERATOR_CATEGORY to write code that's portable to older +// GCCs. + +# if BOOST_WORKAROUND(__GNUC__, <= 2) +# define BOOST_ITERATOR_CATEGORY iterator_category_ +# else +# define BOOST_ITERATOR_CATEGORY iterator_category +# endif + + +template +struct iterator_value +{ + typedef typename detail::iterator_traits::value_type type; +}; + +template +struct iterator_reference +{ + typedef typename detail::iterator_traits::reference type; +}; + + +template +struct iterator_pointer +{ + typedef typename detail::iterator_traits::pointer type; +}; + +template +struct iterator_difference +{ + typedef typename detail::iterator_traits::difference_type type; +}; + +template +struct BOOST_ITERATOR_CATEGORY +{ + typedef typename detail::iterator_traits::iterator_category type; +}; + +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +template <> +struct iterator_value +{ + typedef void type; +}; + +template <> +struct iterator_reference +{ + typedef void type; +}; + +template <> +struct iterator_pointer +{ + typedef void type; +}; + +template <> +struct iterator_difference +{ + typedef void type; +}; + +template <> +struct BOOST_ITERATOR_CATEGORY +{ + typedef void type; +}; +# endif + +} // namespace boost::iterator + +#endif // ITERATOR_TRAITS_DWA200347_HPP diff --git a/boost/boost/iterator/transform_iterator.hpp b/boost/boost/iterator/transform_iterator.hpp new file mode 100644 index 0000000000..20da1aba5f --- /dev/null +++ b/boost/boost/iterator/transform_iterator.hpp @@ -0,0 +1,183 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 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. +#ifndef BOOST_TRANSFORM_ITERATOR_23022003THW_HPP +#define BOOST_TRANSFORM_ITERATOR_23022003THW_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) +# include + +#endif +#include + + +namespace boost +{ + template + class transform_iterator; + + namespace detail + { + + template + struct function_object_result + { + typedef typename UnaryFunction::result_type type; + }; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template + struct function_object_result + { + typedef Return type; + }; +#endif + + // Compute the iterator_adaptor instantiation to be used for transform_iterator + template + struct transform_iterator_base + { + private: + // By default, dereferencing the iterator yields the same as + // the function. Do we need to adjust the way + // function_object_result is computed for the standard + // proposal (e.g. using Doug's result_of)? + typedef typename ia_dflt_help< + Reference + , function_object_result + >::type reference; + + // To get the default for Value: remove any reference on the + // result type, but retain any constness to signal + // non-writability. Note that if we adopt Thomas' suggestion + // to key non-writability *only* on the Reference argument, + // we'd need to strip constness here as well. + typedef typename ia_dflt_help< + Value + , remove_reference + >::type cv_value_type; + + public: + typedef iterator_adaptor< + transform_iterator + , Iterator + , cv_value_type + , use_default // Leave the traversal category alone + , reference + > type; + }; + } + + template + class transform_iterator + : public detail::transform_iterator_base::type + { + typedef typename + detail::transform_iterator_base::type + super_t; + + friend class iterator_core_access; + + public: + transform_iterator() { } + + transform_iterator(Iterator const& x, UnaryFunction f) + : super_t(x), m_f(f) { } + + explicit transform_iterator(Iterator const& x) + : super_t(x) + { + // Pro8 is a little too aggressive about instantiating the + // body of this function. +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + // don't provide this constructor if UnaryFunction is a + // function pointer type, since it will be 0. Too dangerous. + BOOST_STATIC_ASSERT(is_class::value); +#endif + } + + template< + class OtherUnaryFunction + , class OtherIterator + , class OtherReference + , class OtherValue> + transform_iterator( + transform_iterator const& t + , typename enable_if_convertible::type* = 0 +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1310) + , typename enable_if_convertible::type* = 0 +#endif + ) + : super_t(t.base()), m_f(t.functor()) + {} + + UnaryFunction functor() const + { return m_f; } + + private: + typename super_t::reference dereference() const + { return m_f(*this->base()); } + + // Probably should be the initial base class so it can be + // optimized away via EBO if it is an empty class. + UnaryFunction m_f; + }; + + template + transform_iterator + make_transform_iterator(Iterator it, UnaryFunction fun) + { + return transform_iterator(it, fun); + } + + // Version which allows explicit specification of the UnaryFunction + // type. + // + // This generator is not provided if UnaryFunction is a function + // pointer type, because it's too dangerous: the default-constructed + // function pointer in the iterator be 0, leading to a runtime + // crash. + template + typename iterators::enable_if< + is_class // We should probably find a cheaper test than is_class<> + , transform_iterator + >::type + make_transform_iterator(Iterator it) + { + return transform_iterator(it, UnaryFunction()); + } + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template + transform_iterator< Return (*)(Argument), Iterator, Return> + make_transform_iterator(Iterator it, Return (*fun)(Argument)) + { + return transform_iterator(it, fun); + } +#endif + +} // namespace boost + +#include + +#endif // BOOST_TRANSFORM_ITERATOR_23022003THW_HPP diff --git a/boost/boost/iterator_adaptors.hpp b/boost/boost/iterator_adaptors.hpp index 9387f22b7a..6d876e7bea 100644 --- a/boost/boost/iterator_adaptors.hpp +++ b/boost/boost/iterator_adaptors.hpp @@ -1,1437 +1,13 @@ -// (C) Copyright David Abrahams 2000. 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. -// -// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, +// 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/iterator_adaptors.htm for documentation. - -// Revision History: - -// 01 Feb 2002 Jeremy Siek -// Added more comments in default_iterator_policies. -// 08 Jan 2001 David Abrahams -// Moved concept checks into a separate class, which makes MSVC -// better at dealing with them. -// 07 Jan 2001 David Abrahams -// Choose proxy for operator->() only if the reference type is not a reference. -// Updated workarounds for __MWERKS__ == 0x2406 -// 20 Dec 2001 David Abrahams -// Adjusted is_convertible workarounds for __MWERKS__ == 0x2406 -// 03 Nov 2001 Jeremy Siek -// Changed the named template parameter interface and internal. -// 04 Oct 2001 Jeremy Siek -// Changed projection_iterator to not rely on the default reference, -// working around a limitation of detail::iterator_traits. -// 04 Oct 2001 David Abrahams -// Applied indirect_iterator patch from George A. Heintzelman -// Changed name of "bind" to "select" to avoid problems with MSVC. -// 26 Sep 2001 David Abrahams -// Added borland bug fix -// 08 Mar 2001 Jeremy Siek -// Added support for optional named template parameters. -// 19 Feb 2001 David Abrahams -// Rolled back reverse_iterator_pair_generator again, as it doesn't -// save typing on a conforming compiler. -// 18 Feb 2001 David Abrahams -// Reinstated reverse_iterator_pair_generator -// 16 Feb 2001 David Abrahams -// Add an implicit conversion operator to operator_arrow_proxy -// as CW and BCC workarounds. -// 11 Feb 2001 David Abrahams -// Switch to use of BOOST_STATIC_CONSTANT where possible -// 11 Feb 2001 Jeremy Siek -// Removed workaround for older MIPSpro compiler. The workaround -// was preventing the proper functionality of the underlying -// iterator being carried forward into the iterator adaptor. -// Also added is_bidirectional enum to avoid EDG compiler error. -// 11 Feb 2001 David Abrahams -// Borland fixes up the wazoo. It finally works! -// 10 Feb 2001 David Abrahams -// Removed traits argument from iterator_adaptor<> and switched to -// explicit trait specification for maximum ease-of-use. -// Added comments to detail::iterator_defaults<> -// Began using detail::iterator_defaults<> unconditionally for code clarity -// Changed uses of `Iterator' to `Base' where non-iterators can be used. -// -// 10 Feb 2001 David Abrahams -// Rolled in supposed Borland fixes from John Maddock, but not seeing any -// improvement yet -// Changed argument order to indirect_ generator, for convenience in the -// case of input iterators (where Reference must be a value type). -// Removed derivation of filter_iterator_policies from -// default_iterator_policies, since the iterator category is likely to be -// reduced (we don't want to allow illegal operations like decrement). -// Support for a simpler filter iterator interface. -// -// 09 Feb 2001 David Abrahams -// Improved interface to indirect_ and reverse_ iterators -// Rolled back Jeremy's new constructor for now; it was causing -// problems with counting_iterator_test -// Attempted fix for Borland -// -// 09 Feb 2001 Jeremy Siek -// Added iterator constructor to allow const adaptor -// from non-const adaptee. -// Changed make_xxx to pass iterators by-value to -// get arrays converted to pointers. -// Removed InnerIterator template parameter from -// indirect_iterator_generator. -// Rearranged parameters for make_filter_iterator -// -// 07 Feb 2001 Jeremy Siek -// Removed some const iterator adaptor generators. -// Added make_xxx_iterator() helper functions for remaining -// iterator adaptors. -// Removed some traits template parameters where they -// where no longer needed thanks to detail::iterator_traits. -// Moved some of the compile-time logic into enums for -// EDG compatibility. -// -// 07 Feb 2001 David Abrahams -// Removed iterator_adaptor_pair_generator and -// reverse_iterator_pair_generator (more such culling to come) -// Improved comments -// Changed all uses of std::iterator_traits as default arguments -// to boost::detail::iterator_traits for improved utility in -// non-generic contexts -// Fixed naming convention of non-template parameter names -// -// 06 Feb 2001 David Abrahams -// Produce operator-> proxy objects for InputIterators -// Added static assertions to do some basic concept checks -// Renamed single-type generators -> xxx_generator -// Renamed const/nonconst iterator generators -> xxx_pair_generator -// Added make_transform_iterator(iter, function) -// The existence of boost::detail::iterator_traits allowed many -// template arguments to be defaulted. Some arguments had to be -// moved to accomplish it. -// -// 04 Feb 2001 MWERKS bug workaround, concept checking for proper -// reference types (David Abrahams) - -#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ -# define BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# if BOOST_WORKAROUND(__GNUC__, == 2) && __GNUC_MINOR__ <= 96 && !defined(__STL_USE_NAMESPACES) -# define BOOST_RELOPS_AMBIGUITY_BUG 1 -# endif - -namespace boost { - -//============================================================================ -// Concept checking classes that express the requirements for iterator -// policies and adapted types. These classes are mostly for -// documentation purposes, and are not used in this header file. They -// merely provide a more succinct statement of what is expected of the -// iterator policies. - -template -struct TrivialIteratorPoliciesConcept -{ - typedef typename Traits::reference reference; - void constraints() { - function_requires< AssignableConcept >(); - function_requires< DefaultConstructibleConcept >(); - function_requires< AssignableConcept >(); - function_requires< DefaultConstructibleConcept >(); - - const_constraints(); - } - void const_constraints() const { - reference r = p.dereference(x); - b = p.equal(x, x); - ignore_unused_variable_warning(r); - } - Policies p; - Adapted x; - mutable bool b; -}; - -// Add InputIteratorPoliciesConcept? - -template -struct ForwardIteratorPoliciesConcept -{ - typedef typename Traits::iterator_category iterator_category; - void constraints() { - function_requires< - TrivialIteratorPoliciesConcept - >(); - - p.increment(x); - std::forward_iterator_tag t = iterator_category(); - ignore_unused_variable_warning(t); - } - Policies p; - Adapted x; - iterator_category category; -}; - -template -struct BidirectionalIteratorPoliciesConcept -{ - typedef typename Traits::iterator_category iterator_category; - void constraints() { - function_requires< - ForwardIteratorPoliciesConcept - >(); - - p.decrement(x); - std::bidirectional_iterator_tag t = iterator_category(); - ignore_unused_variable_warning(t); - } - Policies p; - Adapted x; -}; - -template -struct RandomAccessIteratorPoliciesConcept -{ - typedef typename Traits::difference_type DifferenceType; - typedef typename Traits::iterator_category iterator_category; - void constraints() { - function_requires< - BidirectionalIteratorPoliciesConcept - >(); - - p.advance(x, n); - std::random_access_iterator_tag t = iterator_category(); - const_constraints(); - ignore_unused_variable_warning(t); - } - void const_constraints() const { - n = p.distance(x, x); - } - Policies p; - Adapted x; - mutable DifferenceType n; - mutable bool b; -}; - - -//============================================================================ -// Default policies for iterator adaptors. You can use this as a base -// class if you want to customize particular policies. -struct default_iterator_policies -{ - // Some of the member functions were defined static, but Borland - // got confused and thought they were non-const. Also, Sun C++ - // does not like static function templates. - // - // The reason some members were defined static is because there is - // not state (data members) needed by those members of the - // default_iterator_policies class. If your policies class member - // functions need to access state stored in the policies object, - // then the member functions should not be static (they can't be). - - template - void initialize(Base&) - { } - - template - typename IteratorAdaptor::reference dereference(const IteratorAdaptor& x) const - { return *x.base(); } - - template - void increment(IteratorAdaptor& x) - { ++x.base(); } - - template - void decrement(IteratorAdaptor& x) - { --x.base(); } - - template - void advance(IteratorAdaptor& x, DifferenceType n) - { x.base() += n; } - - template - typename IteratorAdaptor1::difference_type - distance(const IteratorAdaptor1& x, const IteratorAdaptor2& y) const - { return y.base() - x.base(); } - - template - bool equal(const IteratorAdaptor1& x, const IteratorAdaptor2& y) const - { return x.base() == y.base(); } -}; - -// putting the comparisons in a base class avoids the g++ -// ambiguous overload bug due to the relops operators - -#ifdef BOOST_RELOPS_AMBIGUITY_BUG -template -struct iterator_comparisons : Base { }; - -template -inline bool operator==(const iterator_comparisons& xb, - const iterator_comparisons& yb) -{ - const D1& x = static_cast(xb); - const D2& y = static_cast(yb); - return x.policies().equal(x, y); -} - -template -inline bool operator!=(const iterator_comparisons& xb, - const iterator_comparisons& yb) -{ - const D1& x = static_cast(xb); - const D2& y = static_cast(yb); - return !x.policies().equal(x, y); -} - -template -inline bool operator<(const iterator_comparisons& xb, - const iterator_comparisons& yb) -{ - const D1& x = static_cast(xb); - const D2& y = static_cast(yb); - return x.policies().distance(y, x) < 0; -} - -template -inline bool operator>(const iterator_comparisons& xb, - const iterator_comparisons& yb) -{ - const D1& x = static_cast(xb); - const D2& y = static_cast(yb); - return x.policies().distance(y, x) > 0; -} - -template -inline bool operator>=(const iterator_comparisons& xb, - const iterator_comparisons& yb) -{ - const D1& x = static_cast(xb); - const D2& y = static_cast(yb); - return x.policies().distance(y, x) >= 0; -} - -template -inline bool operator<=(const iterator_comparisons& xb, - const iterator_comparisons& yb) -{ - const D1& x = static_cast(xb); - const D2& y = static_cast(yb); - return x.policies().distance(y, x) <= 0; -} -#endif - -namespace detail { - - // operator->() needs special support for input iterators to strictly meet the - // standard's requirements. If *i is not a reference type, we must still - // produce a (constant) lvalue to which a pointer can be formed. We do that by - // returning an instantiation of this special proxy class template. - - template - struct operator_arrow_proxy - { - operator_arrow_proxy(const T& x) : m_value(x) {} - const T* operator->() const { return &m_value; } - // This function is needed for MWCW and BCC, which won't call operator-> - // again automatically per 13.3.1.2 para 8 - operator const T*() const { return &m_value; } - T m_value; - }; - - template - inline operator_arrow_proxy - operator_arrow(const Iter& i, std::input_iterator_tag) { - typedef typename Iter::value_type value_t; // VC++ needs this typedef - return operator_arrow_proxy(*i); - } - - template - inline typename Iter::pointer - operator_arrow(const Iter& i, std::forward_iterator_tag) { - return &(*i); - } - - template - struct operator_arrow_result_generator - { - typedef operator_arrow_proxy proxy; - // Borland chokes unless it's an actual enum (!) - enum { use_proxy = !boost::is_reference::value }; - - typedef typename boost::detail::if_true<(use_proxy)>::template - then< - proxy, - // else - Pointer - >::type type; - }; - - -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_STD_ITERATOR_TRAITS) - - // Select default pointer and reference types for adapted non-pointer - // iterators based on the iterator and the value_type. Poor man's partial - // specialization is in use here. - template - struct iterator_defaults_select - { - template - struct traits - { - // The assumption is that iterator_traits can deduce these types - // properly as long as the iterator is not a pointer. - typedef typename boost::detail::iterator_traits::pointer pointer; - typedef typename boost::detail::iterator_traits::reference reference; - }; - }; - - // Select default pointer and reference types for adapted pointer iterators - // given a (possibly-const) value_type. - template <> - struct iterator_defaults_select - { - template - struct traits - { - typedef Value* pointer; - typedef Value& reference; - }; - }; - - // Consolidate selection of the default pointer and reference type - template - struct iterator_defaults - { - BOOST_STATIC_CONSTANT(bool, is_ptr = boost::is_pointer::value); - - typedef typename iterator_defaults_select::template traits traits; - typedef typename traits::pointer pointer; - typedef typename traits::reference reference; - }; -# else - template - struct iterator_defaults : iterator_traits - { - // Trying to factor the common is_same expression into an enum or a - // static bool constant confused Borland. - typedef typename if_true<( - ::boost::is_same::value_type>::value - )>::template then< - typename iterator_traits::pointer, - Value* - >::type pointer; - - typedef typename if_true<( - ::boost::is_same::value_type>::value - )>::template then< - typename iterator_traits::reference, - Value& - >::type reference; - - }; -# endif - - //=========================================================================== - // Specify the defaults for iterator_adaptor's template parameters - - struct default_argument { }; - // This class template is a workaround for MSVC. - struct dummy_default_gen { - template - struct select { typedef default_argument type; }; - }; - // This class template is a workaround for MSVC. - template struct default_generator { - typedef dummy_default_gen type; - }; - - struct default_value_type { - template - struct select { - typedef typename boost::detail::iterator_traits::value_type type; - }; - }; - template <> struct default_generator - { typedef default_value_type type; }; // VC++ workaround - - struct default_difference_type { - template - struct select { - typedef typename boost::detail::iterator_traits::difference_type type; - }; - }; - template <> struct default_generator - { typedef default_difference_type type; }; // VC++ workaround - - struct default_iterator_category { - template - struct select { - typedef typename boost::detail::iterator_traits::iterator_category type; - }; - }; - template <> struct default_generator - { typedef default_iterator_category type; }; // VC++ workaround - - struct default_pointer { - template - struct select { - typedef typename Traits::value_type Value; - typedef typename boost::detail::iterator_defaults::pointer - type; - }; - }; - template <> struct default_generator - { typedef default_pointer type; }; // VC++ workaround - - struct default_reference { - template - struct select { - typedef typename Traits::value_type Value; - typedef typename boost::detail::iterator_defaults::reference - type; - }; - }; - template <> struct default_generator - { typedef default_reference type; }; // VC++ workaround - -} // namespace detail - - - //=========================================================================== - // Support for named template parameters - -struct named_template_param_base { }; - -namespace detail { - struct value_type_tag { }; - struct reference_tag { }; - struct pointer_tag { }; - struct difference_type_tag { }; - struct iterator_category_tag { }; - - // avoid using std::pair because A or B might be a reference type, and g++ - // complains about forming references to references inside std::pair - template - struct cons_type { - typedef A first_type; - typedef B second_type; - }; - -} // namespace detail - -template struct value_type_is : public named_template_param_base -{ - typedef detail::cons_type type; -}; -template struct reference_is : public named_template_param_base -{ - typedef detail::cons_type type; -}; -template struct pointer_is : public named_template_param_base -{ - typedef detail::cons_type type; -}; -template struct difference_type_is - : public named_template_param_base -{ - typedef detail::cons_type type; -}; -template struct iterator_category_is - : public named_template_param_base -{ - typedef detail::cons_type type; -}; - -namespace detail { - - struct end_of_list { }; - - // Given an associative list, find the value with the matching key. - // An associative list is a list of key-value pairs. The list is - // built out of cons_type's and is terminated by end_of_list. - -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || BOOST_WORKAROUND(__BORLANDC__, != 0) - template - struct find_param; - - struct find_param_continue { - template struct select { - typedef typename AssocList::first_type Head; - typedef typename Head::first_type Key1; - typedef typename Head::second_type Value; - typedef typename if_true<(is_same::value)>::template - then::type - >::type type; - }; - }; - struct find_param_end { - template - struct select { typedef detail::default_argument type; }; - }; - template struct find_param_helper1 - { typedef find_param_continue type; }; - template <> struct find_param_helper1 - { typedef find_param_end type; }; - - template - struct find_param { - typedef typename find_param_helper1::type select1; - typedef typename select1::template select::type type; - }; -# else - template struct find_param; - - template - struct find_param { typedef default_argument type; }; - - // Found a matching Key, return the associated Value - template - struct find_param, Rest>, Key> { - typedef Value type; - }; - - // Non-matching keys, continue the search - template - struct find_param, Rest>, Key2> { - typedef typename find_param::type type; - }; -# endif - - struct make_named_arg { - template - struct select { typedef typename Value::type type; }; - }; - struct make_key_value { - template - struct select { typedef detail::cons_type type; }; - }; - - template - struct is_named_parameter - { - enum { value = is_convertible< typename add_reference< Value >::type, add_reference< named_template_param_base >::type >::value }; - }; - -# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) // workaround for broken is_convertible implementation - template struct is_named_parameter > { enum { value = true }; }; - template struct is_named_parameter > { enum { value = true }; }; - template struct is_named_parameter > { enum { value = true }; }; - template struct is_named_parameter > { enum { value = true }; }; - template struct is_named_parameter > { enum { value = true }; }; -# endif - - template - struct make_arg { -# if BOOST_WORKAROUND(__BORLANDC__, > 0) - // Borland C++ doesn't like the extra indirection of is_named_parameter - typedef typename - if_true<(is_convertible::value)>:: - template then::type Make; -# else - enum { is_named = is_named_parameter::value }; - typedef typename if_true<(is_named)>::template - then::type Make; -# endif - typedef typename Make::template select::type type; - }; - - // Mechanism for resolving the default argument for a template parameter. - - template struct is_default { typedef type_traits::no_type type; }; - template <> struct is_default - { typedef type_traits::yes_type type; }; - - struct choose_default { - template - struct select { - typedef typename default_generator::type Gen; - typedef typename Gen::template select::type type; - }; - }; - struct choose_arg { - template - struct select { - typedef Arg type; - }; - }; - - template - struct choose_arg_or_default { typedef choose_arg type; }; - template <> struct choose_arg_or_default { - typedef choose_default type; - }; - - template - class resolve_default { - typedef typename choose_arg_or_default::type>::type - Selector; - public: - typedef typename Selector - ::template select::type type; - }; - - template - class iterator_adaptor_traits_gen - { - // Form an associative list out of the template parameters - // If the argument is a normal parameter (not named) then make_arg - // creates a key-value pair. If the argument is a named parameter, - // then make_arg extracts the key-value pair defined inside the - // named parameter. - typedef detail::cons_type< typename make_arg::type, - detail::cons_type::type, - detail::cons_type::type, - detail::cons_type::type, - detail::cons_type::type, - end_of_list> > > > > ArgList; - - // Search the list for particular parameters - typedef typename find_param::type Val; - typedef typename find_param::type Diff; - typedef typename find_param::type Cat; - typedef typename find_param::type Ptr; - typedef typename find_param::type Ref; - - typedef boost::iterator - Traits0; - - // Compute the defaults if necessary - typedef typename resolve_default::type - value_type; - // if getting default value type from iterator_traits, then it won't be const - typedef typename resolve_default::type difference_type; - typedef typename resolve_default::type iterator_category; - - typedef boost::iterator Traits1; - - // Compute the defaults for pointer and reference. This is done as a - // separate step because the defaults for pointer and reference depend - // on value_type. - typedef typename resolve_default::type - pointer; - typedef typename resolve_default::type - reference; - - public: - typedef boost::iterator::type, - difference_type, pointer, reference> type; - }; - - // This is really a partial concept check for iterators. Should it - // be moved or done differently? - template - struct validator - { - BOOST_STATIC_CONSTANT( - bool, is_input_or_output_iter - = (boost::is_convertible::value - | boost::is_convertible::value)); - - // Iterators should satisfy one of the known categories - BOOST_STATIC_ASSERT(is_input_or_output_iter); - - // Iterators >= ForwardIterator must produce real references - // as required by the C++ standard requirements in Table 74. - BOOST_STATIC_CONSTANT( - bool, forward_iter_with_real_reference - = ((!boost::is_convertible::value) - | boost::is_same::value - | boost::is_same::type&>::value)); - - BOOST_STATIC_ASSERT(forward_iter_with_real_reference); - }; - - template struct dependent - { - typedef Result type; - }; - -} // namespace detail - - - -// This macro definition is only temporary in this file -# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# define BOOST_ARG_DEPENDENT_TYPENAME typename -# else -# define BOOST_ARG_DEPENDENT_TYPENAME -# endif - -//============================================================================ -//iterator_adaptor - Adapts a generic piece of data as an iterator. Adaptation -// is especially easy if the data being adapted is itself an iterator -// -// Base - the base (usually iterator) type being wrapped. -// -// Policies - a set of policies determining how the resulting iterator -// works. -// -// Value - if supplied, the value_type of the resulting iterator, unless -// const. If const, a conforming compiler strips constness for the -// value_type. If not supplied, iterator_traits::value_type is used -// -// Reference - the reference type of the resulting iterator, and in -// particular, the result type of operator*(). If not supplied but -// Value is supplied, Value& is used. Otherwise -// iterator_traits::reference is used. -// -// Pointer - the pointer type of the resulting iterator, and in -// particular, the result type of operator->(). If not -// supplied but Value is supplied, Value* is used. Otherwise -// iterator_traits::pointer is used. -// -// Category - the iterator_category of the resulting iterator. If not -// supplied, iterator_traits::iterator_category is used. -// -// Distance - the difference_type of the resulting iterator. If not -// supplied, iterator_traits::difference_type is used. -template -struct iterator_adaptor : -#ifdef BOOST_RELOPS_AMBIGUITY_BUG - iterator_comparisons< - iterator_adaptor, - typename detail::iterator_adaptor_traits_gen::type - > -#else - detail::iterator_adaptor_traits_gen::type -#endif -{ - typedef iterator_adaptor self; - public: - typedef detail::iterator_adaptor_traits_gen TraitsGen; - typedef typename TraitsGen::type Traits; - - typedef typename Traits::difference_type difference_type; - typedef typename Traits::value_type value_type; - typedef typename Traits::pointer pointer; - typedef typename Traits::reference reference; - typedef typename Traits::iterator_category iterator_category; - - typedef Base base_type; - typedef Policies policies_type; - - private: - typedef detail::validator< - iterator_category,value_type,difference_type,pointer,reference - > concept_check; - - public: - iterator_adaptor() - { - } - - explicit - iterator_adaptor(const Base& it, const Policies& p = Policies()) - : m_iter_p(it, p) { - policies().initialize(base()); - } - - template - iterator_adaptor ( - const iterator_adaptor& src) - : m_iter_p(src.base(), src.policies()) - { - policies().initialize(base()); - } - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(__BORLANDC__, > 0) - // This is required to prevent a bug in how VC++ generates - // the assignment operator for compressed_pair - iterator_adaptor& operator= (const iterator_adaptor& x) { - m_iter_p = x.m_iter_p; - return *this; - } -#endif - reference operator*() const { - return policies().dereference(*this); - } - -#if BOOST_WORKAROUND(BOOST_MSVC, > 0) -# pragma warning(push) -# pragma warning( disable : 4284 ) -#endif - - typename boost::detail::operator_arrow_result_generator::type - operator->() const - { return detail::operator_arrow(*this, iterator_category()); } - -#if BOOST_WORKAROUND(BOOST_MSVC, > 0) -# pragma warning(pop) -#endif - - template - typename detail::dependent::type operator[](diff_type n) const - { return *(*this + n); } - - self& operator++() { -#if !BOOST_WORKAROUND(__MWERKS__, < 0x2405) - policies().increment(*this); -#else - // Odd bug, MWERKS couldn't deduce the type for the member template - // Workaround by explicitly specifying the type. - policies().increment(*this); -#endif - return *this; - } - - self operator++(int) { self tmp(*this); ++*this; return tmp; } - - self& operator--() { -#if !BOOST_WORKAROUND(__MWERKS__, < 0x2405) - policies().decrement(*this); -#else - policies().decrement(*this); -#endif - return *this; - } - - self operator--(int) { self tmp(*this); --*this; return tmp; } - - self& operator+=(difference_type n) { - policies().advance(*this, n); - return *this; - } - - self& operator-=(difference_type n) { - policies().advance(*this, -n); - return *this; - } - - base_type const& base() const { return m_iter_p.first(); } - - // Moved from global scope to avoid ambiguity with the operator-() which - // subtracts iterators from one another. - self operator-(difference_type x) const - { self result(*this); return result -= x; } -private: - compressed_pair m_iter_p; - -public: // implementation details (too many compilers have trouble when these are private). - base_type& base() { return m_iter_p.first(); } - Policies& policies() { return m_iter_p.second(); } - const Policies& policies() const { return m_iter_p.second(); } -}; - -template -iterator_adaptor -operator+( - iterator_adaptor p, - Distance2 x) -{ - return p += x; -} - -template -iterator_adaptor -operator+( - Distance2 x, - iterator_adaptor p) -{ - return p += x; -} - -template -typename iterator_adaptor::difference_type -operator-( - const iterator_adaptor& x, - const iterator_adaptor& y) -{ - typedef typename iterator_adaptor::difference_type difference_type; - return x.policies().distance(y, x); -} - -#ifndef BOOST_RELOPS_AMBIGUITY_BUG -template -inline bool -operator==( - const iterator_adaptor& x, - const iterator_adaptor& y) -{ - return x.policies().equal(x, y); -} - -template -inline bool -operator<( - const iterator_adaptor& x, - const iterator_adaptor& y) -{ - return x.policies().distance(y, x) < 0; -} - -template -inline bool -operator>( - const iterator_adaptor& x, - const iterator_adaptor& y) -{ - return x.policies().distance(y, x) > 0; -} - -template -inline bool -operator>=( - const iterator_adaptor& x, - const iterator_adaptor& y) -{ - return x.policies().distance(y, x) >= 0; -} - -template -inline bool -operator<=( - const iterator_adaptor& x, - const iterator_adaptor& y) -{ - return x.policies().distance(y, x) <= 0; -} - -template -inline bool -operator!=( - const iterator_adaptor& x, - const iterator_adaptor& y) -{ - return !x.policies().equal(x, y); -} -#endif - -//============================================================================= -// Transform Iterator Adaptor -// -// Upon deference, apply some unary function object and return the -// result by value. - -template -struct transform_iterator_policies : public default_iterator_policies -{ - transform_iterator_policies() { } - transform_iterator_policies(const AdaptableUnaryFunction& f) : m_f(f) { } - - template - typename IteratorAdaptor::reference - dereference(const IteratorAdaptor& iter) const - { return m_f(*iter.base()); } - - AdaptableUnaryFunction m_f; -}; - -template -class transform_iterator_generator -{ - typedef typename AdaptableUnaryFunction::result_type value_type; -public: - typedef iterator_adaptor, - value_type, value_type, value_type*, std::input_iterator_tag> - type; -}; - -template -inline typename transform_iterator_generator::type -make_transform_iterator( - Iterator base, - const AdaptableUnaryFunction& f = AdaptableUnaryFunction()) -{ - typedef typename transform_iterator_generator::type result_t; - return result_t(base, f); -} - -//============================================================================= -// Indirect Iterators Adaptor - -// Given a pointer to pointers (or iterator to iterators), -// apply a double dereference inside operator*(). -// -// We use the term "outer" to refer to the first level iterator type -// and "inner" to refer to the second level iterator type. For -// example, given T**, T* is the inner iterator type and T** is the -// outer iterator type. Also, const T* would be the const inner -// iterator. - -// We tried to implement this with transform_iterator, but that required -// using boost::remove_ref, which is not compiler portable. - -struct indirect_iterator_policies : public default_iterator_policies -{ - template - typename IteratorAdaptor::reference dereference(const IteratorAdaptor& x) const - { return **x.base(); } -}; - -namespace detail { -# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // strangely instantiated even when unused! Maybe try a recursive template someday ;-) - template - struct traits_of_value_type { - typedef typename boost::detail::iterator_traits::value_type outer_value; - typedef typename boost::detail::iterator_traits::value_type value_type; - typedef typename boost::detail::iterator_traits::reference reference; - typedef typename boost::detail::iterator_traits::pointer pointer; - }; -# endif -} - -template ::value_type -#endif - , class Reference -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< - OuterIterator>::reference -#else - = Value & -#endif - , class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits< - OuterIterator>::iterator_category - , class Pointer -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< - OuterIterator>::pointer -#else - = Value* -#endif - > -struct indirect_iterator_generator -{ - typedef iterator_adaptor type; -}; - -template ::value_type -#endif - , class Reference -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< - OuterIterator>::reference -#else - = Value & -#endif - , class ConstReference = Value const& - , class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits< - OuterIterator>::iterator_category - , class Pointer -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< - OuterIterator>::pointer -#else - = Value* -#endif - , class ConstPointer = Value const* - > -struct indirect_iterator_pair_generator -{ - typedef typename indirect_iterator_generator::type iterator; - typedef typename indirect_iterator_generator::type const_iterator; -}; - -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -template -inline typename indirect_iterator_generator::type -make_indirect_iterator(OuterIterator base) -{ - typedef typename indirect_iterator_generator - ::type result_t; - return result_t(base); -} -#endif - -//============================================================================= -// Reverse Iterators Adaptor - -struct reverse_iterator_policies : public default_iterator_policies -{ - template - typename IteratorAdaptor::reference dereference(const IteratorAdaptor& x) const - { return *boost::prior(x.base()); } - - template - void increment(BidirectionalIterator& x) const - { --x.base(); } - - template - void decrement(BidirectionalIterator& x) const - { ++x.base(); } - - template - void advance(BidirectionalIterator& x, DifferenceType n) const - { x.base() -= n; } - - template - typename Iterator1::difference_type distance( - const Iterator1& x, const Iterator2& y) const - { return x.base() - y.base(); } - - template - bool equal(const Iterator1& x, const Iterator2& y) const - { return x.base() == y.base(); } -}; - -template ::value_type, - class Reference = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults::reference, - class Pointer = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults::pointer, - class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits::iterator_category, - class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits::difference_type - > -struct reverse_iterator_generator -{ - typedef iterator_adaptor type; -}; - -template -inline typename reverse_iterator_generator::type -make_reverse_iterator(BidirectionalIterator base) -{ - typedef typename reverse_iterator_generator::type result_t; - return result_t(base); -} - -//============================================================================= -// Projection Iterators Adaptor - -template -struct projection_iterator_policies : public default_iterator_policies -{ - projection_iterator_policies() { } - projection_iterator_policies(const AdaptableUnaryFunction& f) : m_f(f) { } - - template - typename IteratorAdaptor::reference dereference(IteratorAdaptor const& iter) const { - return m_f(*iter.base()); - } - - AdaptableUnaryFunction m_f; -}; - -template -class projection_iterator_generator { - typedef typename AdaptableUnaryFunction::result_type value_type; - typedef projection_iterator_policies policies; -public: - typedef iterator_adaptor type; -}; - -template -class const_projection_iterator_generator { - typedef typename AdaptableUnaryFunction::result_type value_type; - typedef projection_iterator_policies policies; -public: - typedef iterator_adaptor type; -}; - -template -struct projection_iterator_pair_generator { - typedef typename projection_iterator_generator::type iterator; - typedef typename const_projection_iterator_generator::type const_iterator; -}; - - -template -inline typename projection_iterator_generator::type -make_projection_iterator( - Iterator iter, - const AdaptableUnaryFunction& f = AdaptableUnaryFunction()) -{ - typedef typename projection_iterator_generator::type result_t; - return result_t(iter, f); -} - -template -inline typename const_projection_iterator_generator::type -make_const_projection_iterator( - Iterator iter, - const AdaptableUnaryFunction& f = AdaptableUnaryFunction()) -{ - typedef typename const_projection_iterator_generator::type result_t; - return result_t(iter, f); -} - -//============================================================================= -// Filter Iterator Adaptor - -template -class filter_iterator_policies -{ -public: - filter_iterator_policies() { } - - filter_iterator_policies(const Predicate& p, const Iterator& end) - : m_predicate(p), m_end(end) { } - - void initialize(Iterator& x) { - satisfy_predicate(x); - } - - // The Iter template argument is neccessary for compatibility with a MWCW - // bug workaround - template - void increment(IteratorAdaptor& x) { - ++x.base(); - satisfy_predicate(x.base()); - } - - template - typename IteratorAdaptor::reference dereference(const IteratorAdaptor& x) const - { return *x.base(); } - - template - bool equal(const IteratorAdaptor1& x, const IteratorAdaptor2& y) const - { return x.base() == y.base(); } - - private: - void satisfy_predicate(Iterator& iter); - Predicate m_predicate; - Iterator m_end; -}; - -template -void filter_iterator_policies::satisfy_predicate( - Iterator& iter) -{ - while (m_end != iter && !m_predicate(*iter)) - ++iter; -} - - - -namespace detail { - // A type generator returning Base if T is derived from Base, and T otherwise. - template - struct reduce_to_base_class - { - typedef typename if_true<( - ::boost::is_convertible::value - )>::template then::type type; - }; - - // "Steps down" the category of iterators below bidirectional so the category - // can be used with filter iterators. - template - struct non_bidirectional_category - { -# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - typedef typename reduce_to_base_class< - std::forward_iterator_tag, - typename iterator_traits::iterator_category - >::type type; - private: - // For some reason, putting this assertion in filter_iterator_generator fails inexplicably under MSVC - BOOST_STATIC_CONSTANT( - bool, is_bidirectional - = (!boost::is_convertible::value)); - BOOST_STATIC_ASSERT(is_bidirectional); -# else - // is_convertible doesn't work with MWERKS - typedef typename iterator_traits::iterator_category input_category; - public: - typedef typename if_true<( - boost::is_same::value - || boost::is_same::value - )>::template then< - std::forward_iterator_tag, - input_category - >::type type; -# endif - }; -} - -template ::value_type, - class Reference = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults::reference, - class Pointer = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_defaults::pointer, - class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::non_bidirectional_category::type, - class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits::difference_type - > -class filter_iterator_generator { - BOOST_STATIC_CONSTANT(bool, is_bidirectional - = (boost::is_convertible::value)); -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // I don't have any idea why this occurs, but it doesn't seem to hurt too badly. - BOOST_STATIC_ASSERT(!is_bidirectional); -#endif - typedef filter_iterator_policies policies_type; - public: - typedef iterator_adaptor type; -}; - -// This keeps MSVC happy; it doesn't like to deduce default template arguments -// for template function return types -namespace detail { - template - struct filter_generator { - typedef typename boost::filter_iterator_generator::type type; - }; -} - -template -inline typename detail::filter_generator::type -make_filter_iterator(Iterator first, Iterator last, const Predicate& p = Predicate()) -{ - typedef filter_iterator_generator Gen; - typedef filter_iterator_policies policies_t; - typedef typename Gen::type result_t; - return result_t(first, policies_t(p, last)); -} - -} // namespace boost -# undef BOOST_ARG_DEPENDENT_TYPENAME - - -#endif - +#ifndef BOOST_ITERATOR_ADAPTOR_13062003HK_HPP +#define BOOST_ITERATOR_ADAPTOR_13062003HK_HPP +#define BOOST_ITERATOR_ADAPTORS_VERSION 0x0200 +#include +#endif // BOOST_ITERATOR_ADAPTOR_13062003HK_HPP diff --git a/boost/boost/last_value.hpp b/boost/boost/last_value.hpp index bca93057e3..9554e1b083 100644 --- a/boost/boost/last_value.hpp +++ b/boost/boost/last_value.hpp @@ -1,16 +1,10 @@ // last_value function object (documented as part of Boost.Signals) -// -// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. - + +// Copyright Doug 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 @@ -22,7 +16,7 @@ namespace boost { template struct last_value { typedef T result_type; - + template T operator()(InputIterator first, InputIterator last) const { @@ -33,14 +27,14 @@ namespace boost { return value; } }; - + template<> struct last_value { struct unusable {}; public: typedef unusable result_type; - + template result_type operator()(InputIterator first, InputIterator last) const diff --git a/boost/boost/mem_fn.hpp b/boost/boost/mem_fn.hpp index 9eab3a2bba..1e5f606c16 100644 --- a/boost/boost/mem_fn.hpp +++ b/boost/boost/mem_fn.hpp @@ -1,8 +1,10 @@ #ifndef BOOST_MEM_FN_HPP_INCLUDED #define BOOST_MEM_FN_HPP_INCLUDED -#if _MSC_VER+0 >= 1020 -#pragma once +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif // @@ -21,6 +23,7 @@ #include #include +#include namespace boost { @@ -292,7 +295,7 @@ public: return call(u, &u); } -#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1300) +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) R & operator()(T & t) const { diff --git a/boost/boost/min_rand.hpp b/boost/boost/min_rand.hpp deleted file mode 100644 index 960b5dd745..0000000000 --- a/boost/boost/min_rand.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// Boost min_rand.hpp header file ------------------------------------------// - -// (C) Copyright Beman Dawes 1998. 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. - -// Version 1.1, 25 May 99 Add operator()() to meet Generator requirements -// Version 1.0, 9 Nov 98 Initial version - -#ifndef BOOST_MIN_RAND_HPP -#define BOOST_MIN_RAND_HPP - -#include - -namespace boost { - -// min_rand ----------------------------------------------------------------// - -// see min_rand.html for documentation - -class min_rand { - - // Don't even think about changing the values of the constants below. - // See the article cited in the documentation for rationale. - enum constants { - modulus = 2147483647L, - multiplier = 48271L, // 16807L for original "minimal standard" - validation = 399268537L, // 1043618065L for original "minimal standard" - q = modulus / multiplier, - r = modulus % multiplier - }; - - long value; // invariant: 0 < value <= modulus - - public: - - // compiler generated copy constructor and operator= are valid and useful - - explicit min_rand( long seed_value=1 ) : value( seed_value ) - { assert( value > 0 && value <= modulus ); } - - operator long() const { return value; } - double fvalue() const { return double(value) / modulus; } - - min_rand& operator=( long new_value ) { - value = new_value; - assert( value > 0 && value <= modulus ); - return *this; - } - - long operator++() { value = multiplier*(value%q) - r*(value/q); - if ( value <= 0 ) value += modulus; - assert( value > 0 && value <= modulus ); - return value; - } - long operator++(int) { long temp = value; operator++(); return temp; } - - long ten_thousandth() const { return validation; } - - // satisfy std::RandomNumberGenerator and std::Generator requirements: - typedef long argument_type; - typedef long result_type; - long operator()( long n ) { return operator++() % n; } - long operator()() { return operator++(); } - - }; // min_rand - -} // namespace boost - -#endif // BOOST_MIN_RAND_HPP diff --git a/boost/boost/mpl/always.hpp b/boost/boost/mpl/always.hpp new file mode 100644 index 0000000000..998b625829 --- /dev/null +++ b/boost/boost/mpl/always.hpp @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// boost mpl/always.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_ALWAYS_HPP_INCLUDED +#define BOOST_MPL_ALWAYS_HPP_INCLUDED + +#include "boost/mpl/aux_/preprocessor/def_params_tail.hpp" +#include "boost/mpl/void.hpp" +#include "boost/mpl/aux_/arity_spec.hpp" +#include "boost/mpl/aux_/lambda_spec.hpp" + +namespace boost { +namespace mpl { + +template< typename Value > +struct always +{ + template< + typename T + BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(1, typename T, void_) + > + struct apply + { + typedef Value type; + }; +}; + + +BOOST_MPL_AUX_ARITY_SPEC(1,always) +BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(1,always) + +} // namespace mpl +} // namespace boost + +#endif // BOOST_MPL_ALWAYS_HPP_INCLUDED diff --git a/boost/boost/mpl/and.hpp b/boost/boost/mpl/and.hpp new file mode 100644 index 0000000000..a2cced8bb6 --- /dev/null +++ b/boost/boost/mpl/and.hpp @@ -0,0 +1,42 @@ + +#ifndef BOOST_MPL_AND_HPP_INCLUDED +#define BOOST_MPL_AND_HPP_INCLUDED + +// + file: boost/mpl/and.hpp +// + last modified: 25/feb/03 + +// Copyright (c) 2000-03 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. +// +// See http://www.boost.org/libs/mpl for documentation. + +#include "boost/mpl/aux_/config/use_preprocessed.hpp" + +#if !defined(BOOST_MPL_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# include "boost/mpl/bool.hpp" +# include "boost/mpl/aux_/nested_type_wknd.hpp" +# include "boost/mpl/aux_/void_spec.hpp" +# include "boost/mpl/aux_/lambda_support.hpp" + +# define BOOST_MPL_PREPROCESSED_HEADER and.hpp +# include "boost/mpl/aux_/include_preprocessed.hpp" + +#else + +# define AUX_LOGICAL_OP_NAME and_ +# define AUX_LOGICAL_OP_VALUE1 false +# define AUX_LOGICAL_OP_VALUE2 true +# include "boost/mpl/aux_/logical_op.hpp" + +#endif // BOOST_MPL_USE_PREPROCESSED_HEADERS +#endif // BOOST_MPL_AND_HPP_INCLUDED diff --git a/boost/boost/mpl/apply.hpp b/boost/boost/mpl/apply.hpp new file mode 100644 index 0000000000..bf6191acc1 --- /dev/null +++ b/boost/boost/mpl/apply.hpp @@ -0,0 +1,355 @@ +//----------------------------------------------------------------------------- +// boost mpl/apply.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-03 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +#ifndef BOOST_MPL_APPLY_HPP_INCLUDED +#define BOOST_MPL_APPLY_HPP_INCLUDED + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include "boost/mpl/arg_fwd.hpp" +# include "boost/mpl/void.hpp" +# include "boost/mpl/aux_/arity.hpp" +# include "boost/mpl/aux_/msvc_never_true.hpp" +# include "boost/type_traits/same_traits.hpp" +#endif + +#include "boost/mpl/aux_/config/use_preprocessed.hpp" + +#if !defined(BOOST_MPL_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER apply.hpp +# include "boost/mpl/aux_/include_preprocessed.hpp" + +#else + +# include "boost/mpl/limits/arity.hpp" +# include "boost/mpl/aux_/lambda_support.hpp" +# include "boost/mpl/aux_/preprocessor/params.hpp" +# include "boost/mpl/aux_/preprocessor/default_params.hpp" +# include "boost/mpl/aux_/preprocessor/partial_spec_params.hpp" +# include "boost/mpl/aux_/preprocessor/enum.hpp" +# include "boost/mpl/aux_/preprocessor/add.hpp" +# include "boost/mpl/aux_/config/dtp.hpp" +# include "boost/mpl/aux_/config/nttp.hpp" +# include "boost/mpl/aux_/config/eti.hpp" +# include "boost/mpl/aux_/config/lambda.hpp" + +# include "boost/preprocessor/comma_if.hpp" +# include "boost/preprocessor/inc.hpp" +# include "boost/preprocessor/iterate.hpp" + +# include "boost/config.hpp" + +// agurt, 15/jan/02: top-level 'apply' template gives an ICE on MSVC +// (for known reasons) +#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200) +# define BOOST_MPL_NO_APPLY_TEMPLATE +#endif + +namespace boost { +namespace mpl { + +// local macros, #undef-ined at the end of the header +# define AUX_APPLY_PARAMS(param) \ + BOOST_MPL_PP_PARAMS( \ + BOOST_MPL_METAFUNCTION_MAX_ARITY \ + , param \ + ) \ + /**/ + +# define AUX_APPLY_DEFAULT_PARAMS(param, value) \ + BOOST_MPL_PP_DEFAULT_PARAMS( \ + BOOST_MPL_METAFUNCTION_MAX_ARITY \ + , param \ + , value \ + ) \ + /**/ + +# define AUX_APPLY_N_PARAMS(n, param) \ + BOOST_MPL_PP_PARAMS(n, param) \ + /**/ + +# define AUX_APPLY_N_COMMA_PARAMS(n, param) \ + BOOST_PP_COMMA_IF(n) \ + BOOST_MPL_PP_PARAMS(n, param) \ + /**/ + +# define AUX_APPLY_N_PARTIAL_SPEC_PARAMS(n, param, def) \ + BOOST_PP_COMMA_IF(n) \ + BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \ + /**/ + +# define AUX_APPLY_N_SPEC_PARAMS(n, param) \ + BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \ + /**/ + +# if !defined(BOOST_MPL_NO_APPLY_TEMPLATE) + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +// forward declaration +template< + typename F, AUX_APPLY_DEFAULT_PARAMS(typename T, void_) + > +struct apply; +#else +namespace aux { +template< BOOST_MPL_AUX_NTTP_DECL(int, arity_) > struct apply_impl_chooser; +} +#endif + +# endif // BOOST_MPL_NO_APPLY_TEMPLATE + +#define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(0, BOOST_MPL_METAFUNCTION_MAX_ARITY, "boost/mpl/apply.hpp")) +#include BOOST_PP_ITERATE() + +# if !defined(BOOST_MPL_NO_APPLY_TEMPLATE) +// real C++ version is already taken care of +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +namespace aux { +// apply_count_args +#define BOOST_MPL_AUX_COUNT_ARGS_PREFIX apply +#define BOOST_MPL_AUX_COUNT_ARGS_DEFAULT void_ +#define BOOST_MPL_AUX_COUNT_ARGS_ARITY BOOST_MPL_METAFUNCTION_MAX_ARITY +#include "boost/mpl/aux_/count_args.hpp" +} // namespace aux + +template< + typename F, AUX_APPLY_DEFAULT_PARAMS(typename T, void_) + > +struct apply + : aux::apply_impl_chooser< + aux::apply_count_args< AUX_APPLY_PARAMS(T) >::value + >::template result_< F, AUX_APPLY_PARAMS(T) >::type +{ +}; + +# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# endif // BOOST_MPL_NO_APPLY_TEMPLATE + +# undef AUX_APPLY_N_SPEC_PARAMS +# undef AUX_APPLY_N_PARTIAL_SPEC_PARAMS +# undef AUX_APPLY_N_COMMA_PARAMS +# undef AUX_APPLY_N_PARAMS +# undef AUX_APPLY_DEFAULT_PARAMS +# undef AUX_APPLY_PARAMS + +} // namespace mpl +} // namespace boost + +#endif // BOOST_MPL_USE_PREPROCESSED_HEADERS +#endif // BOOST_MPL_APPLY_HPP_INCLUDED + +///// iteration, depth == 1 + +#elif BOOST_PP_ITERATION_DEPTH() == 1 + +# define i BOOST_PP_FRAME_ITERATION(1) +# if i == 0 + +template< typename F > +struct apply0 : F +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1, apply0, (F)) +}; + +#if defined(BOOST_MPL_MSVC_ETI_BUG) +//: workaround for the ETI bug +template<> +struct apply0 +{ + typedef int type; +}; +#endif + +# else // i > 0 + +# if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) +// MSVC version + +namespace aux { +// msvc_apply##i +#define BOOST_MPL_AUX_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i) +#define BOOST_MPL_AUX_MSVC_DTW_ORIGINAL_NAME apply +#define BOOST_MPL_AUX_MSVC_DTW_ARITY i +#include "boost/mpl/aux_/msvc_dtw.hpp" +} // namespace aux + +template< + typename F, AUX_APPLY_N_PARAMS(i, typename T) + > +struct BOOST_PP_CAT(apply,i) +{ + // Metafunction forwarding confuses vc6 + typedef typename BOOST_PP_CAT(aux::msvc_apply,i)::template result_< + AUX_APPLY_N_PARAMS(i, T) + >::type type; + + BOOST_MPL_AUX_LAMBDA_SUPPORT( + BOOST_PP_INC(i) + , BOOST_PP_CAT(apply,i) + , (F, AUX_APPLY_N_PARAMS(i,T)) + ) +}; + +# elif defined(BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) +// MWCW/Borland version + +namespace aux { +template< + int N, typename F, AUX_APPLY_N_PARAMS(i, typename T) + > +struct BOOST_PP_CAT(apply_impl,i); +} + +#define BOOST_PP_ITERATION_PARAMS_2 \ + (3,(0, BOOST_MPL_METAFUNCTION_MAX_ARITY - i, "boost/mpl/apply.hpp")) +#include BOOST_PP_ITERATE() + +template< + typename F, AUX_APPLY_N_PARAMS(i, typename T) + > +struct BOOST_PP_CAT(apply,i) + : BOOST_PP_CAT(aux::apply_impl,i)< + ::boost::mpl::aux::arity::value + , F + , AUX_APPLY_N_PARAMS(i, T) + >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + BOOST_PP_INC(i) + , BOOST_PP_CAT(apply,i) + , (F, AUX_APPLY_N_PARAMS(i,T)) + ) +}; + +# else +// ISO98 C++, with minor concession to vc7 + +template< + typename F, AUX_APPLY_N_PARAMS(i, typename T) + > +struct BOOST_PP_CAT(apply,i) +{ + // Metafunction forwarding confuses vc7 + typedef typename F::template apply< + AUX_APPLY_N_PARAMS(i, T) + >::type type; + + BOOST_MPL_AUX_LAMBDA_SUPPORT( + BOOST_PP_INC(i) + , BOOST_PP_CAT(apply,i) + , (F, AUX_APPLY_N_PARAMS(i,T)) + ) +}; + +# endif // workarounds + +#if defined(BOOST_MPL_MSVC_ETI_BUG) +//: workaround for ETI bug +template<> +struct BOOST_PP_CAT(apply,i) +{ + typedef int type; +}; +#endif + +# endif // i > 0 + +# if !defined(BOOST_MPL_NO_APPLY_TEMPLATE) +# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +#if i == BOOST_MPL_METAFUNCTION_MAX_ARITY + +//: primary template (not a specialization!) +template< + typename F AUX_APPLY_N_COMMA_PARAMS(i, typename T) + > +struct apply + : BOOST_PP_CAT(apply,i)< F AUX_APPLY_N_COMMA_PARAMS(i, T) > +{ +}; + +#else + +template< + typename F AUX_APPLY_N_COMMA_PARAMS(i, typename T) + > +struct apply< F AUX_APPLY_N_PARTIAL_SPEC_PARAMS(i, T, void_) > + : BOOST_PP_CAT(apply,i)< F AUX_APPLY_N_COMMA_PARAMS(i, T) > +{ +}; + +#endif // i == BOOST_MPL_METAFUNCTION_MAX_ARITY + +# else + +namespace aux { + +template<> +struct apply_impl_chooser +{ + template< + typename F, AUX_APPLY_PARAMS(typename T) + > + struct result_ + { + typedef BOOST_PP_CAT(apply,i)< + F AUX_APPLY_N_COMMA_PARAMS(i, T) + > type; + }; +}; + +} // namespace aux + +# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# endif // BOOST_MPL_NO_APPLY_TEMPLATE + +# undef i + +///// iteration, depth == 2 + +#elif BOOST_PP_ITERATION_DEPTH() == 2 + +# define j BOOST_PP_FRAME_ITERATION(2) + +namespace aux { + +template< + typename F, AUX_APPLY_N_PARAMS(i, typename T) + > +struct BOOST_PP_CAT(apply_impl,i)< + BOOST_MPL_PP_ADD(i, j) + , F + , AUX_APPLY_N_PARAMS(i, T) + > +{ + typedef typename F::template apply< + AUX_APPLY_N_PARAMS(i, T) + BOOST_PP_COMMA_IF(j) BOOST_MPL_PP_ENUM(j, void_) + > type; +}; + +} // namespace aux + +# undef j + +#endif // BOOST_PP_IS_ITERATING diff --git a/boost/boost/mpl/apply_if.hpp b/boost/boost/mpl/apply_if.hpp new file mode 100644 index 0000000000..f2ab41aaee --- /dev/null +++ b/boost/boost/mpl/apply_if.hpp @@ -0,0 +1,64 @@ +//----------------------------------------------------------------------------- +// boost/mpl/apply_if.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_APPLY_IF_HPP_INCLUDED +#define BOOST_MPL_APPLY_IF_HPP_INCLUDED + +#include "boost/mpl/if.hpp" +#include "boost/mpl/aux_/apply.hpp" +#include "boost/mpl/aux_/void_spec.hpp" +#include "boost/mpl/aux_/lambda_support.hpp" + +namespace boost { +namespace mpl { + +template< + typename BOOST_MPL_AUX_VOID_SPEC_PARAM(C) + , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(F1) + , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(F2) + > +struct apply_if +{ + private: + typedef typename if_::type nullary_func_; + + public: + typedef typename BOOST_MPL_AUX_APPLY0(nullary_func_)::type type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(3,apply_if,(C,F1,F2)) +}; + +// (almost) copy & paste in order to save one more +// recursively nested template instantiation to user +template< + bool C + , typename F1 + , typename F2 + > +struct apply_if_c +{ + private: + typedef typename if_c::type nullary_func_; + + public: + typedef typename BOOST_MPL_AUX_APPLY0(nullary_func_)::type type; +}; + +BOOST_MPL_AUX_VOID_SPEC(3, apply_if) + +} // namespace mpl +} // namespace boost + +#endif // BOOST_MPL_APPLY_IF_HPP_INCLUDED diff --git a/boost/boost/mpl/arg.hpp b/boost/boost/mpl/arg.hpp new file mode 100644 index 0000000000..5638fa8cea --- /dev/null +++ b/boost/boost/mpl/arg.hpp @@ -0,0 +1,141 @@ +//----------------------------------------------------------------------------- +// boost mpl/arg.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-02 +// Peter Dimov, Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +#ifndef BOOST_MPL_ARG_HPP_INCLUDED +#define BOOST_MPL_ARG_HPP_INCLUDED + +#include "boost/mpl/aux_/config/static_constant.hpp" + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include "boost/mpl/arg_fwd.hpp" +# include "boost/mpl/void.hpp" +# include "boost/mpl/aux_/arity_spec.hpp" +# include "boost/mpl/aux_/arg_typedef.hpp" +# include "boost/static_assert.hpp" +#endif + +#include "boost/mpl/aux_/config/use_preprocessed.hpp" + +#if !defined(BOOST_MPL_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER arg.hpp +# include "boost/mpl/aux_/include_preprocessed.hpp" + +#else +# include "boost/mpl/limits/arity.hpp" +# include "boost/mpl/aux_/preprocessor/default_params.hpp" +# include "boost/mpl/aux_/preprocessor/params.hpp" +# include "boost/mpl/aux_/config/lambda.hpp" +# include "boost/mpl/aux_/config/dtp.hpp" +# include "boost/mpl/aux_/config/nttp.hpp" + +# include "boost/preprocessor/iterate.hpp" +# include "boost/preprocessor/inc.hpp" +# include "boost/preprocessor/cat.hpp" + +namespace boost { +namespace mpl { + +// local macro, #undef-ined at the end of the header +#if !defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) +# define AUX_ARG_N_DEFAULT_PARAMS(param,value) \ + BOOST_MPL_PP_DEFAULT_PARAMS( \ + BOOST_MPL_METAFUNCTION_MAX_ARITY \ + , param \ + , value \ + ) \ + /**/ +#else +# define AUX_ARG_N_DEFAULT_PARAMS(param,value) \ + BOOST_MPL_PP_PARAMS( \ + BOOST_MPL_METAFUNCTION_MAX_ARITY \ + , param \ + ) \ + /**/ +#endif + +#define BOOST_PP_ITERATION_PARAMS_1 \ + (3,(0, BOOST_MPL_METAFUNCTION_MAX_ARITY, "boost/mpl/arg.hpp")) +#include BOOST_PP_ITERATE() + + +# undef AUX_ARG_N_DEFAULT_PARAMS + +BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(1,int,arg) + +} // namespace mpl +} // namespace boost + +#endif // BOOST_MPL_USE_PREPROCESSED_HEADERS +#endif // BOOST_MPL_ARG_HPP_INCLUDED + +///// iteration + +#else +#define i BOOST_PP_FRAME_ITERATION(1) + +#if i > 0 + +template<> struct arg +{ + BOOST_STATIC_CONSTANT(int, value = i); + typedef arg next; + BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag) + + template< + AUX_ARG_N_DEFAULT_PARAMS(typename U, void_) + > + struct apply + { + typedef BOOST_PP_CAT(U,i) type; +#if !defined(__BORLANDC__) || (__BORLANDC__ > 0x561 && defined(BOOST_STRICT_CONFIG)) + private: + BOOST_STATIC_CONSTANT(bool, nv = !is_void_::value); + BOOST_STATIC_ASSERT(nv); +#endif + }; +}; + +#else + +template<> struct arg<-1> +{ + BOOST_STATIC_CONSTANT(int, value = -1); + BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag) + + template< + AUX_ARG_N_DEFAULT_PARAMS(typename U, void_) + > + struct apply + { + typedef U1 type; +#if !defined(__BORLANDC__) || (__BORLANDC__ > 0x561 && defined(BOOST_STRICT_CONFIG)) + private: + BOOST_STATIC_CONSTANT(bool, nv = !is_void_::value); + BOOST_STATIC_ASSERT(nv); +#endif + }; +}; + +#endif // i > 0 + +#undef i +#endif // BOOST_PP_IS_ITERATING diff --git a/boost/boost/mpl/arg_fwd.hpp b/boost/boost/mpl/arg_fwd.hpp new file mode 100644 index 0000000000..ff6bda1409 --- /dev/null +++ b/boost/boost/mpl/arg_fwd.hpp @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// boost mpl/arg_fwd.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-02 +// Peter Dimov, Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_ARG_FWD_HPP_INCLUDED +#define BOOST_MPL_ARG_FWD_HPP_INCLUDED + +#include "boost/mpl/aux_/config/nttp.hpp" + +namespace boost { +namespace mpl { + +template< BOOST_MPL_AUX_NTTP_DECL(int, N) > struct arg; + +} // namespace mpl +} // namespace boost + +#endif // BOOST_MPL_ARG_FWD_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/apply.hpp b/boost/boost/mpl/aux_/apply.hpp new file mode 100644 index 0000000000..96e3f74cce --- /dev/null +++ b/boost/boost/mpl/aux_/apply.hpp @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/apply.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_APPLY_HPP_INCLUDED +#define BOOST_MPL_AUX_APPLY_HPP_INCLUDED + +#include "boost/mpl/aux_/config/dtp.hpp" +#include "boost/config.hpp" + +#define BOOST_MPL_AUX_APPLY(arity, args) \ + BOOST_PP_CAT(BOOST_MPL_AUX_APPLY,arity) args \ +/**/ + +// agurt, 14/nov/02: temporary fix, need to research a couple of ICEs to +// get rid of this mess +#if defined(BOOST_MSVC) && BOOST_MSVC == 1300 && !defined(BOOST_MPL_PREPROCESSING_MODE) +# include "boost/mpl/apply.hpp" +#endif + +#if defined(BOOST_MPL_USE_APPLY_INTERNALLY) \ + || defined(BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) \ + || defined(BOOST_MSVC) && (BOOST_MSVC < 1300 || BOOST_MSVC == 1300 && defined(BOOST_MPL_PREPROCESSING_MODE)) + +# if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include "boost/mpl/apply.hpp" +# endif + +// tokenization takes place before macro expansion (see 2.1 [lex.phases] +// para 3-4), so, strictly speaking, spaces between '<', 'f', and '>' tokens +// below (BOOST_MPL_AUX_APPLY0) are not required; they are needed in practice, +// though, because there is at least one compiler (MSVC 6.5) that does not +// conform to the standard here +# define BOOST_MPL_AUX_APPLY0(f) apply0< f > +# define BOOST_MPL_AUX_APPLY1(f,a1) apply1 +# define BOOST_MPL_AUX_APPLY2(f,a1,a2) apply2 +# define BOOST_MPL_AUX_APPLY3(f,a1,a2,a3) apply3 +# define BOOST_MPL_AUX_APPLY4(f,a1,a2,a3,a4) apply4 +# define BOOST_MPL_AUX_APPLY5(f,a1,a2,a3,a4,a5) apply5 +# define BOOST_MPL_AUX_APPLY6(f,a1,a2,a3,a4,a5,a6) apply6 +# define BOOST_MPL_AUX_APPLY7(f,a1,a2,a3,a4,a5,a6,a7) apply7 +# define BOOST_MPL_AUX_APPLY8(f,a1,a2,a3,a4,a5,a6,a7,a8) apply8 +# define BOOST_MPL_AUX_APPLY9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) apply9 + +#else + +# define BOOST_MPL_AUX_APPLY0(f) f +# define BOOST_MPL_AUX_APPLY1(f,a1) f::template apply +# define BOOST_MPL_AUX_APPLY2(f,a1,a2) f::template apply +# define BOOST_MPL_AUX_APPLY3(f,a1,a2,a3) f::template apply +# define BOOST_MPL_AUX_APPLY4(f,a1,a2,a3,a4) f::template apply +# define BOOST_MPL_AUX_APPLY5(f,a1,a2,a3,a4,a5) f::template apply +# define BOOST_MPL_AUX_APPLY6(f,a1,a2,a3,a4,a5,a6) f::template apply +# define BOOST_MPL_AUX_APPLY7(f,a1,a2,a3,a4,a5,a6,a7) f::template apply +# define BOOST_MPL_AUX_APPLY8(f,a1,a2,a3,a4,a5,a6,a7,a8) f::template apply +# define BOOST_MPL_AUX_APPLY9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) f::template apply + +#endif + +#endif // BOOST_MPL_AUX_APPLY_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/arg_typedef.hpp b/boost/boost/mpl/aux_/arg_typedef.hpp new file mode 100644 index 0000000000..19b6bc05ee --- /dev/null +++ b/boost/boost/mpl/aux_/arg_typedef.hpp @@ -0,0 +1,28 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/arg_typedef.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_ARG_TYPEDEF_HPP_INCLUDED +#define BOOST_MPL_AUX_ARG_TYPEDEF_HPP_INCLUDED + +#include "boost/mpl/aux_/config/lambda.hpp" + +#if defined(BOOST_MPL_NO_FULL_LAMBDA_SUPPORT) +# define BOOST_MPL_AUX_ARG_TYPEDEF(T, name) typedef T name; +#else +# define BOOST_MPL_AUX_ARG_TYPEDEF(T, name) /**/ +#endif + +#endif // BOOST_MPL_AUX_ARG_TYPEDEF_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/arity_spec.hpp b/boost/boost/mpl/aux_/arity_spec.hpp new file mode 100644 index 0000000000..d3939f7f4e --- /dev/null +++ b/boost/boost/mpl/aux_/arity_spec.hpp @@ -0,0 +1,49 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/arity_spec.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_ARITY_SPEC_HPP_INCLUDED +#define BOOST_MPL_AUX_ARITY_SPEC_HPP_INCLUDED + +#include "boost/mpl/aux_/config/dtp.hpp" +#include "boost/mpl/aux_/preprocessor/params.hpp" +#include "boost/mpl/aux_/arity.hpp" +#include "boost/mpl/limits/arity.hpp" +#include "boost/config.hpp" + +#if defined(BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) +# define BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(i,type,name) \ +namespace aux { \ +template< BOOST_MPL_AUX_NTTP_DECL(int, N), BOOST_MPL_PP_PARAMS(i,type T) > \ +struct arity< \ + name< BOOST_MPL_PP_PARAMS(i,T) > \ + , N \ + > \ +{ \ + BOOST_STATIC_CONSTANT(int \ + , value = BOOST_MPL_METAFUNCTION_MAX_ARITY \ + ); \ +}; \ +} \ +/**/ +#else +# define BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(i,type,name) /**/ +#endif + +# define BOOST_MPL_AUX_ARITY_SPEC(i,name) \ + BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(i,typename,name) \ +/**/ + +#endif // BOOST_MPL_AUX_ARITY_SPEC_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/config/compiler.hpp b/boost/boost/mpl/aux_/config/compiler.hpp new file mode 100644 index 0000000000..a7779d9638 --- /dev/null +++ b/boost/boost/mpl/aux_/config/compiler.hpp @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/config/dtp.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_CONFIG_COMPILER_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_COMPILER_HPP_INCLUDED + +#include "boost/mpl/aux_/config/dtp.hpp" +#include "boost/mpl/aux_/config/ttp.hpp" +#include "boost/config.hpp" + +#if defined(BOOST_MSVC) && BOOST_MSVC < 1300 +# define BOOST_MPL_COMPILER_DIR msvc60 + +#elif defined(BOOST_MSVC) && BOOST_MSVC == 1300 +# define BOOST_MPL_COMPILER_DIR msvc70 + +#elif defined(__GNUC__) && !defined(__EDG_VERSION__) +# define BOOST_MPL_COMPILER_DIR gcc + +#elif defined(__BORLANDC__) +# if !defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) +# define BOOST_MPL_COMPILER_DIR bcc551 +# else +# define BOOST_MPL_COMPILER_DIR bcc +# endif + +#elif defined(__MWERKS__) +# if defined(BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) +# define BOOST_MPL_COMPILER_DIR mwcw +# else +# define BOOST_MPL_COMPILER_DIR plain +# endif + +#elif defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +# define BOOST_MPL_COMPILER_DIR no_ctps + +#elif defined(BOOST_NO_TEMPLATE_TEMPLATE_PARAMETERS) +# define BOOST_MPL_COMPILER_DIR no_ttp + +#else +# define BOOST_MPL_COMPILER_DIR plain +#endif + +#endif // BOOST_MPL_AUX_CONFIG_COMPILER_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/config/ctps.hpp b/boost/boost/mpl/aux_/config/ctps.hpp index dfc9d0b3d0..c0adabb946 100644 --- a/boost/boost/mpl/aux_/config/ctps.hpp +++ b/boost/boost/mpl/aux_/config/ctps.hpp @@ -19,9 +19,12 @@ #include "boost/config.hpp" -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \ - && !defined(BOOST_NO_NON_TYPE_TEMPLATE_PARTIAL_SPECIALIZATION) +#if !defined(BOOST_NO_NON_TYPE_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) + # define BOOST_NO_NON_TYPE_TEMPLATE_PARTIAL_SPECIALIZATION + #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION is defined in "boost/config.hpp" diff --git a/boost/boost/mpl/aux_/config/dtp.hpp b/boost/boost/mpl/aux_/config/dtp.hpp index d6bfb3b43a..cefacfc742 100644 --- a/boost/boost/mpl/aux_/config/dtp.hpp +++ b/boost/boost/mpl/aux_/config/dtp.hpp @@ -25,17 +25,25 @@ // the owner class is a class template), and Borland 5.6 isn't even // able to compile a definition of nested class template with DTP -#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 && \ - (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \ - && !defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) +#if !defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && defined(__BORLANDC__) && __BORLANDC__ >= 0x560 && \ + (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) + # define BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES + #endif -#if defined(__MWERKS__) && __MWERKS__ <= 0x3001 \ - || defined(__BORLANDC__) && (__BORLANDC__ <= 0x570 || !defined(BOOST_STRICT_CONFIG)) \ - || defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) \ - && !defined(BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) + +#if !defined(BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && ( defined(__MWERKS__) && __MWERKS__ <= 0x3001 \ + || defined(__BORLANDC__) && (__BORLANDC__ <= 0x570 || !defined(BOOST_STRICT_CONFIG)) \ + || defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) \ + ) + # define BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES + #endif #endif // BOOST_MPL_AUX_CONFIG_DTP_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/config/overload_resolution.hpp b/boost/boost/mpl/aux_/config/overload_resolution.hpp index 009ccc821c..8e7ed0d3bc 100644 --- a/boost/boost/mpl/aux_/config/overload_resolution.hpp +++ b/boost/boost/mpl/aux_/config/overload_resolution.hpp @@ -1,9 +1,11 @@ -//----------------------------------------------------------------------------- -// boost mpl/aux_/config/overload_resolution.hpp header file -// See http://www.boost.org for updates, documentation, and revision history. -//----------------------------------------------------------------------------- -// -// Copyright (c) 2002 + +#ifndef BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED + +// + file: boost/mpl/aux_/config/overload_resolution.hpp +// + last modified: 23/jun/03 + +// Copyright (c) 2002-03 // Aleksey Gurtovoy // // Permission to use, copy, modify, distribute and sell this software @@ -13,16 +15,19 @@ // supporting documentation. No representations are made about the // suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. +// +// See http://www.boost.org/libs/mpl for documentation. -#ifndef BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED -#define BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED +#include "boost/mpl/aux_/config/workaround.hpp" -#include "boost/config.hpp" +#if !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && ( BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ + || BOOST_WORKAROUND(__MWERKS__, < 0x3001) \ + ) -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \ - || defined(__MWERKS__) && __MWERKS__ < 0x3001 \ - && !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION) # define BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION + #endif #endif // BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/config/preprocessor.hpp b/boost/boost/mpl/aux_/config/preprocessor.hpp index 66cef48846..798612aca4 100644 --- a/boost/boost/mpl/aux_/config/preprocessor.hpp +++ b/boost/boost/mpl/aux_/config/preprocessor.hpp @@ -1,30 +1,38 @@ -//----------------------------------------------------------------------------- -// boost mpl/aux_/config/preprocessor.hpp header file -// See http://www.boost.org for updates, documentation, and revision history. -//----------------------------------------------------------------------------- -// -// Copyright (c) 2000-02 -// Aleksey Gurtovoy -// -// 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. No representations are made about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. #ifndef BOOST_MPL_AUX_CONFIG_PREPROCESSOR_HPP_INCLUDED #define BOOST_MPL_AUX_CONFIG_PREPROCESSOR_HPP_INCLUDED -#include "boost/config.hpp" +// Copyright (c) 2000-04 Aleksey Gurtovoy +// +// 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/mpl for documentation. + +// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/preprocessor.hpp,v $ +// $Date: 2004/01/20 16:26:31 $ +// $Revision: 1.4.2.1 $ + +#include "boost/mpl/aux_/config/workaround.hpp" + +#if !defined(BOOST_MPL_BROKEN_PP_MACRO_EXPANSION) \ + && ( BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ + || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ + ) -#if defined(__MWERKS__) && (__MWERKS__ <= 0x3003 || !defined(BOOST_STRICT_CONFIG)) \ - || defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \ - || defined(__IBMCPP__) && (__IBMCPP__ <= 502 || !defined(BOOST_STRICT_CONFIG)) # define BOOST_MPL_BROKEN_PP_MACRO_EXPANSION + #endif //#define BOOST_MPL_NO_OWN_PP_PRIMITIVES +#if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) \ + && BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x833)) + +# define BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING + +#endif + #endif // BOOST_MPL_AUX_CONFIG_PREPROCESSOR_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/config/ttp.hpp b/boost/boost/mpl/aux_/config/ttp.hpp index 29f1fc620a..ba285efaba 100644 --- a/boost/boost/mpl/aux_/config/ttp.hpp +++ b/boost/boost/mpl/aux_/config/ttp.hpp @@ -19,16 +19,23 @@ #include "boost/config.hpp" -#if defined(BOOST_NO_TEMPLATE_TEMPLATES) \ - && (!defined(BOOST_MSVC) || BOOST_MSVC < 1300) +#if defined(BOOST_NO_TEMPLATE_TEMPLATES) \ + && ( !defined(BOOST_MSVC) || BOOST_MSVC < 1300 ) + # define BOOST_NO_TEMPLATE_TEMPLATE_PARAMETERS + #endif -#if defined(__GNUC__) && (__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 2 \ - || !defined(BOOST_STRICT_CONFIG)) \ - || defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \ - && !defined(BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) + +#if !defined(BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && ( defined(__GNUC__) && !defined(__EDG_VERSION__) && (__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 2 \ + || !defined(BOOST_STRICT_CONFIG)) \ + || defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \ + ) + # define BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING + #endif #endif // BOOST_MPL_AUX_CONFIG_TTP_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/config/use_preprocessed.hpp b/boost/boost/mpl/aux_/config/use_preprocessed.hpp new file mode 100644 index 0000000000..8d3bdb32ec --- /dev/null +++ b/boost/boost/mpl/aux_/config/use_preprocessed.hpp @@ -0,0 +1,22 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/config/use_preprocessed.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2002 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_CONFIG_USE_PREPROCESSED_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_USE_PREPROCESSED_HPP_INCLUDED + +//#define BOOST_MPL_NO_PREPROCESSED_HEADERS + +#endif // BOOST_MPL_AUX_CONFIG_USE_PREPROCESSED_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/has_xxx.hpp b/boost/boost/mpl/aux_/has_xxx.hpp index 631ce2291d..4e765be865 100644 --- a/boost/boost/mpl/aux_/has_xxx.hpp +++ b/boost/boost/mpl/aux_/has_xxx.hpp @@ -1,62 +1,96 @@ -//----------------------------------------------------------------------------- -// boost mpl/aux_/has_xxx.hpp header file -// See http://www.boost.org for updates, documentation, and revision history. -//----------------------------------------------------------------------------- -// -// Copyright (c) 2002 -// Aleksey Gurtovoy -// -// 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. No representations are made about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. #ifndef BOOST_MPL_AUX_HAS_XXX_HPP_INCLUDED #define BOOST_MPL_AUX_HAS_XXX_HPP_INCLUDED +// Copyright (C) Aleksey Gurtovoy 2002-2003 +// Copyright (C) David Abrahams 2002-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/mpl for documentation. + +// $Source: /home/lyx/cvs/lyx-devel/boost/boost/mpl/aux_/Attic/has_xxx.hpp,v $ +// $Date: 2004/02/05 09:14:17 $ +// $Revision: 1.2 $ + #include "boost/mpl/aux_/type_wrapper.hpp" #include "boost/mpl/aux_/yes_no.hpp" #include "boost/mpl/aux_/config/msvc_typename.hpp" #include "boost/mpl/aux_/config/overload_resolution.hpp" #include "boost/mpl/aux_/config/static_constant.hpp" +#include "boost/detail/workaround.hpp" -#if !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION) && (!defined(__GNUC__) || __GNUC__ == 3) +#if !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION) \ + && !BOOST_WORKAROUND(__GNUC__, <= 2) \ + && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x833)) -# if (!defined(BOOST_MSVC) || BOOST_MSVC > 1300) +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // the implementation below is based on a USENET newsgroup's posting by // Rani Sharoni (comp.lang.c++.moderated, 2002-03-17 07:45:09 PST) -# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \ -template< typename T > \ -boost::mpl::aux::yes_tag \ -trait##_helper( \ - boost::mpl::aux::type_wrapper const volatile* \ - , boost::mpl::aux::type_wrapper* = 0 \ - ); \ -\ -boost::mpl::aux::no_tag \ -trait##_helper(...); \ -\ -template< typename T > \ -struct trait \ -{ \ - typedef boost::mpl::aux::type_wrapper t_; \ - BOOST_STATIC_CONSTANT(bool, value = \ - sizeof((trait##_helper)(static_cast(0))) \ - == sizeof(boost::mpl::aux::yes_tag) \ - ); \ -}; \ +# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) + +# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \ +template< typename T > \ +boost::mpl::aux::yes_tag \ +trait##_helper( \ + boost::mpl::aux::type_wrapper const volatile* \ + , boost::mpl::aux::type_wrapper* = 0 \ + ); \ + \ +boost::mpl::aux::no_tag \ +trait##_helper(...); \ + \ +template< typename T > \ +struct trait \ +{ \ + typedef boost::mpl::aux::type_wrapper t_; \ + BOOST_STATIC_CONSTANT(bool, value = \ + sizeof((trait##_helper)(static_cast(0))) \ + == sizeof(boost::mpl::aux::yes_tag) \ + ); \ +}; \ +/**/ + +# else // conforming compilers + +# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \ +template< typename T > \ +struct trait \ +{ \ + struct helpers \ + { \ + template< typename U > \ + static boost::mpl::aux::yes_tag \ + test( \ + boost::mpl::aux::type_wrapper const volatile* \ + , boost::mpl::aux::type_wrapper* = 0 \ + ); \ + \ + static boost::mpl::aux::no_tag \ + test(...); \ + }; \ + \ + typedef boost::mpl::aux::type_wrapper t_; \ + \ + BOOST_STATIC_CONSTANT( \ + bool, value = \ + sizeof(helpers::test(static_cast(0))) \ + == sizeof(boost::mpl::aux::yes_tag) \ + ); \ +}; \ /**/ +# endif + # else -#include "boost/mpl/if.hpp" -#include "boost/mpl/bool.hpp" -#include "boost/preprocessor/cat.hpp" +# include "boost/mpl/if.hpp" +# include "boost/mpl/bool.hpp" +# include "boost/preprocessor/cat.hpp" // agurt, 11/sep/02: MSVC version, based on a USENET newsgroup's posting by // John Madsen (comp.lang.c++.moderated, 1999-11-12 19:17:06 GMT); @@ -69,13 +103,31 @@ namespace boost { namespace mpl { namespace aux { struct has_xxx_tag; -template< typename T > +# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) + template + struct msvc_incomplete_array + { + typedef char (&type)[sizeof(U) + 1]; + }; +# endif + +template struct msvc_is_incomplete { - struct incomplete_; - BOOST_STATIC_CONSTANT(bool, value = - sizeof(void (T::*)()) == sizeof(void (incomplete_::*)()) - ); + // MSVC is capable of some kinds of SFINAE. If U is an incomplete + // type, it won't pick the second overload + static char tester(...); + +# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) + template + static typename msvc_incomplete_array::type tester(type_wrapper); +# else + template + static char (& tester(type_wrapper) )[sizeof(U)+1]; +# endif + + BOOST_STATIC_CONSTANT( + bool, value = sizeof(tester(type_wrapper())) == 1); }; template<> @@ -86,83 +138,87 @@ struct msvc_is_incomplete }}} -# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \ -template< typename T, typename name = ::boost::mpl::aux::has_xxx_tag > \ -struct BOOST_PP_CAT(trait,_impl) : T \ -{ \ - private: \ - static boost::mpl::aux::no_tag test(void(*)(::boost::mpl::aux::has_xxx_tag)); \ - static boost::mpl::aux::yes_tag test(...); \ -\ - public: \ - BOOST_STATIC_CONSTANT(bool, value = \ - sizeof(test(static_cast(0))) \ - != sizeof(boost::mpl::aux::no_tag) \ - ); \ -}; \ -\ -template< typename T > struct trait \ - : boost::mpl::if_c< \ - boost::mpl::aux::msvc_is_incomplete::value \ - , boost::mpl::bool_ \ - , BOOST_PP_CAT(trait,_impl) \ - >::type \ -{ \ -}; \ -\ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, void) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, bool) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, char) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed char) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned char) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed short) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned short) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed int) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned int) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed long) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned long) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, float) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, double) \ -BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, long double) \ +# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \ +template< typename T, typename name = ::boost::mpl::aux::has_xxx_tag > \ +struct BOOST_PP_CAT(trait,_impl) : T \ +{ \ + private: \ + static boost::mpl::aux::no_tag test(void(*)(::boost::mpl::aux::has_xxx_tag)); \ + static boost::mpl::aux::yes_tag test(...); \ + \ + public: \ + BOOST_STATIC_CONSTANT(bool, value = \ + sizeof(test(static_cast(0))) \ + != sizeof(boost::mpl::aux::no_tag) \ + ); \ +}; \ + \ +template< typename T > struct trait \ + : boost::mpl::if_c< \ + boost::mpl::aux::msvc_is_incomplete::value \ + , boost::mpl::bool_ \ + , BOOST_PP_CAT(trait,_impl) \ + >::type \ +{ \ +}; \ + \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, void) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, bool) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, char) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed char) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned char) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed short) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned short) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed int) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned int) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed long) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned long) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, float) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, double) \ +BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, long double) \ /**/ -# define BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, T) \ -template<> struct trait \ -{ \ - BOOST_STATIC_CONSTANT(bool,value = false); \ -}; \ +# define BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, T) \ +template<> struct trait \ +{ \ + BOOST_STATIC_CONSTANT(bool,value = false); \ +}; \ /**/ -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) -# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \ - BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \ - BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, wchar_t) \ - /**/ -#else -# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \ - BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \ - /**/ -#endif +# if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + +# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \ + BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \ + BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, wchar_t) \ + /**/ + +# else + +# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \ + BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \ + /**/ + +# endif # endif // BOOST_MSVC > 1300 #else // agurt, 11/jan/03: signals a stub-only implementation -# define BOOST_NO_MPL_AUX_HAS_XXX - -# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, default_value) \ -template< typename T > \ -struct trait \ -{ \ - BOOST_STATIC_CONSTANT(bool, value = default_value); \ -}; \ +# define BOOST_MPL_NO_AUX_HAS_XXX + +# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, default_value) \ +template< typename T > \ +struct trait \ +{ \ + BOOST_STATIC_CONSTANT(bool, value = default_value); \ +}; \ /**/ #endif // BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION -#define BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \ -BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_##name, name, false) \ +#define BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \ +BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_##name, name, false) \ /**/ #endif // BOOST_MPL_AUX_HAS_XXX_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/ice_cast.hpp b/boost/boost/mpl/aux_/ice_cast.hpp index ffa6226fbc..e5faa2599b 100644 --- a/boost/boost/mpl/aux_/ice_cast.hpp +++ b/boost/boost/mpl/aux_/ice_cast.hpp @@ -21,7 +21,7 @@ #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ || BOOST_WORKAROUND(__GNUC__, < 3) -# define BOOST_MPL_AUX_ICE_CAST(T, expr) T(expr) +# define BOOST_MPL_AUX_ICE_CAST(T, expr) (T)(expr) #elif BOOST_WORKAROUND(__MWERKS__, <= 0x3001) # define BOOST_MPL_AUX_ICE_CAST(T, expr) (T)(expr) #else diff --git a/boost/boost/mpl/aux_/include_preprocessed.hpp b/boost/boost/mpl/aux_/include_preprocessed.hpp new file mode 100644 index 0000000000..ea95e107cc --- /dev/null +++ b/boost/boost/mpl/aux_/include_preprocessed.hpp @@ -0,0 +1,34 @@ + +// Copyright (c) 2001-04 Aleksey Gurtovoy +// +// 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/mpl for documentation. + +// $Source: /cvsroot/boost/boost/boost/mpl/aux_/include_preprocessed.hpp,v $ +// $Date: 2004/01/20 16:26:31 $ +// $Revision: 1.3.6.1 $ + +// no include guards, the header is intended for multiple inclusion! + +#include "boost/mpl/aux_/config/compiler.hpp" +#include "boost/mpl/aux_/config/preprocessor.hpp" +#include "boost/preprocessor/cat.hpp" +#include "boost/preprocessor/stringize.hpp" + +#if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) +# define AUX_PREPROCESSED_HEADER \ + BOOST_MPL_COMPILER_DIR/BOOST_MPL_PREPROCESSED_HEADER \ +/**/ +#else +# define AUX_PREPROCESSED_HEADER \ + BOOST_PP_CAT(BOOST_MPL_COMPILER_DIR,/)##BOOST_MPL_PREPROCESSED_HEADER \ +/**/ +#endif + +# include BOOST_PP_STRINGIZE(boost/mpl/aux_/preprocessed/AUX_PREPROCESSED_HEADER) +# undef AUX_PREPROCESSED_HEADER + +#undef BOOST_MPL_PREPROCESSED_HEADER diff --git a/boost/boost/mpl/aux_/integral_wrapper.hpp b/boost/boost/mpl/aux_/integral_wrapper.hpp index 216ea3bbb9..64ec3080c8 100644 --- a/boost/boost/mpl/aux_/integral_wrapper.hpp +++ b/boost/boost/mpl/aux_/integral_wrapper.hpp @@ -1,6 +1,6 @@ // + file: boost/mpl/aux_/intergal_wrapper.hpp -// + last modified: 27/jan/03 +// + last modified: 12/apr/03 // Copyright (c) 2000-03 // Aleksey Gurtovoy @@ -17,7 +17,7 @@ // no include guards, the header is intended for multiple inclusion! -#include "boost/mpl/aux_/ice_cast.hpp" +#include "boost/mpl/aux_/static_cast.hpp" #include "boost/mpl/aux_/config/nttp.hpp" #include "boost/mpl/aux_/config/static_constant.hpp" #include "boost/mpl/aux_/config/workaround.hpp" @@ -33,7 +33,11 @@ #endif #if !defined(AUX_WRAPPER_INST) -# define AUX_WRAPPER_INST(value) mpl::AUX_WRAPPER_NAME< value > +# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) +# define AUX_WRAPPER_INST(value) AUX_WRAPPER_NAME< value > +# else +# define AUX_WRAPPER_INST(value) mpl::AUX_WRAPPER_NAME< value > +# endif #endif namespace boost { namespace mpl { @@ -56,28 +60,33 @@ struct AUX_WRAPPER_NAME // either #if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) private: - BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1))); - BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1))); + BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1))); + BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1))); public: typedef AUX_WRAPPER_INST(next_value) next; typedef AUX_WRAPPER_INST(prior_value) prior; #elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) - typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next; - typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior; #else - typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next; - typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior; #endif // enables uniform function call syntax for families of overloaded // functions that return objects of both arithmetic ('int', 'long', // 'double', etc.) and wrapped integral types (for an example, see // "mpl/example/power.cpp") - operator AUX_WRAPPER_VALUE_TYPE() const { return this->value; } + operator AUX_WRAPPER_VALUE_TYPE() const { return static_cast(this->value); } }; +#if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) +template< AUX_WRAPPER_PARAMS(N) > +AUX_WRAPPER_VALUE_TYPE const AUX_WRAPPER_INST(N)::value; +#endif + }} // namespace boost::mpl #undef AUX_WRAPPER_NAME diff --git a/boost/boost/mpl/aux_/is_msvc_eti_arg.hpp b/boost/boost/mpl/aux_/is_msvc_eti_arg.hpp new file mode 100644 index 0000000000..002197e131 --- /dev/null +++ b/boost/boost/mpl/aux_/is_msvc_eti_arg.hpp @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/is_msvc_eti_arg.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-03 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_IS_MSVC_ETI_ARG_HPP_INCLUDED +#define BOOST_MPL_AUX_IS_MSVC_ETI_ARG_HPP_INCLUDED + +#include "boost/mpl/aux_/yes_no.hpp" +#include "boost/mpl/aux_/config/eti.hpp" +#include "boost/mpl/aux_/config/static_constant.hpp" + +namespace boost { namespace mpl { namespace aux { + +#if defined(BOOST_MPL_MSVC_ETI_BUG) + +#if defined(BOOST_MPL_MSVC_60_ETI_BUG) + +template< typename T > +struct is_msvc_eti_arg +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +#else + +struct eti_int_convertible +{ + eti_int_convertible(int); +}; + +template< typename T > +struct is_msvc_eti_arg +{ + static no_tag test(...); + static yes_tag test(eti_int_convertible); + static T& get(); + + BOOST_STATIC_CONSTANT(bool, value = + sizeof(test(get())) == sizeof(yes_tag) + ); +}; + +#endif // BOOST_MPL_MSVC_60_ETI_BUG + +template<> +struct is_msvc_eti_arg +{ + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +#endif // BOOST_MPL_MSVC_ETI_BUG + +}}} // namespace boost::mpl::aux + +#endif // BOOST_MPL_AUX_IS_MSVC_ETI_ARG_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/lambda_spec.hpp b/boost/boost/mpl/aux_/lambda_spec.hpp new file mode 100644 index 0000000000..cc8978a5bf --- /dev/null +++ b/boost/boost/mpl/aux_/lambda_spec.hpp @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/lambda_spec.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED +#define BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED + +#include "boost/mpl/void.hpp" +#include "boost/mpl/lambda_fwd.hpp" +#include "boost/mpl/int_fwd.hpp" +#include "boost/mpl/aux_/preprocessor/params.hpp" +#include "boost/mpl/aux_/lambda_arity_param.hpp" +#include "boost/mpl/aux_/config/lambda.hpp" + +#if !defined(BOOST_MPL_NO_FULL_LAMBDA_SUPPORT) + +# define BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(i, name) \ +template< \ + BOOST_MPL_PP_PARAMS(i, typename T) \ + , typename Tag \ + > \ +struct lambda< \ + name< BOOST_MPL_PP_PARAMS(i, T) > \ + , Tag \ + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(int_<-1>) \ + > \ +{ \ + typedef name< BOOST_MPL_PP_PARAMS(i, T) > type; \ +}; \ +/**/ + +#else + +# define BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(i, name) /**/ + +#endif + +#endif // BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/msvc_eti_base.hpp b/boost/boost/mpl/aux_/msvc_eti_base.hpp new file mode 100644 index 0000000000..152dd16bf6 --- /dev/null +++ b/boost/boost/mpl/aux_/msvc_eti_base.hpp @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/msvc_msvc_eti_base.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2001-03 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_MSVC_ETI_BASE_HPP_INCLUDED +#define BOOST_MPL_AUX_MSVC_ETI_BASE_HPP_INCLUDED + +#include "boost/mpl/aux_/config/eti.hpp" +#include "boost/mpl/aux_/is_msvc_eti_arg.hpp" + +namespace boost { namespace mpl { namespace aux { + +#if defined(BOOST_MPL_MSVC_ETI_BUG) + +template< bool > struct msvc_eti_base_impl +{ + template< typename T > struct result_ + { + typedef T type; + }; +}; + +template<> struct msvc_eti_base_impl +{ + template< typename T > struct result_ + { + typedef result_ type; + }; +}; + +template< typename T > struct msvc_eti_base + : msvc_eti_base_impl< is_msvc_eti_arg::value > + ::template result_ +{ +}; + +#else + +template< typename T > struct msvc_eti_base +{ + typedef T type; +}; + +#endif // BOOST_MPL_MSVC_ETI_BUG + +}}} // namespace boost::mpl::aux + +#endif // BOOST_MPL_AUX_MSVC_ETI_BASE_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/msvc_never_true.hpp b/boost/boost/mpl/aux_/msvc_never_true.hpp new file mode 100644 index 0000000000..88f67ed239 --- /dev/null +++ b/boost/boost/mpl/aux_/msvc_never_true.hpp @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/msvc_never_true.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_MSVC_NEVER_TRUE_HPP_INCLUDED +#define BOOST_MPL_AUX_MSVC_NEVER_TRUE_HPP_INCLUDED + +#include "boost/config.hpp" + +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 + +namespace boost { +namespace mpl { +namespace aux { + +template< typename T > +struct msvc_never_true +{ + enum { value = false }; +}; + +} // namespace aux +} // namespace mpl +} // namespace boost + +#endif // BOOST_MSVC < 1300 + +#endif // BOOST_MPL_AUX_MSVC_NEVER_TRUE_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/nested_type_wknd.hpp b/boost/boost/mpl/aux_/nested_type_wknd.hpp new file mode 100644 index 0000000000..1058a20d8f --- /dev/null +++ b/boost/boost/mpl/aux_/nested_type_wknd.hpp @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/nested_type_wknd.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_NESTED_TYPE_WKND_HPP_INCLUDED +#define BOOST_MPL_AUX_NESTED_TYPE_WKND_HPP_INCLUDED + +#include "boost/config.hpp" + +#if defined(__GNUC__) && (__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 2 \ + || !defined(BOOST_STRICT_CONFIG)) \ + || defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \ + || defined(__SUNPRO_CC) + +namespace boost { namespace mpl { namespace aux { + +template< typename T > +struct nested_type_wknd + : T::type +{ +}; + +}}} // namespace boost::mpl::aux + +# define BOOST_MPL_AUX_NESTED_TYPE_WKND(T) ::boost::mpl::aux::nested_type_wknd + +#else + +# define BOOST_MPL_AUX_NESTED_TYPE_WKND(T) T::type + +#endif // __GNUC__ + +#endif // BOOST_MPL_AUX_NESTED_TYPE_WKND_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/preprocessed/gcc/and.hpp b/boost/boost/mpl/aux_/preprocessed/gcc/and.hpp new file mode 100644 index 0000000000..9f6982a597 --- /dev/null +++ b/boost/boost/mpl/aux_/preprocessed/gcc/and.hpp @@ -0,0 +1,62 @@ +// preprocessed version of 'boost/mpl/aux_/config/use_preprocessed.hpp' header +// see the original for copyright information + +namespace boost { namespace mpl { + +namespace aux { + +template< bool C_, typename T1, typename T2, typename T3, typename T4 > +struct and_impl + : false_ +{ +}; + +template< typename T1, typename T2, typename T3, typename T4 > +struct and_impl< true,T1,T2,T3,T4 > + : and_impl< + BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value + , T2, T3, T4 + , true_ + > +{ +}; + +template<> +struct and_impl< + true + , true_, true_, true_, true_ + > + : true_ +{ +}; + +} // namespace aux + +template< + typename BOOST_MPL_AUX_VOID_SPEC_PARAM(T1) + , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(T2) + , typename T3 = true_, typename T4 = true_, typename T5 = true_ + > +struct and_ + + : aux::and_impl< + BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value + , T2, T3, T4, T5 + > + +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , and_ + , (T1, T2, T3, T4, T5) + ) +}; + +BOOST_MPL_AUX_VOID_SPEC_EXT( + 2 + , 5 + , and_ + ) + +}} // namespace boost::mpl + diff --git a/boost/boost/mpl/aux_/preprocessed/gcc/apply.hpp b/boost/boost/mpl/aux_/preprocessed/gcc/apply.hpp new file mode 100644 index 0000000000..9dc3d5c8ba --- /dev/null +++ b/boost/boost/mpl/aux_/preprocessed/gcc/apply.hpp @@ -0,0 +1,121 @@ +// preprocessed version of 'boost/mpl/apply.hpp' header +// see the original for copyright information + +namespace boost { +namespace mpl { + +template< + typename F, typename T1 = void_, typename T2 = void_ + , typename T3 = void_, typename T4 = void_, typename T5 = void_ + > +struct apply; + +template< typename F > +struct apply0 : F +{ +}; + +template< + typename F + > +struct apply< F,void_,void_,void_,void_,void_ > + : apply0 +{ +}; + +template< + typename F, typename T1 + > +struct apply1 + : F::template apply< + T1 + > +{ +}; + +template< + typename F, typename T1 + > +struct apply< F,T1,void_,void_,void_,void_ > + : apply1< F,T1 > +{ +}; + +template< + typename F, typename T1, typename T2 + > +struct apply2 + : F::template apply< + T1, T2 + > +{ +}; + +template< + typename F, typename T1, typename T2 + > +struct apply< F,T1,T2,void_,void_,void_ > + : apply2< F,T1,T2 > +{ +}; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct apply3 + : F::template apply< + T1, T2, T3 + > +{ +}; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct apply< F,T1,T2,T3,void_,void_ > + : apply3< F,T1,T2,T3 > +{ +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct apply4 + : F::template apply< + T1, T2, T3, T4 + > +{ +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct apply< F,T1,T2,T3,T4,void_ > + : apply4< F,T1,T2,T3,T4 > +{ +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct apply5 + : F::template apply< + T1, T2, T3, T4, T5 + > +{ +}; + +// primary template (not a specialization!) +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct apply + : apply5< F,T1,T2,T3,T4,T5 > +{ +}; + +} // namespace mpl +} // namespace boost + diff --git a/boost/boost/mpl/aux_/preprocessed/gcc/arg.hpp b/boost/boost/mpl/aux_/preprocessed/gcc/arg.hpp new file mode 100644 index 0000000000..d7097f86cd --- /dev/null +++ b/boost/boost/mpl/aux_/preprocessed/gcc/arg.hpp @@ -0,0 +1,136 @@ +// preprocessed version of 'boost/mpl/arg.hpp' header +// see the original for copyright information + +namespace boost { +namespace mpl { + +template<> struct arg<-1> +{ + static int const value = -1; + BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag) + + template< + typename U1 = void_, typename U2 = void_, typename U3 = void_ + , typename U4 = void_, typename U5 = void_ + > + struct apply + { + typedef U1 type; + + private: + static bool const nv = !is_void_::value; + BOOST_STATIC_ASSERT(nv); + + }; +}; + +template<> struct arg<1> +{ + static int const value = 1; + typedef arg<2> next; + BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag) + + template< + typename U1 = void_, typename U2 = void_, typename U3 = void_ + , typename U4 = void_, typename U5 = void_ + > + struct apply + { + typedef U1 type; + + private: + static bool const nv = !is_void_::value; + BOOST_STATIC_ASSERT(nv); + + }; +}; + +template<> struct arg<2> +{ + static int const value = 2; + typedef arg<3> next; + BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag) + + template< + typename U1 = void_, typename U2 = void_, typename U3 = void_ + , typename U4 = void_, typename U5 = void_ + > + struct apply + { + typedef U2 type; + + private: + static bool const nv = !is_void_::value; + BOOST_STATIC_ASSERT(nv); + + }; +}; + +template<> struct arg<3> +{ + static int const value = 3; + typedef arg<4> next; + BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag) + + template< + typename U1 = void_, typename U2 = void_, typename U3 = void_ + , typename U4 = void_, typename U5 = void_ + > + struct apply + { + typedef U3 type; + + private: + static bool const nv = !is_void_::value; + BOOST_STATIC_ASSERT(nv); + + }; +}; + +template<> struct arg<4> +{ + static int const value = 4; + typedef arg<5> next; + BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag) + + template< + typename U1 = void_, typename U2 = void_, typename U3 = void_ + , typename U4 = void_, typename U5 = void_ + > + struct apply + { + typedef U4 type; + + private: + static bool const nv = !is_void_::value; + BOOST_STATIC_ASSERT(nv); + + }; +}; + +template<> struct arg<5> +{ + static int const value = 5; + typedef arg<6> next; + BOOST_MPL_AUX_ARG_TYPEDEF(void_, tag) + + template< + typename U1 = void_, typename U2 = void_, typename U3 = void_ + , typename U4 = void_, typename U5 = void_ + > + struct apply + { + typedef U5 type; + + private: + static bool const nv = !is_void_::value; + BOOST_STATIC_ASSERT(nv); + + }; +}; + +BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(1, int, arg) + +} // namespace mpl +} // namespace boost + diff --git a/boost/boost/mpl/aux_/preprocessed/gcc/or.hpp b/boost/boost/mpl/aux_/preprocessed/gcc/or.hpp new file mode 100644 index 0000000000..517fbdff83 --- /dev/null +++ b/boost/boost/mpl/aux_/preprocessed/gcc/or.hpp @@ -0,0 +1,62 @@ +// preprocessed version of 'boost/mpl/aux_/config/use_preprocessed.hpp' header +// see the original for copyright information + +namespace boost { namespace mpl { + +namespace aux { + +template< bool C_, typename T1, typename T2, typename T3, typename T4 > +struct or_impl + : true_ +{ +}; + +template< typename T1, typename T2, typename T3, typename T4 > +struct or_impl< false,T1,T2,T3,T4 > + : or_impl< + BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value + , T2, T3, T4 + , false_ + > +{ +}; + +template<> +struct or_impl< + false + , false_, false_, false_, false_ + > + : false_ +{ +}; + +} // namespace aux + +template< + typename BOOST_MPL_AUX_VOID_SPEC_PARAM(T1) + , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(T2) + , typename T3 = false_, typename T4 = false_, typename T5 = false_ + > +struct or_ + + : aux::or_impl< + BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value + , T2, T3, T4, T5 + > + +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , or_ + , (T1, T2, T3, T4, T5) + ) +}; + +BOOST_MPL_AUX_VOID_SPEC_EXT( + 2 + , 5 + , or_ + ) + +}} // namespace boost::mpl + diff --git a/boost/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp b/boost/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp new file mode 100644 index 0000000000..8c17ad30e5 --- /dev/null +++ b/boost/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp @@ -0,0 +1,54 @@ +// preprocessed version of 'boost/mpl/aux_/config/use_preprocessed.hpp' header +// see the original for copyright information + +namespace boost { +namespace mpl { + +typedef arg< -1 > _; + +namespace placeholders { +using boost::mpl::_; +} + +// agurt, 17/mar/02: one more placeholder for the last 'apply#' +// specialization + +typedef arg<1> _1; + +namespace placeholders { +using boost::mpl::_1; +} + +typedef arg<2> _2; + +namespace placeholders { +using boost::mpl::_2; +} + +typedef arg<3> _3; + +namespace placeholders { +using boost::mpl::_3; +} + +typedef arg<4> _4; + +namespace placeholders { +using boost::mpl::_4; +} + +typedef arg<5> _5; + +namespace placeholders { +using boost::mpl::_5; +} + +typedef arg<6> _6; + +namespace placeholders { +using boost::mpl::_6; +} + +} // namespace mpl +} // namespace boost + diff --git a/boost/boost/mpl/aux_/static_cast.hpp b/boost/boost/mpl/aux_/static_cast.hpp new file mode 100644 index 0000000000..dcb5be8453 --- /dev/null +++ b/boost/boost/mpl/aux_/static_cast.hpp @@ -0,0 +1,31 @@ + +#ifndef BOOST_MPL_AUX_STATIC_CAST_HPP_INCLUDED +#define BOOST_MPL_AUX_STATIC_CAST_HPP_INCLUDED + +// + file: boost/mpl/aux_/static_cast.hpp +// + last modified: 02/may/03 + +// Copyright (c) 2001-03 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. +// +// See http://www.boost.org/libs/mpl for documentation. + +#include "boost/mpl/aux_/config/workaround.hpp" + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ + || BOOST_WORKAROUND(__GNUC__, < 3) \ + || BOOST_WORKAROUND(__MWERKS__, <= 0x3001) +# define BOOST_MPL_AUX_STATIC_CAST(T, expr) (T)(expr) +#else +# define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast(expr) +#endif + +#endif // BOOST_MPL_AUX_STATIC_CAST_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/template_arity_fwd.hpp b/boost/boost/mpl/aux_/template_arity_fwd.hpp index 2f66dc5a41..6cb409ec4a 100644 --- a/boost/boost/mpl/aux_/template_arity_fwd.hpp +++ b/boost/boost/mpl/aux_/template_arity_fwd.hpp @@ -7,11 +7,11 @@ // Aleksey Gurtovoy // // 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. No representations are made about the -// suitability of this software for any purpose. It is provided "as is" +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. #ifndef BOOST_MPL_AUX_TEMPLATE_ARITY_FWD_HPP_INCLUDED diff --git a/boost/boost/mpl/aux_/type_wrapper.hpp b/boost/boost/mpl/aux_/type_wrapper.hpp index bd33ed85c1..f432fb122b 100644 --- a/boost/boost/mpl/aux_/type_wrapper.hpp +++ b/boost/boost/mpl/aux_/type_wrapper.hpp @@ -1,9 +1,11 @@ -//----------------------------------------------------------------------------- -// boost mpl/aux/type_wrapper.hpp header file -// See http://www.boost.org for updates, documentation, and revision history. -//----------------------------------------------------------------------------- -// -// Copyright (c) 2000-02 + +#ifndef BOOST_MPL_AUX_TYPE_WRAPPER_HPP_INCLUDED +#define BOOST_MPL_AUX_TYPE_WRAPPER_HPP_INCLUDED + +// + file: boost/mpl/aux_/type_wrapper.hpp +// + last modified: 09/may/03 + +// Copyright (c) 2000-03 // Peter Dimov, Aleksey Gurtovoy // // Permission to use, copy, modify, distribute and sell this software @@ -13,9 +15,10 @@ // supporting documentation. No representations are made about the // suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. +// +// See http://www.boost.org/libs/mpl for documentation. -#ifndef BOOST_MPL_AUX_TYPE_WRAPPER_HPP_INCLUDED -#define BOOST_MPL_AUX_TYPE_WRAPPER_HPP_INCLUDED +#include "boost/mpl/aux_/config/ctps.hpp" namespace boost { namespace mpl { @@ -26,6 +29,24 @@ template< typename T > struct type_wrapper typedef T type; }; +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +// agurt 08/may/03: a complicated way to extract the wrapped type; need it +// mostly for the sake of GCC (3.2.x), which ICEs if you try to extract the +// nested 'type' from 'type_wrapper' when the latter was the result of a +// 'typeof' expression +template< typename T > struct wrapped_type; + +template< typename T > struct wrapped_type< type_wrapper > +{ + typedef T type; +}; +#else +template< typename W > struct wrapped_type +{ + typedef typename W::type type; +}; +#endif + } // namespace aux } // namespace mpl } // namespace boost diff --git a/boost/boost/mpl/aux_/value_wknd.hpp b/boost/boost/mpl/aux_/value_wknd.hpp index f0676d97f8..06304ed0a0 100644 --- a/boost/boost/mpl/aux_/value_wknd.hpp +++ b/boost/boost/mpl/aux_/value_wknd.hpp @@ -35,7 +35,7 @@ struct value_wknd #if defined(BOOST_MPL_MSVC_60_ETI_BUG) template<> struct value_wknd - : int_<0> + : int_<1> { }; #endif diff --git a/boost/boost/mpl/aux_/void_spec.hpp b/boost/boost/mpl/aux_/void_spec.hpp index 7363aa044e..be850f4cb7 100644 --- a/boost/boost/mpl/aux_/void_spec.hpp +++ b/boost/boost/mpl/aux_/void_spec.hpp @@ -78,6 +78,7 @@ struct name< BOOST_MPL_AUX_VOID_SPEC_PARAMS(i) > \ template<> \ struct lambda< \ name< BOOST_MPL_AUX_VOID_SPEC_PARAMS(i) > \ + , void_ \ , true \ > \ { \ @@ -89,6 +90,7 @@ struct lambda< \ template<> \ struct lambda< \ name< BOOST_MPL_AUX_VOID_SPEC_PARAMS(i) > \ + , void_ \ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(int_<-1>) \ > \ { \ diff --git a/boost/boost/mpl/aux_/yes_no.hpp b/boost/boost/mpl/aux_/yes_no.hpp index b7a1999b98..b9a1bceed4 100644 --- a/boost/boost/mpl/aux_/yes_no.hpp +++ b/boost/boost/mpl/aux_/yes_no.hpp @@ -1,31 +1,56 @@ -//----------------------------------------------------------------------------- -// boost mpl/aux_/yes_no.hpp header file -// See http://www.boost.org for updates, documentation, and revision history. -//----------------------------------------------------------------------------- -// -// Copyright (c) 2001-02 -// Peter Dimov, Aleksey Gurtovoy -// -// 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. No representations are made about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. #ifndef BOOST_MPL_AUX_YES_NO_HPP_INCLUDED #define BOOST_MPL_AUX_YES_NO_HPP_INCLUDED -namespace boost { -namespace mpl { -namespace aux { +// + file: boost/mpl/aux_/yes_no.hpp +// + last modified: 05/nov/03 + +// Copyright Aleksey Gurtovoy 2000-03 +// +// 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/mpl for documentation. + + +#include "boost/mpl/aux_/config/workaround.hpp" +#include "boost/mpl/aux_/config/msvc.hpp" + +namespace boost { namespace mpl { namespace aux { typedef char (&no_tag)[1]; typedef char (&yes_tag)[2]; -} // namespace aux -} // namespace mpl -} // namespace boost +template< bool C_ > struct yes_no_tag +{ + typedef no_tag type; +}; + +template<> struct yes_no_tag +{ + typedef yes_tag type; +}; + + +template< long n > struct weighted_tag +{ +#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) + typedef char (&type)[n]; +#else + char buf[n]; + typedef weighted_tag type; +#endif +}; + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ + || BOOST_WORKAROUND(BOOST_MSVC, == 1300) +template<> struct weighted_tag<0> +{ + typedef char (&type)[1]; +}; +#endif + +}}} // namespace boost::mpl::aux #endif // BOOST_MPL_AUX_YES_NO_HPP_INCLUDED diff --git a/boost/boost/mpl/bool.hpp b/boost/boost/mpl/bool.hpp index 38e8596644..5c3bab2841 100644 --- a/boost/boost/mpl/bool.hpp +++ b/boost/boost/mpl/bool.hpp @@ -3,7 +3,7 @@ #define BOOST_MPL_BOOL_HPP_INCLUDED // + file: boost/mpl/bool.hpp -// + last modified: 08/mar/03 +// + last modified: 12/apr/03 // Copyright (c) 2000-03 // Aleksey Gurtovoy @@ -31,6 +31,11 @@ template< bool C_ > struct bool_ operator bool() const { return this->value; } }; +#if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) +template< bool C_ > +bool const bool_::value; +#endif + }} // namespace boost::mpl #endif // BOOST_MPL_BOOL_HPP_INCLUDED diff --git a/boost/boost/mpl/bool_fwd.hpp b/boost/boost/mpl/bool_fwd.hpp index f1cf07894f..851293715c 100644 --- a/boost/boost/mpl/bool_fwd.hpp +++ b/boost/boost/mpl/bool_fwd.hpp @@ -1,3 +1,4 @@ + #ifndef BOOST_MPL_BOOL_FWD_HPP_INCLUDED #define BOOST_MPL_BOOL_FWD_HPP_INCLUDED @@ -8,11 +9,11 @@ // Aleksey Gurtovoy // // 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. No representations are made about the -// suitability of this software for any purpose. It is provided "as is" +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. // // See http://www.boost.org/libs/mpl for documentation. diff --git a/boost/boost/mpl/identity.hpp b/boost/boost/mpl/identity.hpp new file mode 100644 index 0000000000..bebc291745 --- /dev/null +++ b/boost/boost/mpl/identity.hpp @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// boost mpl/identity.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-02 +// Aleksey Gurtovoy +// +// 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. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_IDENTITY_HPP_INCLUDED +#define BOOST_MPL_IDENTITY_HPP_INCLUDED + +#include "boost/mpl/aux_/void_spec.hpp" +#include "boost/mpl/aux_/lambda_support.hpp" + +namespace boost { +namespace mpl { + +template< + typename BOOST_MPL_AUX_VOID_SPEC_PARAM(T) + > +struct identity +{ + typedef T type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,identity,(T)) +}; + +template< + typename BOOST_MPL_AUX_VOID_SPEC_PARAM(T) + > +struct make_identity +{ + typedef identity type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,make_identity,(T)) +}; + +BOOST_MPL_AUX_VOID_SPEC(1, identity) +BOOST_MPL_AUX_VOID_SPEC(1, make_identity) + +} // namespace mpl +} // namespace boost + +#endif // BOOST_MPL_IDENTITY_HPP_INCLUDED diff --git a/boost/boost/mpl/if.hpp b/boost/boost/mpl/if.hpp index 0ef343e196..c4f93151d9 100644 --- a/boost/boost/mpl/if.hpp +++ b/boost/boost/mpl/if.hpp @@ -3,7 +3,7 @@ #define BOOST_MPL_IF_HPP_INCLUDED // + file: boost/mpl/if.hpp -// + last modified: 10/mar/03 +// + last modified: 17/sep/03 // Copyright (c) 2000-03 Boost.org // @@ -17,18 +17,25 @@ // // See http://www.boost.org/libs/mpl for documentation. +#include "boost/mpl/void.hpp" #include "boost/mpl/aux_/value_wknd.hpp" -#include "boost/mpl/aux_/ice_cast.hpp" +#include "boost/mpl/aux_/static_cast.hpp" #include "boost/mpl/aux_/void_spec.hpp" #include "boost/mpl/aux_/lambda_support.hpp" #include "boost/mpl/aux_/config/workaround.hpp" #include "boost/config.hpp" +#if !defined(BOOST_MPL_NO_FULL_LAMBDA_SUPPORT) +# include "boost/mpl/arg_fwd.hpp" +#endif + namespace boost { namespace mpl { #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +BOOST_MPL_AUX_AGLORITHM_NAMESPACE_BEGIN + template< bool C , typename T1 @@ -61,7 +68,7 @@ struct if_ #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) BOOST_MPL_AUX_VALUE_WKND(C)::value #else - BOOST_MPL_AUX_ICE_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(C)::value) + BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(C)::value) #endif , T1 , T2 @@ -73,48 +80,6 @@ struct if_ BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C,T1,T2)) }; -#elif defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - -// MSVC6.5-specific version - -template< - bool C_ - , typename T1 - , typename T2 - > -struct if_c -{ - private: - template struct answer { typedef T1 type; }; - template<> struct answer { typedef T2 type; }; - - public: - typedef typename answer< C_ >::type type; -}; - -// (almost) copy & paste in order to save one more -// recursively nested template instantiation to user -template< - typename C_ - , typename T1 - , typename T2 - > -struct if_ -{ - private: - template struct answer { typedef T1 type; }; - template<> struct answer { typedef T2 type; }; - - // agurt, 17/sep/02: in some situations MSVC 7.0 doesn't - // handle 'answer' expression very well - enum { c_ = C_::value }; - - public: - typedef typename answer< BOOST_MPL_AUX_ICE_CAST(bool, c_) >::type type; - - BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C_,T1,T2)) -}; - #else // no partial class template specialization @@ -142,34 +107,129 @@ struct if_impl } // namespace aux template< - bool C + bool C_ , typename T1 , typename T2 > struct if_c { - typedef typename aux::if_impl< C > + typedef typename aux::if_impl< C_ > ::template result_::type type; }; // (almost) copy & paste in order to save one more // recursively nested template instantiation to user template< - typename BOOST_MPL_AUX_VOID_SPEC_PARAM(C) + typename BOOST_MPL_AUX_VOID_SPEC_PARAM(C_) , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(T1) , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(T2) > struct if_ { - typedef typename aux::if_impl< BOOST_MPL_AUX_ICE_CAST(bool, C::value) > + enum { msvc70_wknd_ = C_::value }; + + typedef typename aux::if_impl< BOOST_MPL_AUX_STATIC_CAST(bool, msvc70_wknd_) > ::template result_::type type; - BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C,T1,T2)) + BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C_,T1,T2)) }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -BOOST_MPL_AUX_VOID_SPEC(3, if_) +BOOST_MPL_AUX_AGLORITHM_NAMESPACE_END + +BOOST_MPL_AUX_ALGORITHM_VOID_SPEC(3, if_) + + +#if !defined(BOOST_MPL_NO_FULL_LAMBDA_SUPPORT) + +// Aleksey, check it out: lazy if_ evaluation in lambdas! +// I think this doesn't handle the case of +// +// _1, bar<_2>, baz<_2> > +// +// (or however it is that you express that... when the ordinary bind3 +// computes the function based on the actual arguments). That leads me +// to think that some kind of true currying might be a better +// approach, e.g.: +// +// +// boost::mpl::bind3< +// boost::mpl::quote3 +// , boost::mpl::bind1, boost::mpl::arg<1> > +// , boost::mpl::arg<1> +// , boost::mpl::bind1, boost::mpl::arg<1> > +// >::apply<...> +// +// becomes: +// +// boost::mpl::bind< +// boost::mpl::quote3 +// >::bind< +// , boost::mpl::bind1, +// boost::mpl::arg<1> > +// >::bind< +// boost::mpl::arg<1> +// >::bind< +// boost::mpl::bind1, boost::mpl::arg<1> > +// >::apply<...> +// +// so that after the 2nd bind we have a different function depending +// on the result of is_reference. + +template struct bind3; +template