From 19fa02ff12689811eab10ce4e1cdc445f0a1ff21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20K=C3=BCmmel?= Date: Fri, 25 May 2007 15:15:20 +0000 Subject: [PATCH] update to boost 1.34 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18510 a592a061-630c-0410-9148-cb99ea01b6c8 --- .../detail/streambuf/indirect_streambuf.hpp | 4 +- boost/boost/mpl/aux_/lambda_spec.hpp | 9 +- boost/boost/none.hpp | 43 ++++ boost/boost/none_t.hpp | 24 --- boost/boost/optional/optional.hpp | 188 ++++++++++++++++-- boost/boost/preprocessor/config/config.hpp | 6 +- boost/boost/regex/v4/cpp_regex_traits.hpp | 2 +- boost/boost/regex/v4/regex_traits.hpp | 4 +- boost/boost/spirit/utility/loops.hpp | 2 +- boost/boost/type_traits/is_convertible.hpp | 3 +- 10 files changed, 227 insertions(+), 58 deletions(-) create mode 100755 boost/boost/none.hpp delete mode 100644 boost/boost/none_t.hpp diff --git a/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp b/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp index f2b866a233..1514fa3a26 100644 --- a/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp +++ b/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp @@ -58,7 +58,7 @@ public: indirect_streambuf(); void open(const T& t BOOST_IOSTREAMS_PUSH_PARAMS()); - bool is_open(); + bool is_open() const; void close(); bool auto_close() const; void set_auto_close(bool close); @@ -189,7 +189,7 @@ void indirect_streambuf::open } template -inline bool indirect_streambuf::is_open() +inline bool indirect_streambuf::is_open() const { return (flags_ & f_open) != 0; } template diff --git a/boost/boost/mpl/aux_/lambda_spec.hpp b/boost/boost/mpl/aux_/lambda_spec.hpp index fe53da324d..acbefafcf5 100644 --- a/boost/boost/mpl/aux_/lambda_spec.hpp +++ b/boost/boost/mpl/aux_/lambda_spec.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED #define BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2001-2004 +// Copyright Aleksey Gurtovoy 2001-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -11,8 +11,8 @@ // See http://www.boost.org/libs/mpl for documentation. // $Source: /cvsroot/boost/boost/boost/mpl/aux_/lambda_spec.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.8 $ +// $Date: 2007/01/29 07:28:45 $ +// $Revision: 1.8.14.1 $ #include #include @@ -35,7 +35,8 @@ struct lambda< \ > \ { \ typedef false_ is_le; \ - typedef name< BOOST_MPL_PP_PARAMS(i, T) > type; \ + typedef name< BOOST_MPL_PP_PARAMS(i, T) > result_; \ + typedef result_ type; \ }; \ /**/ diff --git a/boost/boost/none.hpp b/boost/boost/none.hpp new file mode 100755 index 0000000000..0f5e31cce9 --- /dev/null +++ b/boost/boost/none.hpp @@ -0,0 +1,43 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2007, Anthony Williams +// Copyright (C) 2007, Steven Watanabe, Richard Smith +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/lib/optional/ for documentation. +// +// You are welcome to contact the author at: +// fernando.cacciola@gmail.com +// +#ifndef BOOST_NONE_17SEP2003_HPP +#define BOOST_NONE_17SEP2003_HPP + +namespace boost +{ + namespace detail + { + class none_helper; + } + + inline void none(detail::none_helper); + + namespace detail + { + class none_helper + { + private: + + none_helper( none_helper const& ) {} + + friend void boost::none(none_helper); + }; + } + + typedef void (*none_t)(detail::none_helper); + + inline void none(detail::none_helper) {} +} + +#endif diff --git a/boost/boost/none_t.hpp b/boost/boost/none_t.hpp deleted file mode 100644 index 4b97e20992..0000000000 --- a/boost/boost/none_t.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/lib/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// -#ifndef BOOST_NONE_T_17SEP2003_HPP -#define BOOST_NONE_T_17SEP2003_HPP - -namespace boost { - -namespace detail { struct none_helper{}; } - -typedef int detail::none_helper::*none_t ; - -} // namespace boost - -#endif - diff --git a/boost/boost/optional/optional.hpp b/boost/boost/optional/optional.hpp index 4421f4aa63..42277ba61e 100644 --- a/boost/boost/optional/optional.hpp +++ b/boost/boost/optional/optional.hpp @@ -26,7 +26,7 @@ #include "boost/mpl/bool.hpp" #include "boost/mpl/not.hpp" #include "boost/detail/reference_content.hpp" -#include "boost/none_t.hpp" +#include "boost/none.hpp" #include "boost/utility/compare_pointees.hpp" #include "boost/optional/optional_fwd.hpp" @@ -76,6 +76,19 @@ #define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION #endif +// Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<> +// member template of a factory as used in the optional<> implementation. +// He proposed this simple fix which is to move the call to apply<> outside +// namespace boost. +namespace boost_optional_detail +{ + template + void construct(Factory const& factory, void* address) + { + factory.BOOST_NESTED_TEMPLATE apply(address); + } +} + namespace boost { @@ -173,7 +186,7 @@ class optional_base : public optional_tag // Creates an optional uninitialized. // No-throw - optional_base ( none_t const& ) + optional_base ( none_t ) : m_initialized(false) {} @@ -185,6 +198,16 @@ class optional_base : public optional_tag { construct(val); } + + // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialzed optional. + // Can throw if T::T(T const&) does + optional_base ( bool cond, argument_type val ) + : + m_initialized(false) + { + if ( cond ) + construct(val); + } // Creates a deep copy of another optional // Can throw if T::T(T const&) does @@ -256,7 +279,7 @@ class optional_base : public optional_tag // Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED // No-throw (assuming T::~T() doesn't) - void assign ( none_t const& ) { destroy(); } + void assign ( none_t ) { destroy(); } #ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT template @@ -299,7 +322,7 @@ class optional_base : public optional_tag void construct ( Expr const& factory, in_place_factory_base const* ) { BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; - factory.BOOST_NESTED_TEMPLATE apply(m_storage.address()) ; + boost_optional_detail::construct(factory, m_storage.address()); m_initialized = true ; } @@ -418,6 +441,8 @@ class optional_base : public optional_tag // the following olverloads are used to filter out the case and guarantee an error in case of T being a reference. pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; } pointer_type cast_ptr( internal_type * p, is_not_reference_tag ) { return p ; } + pointer_const_type cast_ptr( internal_type const* p, is_reference_tag ) const { return &p->get() ; } + pointer_type cast_ptr( internal_type * p, is_reference_tag ) { return &p->get() ; } bool m_initialized ; storage_type m_storage ; @@ -449,12 +474,15 @@ class optional : public optional_detail::optional_base // Creates an optional uninitialized. // No-throw - optional( none_t const& none_ ) : base(none_) {} + optional( none_t none_ ) : base(none_) {} // Creates an optional initialized with 'val'. // Can throw if T::T(T const&) does optional ( argument_type val ) : base(val) {} + // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. + // Can throw if T::T(T const&) does + optional ( bool cond, argument_type val ) : base(cond,val) {} #ifndef BOOST_OPTIONAL_NO_CONVERTING_COPY_CTOR // NOTE: MSVC needs templated versions first @@ -537,7 +565,7 @@ class optional : public optional_detail::optional_base // Assigns from a "none" // Which destroys the current value, if any, leaving this UNINITIALIZED // No-throw (assuming T::~T() doesn't) - optional& operator= ( none_t const& none_ ) + optional& operator= ( none_t none_ ) { this->assign( none_ ) ; return *this ; @@ -549,6 +577,10 @@ class optional : public optional_detail::optional_base reference_const_type get() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } reference_type get() { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } + // Returns a copy of the value if this is initialized, 'v' otherwise + reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; } + reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; } + // Returns a pointer to the value if this is initialized, otherwise, // the behaviour is UNDEFINED // No-throw @@ -570,6 +602,22 @@ class optional : public optional_detail::optional_base bool operator!() const { return !this->is_initialized() ; } } ; +// Returns optional(v) +template +inline +optional make_optional ( T const& v ) +{ + return optional(v); +} + +// Returns optional(cond,v) +template +inline +optional make_optional ( bool cond, T const& v ) +{ + return optional(cond,v); +} + // Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. // No-throw template @@ -606,6 +654,24 @@ get ( optional* opt ) return opt->get_ptr() ; } +// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. +// No-throw +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_const_type +get_optional_value_or ( optional const& opt, BOOST_DEDUCED_TYPENAME optional::reference_const_type v ) +{ + return opt.get_value_or(v) ; +} + +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_type +get_optional_value_or ( optional& opt, BOOST_DEDUCED_TYPENAME optional::reference_type v ) +{ + return opt.get_value_or(v) ; +} + // Returns a pointer to the value if this is initialized, otherwise, returns NULL. // No-throw template @@ -627,6 +693,11 @@ get_pointer ( optional& opt ) // optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values). // WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead. + +// +// optional vs optional cases +// + template inline bool operator == ( optional const& x, optional const& y ) @@ -657,64 +728,141 @@ inline bool operator >= ( optional const& x, optional const& y ) { return !( x < y ) ; } + +// +// optional vs T cases +// +template +inline +bool operator == ( optional const& x, T const& y ) +{ return equal_pointees(x, optional(y)); } + +template +inline +bool operator < ( optional const& x, T const& y ) +{ return less_pointees(x, optional(y)); } + +template +inline +bool operator != ( optional const& x, T const& y ) +{ return !( x == y ) ; } + +template +inline +bool operator > ( optional const& x, T const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( optional const& x, T const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( optional const& x, T const& y ) +{ return !( x < y ) ; } + +// +// T vs optional cases +// + +template +inline +bool operator == ( T const& x, optional const& y ) +{ return equal_pointees( optional(x), y ); } + +template +inline +bool operator < ( T const& x, optional const& y ) +{ return less_pointees( optional(x), y ); } + +template +inline +bool operator != ( T const& x, optional const& y ) +{ return !( x == y ) ; } + +template +inline +bool operator > ( T const& x, optional const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( T const& x, optional const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( T const& x, optional const& y ) +{ return !( x < y ) ; } + + +// +// optional vs none cases +// + template inline -bool operator == ( optional const& x, none_t const& ) +bool operator == ( optional const& x, none_t ) { return equal_pointees(x, optional() ); } template inline -bool operator < ( optional const& x, none_t const& ) +bool operator < ( optional const& x, none_t ) { return less_pointees(x,optional() ); } template inline -bool operator != ( optional const& x, none_t const& y ) +bool operator != ( optional const& x, none_t y ) { return !( x == y ) ; } template inline -bool operator > ( optional const& x, none_t const& y ) +bool operator > ( optional const& x, none_t y ) { return y < x ; } template inline -bool operator <= ( optional const& x, none_t const& y ) +bool operator <= ( optional const& x, none_t y ) { return !( y < x ) ; } template inline -bool operator >= ( optional const& x, none_t const& y ) +bool operator >= ( optional const& x, none_t y ) { return !( x < y ) ; } +// +// none vs optional cases +// + template inline -bool operator == ( none_t const& x, optional const& y ) +bool operator == ( none_t x, optional const& y ) { return equal_pointees(optional() ,y); } template inline -bool operator < ( none_t const& x, optional const& y ) +bool operator < ( none_t x, optional const& y ) { return less_pointees(optional() ,y); } template inline -bool operator != ( none_t const& x, optional const& y ) +bool operator != ( none_t x, optional const& y ) { return !( x == y ) ; } template inline -bool operator > ( none_t const& x, optional const& y ) +bool operator > ( none_t x, optional const& y ) { return y < x ; } template inline -bool operator <= ( none_t const& x, optional const& y ) +bool operator <= ( none_t x, optional const& y ) { return !( y < x ) ; } template inline -bool operator >= ( none_t const& x, optional const& y ) +bool operator >= ( none_t x, optional const& y ) { return !( x < y ) ; } // @@ -767,10 +915,6 @@ template inline void swap ( optional& x, optional& y ) optional_detail::optional_swap(x,y); } -template inline optional make_optional ( T const& v ) -{ - return optional(v); -} } // namespace boost diff --git a/boost/boost/preprocessor/config/config.hpp b/boost/boost/preprocessor/config/config.hpp index ab1f6384a1..dd0f7138d0 100644 --- a/boost/boost/preprocessor/config/config.hpp +++ b/boost/boost/preprocessor/config/config.hpp @@ -31,7 +31,11 @@ # elif defined(__MWERKS__) && __MWERKS__ >= 0x3200 # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT()) # elif defined(__EDG__) || defined(__EDG_VERSION__) -# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_EDG() | BOOST_PP_CONFIG_STRICT()) +# if defined(_MSC_VER) && __EDG_VERSION__ >= 308 +# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC()) +# else +# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_EDG() | BOOST_PP_CONFIG_STRICT()) +# endif # elif defined(__MWERKS__) # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MWCC()) # elif defined(__DMC__) diff --git a/boost/boost/regex/v4/cpp_regex_traits.hpp b/boost/boost/regex/v4/cpp_regex_traits.hpp index 6ba599a41a..bbe5c5085e 100644 --- a/boost/boost/regex/v4/cpp_regex_traits.hpp +++ b/boost/boost/regex/v4/cpp_regex_traits.hpp @@ -562,7 +562,7 @@ typename cpp_regex_traits_implementation::string_type // std::collate::transform returns a different string! // So as a workaround, we'll truncate the string at the first NULL // which _seems_ to work.... -#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +#if BOOST_WORKAROUND(__BORLANDC__, < 0x580) result.erase(result.find(charT(0))); #else // diff --git a/boost/boost/regex/v4/regex_traits.hpp b/boost/boost/regex/v4/regex_traits.hpp index 93ee9caa25..9f2b3700a9 100644 --- a/boost/boost/regex/v4/regex_traits.hpp +++ b/boost/boost/regex/v4/regex_traits.hpp @@ -76,7 +76,7 @@ struct regex_traits : public implementationT // required "standard" ones: // namespace re_detail{ -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500)) +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, < 60000) BOOST_MPL_HAS_XXX_TRAIT_DEF(boost_extensions_tag) #else template @@ -129,7 +129,7 @@ struct compute_wrapper_base { typedef BaseT type; }; -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500)) +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, < 60000) template struct compute_wrapper_base { diff --git a/boost/boost/spirit/utility/loops.hpp b/boost/boost/spirit/utility/loops.hpp index 65cc4a3065..f42776a029 100644 --- a/boost/boost/spirit/utility/loops.hpp +++ b/boost/boost/spirit/utility/loops.hpp @@ -208,7 +208,7 @@ namespace boost { namespace spirit { result_t hit = scan.empty_match(); std::size_t n = m_min; - for (std::size_t i = 0;; ++i) + for (std::size_t i = 0; ; ++i) { typename ScannerT::iterator_t save = scan.first; result_t next = this->subject().parse(scan); diff --git a/boost/boost/type_traits/is_convertible.hpp b/boost/boost/type_traits/is_convertible.hpp index f817f66f5c..54a11a14af 100644 --- a/boost/boost/type_traits/is_convertible.hpp +++ b/boost/boost/type_traits/is_convertible.hpp @@ -340,7 +340,7 @@ struct is_convertible_impl_select template struct is_convertible_impl_dispatch_base { -#ifndef __HP_aCC +#if !BOOST_WORKAROUND(__HP_aCC, < 60700) typedef is_convertible_impl_select< ::boost::is_arithmetic::value, ::boost::is_arithmetic::value, @@ -413,3 +413,4 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convert #include #endif // BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED + -- 2.39.2