diff --git a/include/boost/boost_version.txt b/include/boost/boost_version.txt index 0c462da4ec..587a3af9e0 100644 --- a/include/boost/boost_version.txt +++ b/include/boost/boost_version.txt @@ -1 +1 @@ -boost version: 1_43_0 +boost version: 1_44_0 diff --git a/include/boost/concept/detail/backward_compatibility.hpp b/include/boost/concept/detail/backward_compatibility.hpp new file mode 100644 index 0000000000..91254b5211 --- /dev/null +++ b/include/boost/concept/detail/backward_compatibility.hpp @@ -0,0 +1,16 @@ +// Copyright David Abrahams 2009. Distributed under the Boost +// Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_CONCEPT_BACKWARD_COMPATIBILITY_DWA200968_HPP +# define BOOST_CONCEPT_BACKWARD_COMPATIBILITY_DWA200968_HPP + +namespace boost +{ + namespace concepts {} + +# if !defined(BOOST_NO_CONCEPTS) && !defined(BOOST_CONCEPT_NO_BACKWARD_KEYWORD) + namespace concept = concepts; +# endif +} // namespace boost::concept + +#endif // BOOST_CONCEPT_BACKWARD_COMPATIBILITY_DWA200968_HPP diff --git a/include/boost/concept/detail/borland.hpp b/include/boost/concept/detail/borland.hpp index cbc2ee0c90..a789798e3c 100644 --- a/include/boost/concept/detail/borland.hpp +++ b/include/boost/concept/detail/borland.hpp @@ -5,8 +5,9 @@ # define BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP # include +# include -namespace boost { namespace concept { +namespace boost { namespace concepts { template struct require; @@ -21,7 +22,7 @@ struct require enum \ { \ BOOST_PP_CAT(boost_concept_check,__LINE__) = \ - boost::concept::require::instantiate \ + boost::concepts::require::instantiate \ } }} // namespace boost::concept diff --git a/include/boost/concept/detail/general.hpp b/include/boost/concept/detail/general.hpp index 859a880e88..53e34e11b8 100644 --- a/include/boost/concept/detail/general.hpp +++ b/include/boost/concept/detail/general.hpp @@ -5,6 +5,7 @@ # define BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP # include +# include # ifdef BOOST_OLD_CONCEPT_SUPPORT # include @@ -13,7 +14,7 @@ // This implementation works on Comeau and GCC, all the way back to // 2.95 -namespace boost { namespace concept { +namespace boost { namespace concepts { template struct requirement_; @@ -29,6 +30,14 @@ struct requirement static void failed() { ((Model*)0)->~Model(); } }; +struct failed {}; + +template +struct requirement +{ + static void failed() { ((Model*)0)->~Model(); } +}; + # ifdef BOOST_OLD_CONCEPT_SUPPORT template @@ -40,9 +49,9 @@ struct constraint template struct requirement_ : mpl::if_< - concept::not_satisfied + concepts::not_satisfied , constraint - , requirement + , requirement >::type {}; @@ -51,14 +60,14 @@ struct requirement_ // For GCC-2.x, these can't have exactly the same name template struct requirement_ - : requirement + : requirement {}; # endif # define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ - typedef ::boost::concept::detail::instantiate< \ - &::boost::concept::requirement_::failed> \ + typedef ::boost::concepts::detail::instantiate< \ + &::boost::concepts::requirement_::failed> \ BOOST_PP_CAT(boost_concept_check,__LINE__) }} diff --git a/include/boost/concept/detail/has_constraints.hpp b/include/boost/concept/detail/has_constraints.hpp index f937348731..9664c2256c 100644 --- a/include/boost/concept/detail/has_constraints.hpp +++ b/include/boost/concept/detail/has_constraints.hpp @@ -6,7 +6,9 @@ # include # include -namespace boost { namespace concept { +# include + +namespace boost { namespace concepts { namespace detail { @@ -43,6 +45,6 @@ struct not_satisfied typedef mpl::bool_ type; }; -}} // namespace boost::concept::detail +}} // namespace boost::concepts::detail #endif // BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP diff --git a/include/boost/concept/detail/msvc.hpp b/include/boost/concept/detail/msvc.hpp index c19d0a538f..af34c058e5 100644 --- a/include/boost/concept/detail/msvc.hpp +++ b/include/boost/concept/detail/msvc.hpp @@ -5,6 +5,7 @@ # define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP # include +# include # ifdef BOOST_OLD_CONCEPT_SUPPORT # include @@ -12,7 +13,8 @@ # endif -namespace boost { namespace concept { +namespace boost { namespace concepts { + template struct check @@ -22,7 +24,19 @@ struct check x->~Model(); } }; - + +# ifndef BOOST_NO_PARTIAL_SPECIALIZATION +struct failed {}; +template +struct check +{ + virtual void failed(Model* x) + { + x->~Model(); + } +}; +# endif + # ifdef BOOST_OLD_CONCEPT_SUPPORT namespace detail @@ -38,7 +52,11 @@ struct require : mpl::if_c< not_satisfied::value , detail::constraint +# ifndef BOOST_NO_PARTIAL_SPECIALIZATION , check +# else + , check +# endif >::type {}; @@ -46,7 +64,11 @@ struct require template struct require - : check +# ifndef BOOST_NO_PARTIAL_SPECIALIZATION + : check +# else + : check +# endif {}; # endif @@ -70,7 +92,7 @@ struct require enum \ { \ BOOST_PP_CAT(boost_concept_check,__LINE__) = \ - sizeof(::boost::concept::require) \ + sizeof(::boost::concepts::require) \ } # else // Not vc-7.1 @@ -83,7 +105,7 @@ require_(void(*)(Model)); enum \ { \ BOOST_PP_CAT(boost_concept_check,__LINE__) = \ - sizeof(::boost::concept::require_((ModelFnPtr)0)) \ + sizeof(::boost::concepts::require_((ModelFnPtr)0)) \ } # endif diff --git a/include/boost/concept/usage.hpp b/include/boost/concept/usage.hpp index 71b2da7e2c..e642e7c825 100644 --- a/include/boost/concept/usage.hpp +++ b/include/boost/concept/usage.hpp @@ -6,8 +6,9 @@ # include # include +# include -namespace boost { namespace concept { +namespace boost { namespace concepts { # if BOOST_WORKAROUND(__GNUC__, == 2) @@ -25,19 +26,19 @@ struct usage_requirements # define BOOST_CONCEPT_USAGE(model) \ model(); /* at least 2.96 and 3.4.3 both need this :( */ \ - BOOST_CONCEPT_ASSERT((boost::concept::usage_requirements)); \ + BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements)); \ ~model() # else # define BOOST_CONCEPT_USAGE(model) \ - BOOST_CONCEPT_ASSERT((boost::concept::usage_requirements)); \ + BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements)); \ ~model() # endif # endif -}} // namespace boost::concept +}} // namespace boost::concepts #endif // BOOST_CONCEPT_USAGE_DWA2006919_HPP diff --git a/include/boost/config/abi/borland_prefix.hpp b/include/boost/config/abi/borland_prefix.hpp index 6148195106..4db9b8adc3 100644 --- a/include/boost/config/abi/borland_prefix.hpp +++ b/include/boost/config/abi/borland_prefix.hpp @@ -21,7 +21,7 @@ // 8026 - functions taking class by value arguments are not expanded inline #pragma nopushoptwarn -# pragma option push -Vx -Ve -a8 -b -pc -Vmv -VC- -Vl- -w-8027 -w-8026 +# pragma option push -a8 -Vx- -Ve- -b- -pc -Vmv -VC- -Vl- -w-8027 -w-8026 diff --git a/include/boost/config/auto_link.hpp b/include/boost/config/auto_link.hpp index a14f2650fb..0bc9fc8e80 100644 --- a/include/boost/config/auto_link.hpp +++ b/include/boost/config/auto_link.hpp @@ -25,6 +25,9 @@ BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name of the library selected (useful for debugging). BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib, rather than a mangled-name version. +BOOST_AUTO_LINK_TAGGED: Specifies that we link to libraries built with the --layout=tagged option. + This is essentially the same as the default name-mangled version, but without + the compiler name and version, or the Boost version. Just the build options. 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! @@ -60,6 +63,8 @@ BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used, a hiphen: s static runtime (dynamic if not present). + g debug/diagnostic runtime (release if not present). + y Python debug/diagnostic runtime (release if not present). d debug build (release if not present). g debug/diagnostic runtime (release if not present). p STLPort Build. @@ -183,8 +188,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # 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)) +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gydp" +# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-gdp" +# elif defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gydp" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdp" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") @@ -195,8 +208,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gydpn" +# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-gdpn" +# elif defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gydpn" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gdpn" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") @@ -207,7 +228,9 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # else -# if defined(_DEBUG) +# if defined(_DEBUG) && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-gyd" +# elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-gd" # else # define BOOST_LIB_RT_OPT @@ -219,8 +242,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # 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)) +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgydp" +# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-sgdp" +# elif defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgydp" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdp" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") @@ -231,8 +262,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) +# if defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG))\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgydpn" +# elif defined(_DEBUG) && (defined(__STL_DEBUG) || defined(_STLP_DEBUG)) # define BOOST_LIB_RT_OPT "-sgdpn" +# elif defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgydpn" +# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") +# error "Build options aren't compatible with pre-built libraries" # elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgdpn" # pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") @@ -243,7 +282,10 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # else -# if defined(_DEBUG) +# if defined(_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sgyd" +# elif defined(_DEBUG) # define BOOST_LIB_RT_OPT "-sgd" # else # define BOOST_LIB_RT_OPT "-s" @@ -270,16 +312,26 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # ifdef _RTLDLL -# ifdef BOOST_BORLAND_DEBUG +# if defined(BOOST_BORLAND_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-yd" +# elif defined(BOOST_BORLAND_DEBUG) # define BOOST_LIB_RT_OPT "-d" +# elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT -y # else # define BOOST_LIB_RT_OPT # endif # else -# ifdef BOOST_BORLAND_DEBUG +# if defined(BOOST_BORLAND_DEBUG)\ + && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-syd" +# elif defined(BOOST_BORLAND_DEBUG) # define BOOST_LIB_RT_OPT "-sd" +# elif defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) +# define BOOST_LIB_RT_OPT "-sy" # else # define BOOST_LIB_RT_OPT "-s" # endif @@ -309,16 +361,21 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. && defined(BOOST_LIB_RT_OPT) \ && defined(BOOST_LIB_VERSION) -#ifndef BOOST_AUTO_LINK_NOMANGLE -# 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_AUTO_LINK_TAGGED +# pragma commentcomment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".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 +#elif defined(BOOST_AUTO_LINK_NOMANGLE) # pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # endif +#else +# 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 #endif #else @@ -361,13 +418,3 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. # undef BOOST_AUTO_LINK_NOMANGLE #endif - - - - - - - - - - diff --git a/include/boost/config/compiler/borland.hpp b/include/boost/config/compiler/borland.hpp index 661d6c8d40..2e95a6ec08 100644 --- a/include/boost/config/compiler/borland.hpp +++ b/include/boost/config/compiler/borland.hpp @@ -218,7 +218,7 @@ // // check for exception handling support: // -#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) +#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // @@ -230,8 +230,9 @@ // // all versions support __declspec: // -#ifndef __STRICT_ANSI__ -# define BOOST_HAS_DECLSPEC +#if defined(__STRICT_ANSI__) +// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined +# define BOOST_SYMBOL_EXPORT #endif // // ABI fixing headers: @@ -261,6 +262,13 @@ # define BOOST_NO_VOID_RETURNS #endif +// Borland did not implement value-initialization completely, as I reported +// in 2007, Borland Report 51854, "Value-initialization: POD struct should be +// zero-initialized", http://qc.embarcadero.com/wc/qcmain.aspx?d=51854 +// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues +// (Niels Dekker, LKEB, April 2010) +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION + #define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) diff --git a/include/boost/config/compiler/clang.hpp b/include/boost/config/compiler/clang.hpp new file mode 100644 index 0000000000..dc7402304d --- /dev/null +++ b/include/boost/config/compiler/clang.hpp @@ -0,0 +1,62 @@ +// (C) Copyright Douglas Gregor 2010 +// +// 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. + +// Clang compiler setup. + +#if __has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) +#else +# define BOOST_NO_EXCEPTIONS +#endif + +#if __has_feature(cxx_rtti) +#else +# define BOOST_NO_RTTI +#endif + +#if defined(__int64) +# define BOOST_HAS_MS_INT64 +#endif + +#define BOOST_HAS_NRVO + +// NOTE: Clang's C++0x support is not worth detecting. However, it +// supports both extern templates and "long long" even in C++98/03 +// mode. +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + +// HACK: Clang does support extern templates, but Boost's test for +// them is wrong. +#define BOOST_NO_EXTERN_TEMPLATE + +#ifndef BOOST_COMPILER +# define BOOST_COMPILER "Clang version " __clang_version__ +#endif + +// Macro used to identify the Clang compiler. +#define BOOST_CLANG 1 + diff --git a/include/boost/config/compiler/codegear.hpp b/include/boost/config/compiler/codegear.hpp index bd9f12d553..440be7cc89 100644 --- a/include/boost/config/compiler/codegear.hpp +++ b/include/boost/config/compiler/codegear.hpp @@ -19,8 +19,8 @@ #endif // // versions check: -// last known and checked version is 0x620 -#if (__CODEGEARC__ > 0x620) +// last known and checked version is 0x621 +#if (__CODEGEARC__ > 0x621) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else @@ -41,7 +41,7 @@ #endif // CodeGear C++ Builder 2010 -#if (__CODEGEARC__ <= 0x620) +#if (__CODEGEARC__ <= 0x621) # define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS @@ -51,6 +51,15 @@ // Temporary hack, until specific MPL preprocessed headers are generated # define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +// CodeGear has not yet completely implemented value-initialization, for +// example for array types, as I reported in 2010: Embarcadero Report 83751, +// "Value-initialization: arrays should have each element value-initialized", +// http://qc.embarcadero.com/wc/qcmain.aspx?d=83751 +// Last checked version: Embarcadero C++ 6.21 +// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues +// (Niels Dekker, LKEB, April 2010) +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION + # ifdef NDEBUG // fix broken so that Boost.test works: # include @@ -66,6 +75,11 @@ // // C++0x macros: // +#if (__CODEGEARC__ <= 0x620) +#define BOOST_NO_STATIC_ASSERT +#else +#define BOOST_HAS_STATIC_ASSERT +#endif #define BOOST_HAS_CHAR16_T #define BOOST_HAS_CHAR32_T #define BOOST_HAS_LONG_LONG @@ -91,7 +105,6 @@ #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES @@ -122,7 +135,7 @@ // // check for exception handling support: // -#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) +#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // @@ -134,8 +147,9 @@ // // all versions support __declspec: // -#if !defined(__STRICT_ANSI__) -# define BOOST_HAS_DECLSPEC +#if defined(__STRICT_ANSI__) +// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined +# define BOOST_SYMBOL_EXPORT #endif // // ABI fixing headers: diff --git a/include/boost/config/compiler/common_edg.hpp b/include/boost/config/compiler/common_edg.hpp index 452ab7db37..8a9cc42fbb 100644 --- a/include/boost/config/compiler/common_edg.hpp +++ b/include/boost/config/compiler/common_edg.hpp @@ -44,7 +44,7 @@ #endif // See also kai.hpp which checks a Kai-specific symbol for EH -# if !defined(__KCC) && !defined(__EXCEPTIONS) +# if !defined(__KCC) && !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS # endif @@ -59,6 +59,9 @@ // // See above for BOOST_NO_LONG_LONG // +#if (__EDG_VERSION__ < 310) +# define BOOST_NO_EXTERN_TEMPLATE +#endif #if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG) // No support for initializer lists # define BOOST_NO_INITIALIZER_LISTS @@ -74,7 +77,6 @@ #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_LAMBDAS #define BOOST_NO_NULLPTR diff --git a/include/boost/config/compiler/digitalmars.hpp b/include/boost/config/compiler/digitalmars.hpp index 47b23beb1a..0b7fee5d4e 100644 --- a/include/boost/config/compiler/digitalmars.hpp +++ b/include/boost/config/compiler/digitalmars.hpp @@ -51,7 +51,7 @@ // check for exception handling support: -#ifndef _CPPUNWIND +#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index 26ea36ac8b..61fdde5212 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -42,6 +42,7 @@ # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT +# define BOOST_NO_EXTERN_TEMPLATE #elif __GNUC__ == 3 # if defined (__PATHSCALE__) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP @@ -58,6 +59,7 @@ # if __GNUC_MINOR__ < 4 # define BOOST_NO_IS_ABSTRACT # endif +# define BOOST_NO_EXTERN_TEMPLATE #endif #if __GNUC__ < 4 // @@ -69,7 +71,19 @@ # endif #endif -#ifndef __EXCEPTIONS +#if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 ) +// Previous versions of GCC did not completely implement value-initialization: +// GCC Bug 30111, "Value-initialization of POD base class doesn't initialize +// members", reported by Jonathan Wakely in 2006, +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 (fixed for GCC 4.4) +// GCC Bug 33916, "Default constructor fails to initialize array members", +// reported by Michael Elizabeth Chastain in 2007, +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 (fixed for GCC 4.2.4) +// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#endif + +#if !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif @@ -94,20 +108,45 @@ #if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) #define BOOST_HAS_NRVO #endif + +// +// Dynamic shared object (DSO) and dynamic-link library (DLL) support +// +#if __GNUC__ >= 4 +# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + // All Win32 development environments, including 64-bit Windows and MinGW, define + // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment, + // so does not define _WIN32 or its variants. +# define BOOST_HAS_DECLSPEC +# define BOOST_SYMBOL_EXPORT __attribute__((dllexport)) +# define BOOST_SYMBOL_IMPORT __attribute__((dllimport)) +# else +# define BOOST_SYMBOL_EXPORT __attribute__((visibility("default"))) +# define BOOST_SYMBOL_IMPORT +# endif +# define BOOST_SYMBOL_VISIBLE __attribute__((visibility("default"))) +#else +// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined +# define BOOST_SYMBOL_EXPORT +#endif + // // RTTI and typeinfo detection is possible post gcc-4.3: // #if __GNUC__ * 100 + __GNUC_MINOR__ >= 403 # ifndef __GXX_RTTI -# define BOOST_NO_TYPEID -# define BOOST_NO_RTTI +# ifndef BOOST_NO_TYPEID +# define BOOST_NO_TYPEID +# endif +# ifndef BOOST_NO_RTTI +# define BOOST_NO_RTTI +# endif # endif #endif // C++0x features not implemented in any GCC version // #define BOOST_NO_CONSTEXPR -#define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_NULLPTR #define BOOST_NO_TEMPLATE_ALIASES diff --git a/include/boost/config/compiler/gcc_xml.hpp b/include/boost/config/compiler/gcc_xml.hpp index 76954a9f76..b10550ab3b 100644 --- a/include/boost/config/compiler/gcc_xml.hpp +++ b/include/boost/config/compiler/gcc_xml.hpp @@ -25,6 +25,31 @@ // #define BOOST_HAS_LONG_LONG +// C++0x features: +// +# define BOOST_NO_CONSTEXPR +# define BOOST_NO_NULLPTR +# define BOOST_NO_TEMPLATE_ALIASES +# define BOOST_NO_DECLTYPE +# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_AUTO_DECLARATIONS +# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CHAR16_T +# define BOOST_NO_CHAR32_T +# define BOOST_NO_DEFAULTED_FUNCTIONS +# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_SFINAE_EXPR +# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_LAMBDAS +# define BOOST_NO_RAW_LITERALS +# define BOOST_NO_UNICODE_LITERALS + #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ diff --git a/include/boost/config/compiler/intel.hpp b/include/boost/config/compiler/intel.hpp index 620f457586..b444c66baa 100644 --- a/include/boost/config/compiler/intel.hpp +++ b/include/boost/config/compiler/intel.hpp @@ -157,6 +157,29 @@ template<> struct assert_intrinsic_wchar_t {}; # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif +// +// An attempt to value-initialize a pointer-to-member may trigger an +// internal error on Intel <= 11.1 (last checked version), as was +// reported by John Maddock, Intel support issue 589832, May 2010. +// Moreover, according to test results from Huang-Vista-x86_32_intel, +// intel-vc9-win-11.1 may leave a non-POD array uninitialized, in some +// cases when it should be value-initialized. +// (Niels Dekker, LKEB, May 2010) +#if defined(__INTEL_COMPILER) +# if __INTEL_COMPILER <= 1110 +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +# endif +#endif + +// +// Dynamic shared object (DSO) and dynamic-link library (DLL) support +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +# define BOOST_SYMBOL_EXPORT __attribute__((visibility("default"))) +# define BOOST_SYMBOL_IMPORT +# define BOOST_SYMBOL_VISIBLE __attribute__((visibility("default"))) +#endif + // // last known and checked version: #if (BOOST_INTEL_CXX_VERSION > 1110) diff --git a/include/boost/config/compiler/kai.hpp b/include/boost/config/compiler/kai.hpp index 6b5591a874..f9c49ca1df 100644 --- a/include/boost/config/compiler/kai.hpp +++ b/include/boost/config/compiler/kai.hpp @@ -17,7 +17,7 @@ # endif // see also common_edg.hpp which needs a special check for __KCC -# if !defined(_EXCEPTIONS) +# if !defined(_EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS # endif diff --git a/include/boost/config/compiler/metrowerks.hpp b/include/boost/config/compiler/metrowerks.hpp index 1dd07a4b6d..3d906e7e05 100644 --- a/include/boost/config/compiler/metrowerks.hpp +++ b/include/boost/config/compiler/metrowerks.hpp @@ -48,7 +48,7 @@ # define BOOST_NO_INTRINSIC_WCHAR_T #endif -#if !__option(exceptions) +#if !__option(exceptions) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif diff --git a/include/boost/config/compiler/nvcc.hpp b/include/boost/config/compiler/nvcc.hpp index 11b2afeb3e..fb0af4d3d7 100644 --- a/include/boost/config/compiler/nvcc.hpp +++ b/include/boost/config/compiler/nvcc.hpp @@ -66,6 +66,7 @@ #define BOOST_NO_0X_HDR_TYPE_TRAITS #define BOOST_NO_0X_HDR_TUPLE #define BOOST_NO_0X_HDR_THREAD +#define BOOST_NO_0X_HDR_TYPEINDEX #define BOOST_NO_0X_HDR_SYSTEM_ERROR #define BOOST_NO_0X_HDR_REGEX #define BOOST_NO_0X_HDR_RATIO diff --git a/include/boost/config/compiler/sunpro_cc.hpp b/include/boost/config/compiler/sunpro_cc.hpp index 032966c642..1d6520a25c 100644 --- a/include/boost/config/compiler/sunpro_cc.hpp +++ b/include/boost/config/compiler/sunpro_cc.hpp @@ -69,6 +69,25 @@ # define BOOST_NO_IS_ABSTRACT # endif +# if (__SUNPRO_CC <= 0x5100) + // Sun 5.10 may not correctly value-initialize objects of + // some user defined types, as was reported in April 2010 + // (CR 6947016), and confirmed by Steve Clamage. + // (Niels Dekker, LKEB, May 2010). +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +# endif + +// +// Dynamic shared object (DSO) and dynamic-link library (DLL) support +// +#if __SUNPRO_CC > 0x500 +# define BOOST_SYMBOL_EXPORT __global +# define BOOST_SYMBOL_IMPORT __global +# define BOOST_SYMBOL_VISIBLE __global +#endif + + + // // Issues that effect all known versions: // @@ -78,12 +97,7 @@ // // C++0x features // - -#if(__SUNPRO_CC >= 0x590) # define BOOST_HAS_LONG_LONG -#else -# define BOOST_NO_LONG_LONG -#endif #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS diff --git a/include/boost/config/compiler/vacpp.hpp b/include/boost/config/compiler/vacpp.hpp index 13f99b3f92..e8712ca815 100644 --- a/include/boost/config/compiler/vacpp.hpp +++ b/include/boost/config/compiler/vacpp.hpp @@ -30,6 +30,14 @@ # define BOOST_NO_INITIALIZER_LISTS #endif +#if (__IBMCPP__ <= 1110) +// XL C++ V11.1 and earlier versions may not always value-initialize +// a temporary object T(), when T is a non-POD aggregate class type. +// Michael Wong (IBM Canada Ltd) has confirmed this issue and gave it +// high priority. -- Niels Dekker (LKEB), May 2010. +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#endif + // // On AIX thread support seems to be indicated by _THREAD_SAFE: // diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index f13aa3d06c..9a9e21eaf4 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -79,6 +79,8 @@ // although a conforming signature for swprint exists in VC7.1 // it appears not to actually work: # define BOOST_NO_SWPRINTF +// Our extern template tests also fail for this compiler: +# define BOOST_NO_EXTERN_TEMPLATE #endif #if defined(UNDER_CE) @@ -99,6 +101,24 @@ # define BOOST_NO_ADL_BARRIER #endif + +#if (_MSC_VER <= 1600) +// MSVC (including the latest checked version) has not yet completely +// implemented value-initialization, as is reported: +// "VC++ does not value-initialize members of derived classes without +// user-declared constructor", reported in 2009 by Sylvester Hesp: +// https://connect.microsoft.com/VisualStudio/feedback/details/484295 +// "Presence of copy constructor breaks member class initialization", +// reported in 2009 by Alex Vakulenko: +// https://connect.microsoft.com/VisualStudio/feedback/details/499606 +// "Value-initialization in new-expression", reported in 2005 by +// Pavel Kuznetsov (MetaCommunications Engineering): +// https://connect.microsoft.com/VisualStudio/feedback/details/100744 +// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues +// (Niels Dekker, LKEB, May 2010) +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#endif + #if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 # define BOOST_NO_INITIALIZER_LISTS #endif @@ -115,7 +135,7 @@ // // check for exception handling support: -#ifndef _CPPUNWIND +#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif @@ -144,11 +164,6 @@ # define BOOST_NO_RTTI #endif -// -// all versions support __declspec: -// -#define BOOST_HAS_DECLSPEC - // // C++0x features // @@ -159,11 +174,14 @@ #if _MSC_VER < 1600 #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_DECLTYPE #define BOOST_NO_LAMBDAS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_NULLPTR #endif // _MSC_VER < 1600 +#if _MSC_VER >= 1600 +#define BOOST_HAS_STDINT_H +#endif // C++0x features not supported by any versions #define BOOST_NO_CHAR16_T @@ -171,19 +189,17 @@ #define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DECLTYPE #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES - // // prefix and suffix headers: // diff --git a/include/boost/config/platform/cygwin.hpp b/include/boost/config/platform/cygwin.hpp index 514ad25be8..06f778ff8f 100644 --- a/include/boost/config/platform/cygwin.hpp +++ b/include/boost/config/platform/cygwin.hpp @@ -8,9 +8,6 @@ // cygwin specific config options: #define BOOST_PLATFORM "Cygwin" -#define BOOST_NO_CWCTYPE -#define BOOST_NO_CWCHAR -#define BOOST_NO_SWPRINTF #define BOOST_HAS_DIRENT_H #define BOOST_HAS_LOG1P #define BOOST_HAS_EXPM1 diff --git a/include/boost/config/platform/win32.hpp b/include/boost/config/platform/win32.hpp index d18b68918d..e9c9e95c77 100644 --- a/include/boost/config/platform/win32.hpp +++ b/include/boost/config/platform/win32.hpp @@ -21,10 +21,17 @@ # define BOOST_NO_SWPRINTF #endif -#if !defined(__GNUC__) && !defined(BOOST_HAS_DECLSPEC) +// Default defines for BOOST_SYMBOL_EXPORT and BOOST_SYMBOL_IMPORT +// If a compiler doesn't support __declspec(dllexport)/__declspec(dllimport), +// its boost/config/compiler/ file must define BOOST_SYMBOL_EXPORT and +// BOOST_SYMBOL_IMPORT +#ifndef BOOST_SYMBOL_EXPORT # define BOOST_HAS_DECLSPEC +# define BOOST_SYMBOL_EXPORT __declspec(dllexport) +# define BOOST_SYMBOL_IMPORT __declspec(dllimport) #endif + #if defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 2) || ((__MINGW32_MAJOR_VERSION == 2) && (__MINGW32_MINOR_VERSION >= 0))) # define BOOST_HAS_STDINT_H # define __STDC_LIMIT_MACROS diff --git a/include/boost/config/select_compiler_config.hpp b/include/boost/config/select_compiler_config.hpp index 24780c3463..e957dd11f4 100644 --- a/include/boost/config/select_compiler_config.hpp +++ b/include/boost/config/select_compiler_config.hpp @@ -15,6 +15,7 @@ // compilers we support: # define BOOST_CXX_GCCXML 0 +# define BOOST_CXX_CLANG 0 # define BOOST_CXX_COMO 0 # define BOOST_CXX_DMC 0 # define BOOST_CXX_INTEL 0 @@ -49,6 +50,10 @@ // Comeau C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp" +#elif defined __clang__ +// Clang C++ emulates GCC, so it has to appear early. +# define BOOST_COMPILER_CONFIG "boost/config/compiler/clang.hpp" + #elif defined __DMC__ // Digital Mars C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/digitalmars.hpp" diff --git a/include/boost/config/stdlib/dinkumware.hpp b/include/boost/config/stdlib/dinkumware.hpp index d0f984cfc0..17d4dccd4b 100644 --- a/include/boost/config/stdlib/dinkumware.hpp +++ b/include/boost/config/stdlib/dinkumware.hpp @@ -86,6 +86,11 @@ # define BOOST_NO_STD_LOCALE #endif +#include +#if !_HAS_EXCEPTIONS +# define BOOST_NO_STD_TYPEINFO +#endif + // C++0x headers implemented in 520 (as shipped by Microsoft) // #if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 @@ -100,6 +105,12 @@ # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPEINDEX +#endif + +#if !defined(_HAS_TR1_IMPORTS) && !defined(BOOST_NO_0X_HDR_TUPLE) +# define BOOST_NO_0X_HDR_TUPLE #endif // C++0x headers not yet implemented @@ -114,7 +125,6 @@ # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER diff --git a/include/boost/config/stdlib/libcomo.hpp b/include/boost/config/stdlib/libcomo.hpp index c6a1b52f49..eed3dbf710 100644 --- a/include/boost/config/stdlib/libcomo.hpp +++ b/include/boost/config/stdlib/libcomo.hpp @@ -54,6 +54,7 @@ # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_0X_HDR_TYPEINDEX # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET diff --git a/include/boost/config/stdlib/libstdcpp3.hpp b/include/boost/config/stdlib/libstdcpp3.hpp index 340e866a6c..2d4e33fdb3 100644 --- a/include/boost/config/stdlib/libstdcpp3.hpp +++ b/include/boost/config/stdlib/libstdcpp3.hpp @@ -123,5 +123,6 @@ # define BOOST_NO_0X_HDR_FUTURE # define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS # define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_TYPEINDEX // --- end --- diff --git a/include/boost/config/stdlib/modena.hpp b/include/boost/config/stdlib/modena.hpp index c614dcf441..2699e0b147 100644 --- a/include/boost/config/stdlib/modena.hpp +++ b/include/boost/config/stdlib/modena.hpp @@ -43,6 +43,7 @@ # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_0X_HDR_TYPEINDEX # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET diff --git a/include/boost/config/stdlib/msl.hpp b/include/boost/config/stdlib/msl.hpp index c3322267aa..edc1040732 100644 --- a/include/boost/config/stdlib/msl.hpp +++ b/include/boost/config/stdlib/msl.hpp @@ -67,6 +67,7 @@ # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_0X_HDR_TYPEINDEX # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET diff --git a/include/boost/config/stdlib/roguewave.hpp b/include/boost/config/stdlib/roguewave.hpp index 3fbc618008..cbbb9f2be5 100644 --- a/include/boost/config/stdlib/roguewave.hpp +++ b/include/boost/config/stdlib/roguewave.hpp @@ -173,6 +173,7 @@ # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_0X_HDR_TYPEINDEX # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET diff --git a/include/boost/config/stdlib/sgi.hpp b/include/boost/config/stdlib/sgi.hpp index 3fcd5433ff..10731a167d 100644 --- a/include/boost/config/stdlib/sgi.hpp +++ b/include/boost/config/stdlib/sgi.hpp @@ -126,6 +126,7 @@ # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_0X_HDR_TYPEINDEX # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET diff --git a/include/boost/config/stdlib/stlport.hpp b/include/boost/config/stdlib/stlport.hpp index 10bc1e4545..a9669533e0 100644 --- a/include/boost/config/stdlib/stlport.hpp +++ b/include/boost/config/stdlib/stlport.hpp @@ -221,6 +221,7 @@ namespace boost { using std::min; using std::max; } # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_0X_HDR_TYPEINDEX # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET diff --git a/include/boost/config/stdlib/vacpp.hpp b/include/boost/config/stdlib/vacpp.hpp index 38a9773680..0a054f8e5c 100644 --- a/include/boost/config/stdlib/vacpp.hpp +++ b/include/boost/config/stdlib/vacpp.hpp @@ -33,6 +33,7 @@ # define BOOST_NO_0X_HDR_THREAD # define BOOST_NO_0X_HDR_TUPLE # define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_0X_HDR_TYPEINDEX # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET diff --git a/include/boost/config/suffix.hpp b/include/boost/config/suffix.hpp index df19a4d6ae..2af781f403 100644 --- a/include/boost/config/suffix.hpp +++ b/include/boost/config/suffix.hpp @@ -25,6 +25,19 @@ #ifndef BOOST_CONFIG_SUFFIX_HPP #define BOOST_CONFIG_SUFFIX_HPP +// +// ensure that visibility macros are always defined, thus symplifying use +// +#ifndef BOOST_SYMBOL_EXPORT +# define BOOST_SYMBOL_EXPORT +#endif +#ifndef BOOST_SYMBOL_IMPORT +# define BOOST_SYMBOL_IMPORT +#endif +#ifndef BOOST_SYMBOL_VISIBLE +# define BOOST_SYMBOL_VISIBLE +#endif + // // look for long long by looking for the appropriate macros in . // Note that we use limits.h rather than climits for maximal portability, @@ -82,6 +95,13 @@ # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS #endif +// +// Normalize BOOST_NO_STATIC_ASSERT and (depricated) BOOST_HAS_STATIC_ASSERT: +// +#if !defined(BOOST_NO_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT) +# define BOOST_HAS_STATIC_ASSERT +#endif + // // if there is no __int64 then there is no specialisation // for numeric_limits<__int64> either: @@ -314,6 +334,13 @@ # define BOOST_NO_INITIALIZER_LISTS #endif +// +// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined +// +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) +#define BOOST_HAS_RVALUE_REFS +#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: @@ -554,6 +581,12 @@ namespace boost{ #endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +// When BOOST_NO_STD_TYPEINFO is defined, we can just import +// the global definition into std namespace: +#ifdef BOOST_NO_STD_TYPEINFO +#include +namespace std{ using ::typeinfo; } +#endif // ---------------------------------------------------------------------------// diff --git a/include/boost/detail/endian.hpp b/include/boost/detail/endian.hpp index 1a6a8a1430..ecdf93b744 100644 --- a/include/boost/detail/endian.hpp +++ b/include/boost/detail/endian.hpp @@ -1,5 +1,6 @@ // Copyright 2005 Caleb Epstein // Copyright 2006 John Maddock +// Copyright 2010 Rene Rivera // Distributed under the Boost Software License, Version 1.0. (See accompany- // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -42,10 +43,12 @@ # error Unknown machine endianness detected. # endif # define BOOST_BYTE_ORDER __BYTE_ORDER -#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) +#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) || \ + defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) # define BOOST_BIG_ENDIAN # define BOOST_BYTE_ORDER 4321 -#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) || \ + defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) # define BOOST_LITTLE_ENDIAN # define BOOST_BYTE_ORDER 1234 #elif defined(__sparc) || defined(__sparc__) \ diff --git a/include/boost/detail/none_t.hpp b/include/boost/detail/none_t.hpp index e48bd36059..cc98a39526 100644 --- a/include/boost/detail/none_t.hpp +++ b/include/boost/detail/none_t.hpp @@ -4,7 +4,7 @@ // 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. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/include/boost/detail/sp_typeinfo.hpp b/include/boost/detail/sp_typeinfo.hpp index 95318b8a63..c8db66d14c 100644 --- a/include/boost/detail/sp_typeinfo.hpp +++ b/include/boost/detail/sp_typeinfo.hpp @@ -74,7 +74,7 @@ template struct sp_typeid_ } }; -template sp_typeinfo sp_typeid_< T >::ti_( sp_typeid_< T >::name() ); +template sp_typeinfo sp_typeid_< T >::ti_ = sp_typeid_< T >::name(); template struct sp_typeid_< T & >: sp_typeid_< T > { diff --git a/include/boost/detail/workaround.hpp b/include/boost/detail/workaround.hpp index 87011dee45..92cf7c1bb0 100644 --- a/include/boost/detail/workaround.hpp +++ b/include/boost/detail/workaround.hpp @@ -65,6 +65,11 @@ #else #define BOOST_MSVC_WORKAROUND_GUARD 0 #endif +#ifndef BOOST_MSVC_FULL_VER +#define BOOST_MSVC_FULL_VER_WORKAROUND_GUARD 1 +#else +#define BOOST_MSVC_FULL_VER_WORKAROUND_GUARD 0 +#endif #ifndef __GNUC__ #define __GNUC___WORKAROUND_GUARD 1 #else diff --git a/include/boost/foreach.hpp b/include/boost/foreach.hpp index 1bd1f6742f..6bbc3a9993 100644 --- a/include/boost/foreach.hpp +++ b/include/boost/foreach.hpp @@ -31,8 +31,9 @@ // Some compilers let us detect even const-qualified rvalues at compile-time #if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ - || (BOOST_WORKAROUND(__GNUC__, >= 4) && !defined(BOOST_INTEL)) \ - || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL)) + || (BOOST_WORKAROUND(__GNUC__, >= 4) && !defined(BOOST_INTEL) && !defined(BOOST_CLANG)) \ + || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL) && \ + !defined(BOOST_CLANG)) # define BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION #else // Some compilers allow temporaries to be bound to non-const references. @@ -41,7 +42,7 @@ # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ || BOOST_WORKAROUND(__BORLANDC__, < 0x593) \ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ - || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x570)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) \ || BOOST_WORKAROUND(__DECCXX_VER, <= 60590042) # define BOOST_FOREACH_NO_RVALUE_DETECTION # endif @@ -56,6 +57,7 @@ || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 3) && defined(__APPLE_CC__)) \ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, >= 0x5100) \ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) # define BOOST_FOREACH_NO_CONST_RVALUE_DETECTION # else @@ -80,6 +82,7 @@ #include #include #include +#include #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION # include @@ -88,12 +91,6 @@ # include #endif -// This must be at global scope, hence the uglified name -enum boost_foreach_argument_dependent_lookup_hack -{ - boost_foreach_argument_dependent_lookup_hack_value -}; - namespace boost { @@ -116,11 +113,6 @@ namespace foreach return std::make_pair(begin, end); } - /////////////////////////////////////////////////////////////////////////////// - // boost::foreach::tag - // - typedef boost_foreach_argument_dependent_lookup_hack tag; - /////////////////////////////////////////////////////////////////////////////// // boost::foreach::is_lightweight_proxy // Specialize this for user-defined collection types if they are inexpensive to copy. @@ -705,7 +697,7 @@ end(auto_any_t col, type2type *, bool *) #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template inline auto_any -end(auto_any_t col, type2type *, boost::mpl::true_ *) // null-terminated C-style strings +end(auto_any_t, type2type *, boost::mpl::true_ *) // null-terminated C-style strings { return 0; // not used } diff --git a/include/boost/foreach_fwd.hpp b/include/boost/foreach_fwd.hpp new file mode 100644 index 0000000000..5b7bee4a90 --- /dev/null +++ b/include/boost/foreach_fwd.hpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////// +// foreach.hpp header file +// +// Copyright 2010 Eric Niebler. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// See http://www.boost.org/libs/foreach for documentation +// +// Credits: +// Kazutoshi Satoda: for suggesting the need for a _fwd header for foreach's +// customization points. + +#ifndef BOOST_FOREACH_FWD_HPP +#define BOOST_FOREACH_FWD_HPP + +// This must be at global scope, hence the uglified name +enum boost_foreach_argument_dependent_lookup_hack +{ + boost_foreach_argument_dependent_lookup_hack_value +}; + +namespace boost +{ + +namespace foreach +{ + /////////////////////////////////////////////////////////////////////////////// + // boost::foreach::tag + // + typedef boost_foreach_argument_dependent_lookup_hack tag; + + /////////////////////////////////////////////////////////////////////////////// + // boost::foreach::is_lightweight_proxy + // Specialize this for user-defined collection types if they are inexpensive to copy. + // This tells BOOST_FOREACH it can avoid the rvalue/lvalue detection stuff. + template + struct is_lightweight_proxy; + + /////////////////////////////////////////////////////////////////////////////// + // boost::foreach::is_noncopyable + // Specialize this for user-defined collection types if they cannot be copied. + // This also tells BOOST_FOREACH to avoid the rvalue/lvalue detection stuff. + template + struct is_noncopyable; + +} // namespace foreach + +} // namespace boost + +#endif diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index ce168cd232..a04a2e63ce 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -7,7 +7,6 @@ #ifndef BOOST_TRANSFORM_ITERATOR_23022003THW_HPP #define BOOST_TRANSFORM_ITERATOR_23022003THW_HPP -#include #include #include #include diff --git a/include/boost/mpl/aux_/config/has_xxx.hpp b/include/boost/mpl/aux_/config/has_xxx.hpp index 4193b0ea16..fe25a4b49c 100644 --- a/include/boost/mpl/aux_/config/has_xxx.hpp +++ b/include/boost/mpl/aux_/config/has_xxx.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: has_xxx.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49267 $ +// $Id: has_xxx.hpp 63518 2010-07-02 08:32:03Z agurtovoy $ +// $Date: 2010-07-02 04:32:03 -0400 (Fri, 02 Jul 2010) $ +// $Revision: 63518 $ #include #include @@ -27,6 +27,7 @@ ) # define BOOST_MPL_CFG_NO_HAS_XXX +# define BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE #endif diff --git a/include/boost/mpl/bitand.hpp b/include/boost/mpl/bitand.hpp index 561f6331fb..2c3375d1be 100644 --- a/include/boost/mpl/bitand.hpp +++ b/include/boost/mpl/bitand.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_BITAND_HPP_INCLUDED #define BOOST_MPL_BITAND_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2009 // Copyright Jaap Suter 2003 // // Distributed under the Boost Software License, Version 1.0. @@ -11,13 +11,35 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: bitand.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49267 $ +// $Id: bitand.hpp 63520 2010-07-02 08:59:55Z agurtovoy $ +// $Date: 2010-07-02 04:59:55 -0400 (Fri, 02 Jul 2010) $ +// $Revision: 63520 $ + +// agurt, 23/jan/10: workaround a conflict with header's +// macros, see http://tinyurl.com/ycwdxco; 'defined(bitand)' +// has to be checked in a separate condition, otherwise GCC complains +// about 'bitand' being an alternative token +#if defined(_MSC_VER) +#ifndef __GCCXML__ +#if defined(bitand) +# pragma push_macro("bitand") +# undef bitand +# define bitand(x) +#endif +#endif +#endif #define AUX778076_OP_NAME bitand_ #define AUX778076_OP_PREFIX bitand #define AUX778076_OP_TOKEN & #include +#if defined(_MSC_VER) +#ifndef __GCCXML__ +#if defined(bitand) +# pragma pop_macro("bitand") +#endif +#endif +#endif + #endif // BOOST_MPL_BITAND_HPP_INCLUDED diff --git a/include/boost/mpl/bitor.hpp b/include/boost/mpl/bitor.hpp index 6070981ed8..bb7904133c 100644 --- a/include/boost/mpl/bitor.hpp +++ b/include/boost/mpl/bitor.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_BITOR_HPP_INCLUDED #define BOOST_MPL_BITOR_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2009 // Copyright Jaap Suter 2003 // // Distributed under the Boost Software License, Version 1.0. @@ -11,13 +11,35 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: bitor.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49267 $ +// $Id: bitor.hpp 63520 2010-07-02 08:59:55Z agurtovoy $ +// $Date: 2010-07-02 04:59:55 -0400 (Fri, 02 Jul 2010) $ +// $Revision: 63520 $ + +// agurt, 23/jan/10: workaround a conflict with header's +// macros, see http://tinyurl.com/ycwdxco; 'defined(bitor)' +// has to be checked in a separate condition, otherwise GCC complains +// about 'bitor' being an alternative token +#if defined(_MSC_VER) +#ifndef __GCCXML__ +#if defined(bitor) +# pragma push_macro("bitor") +# undef bitor +# define bitor(x) +#endif +#endif +#endif #define AUX778076_OP_NAME bitor_ #define AUX778076_OP_PREFIX bitor #define AUX778076_OP_TOKEN | #include +#if defined(_MSC_VER) +#ifndef __GCCXML__ +#if defined(bitor) +# pragma pop_macro("bitor") +#endif +#endif +#endif + #endif // BOOST_MPL_BITOR_HPP_INCLUDED diff --git a/include/boost/mpl/eval_if.hpp b/include/boost/mpl/eval_if.hpp index f5f8a5539c..d257dd3f5d 100644 --- a/include/boost/mpl/eval_if.hpp +++ b/include/boost/mpl/eval_if.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: eval_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49267 $ +// $Id: eval_if.hpp 61921 2010-05-11 21:33:24Z neilgroves $ +// $Date: 2010-05-11 17:33:24 -0400 (Tue, 11 May 2010) $ +// $Revision: 61921 $ #include #include diff --git a/include/boost/mpl/has_xxx.hpp b/include/boost/mpl/has_xxx.hpp index 79f2ebfd5e..3f596485f8 100644 --- a/include/boost/mpl/has_xxx.hpp +++ b/include/boost/mpl/has_xxx.hpp @@ -4,6 +4,7 @@ // Copyright Aleksey Gurtovoy 2002-2006 // Copyright David Abrahams 2002-2003 +// Copyright Daniel Walker 2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -11,20 +12,26 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: has_xxx.hpp 49273 2008-10-11 06:54:06Z agurtovoy $ -// $Date: 2008-10-11 02:54:06 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49273 $ +// $Id: has_xxx.hpp 64146 2010-07-19 00:46:31Z djwalker $ +// $Date: 2010-07-18 20:46:31 -0400 (Sun, 18 Jul 2010) $ +// $Revision: 64146 $ #include +#include #include #include +#include #include #include #include #include #include +#include #include +#include +#include +#include #if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x590) ) # include @@ -271,4 +278,363 @@ struct trait \ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(BOOST_PP_CAT(has_,name), name, false) \ /**/ + +#if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE) + +// Create a boolean Metafunction to detect a nested template +// member. This implementation is based on a USENET newsgroup's +// posting by Aleksey Gurtovoy (comp.lang.c++.moderated, 2002-03-19), +// Rani Sharoni's USENET posting cited above, the non-template has_xxx +// implementations above, and discussion on the Boost mailing list. + +# if !defined(BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES) +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) +# define BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES 1 +# endif +# endif + +# if !defined(BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION) +# if (defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS)) +# define BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION 1 +# endif +# endif + +# if !defined(BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE) +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) +# define BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE 1 +# endif +# endif + +// NOTE: Many internal implementation macros take a Boost.Preprocessor +// array argument called args which is of the following form. +// ( 4, ( trait, name, max_arity, default_ ) ) + +# define BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) \ + BOOST_PP_CAT(BOOST_PP_ARRAY_ELEM(0, args) , _introspect) \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME(args, n) \ + BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_ARRAY_ELEM(0, args) , _substitute), n) \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args) \ + BOOST_PP_CAT(BOOST_PP_ARRAY_ELEM(0, args) , _test) \ + /**/ + +// Thanks to Guillaume Melquiond for pointing out the need for the +// "substitute" template as an argument to the overloaded test +// functions to get SFINAE to work for member templates with the +// correct name but different number of arguments. +# define BOOST_MPL_HAS_MEMBER_MULTI_SUBSTITUTE(z, n, args) \ + template< \ + template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), typename V) > class V \ + > \ + struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME(args, n) { \ + }; \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_SUBSTITUTE(args, substitute_macro) \ + BOOST_PP_REPEAT( \ + BOOST_PP_ARRAY_ELEM(2, args) \ + , BOOST_MPL_HAS_MEMBER_MULTI_SUBSTITUTE \ + , args \ + ) \ + /**/ + +# if !BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION +# define BOOST_MPL_HAS_MEMBER_REJECT(args, member_macro) \ + template< typename V > \ + static boost::mpl::aux::no_tag \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)(...); \ + /**/ +# else +# define BOOST_MPL_HAS_MEMBER_REJECT(args, member_macro) \ + static boost::mpl::aux::no_tag \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)(...); \ + /**/ +# endif + +# if !BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES +# define BOOST_MPL_HAS_MEMBER_MULTI_ACCEPT(z, n, args) \ + template< typename V > \ + static boost::mpl::aux::yes_tag \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)( \ + boost::mpl::aux::type_wrapper< V > const volatile* \ + , BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME(args, n) < \ + V::template BOOST_PP_ARRAY_ELEM(1, args) \ + >* = 0 \ + ); \ + /**/ +# define BOOST_MPL_HAS_MEMBER_ACCEPT(args, member_macro) \ + BOOST_PP_REPEAT( \ + BOOST_PP_ARRAY_ELEM(2, args) \ + , BOOST_MPL_HAS_MEMBER_MULTI_ACCEPT \ + , args \ + ) \ + /**/ +# else +# define BOOST_MPL_HAS_MEMBER_ACCEPT(args, member_macro) \ + template< typename V > \ + static boost::mpl::aux::yes_tag \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)( \ + V const volatile* \ + , member_macro(args, V, T)* = 0 \ + ); \ + /**/ +# endif + +# if !BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION +# define BOOST_MPL_HAS_MEMBER_TEST(args) \ + sizeof(BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)< U >(0)) \ + == sizeof(boost::mpl::aux::yes_tag) \ + /**/ +# else +# if !BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES +# define BOOST_MPL_HAS_MEMBER_TEST(args) \ + sizeof( \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)( \ + static_cast< boost::mpl::aux::type_wrapper< U >* >(0) \ + ) \ + ) == sizeof(boost::mpl::aux::yes_tag) \ + /**/ +# else +# define BOOST_MPL_HAS_MEMBER_TEST(args) \ + sizeof( \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)( \ + static_cast< U* >(0) \ + ) \ + ) == sizeof(boost::mpl::aux::yes_tag) \ + /**/ +# endif +# endif + +# define BOOST_MPL_HAS_MEMBER_INTROSPECT( \ + args, substitute_macro, member_macro \ + ) \ + template< typename U > \ + struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) { \ + BOOST_MPL_HAS_MEMBER_SUBSTITUTE(args, substitute_macro) \ + BOOST_MPL_HAS_MEMBER_REJECT(args, member_macro) \ + BOOST_MPL_HAS_MEMBER_ACCEPT(args, member_macro) \ + BOOST_STATIC_CONSTANT( \ + bool, value = BOOST_MPL_HAS_MEMBER_TEST(args) \ + ); \ + typedef boost::mpl::bool_< value > type; \ + }; \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_IMPLEMENTATION( \ + args, introspect_macro, substitute_macro, member_macro \ + ) \ + template< \ + typename T \ + , typename fallback_ \ + = boost::mpl::bool_< BOOST_PP_ARRAY_ELEM(3, args) > \ + > \ + class BOOST_PP_ARRAY_ELEM(0, args) { \ + introspect_macro(args, substitute_macro, member_macro) \ + public: \ + static const bool value \ + = BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args)< T >::value; \ + typedef typename BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args)< \ + T \ + >::type type; \ + }; \ + /**/ + +// BOOST_MPL_HAS_MEMBER_WITH_FUNCTION_SFINAE expands to the full +// implementation of the function-based metafunction. Compile with -E +// to see the preprocessor output for this macro. +# define BOOST_MPL_HAS_MEMBER_WITH_FUNCTION_SFINAE( \ + args, substitute_macro, member_macro \ + ) \ + BOOST_MPL_HAS_MEMBER_IMPLEMENTATION( \ + args \ + , BOOST_MPL_HAS_MEMBER_INTROSPECT \ + , substitute_macro \ + , member_macro \ + ) \ + /**/ + +# if BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE + +# if !defined(BOOST_MPL_HAS_XXX_NEEDS_NAMESPACE_LEVEL_SUBSTITUTE) +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) +# define BOOST_MPL_HAS_XXX_NEEDS_NAMESPACE_LEVEL_SUBSTITUTE 1 +# endif +# endif + +# if !BOOST_MPL_HAS_XXX_NEEDS_NAMESPACE_LEVEL_SUBSTITUTE +# define BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME_WITH_TEMPLATE_SFINAE( \ + args, n \ + ) \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME(args, n) \ + /**/ +# else +# define BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME_WITH_TEMPLATE_SFINAE( \ + args, n \ + ) \ + BOOST_PP_CAT( \ + boost_mpl_has_xxx_ \ + , BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME(args, n) \ + ) \ + /**/ +# endif + +# define BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_TAG_NAME( \ + args \ + ) \ + BOOST_PP_CAT( \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME_WITH_TEMPLATE_SFINAE( \ + args, 0 \ + ) \ + , _tag \ + ) \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_MULTI_SUBSTITUTE_WITH_TEMPLATE_SFINAE( \ + z, n, args \ + ) \ + template< \ + template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n), typename U) > class U \ + > \ + struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME_WITH_TEMPLATE_SFINAE( \ + args, n \ + ) { \ + typedef \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_TAG_NAME(args) \ + type; \ + }; \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_SUBSTITUTE_WITH_TEMPLATE_SFINAE( \ + args, substitute_macro \ + ) \ + typedef void \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_TAG_NAME(args); \ + BOOST_PP_REPEAT( \ + BOOST_PP_ARRAY_ELEM(2, args) \ + , BOOST_MPL_HAS_MEMBER_MULTI_SUBSTITUTE_WITH_TEMPLATE_SFINAE \ + , args \ + ) \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_REJECT_WITH_TEMPLATE_SFINAE( \ + args, member_macro \ + ) \ + template< \ + typename U \ + , typename V \ + = BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_TAG_NAME(args) \ + > \ + struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args) { \ + BOOST_STATIC_CONSTANT(bool, value = false); \ + typedef boost::mpl::bool_< value > type; \ + }; \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_MULTI_ACCEPT_WITH_TEMPLATE_SFINAE( \ + z, n, args \ + ) \ + template< typename U > \ + struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)< \ + U \ + , typename \ + BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME_WITH_TEMPLATE_SFINAE( \ + args, n \ + )< \ + BOOST_MSVC_TYPENAME U::BOOST_PP_ARRAY_ELEM(1, args)< > \ + >::type \ + > { \ + BOOST_STATIC_CONSTANT(bool, value = true); \ + typedef boost::mpl::bool_< value > type; \ + }; \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_ACCEPT_WITH_TEMPLATE_SFINAE( \ + args, member_macro \ + ) \ + BOOST_PP_REPEAT( \ + BOOST_PP_ARRAY_ELEM(2, args) \ + , BOOST_MPL_HAS_MEMBER_MULTI_ACCEPT_WITH_TEMPLATE_SFINAE \ + , args \ + ) \ + /**/ + +# define BOOST_MPL_HAS_MEMBER_INTROSPECT_WITH_TEMPLATE_SFINAE( \ + args, substitute_macro, member_macro \ + ) \ + BOOST_MPL_HAS_MEMBER_REJECT_WITH_TEMPLATE_SFINAE(args, member_macro) \ + BOOST_MPL_HAS_MEMBER_ACCEPT_WITH_TEMPLATE_SFINAE(args, member_macro) \ + template< typename U > \ + struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) \ + : BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)< U > { \ + }; \ + /**/ + +// BOOST_MPL_HAS_MEMBER_WITH_TEMPLATE_SFINAE expands to the full +// implementation of the template-based metafunction. Compile with -E +// to see the preprocessor output for this macro. +// +// Note that if BOOST_MPL_HAS_XXX_NEEDS_NAMESPACE_LEVEL_SUBSTITUTE is +// defined BOOST_MPL_HAS_MEMBER_SUBSTITUTE_WITH_TEMPLATE_SFINAE needs +// to be expanded at namespace level before +// BOOST_MPL_HAS_MEMBER_WITH_TEMPLATE_SFINAE can be used. +# define BOOST_MPL_HAS_MEMBER_WITH_TEMPLATE_SFINAE( \ + args, substitute_macro, member_macro \ + ) \ + BOOST_MPL_HAS_MEMBER_SUBSTITUTE_WITH_TEMPLATE_SFINAE( \ + args, substitute_macro \ + ) \ + BOOST_MPL_HAS_MEMBER_IMPLEMENTATION( \ + args \ + , BOOST_MPL_HAS_MEMBER_INTROSPECT_WITH_TEMPLATE_SFINAE \ + , substitute_macro \ + , member_macro \ + ) \ + /**/ + +# endif // BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE + +// Note: In the current implementation the parameter and access macros +// are no longer expanded. +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400) +# define BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(trait, name, default_) \ + BOOST_MPL_HAS_MEMBER_WITH_FUNCTION_SFINAE( \ + ( 4, ( trait, name, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, default_ ) ) \ + , BOOST_MPL_HAS_MEMBER_TEMPLATE_SUBSTITUTE_PARAMETER \ + , BOOST_MPL_HAS_MEMBER_TEMPLATE_ACCESS \ + ) \ + /**/ +# else +# define BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(trait, name, default_) \ + BOOST_MPL_HAS_MEMBER_WITH_TEMPLATE_SFINAE( \ + ( 4, ( trait, name, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, default_ ) ) \ + , BOOST_MPL_HAS_MEMBER_TEMPLATE_SUBSTITUTE_PARAMETER \ + , BOOST_MPL_HAS_MEMBER_TEMPLATE_ACCESS \ + ) \ + /**/ +# endif + +#else // BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE + +// placeholder implementation + +# define BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(trait, name, default_) \ + template< typename T \ + , typename fallback_ = boost::mpl::bool_< default_ > > \ + struct trait { \ + BOOST_STATIC_CONSTANT(bool, value = fallback_::value); \ + typedef fallback_ type; \ + }; \ + /**/ + +#endif // BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE + +# define BOOST_MPL_HAS_XXX_TEMPLATE_DEF(name) \ + BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF( \ + BOOST_PP_CAT(has_, name), name, false \ + ) \ + /**/ + #endif // BOOST_MPL_HAS_XXX_HPP_INCLUDED diff --git a/include/boost/mpl/string.hpp b/include/boost/mpl/string.hpp index f3b161372f..5fd3559cfe 100644 --- a/include/boost/mpl/string.hpp +++ b/include/boost/mpl/string.hpp @@ -240,6 +240,18 @@ namespace boost { namespace mpl }; }; + template + struct has_push_back_impl; + + template<> + struct has_push_back_impl + { + template + struct apply + : mpl::true_ + {}; + }; + template struct pop_back_impl; @@ -267,6 +279,18 @@ namespace boost { namespace mpl #undef M0 }; + template + struct has_pop_back_impl; + + template<> + struct has_pop_back_impl + { + template + struct apply + : mpl::true_ + {}; + }; + template struct push_front_impl; @@ -341,6 +365,18 @@ namespace boost { namespace mpl }; }; + template + struct has_push_front_impl; + + template<> + struct has_push_front_impl + { + template + struct apply + : mpl::true_ + {}; + }; + template struct pop_front_impl; @@ -375,6 +411,18 @@ namespace boost { namespace mpl }; }; + template + struct has_pop_front_impl; + + template<> + struct has_pop_front_impl + { + template + struct apply + : mpl::true_ + {}; + }; + template struct insert_range_impl; diff --git a/include/boost/range/adaptor/adjacent_filtered.hpp b/include/boost/range/adaptor/adjacent_filtered.hpp index 066ad962ee..10f405fe5a 100644 --- a/include/boost/range/adaptor/adjacent_filtered.hpp +++ b/include/boost/range/adaptor/adjacent_filtered.hpp @@ -27,7 +27,6 @@ namespace boost { - namespace range_detail { template< class Iter, class Pred, bool default_pass > @@ -140,10 +139,14 @@ namespace boost public: adjacent_filter_range( const P& p, R& r ) - : base_range( skip_iter( boost::begin(r), boost::end(r), p), - skip_iter( boost::end(r), boost::end(r), p) ) + : base_range(skip_iter(boost::begin(r), boost::end(r), p), + skip_iter(boost::end(r), boost::end(r), p)) { } + + private: + P m_pred; + R* m_range; }; template< class T > diff --git a/include/boost/range/adaptor/map.hpp b/include/boost/range/adaptor/map.hpp index 7515aef91f..8df558b9c4 100644 --- a/include/boost/range/adaptor/map.hpp +++ b/include/boost/range/adaptor/map.hpp @@ -25,9 +25,9 @@ namespace boost template< class Map > struct select_first { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type& - result_type; + typedef BOOST_DEDUCED_TYPENAME range_value::type pair_t; + typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type& + result_type; result_type operator()( const pair_t& r ) const { @@ -38,8 +38,8 @@ namespace boost template< class Map > struct select_second_mutable { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type; + typedef BOOST_DEDUCED_TYPENAME range_value::type pair_t; + typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type; result_type operator()( pair_t& r ) const { @@ -50,16 +50,16 @@ namespace boost template< class Map > struct select_second_const { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type& - result_type; - + typedef BOOST_DEDUCED_TYPENAME range_value::type pair_t; + typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type& + result_type; + result_type operator()( const pair_t& r ) const { return r.second; } }; - + template class select_first_range : public transform_range< @@ -78,7 +78,7 @@ namespace boost select_first_range(const base& other) : base(other) {} }; - + template class select_second_mutable_range : public transform_range< @@ -97,7 +97,7 @@ namespace boost select_second_mutable_range(const base& other) : base(other) {} }; - + template class select_second_const_range : public transform_range< @@ -116,20 +116,20 @@ namespace boost select_second_const_range(const base& other) : base(other) {} }; - + template< class StdPairRng > - inline select_first_range + inline select_first_range operator|( const StdPairRng& r, map_keys_forwarder ) { - return operator|( r, + return operator|( r, boost::adaptors::transformed( select_first() ) ); } template< class StdPairRng > - inline select_second_mutable_range + inline select_second_mutable_range operator|( StdPairRng& r, map_values_forwarder ) { - return operator|( r, + return operator|( r, boost::adaptors::transformed( select_second_mutable() ) ); } @@ -137,27 +137,27 @@ namespace boost inline select_second_const_range operator|( const StdPairRng& r, map_values_forwarder ) { - return operator|( r, - boost::adaptors::transformed( select_second_const() ) ); + return operator|( r, + boost::adaptors::transformed( select_second_const() ) ); } - + } // 'range_detail' - + using range_detail::select_first_range; using range_detail::select_second_mutable_range; using range_detail::select_second_const_range; namespace adaptors - { + { namespace { - const range_detail::map_keys_forwarder map_keys = + const range_detail::map_keys_forwarder map_keys = range_detail::map_keys_forwarder(); - const range_detail::map_values_forwarder map_values = + const range_detail::map_values_forwarder map_values = range_detail::map_values_forwarder(); } - + template inline select_first_range keys(const StdPairRange& rng) @@ -165,7 +165,7 @@ namespace boost return select_first_range( range_detail::select_first(), rng ); } - + template inline select_second_const_range values(const StdPairRange& rng) @@ -173,7 +173,7 @@ namespace boost return select_second_const_range( range_detail::select_second_const(), rng ); } - + template inline select_second_mutable_range values(StdPairRange& rng) @@ -182,7 +182,7 @@ namespace boost range_detail::select_second_mutable(), rng ); } } // 'adaptors' - + } #endif diff --git a/include/boost/range/adaptor/replaced.hpp b/include/boost/range/adaptor/replaced.hpp index 29e9959620..a533123b99 100644 --- a/include/boost/range/adaptor/replaced.hpp +++ b/include/boost/range/adaptor/replaced.hpp @@ -47,7 +47,7 @@ namespace boost }; template< class R > - class replace_range : + class replaced_range : public boost::iterator_range< boost::transform_iterator< replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, @@ -64,7 +64,7 @@ namespace boost public: typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; - replace_range( R& r, value_type from, value_type to ) + replaced_range( R& r, value_type from, value_type to ) : base_t( make_transform_iterator( boost::begin(r), Fn(from, to) ), make_transform_iterator( boost::end(r), Fn(from, to) ) ) { } @@ -83,23 +83,23 @@ namespace boost }; template< class InputRng > - inline replace_range + inline replaced_range operator|( InputRng& r, const replace_holder::type>& f ) { - return replace_range(r, f.val1, f.val2); + return replaced_range(r, f.val1, f.val2); } template< class InputRng > - inline replace_range + inline replaced_range operator|( const InputRng& r, const replace_holder::type>& f ) { - return replace_range(r, f.val1, f.val2); + return replaced_range(r, f.val1, f.val2); } } // 'range_detail' - using range_detail::replace_range; + using range_detail::replaced_range; namespace adaptors { @@ -111,21 +111,21 @@ namespace boost } template - inline replace_range + inline replaced_range replace(InputRange& rng, BOOST_DEDUCED_TYPENAME range_value::type from, BOOST_DEDUCED_TYPENAME range_value::type to) { - return replace_range(rng, from, to); + return replaced_range(rng, from, to); } template - inline replace_range + inline replaced_range replace(const InputRange& rng, BOOST_DEDUCED_TYPENAME range_value::type from, BOOST_DEDUCED_TYPENAME range_value::type to) { - return replace_range(rng, from ,to); + return replaced_range(rng, from ,to); } } // 'adaptors' diff --git a/include/boost/range/adaptor/sliced.hpp b/include/boost/range/adaptor/sliced.hpp index f8fceaf3f3..6a35d53960 100644 --- a/include/boost/range/adaptor/sliced.hpp +++ b/include/boost/range/adaptor/sliced.hpp @@ -28,14 +28,26 @@ namespace boost }; template< class RandomAccessRange > - inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > + class sliced_range : public boost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > + { + typedef boost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > base_t; + public: + template + sliced_range(Rng& rng, T t, U u) + : base_t(boost::make_iterator_range(rng, t, u - boost::size(rng))) + { + } + }; + + template< class RandomAccessRange > + inline sliced_range slice( RandomAccessRange& rng, std::size_t t, std::size_t u ) { BOOST_ASSERT( t <= u && "error in slice indices" ); BOOST_ASSERT( static_cast(boost::size(rng)) >= u && "second slice index out of bounds" ); - return boost::make_iterator_range( rng, t, u - boost::size(rng) ); + return sliced_range(rng, t, u); } template< class RandomAccessRange > @@ -46,23 +58,21 @@ namespace boost BOOST_ASSERT( static_cast(boost::size(rng)) >= u && "second slice index out of bounds" ); - return boost::make_iterator_range( rng, t, u - boost::size(rng) ); + return sliced_range(rng, t, u); } template< class RandomAccessRange > - inline iterator_range< - BOOST_DEDUCED_TYPENAME range_iterator::type > + inline sliced_range operator|( RandomAccessRange& r, const sliced& f ) { - return adaptors::slice( r, f.t, f.u ); + return sliced_range( r, f.t, f.u ); } template< class RandomAccessRange > - inline iterator_range< - BOOST_DEDUCED_TYPENAME range_iterator::type > + inline sliced_range operator|( const RandomAccessRange& r, const sliced& f ) { - return adaptors::slice( r, f.t, f.u ); + return sliced_range( r, f.t, f.u ); } } // namespace adaptors diff --git a/include/boost/range/algorithm/copy.hpp b/include/boost/range/algorithm/copy.hpp index 26aab826c0..b46741841d 100644 --- a/include/boost/range/algorithm/copy.hpp +++ b/include/boost/range/algorithm/copy.hpp @@ -30,7 +30,7 @@ namespace boost template< class SinglePassRange, class OutputIterator > inline OutputIterator copy(const SinglePassRange& rng, OutputIterator out) { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::copy(boost::begin(rng),boost::end(rng),out); } diff --git a/include/boost/range/algorithm/copy_backward.hpp b/include/boost/range/algorithm/copy_backward.hpp index 57dfbe9d49..79a5d311ea 100644 --- a/include/boost/range/algorithm/copy_backward.hpp +++ b/include/boost/range/algorithm/copy_backward.hpp @@ -32,7 +32,7 @@ inline BidirectionalTraversalWriteableIterator copy_backward(const BidirectionalRange& rng, BidirectionalTraversalWriteableIterator out) { - BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); return std::copy_backward(boost::begin(rng), boost::end(rng), out); } diff --git a/include/boost/range/algorithm/equal.hpp b/include/boost/range/algorithm/equal.hpp index 210e515ccf..0cb332472a 100644 --- a/include/boost/range/algorithm/equal.hpp +++ b/include/boost/range/algorithm/equal.hpp @@ -159,8 +159,8 @@ namespace boost template< class SinglePassRange1, class SinglePassRange2 > inline bool equal( const SinglePassRange1& rng1, const SinglePassRange2& rng2 ) { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return ::boost::range_detail::equal( ::boost::begin(rng1), ::boost::end(rng1), @@ -172,8 +172,8 @@ namespace boost inline bool equal( const SinglePassRange1& rng1, const SinglePassRange2& rng2, BinaryPredicate pred ) { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return ::boost::range_detail::equal( ::boost::begin(rng1), ::boost::end(rng1), diff --git a/include/boost/range/algorithm/fill.hpp b/include/boost/range/algorithm/fill.hpp index 37357b2b59..b3c3271044 100644 --- a/include/boost/range/algorithm/fill.hpp +++ b/include/boost/range/algorithm/fill.hpp @@ -33,6 +33,15 @@ inline ForwardRange& fill(ForwardRange& rng, const Value& val) return rng; } +/// \overload +template< class ForwardRange, class Value > +inline const ForwardRange& fill(const ForwardRange& rng, const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::fill(boost::begin(rng), boost::end(rng), val); + return rng; +} + } // namespace range using range::fill; } diff --git a/include/boost/range/algorithm/fill_n.hpp b/include/boost/range/algorithm/fill_n.hpp index 262dd71460..4c78e9379e 100644 --- a/include/boost/range/algorithm/fill_n.hpp +++ b/include/boost/range/algorithm/fill_n.hpp @@ -36,6 +36,16 @@ inline ForwardRange& fill_n(ForwardRange& rng, Size n, const Value& val) return rng; } +/// \overload +template< class ForwardRange, class Size, class Value > +inline const ForwardRange& fill_n(const ForwardRange& rng, Size n, const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_ASSERT( static_cast(std::distance(boost::begin(rng), boost::end(rng))) >= n ); + std::fill_n(boost::begin(rng), n, val); + return rng; +} + } // namespace range using range::fill_n; } // namespace boost diff --git a/include/boost/range/algorithm/find.hpp b/include/boost/range/algorithm/find.hpp index 0eb162044b..01a8d63147 100644 --- a/include/boost/range/algorithm/find.hpp +++ b/include/boost/range/algorithm/find.hpp @@ -27,18 +27,33 @@ namespace boost /// /// \pre SinglePassRange is a model of the SinglePassRangeConcept template< class SinglePassRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find( SinglePassRange& rng, const Value& val ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::find(boost::begin(rng), boost::end(rng), val); } +/// \overload +template< class SinglePassRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find( const SinglePassRange& rng, const Value& val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::find(boost::begin(rng), boost::end(rng), val); +} + // range_return overloads /// \overload template< range_return_value re, class SinglePassRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find( SinglePassRange& rng, const Value& val ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -47,6 +62,17 @@ find( SinglePassRange& rng, const Value& val ) rng); } +/// \overload +template< range_return_value re, class SinglePassRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_return::type +find( const SinglePassRange& rng, const Value& val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return range_return:: + pack(std::find(boost::begin(rng), boost::end(rng), val), + rng); +} + } // namespace range using range::find; } diff --git a/include/boost/range/algorithm/find_end.hpp b/include/boost/range/algorithm/find_end.hpp index ef9cdc9fed..62a10f77f6 100644 --- a/include/boost/range/algorithm/find_end.hpp +++ b/include/boost/range/algorithm/find_end.hpp @@ -29,7 +29,10 @@ namespace boost /// \pre ForwardRange2 is a model of the ForwardRangeConcept /// \pre BinaryPredicate is a model of the BinaryPredicateConcept template< class ForwardRange1, class ForwardRange2 > -inline BOOST_DEDUCED_TYPENAME range_iterator< ForwardRange1 >::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator< ForwardRange1 >::type +>::type find_end(ForwardRange1 & rng1, const ForwardRange2& rng2) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -39,9 +42,24 @@ find_end(ForwardRange1 & rng1, const ForwardRange2& rng2) boost::begin(rng2),boost::end(rng2)); } +/// \overload +template< class ForwardRange1, class ForwardRange2 > +inline BOOST_DEDUCED_TYPENAME range_iterator< const ForwardRange1 >::type +find_end(const ForwardRange1 & rng1, const ForwardRange2& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return std::find_end(boost::begin(rng1),boost::end(rng1), + boost::begin(rng2),boost::end(rng2)); +} + /// \overload template< class ForwardRange1, class ForwardRange2, class BinaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find_end(ForwardRange1 & rng1, const ForwardRange2& rng2, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -51,9 +69,24 @@ find_end(ForwardRange1 & rng1, const ForwardRange2& rng2, BinaryPredicate pred) boost::begin(rng2),boost::end(rng2),pred); } +/// \overload +template< class ForwardRange1, class ForwardRange2, class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find_end(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return std::find_end(boost::begin(rng1),boost::end(rng1), + boost::begin(rng2),boost::end(rng2),pred); +} + /// \overload template< range_return_value re, class ForwardRange1, class ForwardRange2 > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_end(ForwardRange1& rng1, const ForwardRange2& rng2) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -65,10 +98,27 @@ find_end(ForwardRange1& rng1, const ForwardRange2& rng2) rng1); } +/// \overload +template< range_return_value re, class ForwardRange1, class ForwardRange2 > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_end(const ForwardRange1& rng1, const ForwardRange2& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return range_return:: + pack(std::find_end(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2)), + rng1); +} + /// \overload template< range_return_value re, class ForwardRange1, class ForwardRange2, class BinaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -80,6 +130,21 @@ find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) rng1); } +/// \overload +template< range_return_value re, class ForwardRange1, class ForwardRange2, + class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_end(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return range_return:: + pack(std::find_end(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2), pred), + rng1); +} + } // namespace range using range::find_end; } // namespace boost diff --git a/include/boost/range/algorithm/find_first_of.hpp b/include/boost/range/algorithm/find_first_of.hpp index 724fb4e9d8..33813b4545 100644 --- a/include/boost/range/algorithm/find_first_of.hpp +++ b/include/boost/range/algorithm/find_first_of.hpp @@ -29,7 +29,10 @@ namespace boost /// \pre ForwardRange2 is a model of the ForwardRangeConcept /// \pre BinaryPredicate is a model of the BinaryPredicateConcept template< class SinglePassRange1, class ForwardRange2 > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -39,9 +42,24 @@ find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2) boost::begin(rng2),boost::end(rng2)); } +/// \overload +template< class SinglePassRange1, class ForwardRange2 > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return std::find_first_of(boost::begin(rng1),boost::end(rng1), + boost::begin(rng2),boost::end(rng2)); +} + /// \overload template< class SinglePassRange1, class ForwardRange2, class BinaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2, BinaryPredicate pred) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -51,10 +69,25 @@ find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2, BinaryPredica boost::begin(rng2),boost::end(rng2),pred); } +/// \overload +template< class SinglePassRange1, class ForwardRange2, class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return std::find_first_of(boost::begin(rng1),boost::end(rng1), + boost::begin(rng2),boost::end(rng2),pred); +} + // range return overloads /// \overload template< range_return_value re, class SinglePassRange1, class ForwardRange2 > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -66,10 +99,27 @@ find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2) rng1); } +/// \overload +template< range_return_value re, class SinglePassRange1, class ForwardRange2 > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return range_return:: + pack(std::find_first_of(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2)), + rng1); +} + /// \overload template< range_return_value re, class SinglePassRange1, class ForwardRange2, class BinaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_first_of(SinglePassRange1 & rng1, const ForwardRange2& rng2, BinaryPredicate pred) { @@ -82,6 +132,22 @@ find_first_of(SinglePassRange1 & rng1, const ForwardRange2& rng2, rng1); } +/// \overload +template< range_return_value re, class SinglePassRange1, class ForwardRange2, + class BinaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_first_of(const SinglePassRange1 & rng1, const ForwardRange2& rng2, + BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + + return range_return:: + pack(std::find_first_of(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2), pred), + rng1); +} + } // namespace range using range::find_first_of; } // namespace boost diff --git a/include/boost/range/algorithm/find_if.hpp b/include/boost/range/algorithm/find_if.hpp index 3f954216d5..a035bc1fdf 100644 --- a/include/boost/range/algorithm/find_if.hpp +++ b/include/boost/range/algorithm/find_if.hpp @@ -28,18 +28,33 @@ namespace boost /// \pre SinglePassRange is a model of the SinglePassRangeConcept /// \pre UnaryPredicate is a model of the UnaryPredicateConcept template< class SinglePassRange, class UnaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type find_if( SinglePassRange& rng, UnaryPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::find_if(boost::begin(rng), boost::end(rng), pred); } +/// \overload +template< class SinglePassRange, class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +find_if( const SinglePassRange& rng, UnaryPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::find_if(boost::begin(rng), boost::end(rng), pred); +} + // range_return overloads /// \overload template< range_return_value re, class SinglePassRange, class UnaryPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type find_if( SinglePassRange& rng, UnaryPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); @@ -48,6 +63,17 @@ find_if( SinglePassRange& rng, UnaryPredicate pred ) rng); } +/// \overload +template< range_return_value re, class SinglePassRange, class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +find_if( const SinglePassRange& rng, UnaryPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return range_return:: + pack(std::find_if(boost::begin(rng), boost::end(rng), pred), + rng); +} + } // namespace range using range::find_if; } // namespace boost diff --git a/include/boost/range/algorithm/generate.hpp b/include/boost/range/algorithm/generate.hpp index 10c1608dee..39dea1bba9 100644 --- a/include/boost/range/algorithm/generate.hpp +++ b/include/boost/range/algorithm/generate.hpp @@ -33,6 +33,15 @@ inline ForwardRange& generate( ForwardRange& rng, Generator gen ) return rng; } +/// \overload +template< class ForwardRange, class Generator > +inline const ForwardRange& generate( const ForwardRange& rng, Generator gen ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::generate(boost::begin(rng), boost::end(rng), gen); + return rng; +} + } // namespace range using range::generate; } // namespace boost diff --git a/include/boost/range/algorithm/heap_algorithm.hpp b/include/boost/range/algorithm/heap_algorithm.hpp index 8377760d5c..0489cb0800 100644 --- a/include/boost/range/algorithm/heap_algorithm.hpp +++ b/include/boost/range/algorithm/heap_algorithm.hpp @@ -34,6 +34,15 @@ inline RandomAccessRange& push_heap(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& push_heap(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::push_heap(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& push_heap(RandomAccessRange& rng, Compare comp_pred) @@ -43,6 +52,15 @@ inline RandomAccessRange& push_heap(RandomAccessRange& rng, Compare comp_pred) return rng; } +/// \overload +template +inline const RandomAccessRange& push_heap(const RandomAccessRange& rng, Compare comp_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::push_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; +} + /// \brief template function pop_heap /// /// range-based version of the pop_heap std algorithm @@ -57,6 +75,15 @@ inline RandomAccessRange& pop_heap(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& pop_heap(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::pop_heap(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare comp_pred) @@ -66,6 +93,15 @@ inline RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare comp_pred) return rng; } +/// \overload +template +inline const RandomAccessRange& pop_heap(const RandomAccessRange& rng, Compare comp_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::pop_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; +} + /// \brief template function make_heap /// /// range-based version of the make_heap std algorithm @@ -80,6 +116,15 @@ inline RandomAccessRange& make_heap(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& make_heap(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::make_heap(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& make_heap(RandomAccessRange& rng, Compare comp_pred) @@ -89,6 +134,15 @@ inline RandomAccessRange& make_heap(RandomAccessRange& rng, Compare comp_pred) return rng; } +/// \overload +template +inline const RandomAccessRange& make_heap(const RandomAccessRange& rng, Compare comp_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::make_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; +} + /// \brief template function sort_heap /// /// range-based version of the sort_heap std algorithm @@ -103,6 +157,15 @@ inline RandomAccessRange& sort_heap(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& sort_heap(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::sort_heap(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare comp_pred) @@ -112,6 +175,15 @@ inline RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare comp_pred) return rng; } +/// \overload +template +inline const RandomAccessRange& sort_heap(const RandomAccessRange& rng, Compare comp_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::sort_heap(boost::begin(rng), boost::end(rng), comp_pred); + return rng; +} + } // namespace range using range::push_heap; using range::pop_heap; diff --git a/include/boost/range/algorithm/lower_bound.hpp b/include/boost/range/algorithm/lower_bound.hpp index 89967cc03c..3c591b196a 100644 --- a/include/boost/range/algorithm/lower_bound.hpp +++ b/include/boost/range/algorithm/lower_bound.hpp @@ -27,23 +27,52 @@ namespace boost /// /// \pre ForwardRange is a model of the ForwardRangeConcept template< class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type lower_bound( ForwardRange& rng, Value val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::lower_bound(boost::begin(rng), boost::end(rng), val); } + +/// \overload +template< class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +lower_bound( const ForwardRange& rng, Value val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::lower_bound(boost::begin(rng), boost::end(rng), val); +} + /// \overload template< class ForwardRange, class Value, class SortPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type lower_bound( ForwardRange& rng, Value val, SortPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::lower_bound(boost::begin(rng), boost::end(rng), val, pred); } + +/// \overload +template< class ForwardRange, class Value, class SortPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +lower_bound( const ForwardRange& rng, Value val, SortPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::lower_bound(boost::begin(rng), boost::end(rng), val, pred); +} + /// \overload template< range_return_value re, class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type lower_bound( ForwardRange& rng, Value val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -51,9 +80,24 @@ lower_bound( ForwardRange& rng, Value val ) pack(std::lower_bound(boost::begin(rng), boost::end(rng), val), rng); } + +/// \overload +template< range_return_value re, class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_return::type +lower_bound( const ForwardRange& rng, Value val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return:: + pack(std::lower_bound(boost::begin(rng), boost::end(rng), val), + rng); +} + /// \overload template< range_return_value re, class ForwardRange, class Value, class SortPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type lower_bound( ForwardRange& rng, Value val, SortPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -62,6 +106,17 @@ lower_bound( ForwardRange& rng, Value val, SortPredicate pred ) rng); } +/// \overload +template< range_return_value re, class ForwardRange, class Value, class SortPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +lower_bound( const ForwardRange& rng, Value val, SortPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return:: + pack(std::lower_bound(boost::begin(rng), boost::end(rng), val, pred), + rng); +} + } // namespace range using range::lower_bound; } // namespace boost diff --git a/include/boost/range/algorithm/partial_sort.hpp b/include/boost/range/algorithm/partial_sort.hpp index d752814c39..a594ea5814 100644 --- a/include/boost/range/algorithm/partial_sort.hpp +++ b/include/boost/range/algorithm/partial_sort.hpp @@ -35,6 +35,16 @@ inline RandomAccessRange& partial_sort(RandomAccessRange& rng, return rng; } +/// \overload +template +inline const RandomAccessRange& partial_sort(const RandomAccessRange& rng, + BOOST_DEDUCED_TYPENAME range_iterator::type middle) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::partial_sort(boost::begin(rng), middle, boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& partial_sort(RandomAccessRange& rng, @@ -47,6 +57,18 @@ inline RandomAccessRange& partial_sort(RandomAccessRange& rng, return rng; } +/// \overload +template +inline const RandomAccessRange& partial_sort(const RandomAccessRange& rng, + BOOST_DEDUCED_TYPENAME range_iterator::type middle, + BinaryPredicate sort_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::partial_sort(boost::begin(rng), middle, boost::end(rng), + sort_pred); + return rng; +} + } // namespace range using range::partial_sort; } // namespace boost diff --git a/include/boost/range/algorithm/partial_sort_copy.hpp b/include/boost/range/algorithm/partial_sort_copy.hpp index 7de44f5590..d68bb508f9 100644 --- a/include/boost/range/algorithm/partial_sort_copy.hpp +++ b/include/boost/range/algorithm/partial_sort_copy.hpp @@ -32,7 +32,18 @@ template inline BOOST_DEDUCED_TYPENAME range_iterator::type partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2) { - BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2)); +} + +/// \overload +template +inline BOOST_DEDUCED_TYPENAME range_iterator::type +partial_sort_copy(const SinglePassRange& rng1, const RandomAccessRange& rng2) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), boost::begin(rng2), boost::end(rng2)); @@ -45,7 +56,20 @@ inline BOOST_DEDUCED_TYPENAME range_iterator::type partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2, BinaryPredicate pred) { - BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), boost::end(rng2), pred); +} + +/// \overload +template +inline BOOST_DEDUCED_TYPENAME range_iterator::type +partial_sort_copy(const SinglePassRange& rng1, const RandomAccessRange& rng2, + BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1), boost::begin(rng2), boost::end(rng2), pred); diff --git a/include/boost/range/algorithm/partition.hpp b/include/boost/range/algorithm/partition.hpp index c2730d865e..195f09b27b 100644 --- a/include/boost/range/algorithm/partition.hpp +++ b/include/boost/range/algorithm/partition.hpp @@ -34,6 +34,15 @@ partition(ForwardRange& rng, UnaryPredicate pred) return std::partition(boost::begin(rng),boost::end(rng),pred); } +/// \overload +template +inline BOOST_DEDUCED_TYPENAME range_iterator::type +partition(const ForwardRange& rng, UnaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::partition(boost::begin(rng),boost::end(rng),pred); +} + // range_return overloads /// \overload @@ -47,6 +56,17 @@ partition(ForwardRange& rng, UnaryPredicate pred) pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng); } +/// \overload +template< range_return_value re, class ForwardRange, + class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +partition(const ForwardRange& rng, UnaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return boost::range_return:: + pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng); +} + } // namespace range using range::partition; } // namespace boost diff --git a/include/boost/range/algorithm/random_shuffle.hpp b/include/boost/range/algorithm/random_shuffle.hpp index 8fc9b8ad63..956a1ca2a5 100644 --- a/include/boost/range/algorithm/random_shuffle.hpp +++ b/include/boost/range/algorithm/random_shuffle.hpp @@ -34,6 +34,15 @@ inline RandomAccessRange& random_shuffle(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::random_shuffle(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen) @@ -43,6 +52,15 @@ inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen) return rng; } +/// \overload +template +inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng, Generator& gen) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::random_shuffle(boost::begin(rng), boost::end(rng), gen); + return rng; +} + } // namespace range using range::random_shuffle; } // namespace boost diff --git a/include/boost/range/algorithm/remove.hpp b/include/boost/range/algorithm/remove.hpp index c553905375..3d0f082ecd 100644 --- a/include/boost/range/algorithm/remove.hpp +++ b/include/boost/range/algorithm/remove.hpp @@ -34,6 +34,15 @@ remove(ForwardRange& rng, const Value& val) return std::remove(boost::begin(rng),boost::end(rng),val); } +/// \overload +template< class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +remove(const ForwardRange& rng, const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::remove(boost::begin(rng),boost::end(rng),val); +} + // range_return overloads /// \overload @@ -47,6 +56,17 @@ remove(ForwardRange& rng, const Value& val) rng); } +/// \overload +template< range_return_value re, class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_return::type +remove(const ForwardRange& rng, const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return::pack( + std::remove(boost::begin(rng), boost::end(rng), val), + rng); +} + } // namespace range using range::remove; } // namespace boost diff --git a/include/boost/range/algorithm/remove_copy.hpp b/include/boost/range/algorithm/remove_copy.hpp index b35c45a056..d9bc2a8efe 100644 --- a/include/boost/range/algorithm/remove_copy.hpp +++ b/include/boost/range/algorithm/remove_copy.hpp @@ -31,9 +31,9 @@ namespace boost /// InputIterator's value type. template< class SinglePassRange, class OutputIterator, class Value > inline OutputIterator -remove_copy(SinglePassRange& rng, OutputIterator out_it, const Value& val) +remove_copy(const SinglePassRange& rng, OutputIterator out_it, const Value& val) { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::remove_copy(boost::begin(rng), boost::end(rng), out_it, val); } diff --git a/include/boost/range/algorithm/remove_copy_if.hpp b/include/boost/range/algorithm/remove_copy_if.hpp index 76f4ea394b..17a06d7732 100644 --- a/include/boost/range/algorithm/remove_copy_if.hpp +++ b/include/boost/range/algorithm/remove_copy_if.hpp @@ -28,10 +28,10 @@ namespace boost /// \pre out_it is not an iterator in the range rng template< class SinglePassRange, class OutputIterator, class Predicate > inline OutputIterator - remove_copy_if(SinglePassRange& rng, OutputIterator out_it, Predicate pred) + remove_copy_if(const SinglePassRange& rng, OutputIterator out_it, Predicate pred) { - boost::function_requires< SinglePassRangeConcept >(); - return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred); } } diff --git a/include/boost/range/algorithm/remove_if.hpp b/include/boost/range/algorithm/remove_if.hpp index 75d0a44d93..0ca0e27111 100644 --- a/include/boost/range/algorithm/remove_if.hpp +++ b/include/boost/range/algorithm/remove_if.hpp @@ -35,6 +35,15 @@ remove_if(ForwardRange& rng, UnaryPredicate pred) return std::remove_if(boost::begin(rng), boost::end(rng), pred); } +/// \overload +template< class ForwardRange, class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME boost::range_iterator::type +remove_if(const ForwardRange& rng, UnaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::remove_if(boost::begin(rng), boost::end(rng), pred); +} + // range_return overloads /// \overload @@ -48,6 +57,17 @@ remove_if(ForwardRange& rng, UnaryPredicate pred) rng); } +/// \overload +template< range_return_value re, class ForwardRange, class UnaryPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +remove_if(const ForwardRange& rng, UnaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return::pack( + std::remove_if(boost::begin(rng), boost::end(rng), pred), + rng); +} + } // namespace range using range::remove_if; } // namespace boost diff --git a/include/boost/range/algorithm/replace.hpp b/include/boost/range/algorithm/replace.hpp index f7b7e5a6ec..d55ed9fe31 100644 --- a/include/boost/range/algorithm/replace.hpp +++ b/include/boost/range/algorithm/replace.hpp @@ -35,6 +35,17 @@ replace(ForwardRange& rng, const Value& what, return rng; } +/// \overload +template< class ForwardRange, class Value > +inline const ForwardRange& +replace(const ForwardRange& rng, const Value& what, + const Value& with_what) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::replace(boost::begin(rng), boost::end(rng), what, with_what); + return rng; +} + } // namespace range using range::replace; } // namespace boost; diff --git a/include/boost/range/algorithm/replace_copy.hpp b/include/boost/range/algorithm/replace_copy.hpp index 0715a98399..c5db77f0e3 100644 --- a/include/boost/range/algorithm/replace_copy.hpp +++ b/include/boost/range/algorithm/replace_copy.hpp @@ -27,10 +27,10 @@ namespace boost /// \pre ForwardRange is a model of the ForwardRangeConcept template< class ForwardRange, class OutputIterator, class Value > inline OutputIterator -replace_copy(ForwardRange& rng, OutputIterator out_it, const Value& what, +replace_copy(const ForwardRange& rng, OutputIterator out_it, const Value& what, const Value& with_what) { - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::replace_copy(boost::begin(rng), boost::end(rng), out_it, what, with_what); } diff --git a/include/boost/range/algorithm/replace_copy_if.hpp b/include/boost/range/algorithm/replace_copy_if.hpp index e362577b7e..619776aeba 100644 --- a/include/boost/range/algorithm/replace_copy_if.hpp +++ b/include/boost/range/algorithm/replace_copy_if.hpp @@ -31,10 +31,10 @@ namespace boost /// \pre Value is convertible to a type in OutputIterator's set of value types. template< class ForwardRange, class OutputIterator, class Predicate, class Value > inline OutputIterator -replace_copy_if(ForwardRange& rng, OutputIterator out_it, Predicate pred, +replace_copy_if(const ForwardRange& rng, OutputIterator out_it, Predicate pred, const Value& with_what) { - BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::replace_copy_if(boost::begin(rng), boost::end(rng), out_it, pred, with_what); } diff --git a/include/boost/range/algorithm/replace_if.hpp b/include/boost/range/algorithm/replace_if.hpp index 0f6d09d8fd..11d909fdb2 100644 --- a/include/boost/range/algorithm/replace_if.hpp +++ b/include/boost/range/algorithm/replace_if.hpp @@ -36,6 +36,17 @@ inline ForwardRange& return rng; } +/// \overload +template< class ForwardRange, class UnaryPredicate, class Value > +inline const ForwardRange& + replace_if(const ForwardRange& rng, UnaryPredicate pred, + const Value& val) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::replace_if(boost::begin(rng), boost::end(rng), pred, val); + return rng; +} + } // namespace range using range::replace_if; } // namespace boost diff --git a/include/boost/range/algorithm/reverse.hpp b/include/boost/range/algorithm/reverse.hpp index 62948836a0..37d4d469a9 100644 --- a/include/boost/range/algorithm/reverse.hpp +++ b/include/boost/range/algorithm/reverse.hpp @@ -34,6 +34,15 @@ inline BidirectionalRange& reverse(BidirectionalRange& rng) return rng; } +/// \overload +template +inline const BidirectionalRange& reverse(const BidirectionalRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); + std::reverse(boost::begin(rng), boost::end(rng)); + return rng; +} + } // namespace range using range::reverse; } // namespace boost diff --git a/include/boost/range/algorithm/reverse_copy.hpp b/include/boost/range/algorithm/reverse_copy.hpp index 83d070f6f9..83adb684cf 100644 --- a/include/boost/range/algorithm/reverse_copy.hpp +++ b/include/boost/range/algorithm/reverse_copy.hpp @@ -29,7 +29,7 @@ namespace boost template inline OutputIterator reverse_copy(const BidirectionalRange& rng, OutputIterator out) { - BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept )); return std::reverse_copy(boost::begin(rng), boost::end(rng), out); } diff --git a/include/boost/range/algorithm/rotate.hpp b/include/boost/range/algorithm/rotate.hpp index efe341459a..c96a9c4d5a 100644 --- a/include/boost/range/algorithm/rotate.hpp +++ b/include/boost/range/algorithm/rotate.hpp @@ -34,6 +34,16 @@ inline ForwardRange& rotate(ForwardRange& rng, return rng; } +/// \overload +template +inline const ForwardRange& rotate(const ForwardRange& rng, + BOOST_DEDUCED_TYPENAME range_iterator::type middle) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + std::rotate(boost::begin(rng), middle, boost::end(rng)); + return rng; +} + } // namespace range using range::rotate; } // namespace boost diff --git a/include/boost/range/algorithm/search_n.hpp b/include/boost/range/algorithm/search_n.hpp index 295c89605e..3c08e35c55 100644 --- a/include/boost/range/algorithm/search_n.hpp +++ b/include/boost/range/algorithm/search_n.hpp @@ -44,7 +44,7 @@ template< class ForwardRange, class Integer, class Value > inline BOOST_DEDUCED_TYPENAME range_iterator::type search_n(const ForwardRange& rng, Integer count, const Value& value) { - BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); return std::search_n(boost::begin(rng), boost::end(rng), count, value); } @@ -69,7 +69,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator::type search_n(const ForwardRange& rng, Integer count, const Value& value, BinaryPredicate binary_pred) { - BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, const Value&>)); return std::search_n(boost::begin(rng), boost::end(rng), @@ -97,7 +97,7 @@ template< range_return_value re, class ForwardRange, class Integer, inline BOOST_DEDUCED_TYPENAME range_return::type search_n(const ForwardRange& rng, Integer count, const Value& value) { - BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); return range_return:: pack(std::search_n(boost::begin(rng), boost::end(rng), count, value), @@ -128,7 +128,7 @@ inline BOOST_DEDUCED_TYPENAME range_return::type search_n(const ForwardRange& rng, Integer count, const Value& value, BinaryPredicate pred) { - BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept)); BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, const Value&>)); diff --git a/include/boost/range/algorithm/sort.hpp b/include/boost/range/algorithm/sort.hpp index 36a08eaf47..6b1c45fd1a 100644 --- a/include/boost/range/algorithm/sort.hpp +++ b/include/boost/range/algorithm/sort.hpp @@ -34,6 +34,15 @@ inline RandomAccessRange& sort(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& sort(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::sort(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& sort(RandomAccessRange& rng, BinaryPredicate pred) @@ -43,6 +52,15 @@ inline RandomAccessRange& sort(RandomAccessRange& rng, BinaryPredicate pred) return rng; } +/// \overload +template +inline const RandomAccessRange& sort(const RandomAccessRange& rng, BinaryPredicate pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::sort(boost::begin(rng), boost::end(rng), pred); + return rng; +} + } // namespace range using range::sort; } // namespace boost diff --git a/include/boost/range/algorithm/stable_sort.hpp b/include/boost/range/algorithm/stable_sort.hpp index 8acf2fc06d..0dc3927335 100644 --- a/include/boost/range/algorithm/stable_sort.hpp +++ b/include/boost/range/algorithm/stable_sort.hpp @@ -34,6 +34,15 @@ inline RandomAccessRange& stable_sort(RandomAccessRange& rng) return rng; } +/// \overload +template +inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::stable_sort(boost::begin(rng), boost::end(rng)); + return rng; +} + /// \overload template inline RandomAccessRange& stable_sort(RandomAccessRange& rng, BinaryPredicate sort_pred) @@ -43,6 +52,15 @@ inline RandomAccessRange& stable_sort(RandomAccessRange& rng, BinaryPredicate so return rng; } +/// \overload +template +inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng, BinaryPredicate sort_pred) +{ + BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept )); + std::stable_sort(boost::begin(rng), boost::end(rng), sort_pred); + return rng; +} + } // namespace range using range::stable_sort; } // namespace boost diff --git a/include/boost/range/algorithm/swap_ranges.hpp b/include/boost/range/algorithm/swap_ranges.hpp index 908f79fc08..a0b67c4554 100644 --- a/include/boost/range/algorithm/swap_ranges.hpp +++ b/include/boost/range/algorithm/swap_ranges.hpp @@ -80,6 +80,51 @@ swap_ranges(SinglePassRange1& range1, SinglePassRange2& range2) return range2; } +/// \overload +template< class SinglePassRange1, class SinglePassRange2 > +inline SinglePassRange2& +swap_ranges(const SinglePassRange1& range1, SinglePassRange2& range2) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + boost::range_detail::swap_ranges_impl( + boost::begin(range1), boost::end(range1), + boost::begin(range2), boost::end(range2)); + + return range2; +} + +/// \overload +template< class SinglePassRange1, class SinglePassRange2 > +inline const SinglePassRange2& +swap_ranges(SinglePassRange1& range1, const SinglePassRange2& range2) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + boost::range_detail::swap_ranges_impl( + boost::begin(range1), boost::end(range1), + boost::begin(range2), boost::end(range2)); + + return range2; +} + +/// \overload +template< class SinglePassRange1, class SinglePassRange2 > +inline const SinglePassRange2& +swap_ranges(const SinglePassRange1& range1, const SinglePassRange2& range2) +{ + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + + boost::range_detail::swap_ranges_impl( + boost::begin(range1), boost::end(range1), + boost::begin(range2), boost::end(range2)); + + return range2; +} + } // namespace range using range::swap_ranges; } // namespace boost diff --git a/include/boost/range/algorithm/upper_bound.hpp b/include/boost/range/algorithm/upper_bound.hpp index 01ec0b49c3..bb02306c56 100644 --- a/include/boost/range/algorithm/upper_bound.hpp +++ b/include/boost/range/algorithm/upper_bound.hpp @@ -27,24 +27,53 @@ namespace boost /// /// \pre ForwardRange is a model of the ForwardRangeConcept template< class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline +BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type upper_bound( ForwardRange& rng, Value val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::upper_bound(boost::begin(rng), boost::end(rng), val); } + /// \overload +template< class ForwardRange, class Value > +BOOST_DEDUCED_TYPENAME range_iterator::type +upper_bound( const ForwardRange& rng, Value val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::upper_bound(boost::begin(rng), boost::end(rng), val); +} + /// \overload template< class ForwardRange, class Value, class SortPredicate > -inline BOOST_DEDUCED_TYPENAME range_iterator::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_iterator::type +>::type upper_bound( ForwardRange& rng, Value val, SortPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); return std::upper_bound(boost::begin(rng), boost::end(rng), val, pred); } + +/// \overload +template< class ForwardRange, class Value, class SortPredicate > +inline BOOST_DEDUCED_TYPENAME range_iterator::type +upper_bound( const ForwardRange& rng, Value val, SortPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return std::upper_bound(boost::begin(rng), boost::end(rng), val, pred); +} + /// \overload template< range_return_value re, class ForwardRange, class Value > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type upper_bound( ForwardRange& rng, Value val ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -52,10 +81,25 @@ upper_bound( ForwardRange& rng, Value val ) pack(std::upper_bound(boost::begin(rng), boost::end(rng), val), rng); } + +/// \overload +template< range_return_value re, class ForwardRange, class Value > +inline BOOST_DEDUCED_TYPENAME range_return::type +upper_bound( const ForwardRange& rng, Value val ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return:: + pack(std::upper_bound(boost::begin(rng), boost::end(rng), val), + rng); +} + /// \overload template< range_return_value re, class ForwardRange, class Value, class SortPredicate > -inline BOOST_DEDUCED_TYPENAME range_return::type +inline BOOST_DEDUCED_TYPENAME disable_if< + is_const, + BOOST_DEDUCED_TYPENAME range_return::type +>::type upper_bound( ForwardRange& rng, Value val, SortPredicate pred ) { BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); @@ -64,6 +108,18 @@ upper_bound( ForwardRange& rng, Value val, SortPredicate pred ) rng); } +/// \overload +template< range_return_value re, class ForwardRange, class Value, + class SortPredicate > +inline BOOST_DEDUCED_TYPENAME range_return::type +upper_bound( const ForwardRange& rng, Value val, SortPredicate pred ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept )); + return range_return:: + pack(std::upper_bound(boost::begin(rng), boost::end(rng), val, pred), + rng); +} + } // namespace range using range::upper_bound; } // namespace boost diff --git a/include/boost/range/algorithm_ext/iota.hpp b/include/boost/range/algorithm_ext/iota.hpp index 8ae36ee119..1d95c120e1 100644 --- a/include/boost/range/algorithm_ext/iota.hpp +++ b/include/boost/range/algorithm_ext/iota.hpp @@ -34,6 +34,19 @@ inline ForwardRange& iota( ForwardRange& rng, Value x ) return rng; } +template< class ForwardRange, class Value > +inline const ForwardRange& iota( const ForwardRange& rng, Value x ) +{ + BOOST_CONCEPT_ASSERT(( ForwardRangeConcept )); + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator_t; + + iterator_t last_target = ::boost::end(rng); + for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x) + *target = x; + + return rng; +} + } // namespace range using range::iota; } // namespace boost diff --git a/include/boost/range/algorithm_ext/is_sorted.hpp b/include/boost/range/algorithm_ext/is_sorted.hpp index 0e40c651bc..2d64c54199 100644 --- a/include/boost/range/algorithm_ext/is_sorted.hpp +++ b/include/boost/range/algorithm_ext/is_sorted.hpp @@ -51,7 +51,7 @@ template inline bool is_sorted(const SinglePassRange& rng) { BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); - BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept::type>)); + BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept::type>)); return range_detail::is_sorted(boost::begin(rng), boost::end(rng)); } @@ -59,8 +59,8 @@ inline bool is_sorted(const SinglePassRange& rng) template inline bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred) { - BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); - BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, BOOST_DEDUCED_TYPENAME range_value::type>)); + BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept)); + BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept::type, BOOST_DEDUCED_TYPENAME range_value::type>)); return range_detail::is_sorted(boost::begin(rng), boost::end(rng), pred); } diff --git a/include/boost/range/algorithm_ext/overwrite.hpp b/include/boost/range/algorithm_ext/overwrite.hpp index 385080b8f7..e0c566bde7 100644 --- a/include/boost/range/algorithm_ext/overwrite.hpp +++ b/include/boost/range/algorithm_ext/overwrite.hpp @@ -50,6 +50,33 @@ inline void overwrite( const SinglePassRange1& from, SinglePassRange2& to ) } } +template< class SinglePassRange1, class SinglePassRange2 > +inline void overwrite( const SinglePassRange1& from, const SinglePassRange2& to ) +{ + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + + BOOST_DEDUCED_TYPENAME range_iterator::type + i = boost::begin(from), e = boost::end(from); + + BOOST_DEDUCED_TYPENAME range_iterator::type + out = boost::begin(to); + +#ifndef NDEBUG + BOOST_DEDUCED_TYPENAME range_iterator::type + last_out = boost::end(to); +#endif + + for( ; i != e; ++out, ++i ) + { +#ifndef NDEBUG + BOOST_ASSERT( out != last_out + && "out of bounds in boost::overwrite()" ); +#endif + *out = *i; + } +} + } // namespace range using range::overwrite; } // namespace boost diff --git a/include/boost/range/detail/join_iterator.hpp b/include/boost/range/detail/join_iterator.hpp index 45a6ec9a95..a789ec072d 100644 --- a/include/boost/range/detail/join_iterator.hpp +++ b/include/boost/range/detail/join_iterator.hpp @@ -12,9 +12,9 @@ #define BOOST_RANGE_DETAIL_JOIN_ITERATOR_HPP_INCLUDED #include +#include #include #include -#include #include #include #include @@ -30,21 +30,6 @@ namespace boost template struct join_iterator_link { -private: - class reference_count_t - { - public: - reference_count_t() : m_count(0u) {} - reference_count_t(const reference_count_t&) : m_count(0u) {} - reference_count_t& operator=(const reference_count_t&) { return *this; } - - void increment() { ++m_count; } - bool decrement() { return --m_count ? false : true; } - - private: - unsigned int m_count; - }; - public: join_iterator_link(Iterator1 last1, Iterator2 first2) : last1(last1) @@ -52,43 +37,13 @@ public: { } - void add_reference() const - { - count.increment(); - } - - bool release_reference() const - { - return count.decrement(); - } - Iterator1 last1; Iterator2 first2; private: join_iterator_link() /* = delete */ ; - - mutable reference_count_t count; }; -} // range_detail - -template -inline void intrusive_ptr_add_ref(const range_detail::join_iterator_link* p) -{ - p->add_reference(); -} - -template -inline void intrusive_ptr_release(const range_detail::join_iterator_link* p) -{ - if (p->release_reference()) - delete p; -} - -namespace range_detail -{ - class join_iterator_begin_tag {}; class join_iterator_end_tag {}; @@ -179,12 +134,16 @@ public: typedef Iterator1 iterator1_t; typedef Iterator2 iterator2_t; - join_iterator() : m_section(0u) {} + join_iterator() + : m_section(0u) + , m_it(0u, iterator1_t(), iterator2_t()) + , m_link(link_t(iterator1_t(), iterator2_t())) + {} join_iterator(unsigned int section, Iterator1 current1, Iterator1 last1, Iterator2 first2, Iterator2 current2) : m_section(section) , m_it(section, current1, current2) - , m_link(new link_t(last1, first2)) + , m_link(link_t(last1, first2)) { } @@ -192,7 +151,7 @@ public: join_iterator(Range1& r1, Range2& r2, join_iterator_begin_tag) : m_section(boost::empty(r1) ? 1u : 0u) , m_it(boost::empty(r1) ? 1u : 0u, boost::begin(r1), boost::begin(r2)) - , m_link(new link_t(boost::end(r1), boost::begin(r2))) + , m_link(link_t(boost::end(r1), boost::begin(r2))) { } @@ -200,7 +159,7 @@ public: join_iterator(const Range1& r1, const Range2& r2, join_iterator_begin_tag) : m_section(boost::empty(r1) ? 1u : 0u) , m_it(boost::empty(r1) ? 1u : 0u, boost::const_begin(r1), boost::const_begin(r2)) - , m_link(new link_t(boost::const_end(r1), boost::const_begin(r2))) + , m_link(link_t(boost::const_end(r1), boost::const_begin(r2))) { } @@ -208,7 +167,7 @@ public: join_iterator(Range1& r1, Range2& r2, join_iterator_end_tag) : m_section(1u) , m_it(1u, boost::end(r1), boost::end(r2)) - , m_link(new link_t(boost::end(r1), boost::begin(r2))) + , m_link(link_t(boost::end(r1), boost::begin(r2))) { } @@ -216,7 +175,7 @@ public: join_iterator(const Range1& r1, const Range2& r2, join_iterator_end_tag) : m_section(1u) , m_it(1u, boost::const_end(r1), boost::const_end(r2)) - , m_link(new link_t(boost::const_end(r1), boost::const_begin(r2))) + , m_link(link_t(boost::const_end(r1), boost::const_begin(r2))) { } @@ -228,9 +187,9 @@ private: else { ++m_it.it1(); - if (m_it.it1() == m_link->last1) + if (m_it.it1() == m_link.last1) { - m_it.it2() = m_link->first2; + m_it.it2() = m_link.first2; m_section = 1u; } } @@ -240,9 +199,9 @@ private: { if (m_section) { - if (m_it.it2() == m_link->first2) + if (m_it.it2() == m_link.first2) { - m_it.it1() = boost::prior(m_link->last1); + m_it.it1() = boost::prior(m_link.last1); m_section = 0u; } else @@ -280,8 +239,8 @@ private: result = other.m_it.it2() - m_it.it2(); else { - result = (m_link->first2 - m_it.it2()) - + (other.m_it.it1() - m_link->last1); + result = (m_link.first2 - m_it.it2()) + + (other.m_it.it1() - m_link.last1); BOOST_ASSERT( result <= 0 ); } @@ -290,8 +249,8 @@ private: { if (other.m_section) { - result = (m_link->last1 - m_it.it1()) - + (other.m_it.it2() - m_link->first2); + result = (m_link.last1 - m_it.it1()) + + (other.m_it.it2() - m_link.first2); } else result = other.m_it.it1() - m_it.it1(); @@ -305,7 +264,7 @@ private: BOOST_ASSERT( m_section == 1u ); if (offset < 0) { - difference_t r2_dist = m_link->first2 - m_it.it2(); + difference_t r2_dist = m_link.first2 - m_it.it2(); BOOST_ASSERT( r2_dist <= 0 ); if (offset >= r2_dist) std::advance(m_it.it2(), offset); @@ -313,7 +272,7 @@ private: { difference_t r1_dist = offset - r2_dist; BOOST_ASSERT( r1_dist <= 0 ); - m_it.it1() = m_link->last1 + r1_dist; + m_it.it1() = m_link.last1 + r1_dist; m_section = 0u; } } @@ -327,7 +286,7 @@ private: BOOST_ASSERT( m_section == 0u ); if (offset > 0) { - difference_t r1_dist = m_link->last1 - m_it.it1(); + difference_t r1_dist = m_link.last1 - m_it.it1(); BOOST_ASSERT( r1_dist >= 0 ); if (offset < r1_dist) std::advance(m_it.it1(), offset); @@ -335,7 +294,7 @@ private: { difference_t r2_dist = offset - r1_dist; BOOST_ASSERT( r2_dist >= 0 ); - m_it.it2() = m_link->first2 + r2_dist; + m_it.it2() = m_link.first2 + r2_dist; m_section = 1u; } } @@ -345,7 +304,7 @@ private: unsigned int m_section; iterator_union m_it; - intrusive_ptr m_link; + link_t m_link; friend class ::boost::iterator_core_access; }; diff --git a/include/boost/range/irange.hpp b/include/boost/range/irange.hpp index b7afe3270d..bf1772256d 100644 --- a/include/boost/range/irange.hpp +++ b/include/boost/range/irange.hpp @@ -173,28 +173,54 @@ namespace boost } // namespace range_detail template - iterator_range< range_detail::integer_iterator > - irange(Integer first, Integer last) + class integer_range + : public iterator_range< range_detail::integer_iterator > + { + typedef range_detail::integer_iterator iterator_t; + typedef iterator_range base_t; + public: + integer_range(Integer first, Integer last) + : base_t(iterator_t(first), iterator_t(last)) + { + } + }; + + template + class strided_integer_range + : public iterator_range< range_detail::integer_iterator_with_step > + { + typedef range_detail::integer_iterator_with_step iterator_t; + typedef iterator_range base_t; + public: + template + strided_integer_range(Iterator first, Iterator last) + : base_t(first, last) + { + } + }; + + template + integer_range + irange(Integer first, Integer last) { BOOST_ASSERT( first <= last ); - return boost::iterator_range< range_detail::integer_iterator >( - range_detail::integer_iterator(first), - range_detail::integer_iterator(last)); + return integer_range(first, last); } template - iterator_range< range_detail::integer_iterator_with_step > + strided_integer_range irange(Integer first, Integer last, StepSize step_size) { BOOST_ASSERT( step_size != 0 ); BOOST_ASSERT( (step_size > 0) ? (last >= first) : (last <= first) ); + typedef typename range_detail::integer_iterator_with_step iterator_t; const std::ptrdiff_t last_step = (static_cast(last) - static_cast(first)) / (static_cast(step_size)); - return boost::iterator_range< iterator_t >( + return strided_integer_range( iterator_t(first, 0, step_size), iterator_t(first, last_step, step_size)); } diff --git a/include/boost/range/join.hpp b/include/boost/range/join.hpp index 8c53016587..43af12759c 100644 --- a/include/boost/range/join.hpp +++ b/include/boost/range/join.hpp @@ -18,49 +18,64 @@ namespace boost { + namespace range_detail + { template -iterator_range::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME add_const< - BOOST_DEDUCED_TYPENAME range_value::type>::type> -> +class joined_type +{ +public: + typedef iterator_range< + range_detail::join_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_value::type + > + > type; +}; + + } // namespace range_detail + +template +class joined_range + : public range_detail::joined_type::type +{ + typedef range_detail::join_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_value::type + > iterator_t; + + typedef BOOST_DEDUCED_TYPENAME range_detail::joined_type< + SinglePassRange1, SinglePassRange2>::type base_t; +public: + joined_range(SinglePassRange1& rng1, SinglePassRange2& rng2) + : base_t( + iterator_t(rng1, rng2, range_detail::join_iterator_begin_tag()), + iterator_t(rng1, rng2, range_detail::join_iterator_end_tag()) + ) + { + } +}; + +template +joined_range join(const SinglePassRange1& r1, const SinglePassRange2& r2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - typedef range_detail::join_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME add_const< - BOOST_DEDUCED_TYPENAME range_value::type>::type> iterator_t; - - return iterator_range( - iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), - iterator_t(r1, r2, range_detail::join_iterator_end_tag())); + return joined_range(r1, r2); } template -iterator_range::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_value::type> -> +joined_range join(SinglePassRange1& r1, SinglePassRange2& r2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - typedef range_detail::join_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_value::type> iterator_t; - - return iterator_range( - iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), - iterator_t(r1, r2, range_detail::join_iterator_end_tag())); + return joined_range(r1, r2); } } // namespace boost diff --git a/include/boost/range/numeric.hpp b/include/boost/range/numeric.hpp index e71b28df14..a41e6d3810 100644 --- a/include/boost/range/numeric.hpp +++ b/include/boost/range/numeric.hpp @@ -7,13 +7,13 @@ // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// +// // Copyright 2006 Thorsten Ottosen. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// +// // Copyright 2004 Eric Niebler. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -39,14 +40,14 @@ namespace boost template< class SinglePassRange, class Value > inline Value accumulate( const SinglePassRange& rng, Value init ) { - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::accumulate( boost::begin(rng), boost::end(rng), init ); } template< class SinglePassRange, class Value, class BinaryOperation > inline Value accumulate( const SinglePassRange& rng, Value init, BinaryOperation op ) { - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::accumulate( boost::begin(rng), boost::end(rng), init, op ); } @@ -54,42 +55,42 @@ namespace boost template< class SinglePassRange1, class SinglePassRange2, class Value > inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, Value init ) { - boost::function_requires< SinglePassRangeConcept >(); - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) ); - return std::inner_product( boost::begin(rng1), boost::end(rng1), - boost::begin(rng2), init ); + return std::inner_product( boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), init ); } template< class SinglePassRange1, class SinglePassRange2, - class Value, + class Value, class BinaryOperation1, class BinaryOperation2 > inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, - Value init, + Value init, BinaryOperation1 op1, BinaryOperation2 op2 ) { - boost::function_requires< SinglePassRangeConcept >(); - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) ); - return std::inner_product( boost::begin(rng1), boost::end(rng1), - boost::begin(rng2), init, op1, op2 ); + return std::inner_product( boost::begin(rng1), boost::end(rng1), + boost::begin(rng2), init, op1, op2 ); } template< class SinglePassRange, class OutputIterator > - inline OutputIterator partial_sum ( const SinglePassRange& rng, + inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result ) { - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::partial_sum( boost::begin(rng), boost::end(rng), result ); } template< class SinglePassRange, class OutputIterator, class BinaryOperation > - inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result, + inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result, BinaryOperation op ) { - boost::function_requires< SinglePassRangeConcept >(); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); return std::partial_sum( boost::begin(rng), boost::end(rng), result, op ); } @@ -97,8 +98,8 @@ namespace boost inline OutputIterator adjacent_difference ( const SinglePassRange& rng, OutputIterator result ) { - boost::function_requires< SinglePassRangeConcept >(); - return std::adjacent_difference( boost::begin(rng), boost::end(rng), + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::adjacent_difference( boost::begin(rng), boost::end(rng), result ); } @@ -107,11 +108,11 @@ namespace boost OutputIterator result, BinaryOperation op ) { - boost::function_requires< SinglePassRangeConcept >(); - return std::adjacent_difference( boost::begin(rng), boost::end(rng), + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + return std::adjacent_difference( boost::begin(rng), boost::end(rng), result, op ); } - + } #endif diff --git a/include/boost/type_traits/add_reference.hpp b/include/boost/type_traits/add_reference.hpp index 1b10cbb9fe..1df2f2445e 100644 --- a/include/boost/type_traits/add_reference.hpp +++ b/include/boost/type_traits/add_reference.hpp @@ -51,11 +51,29 @@ struct add_reference_impl }; #else +// +// We can't filter out rvalue_references at the same level as +// references or we get ambiguities from msvc: +// + +template +struct add_reference_rvalue_layer +{ + typedef T& type; +}; + +#ifndef BOOST_NO_RVALUE_REFERENCES +template +struct add_reference_rvalue_layer +{ + typedef T&& type; +}; +#endif template struct add_reference_impl { - typedef T& type; + typedef typename add_reference_rvalue_layer::type type; }; #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/type_traits/function_traits.hpp b/include/boost/type_traits/function_traits.hpp index baa19530c3..e7087b3cc2 100644 --- a/include/boost/type_traits/function_traits.hpp +++ b/include/boost/type_traits/function_traits.hpp @@ -166,7 +166,7 @@ struct function_traits_helper template struct function_traits : - public detail::function_traits_helper::type> + public boost::detail::function_traits_helper::type> { }; @@ -227,7 +227,7 @@ type_of_size<11> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8, template struct function_traits { - BOOST_STATIC_CONSTANT(unsigned, arity = (sizeof(detail::function_arity_helper((Function*)0))-1)); + BOOST_STATIC_CONSTANT(unsigned, arity = (sizeof(boost::detail::function_arity_helper((Function*)0))-1)); }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/type_traits/is_complex.hpp b/include/boost/type_traits/is_complex.hpp index c089acf189..9e91825391 100644 --- a/include/boost/type_traits/is_complex.hpp +++ b/include/boost/type_traits/is_complex.hpp @@ -25,7 +25,7 @@ struct is_convertible_from_tester } -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_complex,T,(::boost::is_convertible::value)) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_complex,T,(::boost::is_convertible::value)) } // namespace boost diff --git a/include/boost/type_traits/is_const.hpp b/include/boost/type_traits/is_const.hpp index 5026683f8b..1cfd234853 100644 --- a/include/boost/type_traits/is_const.hpp +++ b/include/boost/type_traits/is_const.hpp @@ -50,12 +50,31 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,__is_const(T)) #elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -//* is a type T declared const - is_const +namespace detail{ +// +// We can't filter out rvalue_references at the same level as +// references or we get ambiguities from msvc: +// +template +struct is_const_rvalue_filter +{ #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) - BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::cv_traits_imp::type*>::is_const) + BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::type*>::is_const); #else - BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::cv_traits_imp::is_const) + BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::is_const); #endif +}; +#ifndef BOOST_NO_RVALUE_REFERENCES +template +struct is_const_rvalue_filter +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif +} + +//* is a type T declared const - is_const +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::is_const_rvalue_filter::value) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T&,false) #if defined(BOOST_ILLEGAL_CV_REFERENCES) @@ -98,7 +117,7 @@ struct is_const_helper { static T* t; BOOST_STATIC_CONSTANT(bool, value = ( - sizeof(detail::yes_type) == sizeof(detail::is_const_tester(t)) + sizeof(boost::detail::yes_type) == sizeof(boost::detail::is_const_tester(t)) )); }; }; @@ -110,7 +129,7 @@ struct is_const_helper { static T t; BOOST_STATIC_CONSTANT(bool, value = ( - sizeof(detail::yes_type) == sizeof(detail::is_const_tester(&t)) + sizeof(boost::detail::yes_type) == sizeof(boost::detail::is_const_tester(&t)) )); }; }; diff --git a/include/boost/type_traits/is_convertible.hpp b/include/boost/type_traits/is_convertible.hpp index df3d387d36..39aaa0d8bd 100644 --- a/include/boost/type_traits/is_convertible.hpp +++ b/include/boost/type_traits/is_convertible.hpp @@ -132,7 +132,7 @@ template struct is_convertible_basic_impl { static From _m_from; - static bool const value = sizeof( detail::checker::_m_check(_m_from, 0) ) + static bool const value = sizeof( boost::detail::checker::_m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type); }; diff --git a/include/boost/type_traits/is_function.hpp b/include/boost/type_traits/is_function.hpp index 5189d7301f..1f74345124 100644 --- a/include/boost/type_traits/is_function.hpp +++ b/include/boost/type_traits/is_function.hpp @@ -95,6 +95,9 @@ struct is_function_impl : public false_type BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,__is_function(T)) #else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,::boost::detail::is_function_impl::value) +#ifndef BOOST_NO_RVALUE_REFERENCES +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_function,T&&,false) +#endif #endif } // namespace boost diff --git a/include/boost/type_traits/is_lvalue_reference.hpp b/include/boost/type_traits/is_lvalue_reference.hpp new file mode 100644 index 0000000000..efa2dec6fe --- /dev/null +++ b/include/boost/type_traits/is_lvalue_reference.hpp @@ -0,0 +1,118 @@ + +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, +// Howard Hinnant and John Maddock 2000. +// (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 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/libs/type_traits for most recent version including documentation. + +// Fixed is_pointer, is_lvalue_reference, is_const, is_volatile, is_same, +// is_member_pointer based on the Simulated Partial Specialization work +// of Mat Marcus and Jesse Jones. See http://opensource.adobe.com or +// http://groups.yahoo.com/group/boost/message/5441 +// Some workarounds in here use ideas suggested from "Generic: +// Mappings between Types and Values" +// by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html). + + +#ifndef BOOST_TT_IS_LVALUE_REFERENCE_HPP_INCLUDED +#define BOOST_TT_IS_LVALUE_REFERENCE_HPP_INCLUDED + +#include + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# include +# include +#endif + +// should be the last #include +#include + +namespace boost { + +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_lvalue_reference,T,__is_reference(T)) +#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_lvalue_reference,T,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T&,true) + +#if defined(BOOST_ILLEGAL_CV_REFERENCES) +// these are illegal specialisations; cv-qualifies applied to +// references have no effect according to [8.3.2p1], +// C++ Builder requires them though as it treats cv-qualified +// references as distinct types... +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T& const,true) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T& volatile,true) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T& const volatile,true) +#endif + +#if defined(__GNUC__) && (__GNUC__ < 3) +// these allow us to work around illegally cv-qualified reference +// types. +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T const ,::boost::is_lvalue_reference::value) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T volatile ,::boost::is_lvalue_reference::value) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T const volatile ,::boost::is_lvalue_reference::value) +// However, the above specializations confuse gcc 2.96 unless we also +// supply these specializations for array types +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_lvalue_reference,T[N],false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_lvalue_reference,const T[N],false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_lvalue_reference,volatile T[N],false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_lvalue_reference,const volatile T[N],false) +#endif + +#else + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4181 4097) +#endif + +namespace detail { + +using ::boost::type_traits::yes_type; +using ::boost::type_traits::no_type; +using ::boost::type_traits::wrap; + +template T&(* is_lvalue_reference_helper1(wrap) )(wrap); +char is_lvalue_reference_helper1(...); + +template no_type is_lvalue_reference_helper2(T&(*)(wrap)); +yes_type is_lvalue_reference_helper2(...); + +template +struct is_lvalue_reference_impl +{ + BOOST_STATIC_CONSTANT( + bool, value = sizeof( + ::boost::detail::is_lvalue_reference_helper2( + ::boost::detail::is_lvalue_reference_helper1(::boost::type_traits::wrap()))) == 1 + ); +}; + +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_lvalue_reference,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_lvalue_reference,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_lvalue_reference,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_lvalue_reference,void const volatile,false) +#endif + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_lvalue_reference,T,::boost::detail::is_lvalue_reference_impl::value) + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED + diff --git a/include/boost/type_traits/is_reference.hpp b/include/boost/type_traits/is_reference.hpp index 3f3267c816..9bb0e6131a 100644 --- a/include/boost/type_traits/is_reference.hpp +++ b/include/boost/type_traits/is_reference.hpp @@ -1,6 +1,6 @@ // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, -// Howard Hinnant and John Maddock 2000. +// Howard Hinnant and John Maddock 2000, 2010. // (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 2001 // Use, modification and distribution are subject to the Boost Software License, @@ -9,107 +9,34 @@ // // See http://www.boost.org/libs/type_traits for most recent version including documentation. -// Fixed is_pointer, is_reference, is_const, is_volatile, is_same, -// is_member_pointer based on the Simulated Partial Specialization work -// of Mat Marcus and Jesse Jones. See http://opensource.adobe.com or -// http://groups.yahoo.com/group/boost/message/5441 -// Some workarounds in here use ideas suggested from "Generic: -// Mappings between Types and Values" -// by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html). - - #ifndef BOOST_TT_IS_REFERENCE_HPP_INCLUDED #define BOOST_TT_IS_REFERENCE_HPP_INCLUDED #include - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include -# include -#endif +#include +#include +#include // should be the last #include #include namespace boost { -#if defined( __CODEGEARC__ ) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,__is_reference(T)) -#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T&,true) - -#if defined(BOOST_ILLEGAL_CV_REFERENCES) -// these are illegal specialisations; cv-qualifies applied to -// references have no effect according to [8.3.2p1], -// C++ Builder requires them though as it treats cv-qualified -// references as distinct types... -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T& const,true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T& volatile,true) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T& const volatile,true) -#endif - -#if defined(__GNUC__) && (__GNUC__ < 3) -// these allow us to work around illegally cv-qualified reference -// types. -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T const ,::boost::is_reference::value) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T volatile ,::boost::is_reference::value) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T const volatile ,::boost::is_reference::value) -// However, the above specializations confuse gcc 2.96 unless we also -// supply these specializations for array types -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference,T[N],false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference,const T[N],false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference,volatile T[N],false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference,const volatile T[N],false) -#endif - -#else - -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable: 4181 4097) -#endif - namespace detail { -using ::boost::type_traits::yes_type; -using ::boost::type_traits::no_type; -using ::boost::type_traits::wrap; - -template T&(* is_reference_helper1(wrap) )(wrap); -char is_reference_helper1(...); - -template no_type is_reference_helper2(T&(*)(wrap)); -yes_type is_reference_helper2(...); - template struct is_reference_impl { - BOOST_STATIC_CONSTANT( - bool, value = sizeof( - ::boost::detail::is_reference_helper2( - ::boost::detail::is_reference_helper1(::boost::type_traits::wrap()))) == 1 - ); + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_lvalue_reference::value, ::boost::is_rvalue_reference::value + >::value)); }; -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void const volatile,false) -#endif - } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,::boost::detail::is_reference_impl::value) -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - } // namespace boost #include diff --git a/include/boost/type_traits/is_rvalue_reference.hpp b/include/boost/type_traits/is_rvalue_reference.hpp new file mode 100644 index 0000000000..c2c5205ef9 --- /dev/null +++ b/include/boost/type_traits/is_rvalue_reference.hpp @@ -0,0 +1,29 @@ + +// (C) John Maddock 2010. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_RVALUE_REFERENCE_HPP_INCLUDED +#define BOOST_TT_IS_RVALUE_REFERENCE_HPP_INCLUDED + +#include + +// should be the last #include +#include + +namespace boost { + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_rvalue_reference,T,false) +#ifndef BOOST_NO_RVALUE_REFERENCES +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_rvalue_reference,T&&,true) +#endif + +} // namespace boost + +#include + +#endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED + diff --git a/include/boost/type_traits/is_same.hpp b/include/boost/type_traits/is_same.hpp index 84195a22d0..ef2c75a8e7 100644 --- a/include/boost/type_traits/is_same.hpp +++ b/include/boost/type_traits/is_same.hpp @@ -61,7 +61,7 @@ struct is_same_part_1 template< typename T1, typename T2 > struct is_same_impl { - enum { value = detail::is_same_part_1::template part_2::value }; + enum { value = boost::detail::is_same_part_1::template part_2::value }; }; #else // generic "no-partial-specialization" version @@ -81,7 +81,7 @@ struct is_same_impl BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< - (sizeof(type_traits::yes_type) == sizeof(detail::is_same_tester(&t,&u))), + (sizeof(type_traits::yes_type) == sizeof(boost::detail::is_same_tester(&t,&u))), (::boost::is_reference::value == ::boost::is_reference::value), (sizeof(T) == sizeof(U)) >::value)); diff --git a/include/boost/type_traits/is_volatile.hpp b/include/boost/type_traits/is_volatile.hpp index 1cf39144f8..61721b53ee 100644 --- a/include/boost/type_traits/is_volatile.hpp +++ b/include/boost/type_traits/is_volatile.hpp @@ -41,16 +41,35 @@ namespace boost { +namespace detail{ +template +struct is_volatile_rval_filter +{ +#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) + BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::type*>::is_volatile); +#else + BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::is_volatile); +#endif +}; +#ifndef BOOST_NO_RVALUE_REFERENCES +// +// We can't filter out rvalue_references at the same level as +// references or we get ambiguities from msvc: +// +template +struct is_volatile_rval_filter +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#endif +} + #if defined( __CODEGEARC__ ) BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,__is_volatile(T)) #elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) //* is a type T declared volatile - is_volatile -#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) - BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp::type*>::is_volatile) -#else - BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp::is_volatile) -#endif +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::is_volatile_rval_filter::value) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T&,false) #if defined(BOOST_ILLEGAL_CV_REFERENCES) @@ -86,7 +105,7 @@ struct is_volatile_helper { static T* t; BOOST_STATIC_CONSTANT(bool, value = ( - sizeof(detail::yes_type) == sizeof(detail::is_volatile_tester(t)) + sizeof(boost::detail::yes_type) == sizeof(boost::detail::is_volatile_tester(t)) )); }; }; @@ -98,7 +117,7 @@ struct is_volatile_helper { static T t; BOOST_STATIC_CONSTANT(bool, value = ( - sizeof(detail::yes_type) == sizeof(detail::is_volatile_tester(&t)) + sizeof(boost::detail::yes_type) == sizeof(boost::detail::is_volatile_tester(&t)) )); }; }; diff --git a/include/boost/type_traits/msvc/remove_all_extents.hpp b/include/boost/type_traits/msvc/remove_all_extents.hpp index aa0b09a35c..f92d3aa052 100644 --- a/include/boost/type_traits/msvc/remove_all_extents.hpp +++ b/include/boost/type_traits/msvc/remove_all_extents.hpp @@ -36,7 +36,7 @@ namespace boost { template struct remove_all_extents { - typedef typename detail::remove_all_extents_impl_typeof< + typedef typename boost::detail::remove_all_extents_impl_typeof< boost::is_array::value >::template inner >::type type; BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_all_extents,T) diff --git a/include/boost/type_traits/msvc/remove_bounds.hpp b/include/boost/type_traits/msvc/remove_bounds.hpp index d097119f4b..57b8267428 100644 --- a/include/boost/type_traits/msvc/remove_bounds.hpp +++ b/include/boost/type_traits/msvc/remove_bounds.hpp @@ -32,7 +32,7 @@ namespace boost { template struct remove_bounds { - typedef typename detail::remove_bounds_impl_typeof< + typedef typename boost::detail::remove_bounds_impl_typeof< boost::is_array::value >::template inner >::type type; BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_bounds,T) diff --git a/include/boost/type_traits/msvc/remove_const.hpp b/include/boost/type_traits/msvc/remove_const.hpp index 47136cce09..68d238a36b 100644 --- a/include/boost/type_traits/msvc/remove_const.hpp +++ b/include/boost/type_traits/msvc/remove_const.hpp @@ -124,7 +124,7 @@ namespace boost { template struct remove_const { - typedef detail::remove_const_impl_typeof< + typedef boost::detail::remove_const_impl_typeof< boost::is_pointer::value, boost::is_array::value, boost::is_const::value, diff --git a/include/boost/type_traits/msvc/remove_cv.hpp b/include/boost/type_traits/msvc/remove_cv.hpp index b2ca9d1e63..817d49f43b 100644 --- a/include/boost/type_traits/msvc/remove_cv.hpp +++ b/include/boost/type_traits/msvc/remove_cv.hpp @@ -171,7 +171,7 @@ namespace boost { template struct remove_cv { - typedef detail::remove_cv_impl_typeof< + typedef boost::detail::remove_cv_impl_typeof< boost::is_pointer::value, boost::is_array::value, boost::is_const::value, diff --git a/include/boost/type_traits/msvc/remove_extent.hpp b/include/boost/type_traits/msvc/remove_extent.hpp index 0156060db7..27cfe159fe 100644 --- a/include/boost/type_traits/msvc/remove_extent.hpp +++ b/include/boost/type_traits/msvc/remove_extent.hpp @@ -32,7 +32,7 @@ namespace boost { template struct remove_extent { - typedef typename detail::remove_extent_impl_typeof< + typedef typename boost::detail::remove_extent_impl_typeof< boost::is_array::value >::template inner >::type type; BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_extent,T) diff --git a/include/boost/type_traits/msvc/remove_pointer.hpp b/include/boost/type_traits/msvc/remove_pointer.hpp index 73b225e352..ef93ab5c02 100644 --- a/include/boost/type_traits/msvc/remove_pointer.hpp +++ b/include/boost/type_traits/msvc/remove_pointer.hpp @@ -32,7 +32,7 @@ namespace boost { template struct remove_pointer { - typedef typename detail::remove_pointer_impl_typeof< + typedef typename boost::detail::remove_pointer_impl_typeof< boost::is_pointer::value >::template inner >::type type; BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_pointer,T) diff --git a/include/boost/type_traits/msvc/remove_reference.hpp b/include/boost/type_traits/msvc/remove_reference.hpp index c884a2911b..f4055eccf4 100644 --- a/include/boost/type_traits/msvc/remove_reference.hpp +++ b/include/boost/type_traits/msvc/remove_reference.hpp @@ -32,7 +32,7 @@ namespace boost { template struct remove_reference { - typedef typename detail::remove_reference_impl_typeof< + typedef typename boost::detail::remove_reference_impl_typeof< boost::is_reference::value >::template inner >::type type; BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_reference,T) diff --git a/include/boost/type_traits/msvc/remove_volatile.hpp b/include/boost/type_traits/msvc/remove_volatile.hpp index d16c4be1ff..c386232e57 100644 --- a/include/boost/type_traits/msvc/remove_volatile.hpp +++ b/include/boost/type_traits/msvc/remove_volatile.hpp @@ -124,7 +124,7 @@ namespace boost { template struct remove_volatile { - typedef detail::remove_volatile_impl_typeof< + typedef boost::detail::remove_volatile_impl_typeof< boost::is_pointer::value, boost::is_array::value, boost::is_const::value, diff --git a/include/boost/type_traits/remove_const.hpp b/include/boost/type_traits/remove_const.hpp index baacc95d07..ad125f733a 100644 --- a/include/boost/type_traits/remove_const.hpp +++ b/include/boost/type_traits/remove_const.hpp @@ -54,6 +54,18 @@ struct remove_const_impl >::type type; }; +#ifndef BOOST_NO_RVALUE_REFERENCES +// +// We can't filter out rvalue_references at the same level as +// references or we get ambiguities from msvc: +// +template +struct remove_const_impl +{ + typedef T&& type; +}; +#endif + } // namespace detail // * convert a type T to non-const type - remove_const diff --git a/include/boost/type_traits/remove_cv.hpp b/include/boost/type_traits/remove_cv.hpp index 6d8a5c8dea..0a5166b67b 100644 --- a/include/boost/type_traits/remove_cv.hpp +++ b/include/boost/type_traits/remove_cv.hpp @@ -27,10 +27,32 @@ namespace boost { +namespace detail{ + +template +struct rvalue_ref_filter_rem_cv +{ + typedef typename boost::detail::cv_traits_imp::unqualified_type type; +}; + +#ifndef BOOST_NO_RVALUE_REFERENCES +// +// We can't filter out rvalue_references at the same level as +// references or we get ambiguities from msvc: +// +template +struct rvalue_ref_filter_rem_cv +{ + typedef T&& type; +}; +#endif + +} + #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // convert a type T to a non-cv-qualified type - remove_cv -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::cv_traits_imp::unqualified_type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::rvalue_ref_filter_rem_cv::type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_cv,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const[N],T type[N]) diff --git a/include/boost/type_traits/remove_reference.hpp b/include/boost/type_traits/remove_reference.hpp index 8ba2f8a150..47eea62ff1 100644 --- a/include/boost/type_traits/remove_reference.hpp +++ b/include/boost/type_traits/remove_reference.hpp @@ -24,7 +24,27 @@ namespace boost { #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,T) +namespace detail{ +// +// We can't filter out rvalue_references at the same level as +// references or we get ambiguities from msvc: +// +template +struct remove_rvalue_ref +{ + typedef T type; +}; +#ifndef BOOST_NO_RVALUE_REFERENCES +template +struct remove_rvalue_ref +{ + typedef T type; +}; +#endif + +} // namespace detail + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,typename boost::detail::remove_rvalue_ref::type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T&,T) #if defined(BOOST_ILLEGAL_CV_REFERENCES) diff --git a/include/boost/type_traits/remove_volatile.hpp b/include/boost/type_traits/remove_volatile.hpp index 05c136f2cf..85b2e5cca6 100644 --- a/include/boost/type_traits/remove_volatile.hpp +++ b/include/boost/type_traits/remove_volatile.hpp @@ -53,6 +53,17 @@ struct remove_volatile_impl >::type type; }; +// +// We can't filter out rvalue_references at the same level as +// references or we get ambiguities from msvc: +// +#ifndef BOOST_NO_RVALUE_REFERENCES +template +struct remove_volatile_impl +{ + typedef T&& type; +}; +#endif } // namespace detail // * convert a type T to a non-volatile type - remove_volatile diff --git a/include/boost/type_traits/type_with_alignment.hpp b/include/boost/type_traits/type_with_alignment.hpp index abb070aa07..f575bd25b4 100644 --- a/include/boost/type_traits/type_with_alignment.hpp +++ b/include/boost/type_traits/type_with_alignment.hpp @@ -286,43 +286,43 @@ struct __declspec(align(128)) a128 { template<> class type_with_alignment<8> { typedef mpl::if_c< - ::boost::alignment_of::value < 8, + ::boost::alignment_of::value < 8, align::a8, - detail::type_with_alignment_imp<8> >::type t1; + boost::detail::type_with_alignment_imp<8> >::type t1; public: typedef t1::type type; }; template<> class type_with_alignment<16> { typedef mpl::if_c< - ::boost::alignment_of::value < 16, + ::boost::alignment_of::value < 16, align::a16, - detail::type_with_alignment_imp<16> >::type t1; + boost::detail::type_with_alignment_imp<16> >::type t1; public: typedef t1::type type; }; template<> class type_with_alignment<32> { typedef mpl::if_c< - ::boost::alignment_of::value < 32, + ::boost::alignment_of::value < 32, align::a32, - detail::type_with_alignment_imp<32> >::type t1; + boost::detail::type_with_alignment_imp<32> >::type t1; public: typedef t1::type type; }; template<> class type_with_alignment<64> { typedef mpl::if_c< - ::boost::alignment_of::value < 64, + ::boost::alignment_of::value < 64, align::a64, - detail::type_with_alignment_imp<64> >::type t1; + boost::detail::type_with_alignment_imp<64> >::type t1; public: typedef t1::type type; }; template<> class type_with_alignment<128> { typedef mpl::if_c< - ::boost::alignment_of::value < 128, + ::boost::alignment_of::value < 128, align::a128, - detail::type_with_alignment_imp<128> >::type t1; + boost::detail::type_with_alignment_imp<128> >::type t1; public: typedef t1::type type; }; diff --git a/include/boost/utility/compare_pointees.hpp b/include/boost/utility/compare_pointees.hpp index 725697945a..136c058e19 100644 --- a/include/boost/utility/compare_pointees.hpp +++ b/include/boost/utility/compare_pointees.hpp @@ -4,7 +4,7 @@ // 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. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/include/boost/utility/detail/in_place_factory_prefix.hpp b/include/boost/utility/detail/in_place_factory_prefix.hpp index 03a08fb936..ee38c67003 100644 --- a/include/boost/utility/detail/in_place_factory_prefix.hpp +++ b/include/boost/utility/detail/in_place_factory_prefix.hpp @@ -5,7 +5,7 @@ // 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. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/include/boost/utility/detail/in_place_factory_suffix.hpp b/include/boost/utility/detail/in_place_factory_suffix.hpp index 9a3cf22d16..009d64c5d5 100644 --- a/include/boost/utility/detail/in_place_factory_suffix.hpp +++ b/include/boost/utility/detail/in_place_factory_suffix.hpp @@ -5,7 +5,7 @@ // 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. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/include/boost/utility/detail/result_of_iterate.hpp b/include/boost/utility/detail/result_of_iterate.hpp index dd32cc285f..43fc16f4f4 100644 --- a/include/boost/utility/detail/result_of_iterate.hpp +++ b/include/boost/utility/detail/result_of_iterate.hpp @@ -20,10 +20,69 @@ #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) template -struct result_of - : boost::detail::result_of_impl::value)> {}; +struct tr1_result_of + : mpl::if_< + mpl::or_< is_pointer, is_member_function_pointer > + , boost::detail::tr1_result_of_impl< + typename remove_cv::type, + typename remove_cv::type(BOOST_RESULT_OF_ARGS), + (boost::detail::has_result_type::value)> + , boost::detail::tr1_result_of_impl< + F, + F(BOOST_RESULT_OF_ARGS), + (boost::detail::has_result_type::value)> >::type { }; #endif +#if !defined(BOOST_NO_DECLTYPE) && defined(BOOST_RESULT_OF_USE_DECLTYPE) + +// As of N2588, C++0x result_of only supports function call +// expressions of the form f(x). This precludes support for member +// function pointers, which are invoked with expressions of the form +// o->*f(x). This implementation supports both. +template +struct result_of + : mpl::if_< + mpl::or_< is_pointer, is_member_function_pointer > + , detail::tr1_result_of_impl< + typename remove_cv::type, + typename remove_cv::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false + > + , detail::cpp0x_result_of_impl< + F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)) + > + >::type +{}; + +namespace detail { + +# define BOOST_RESULT_OF_STATIC_MEMBERS(z, n, _) \ + static T ## n t ## n; \ + /**/ + +template +class cpp0x_result_of_impl +{ + static F f; + BOOST_PP_REPEAT(BOOST_PP_ITERATION(), BOOST_RESULT_OF_STATIC_MEMBERS, _) +public: + typedef decltype(f(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),t))) type; +}; + +} // namespace detail + +#else // defined(BOOST_NO_DECLTYPE) + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +template +struct result_of + : tr1_result_of { }; +#endif + +#endif // defined(BOOST_NO_DECLTYPE) + #undef BOOST_RESULT_OF_ARGS #if BOOST_PP_ITERATION() >= 1 @@ -32,14 +91,14 @@ namespace detail { template -struct result_of_impl +struct tr1_result_of_impl { typedef R type; }; template -struct result_of_impl +struct tr1_result_of_impl { typedef R type; }; @@ -47,7 +106,7 @@ struct result_of_impl -struct result_of_impl { @@ -56,7 +115,7 @@ struct result_of_impl -struct result_of_impl @@ -66,7 +125,7 @@ struct result_of_impl -struct result_of_impl @@ -76,7 +135,7 @@ struct result_of_impl -struct result_of_impl diff --git a/include/boost/utility/in_place_factory.hpp b/include/boost/utility/in_place_factory.hpp index a7f72c39c6..a620f6048f 100644 --- a/include/boost/utility/in_place_factory.hpp +++ b/include/boost/utility/in_place_factory.hpp @@ -5,7 +5,7 @@ // 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. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/include/boost/utility/result_of.hpp b/include/boost/utility/result_of.hpp index 26cab6f9f3..e4ca74e6f4 100644 --- a/include/boost/utility/result_of.hpp +++ b/include/boost/utility/result_of.hpp @@ -10,13 +10,18 @@ #define BOOST_RESULT_OF_HPP #include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include +#include +#include +#include +#include #ifndef BOOST_RESULT_OF_NUM_ARGS # define BOOST_RESULT_OF_NUM_ARGS 10 @@ -25,13 +30,15 @@ namespace boost { template struct result_of; +template struct tr1_result_of; // a TR1-style implementation of result_of #if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) namespace detail { BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) -template struct result_of_impl; +template struct tr1_result_of_impl; +template struct cpp0x_result_of_impl; template struct result_of_void_impl @@ -51,8 +58,13 @@ struct result_of_void_impl typedef R type; }; +// Determine the return type of a function pointer or pointer to member. template -struct result_of_impl +struct result_of_pointer + : tr1_result_of_impl::type, FArgs, false> { }; + +template +struct tr1_result_of_impl { typedef typename F::result_type type; }; @@ -68,7 +80,7 @@ struct result_of_nested_result : F::template result {}; template -struct result_of_impl +struct tr1_result_of_impl : mpl::if_, result_of_void_impl, result_of_nested_result >::type diff --git a/include/boost/utility/typed_in_place_factory.hpp b/include/boost/utility/typed_in_place_factory.hpp index 7beb8cc06f..3725037ae6 100644 --- a/include/boost/utility/typed_in_place_factory.hpp +++ b/include/boost/utility/typed_in_place_factory.hpp @@ -5,7 +5,7 @@ // 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. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/include/boost/utility/value_init.hpp b/include/boost/utility/value_init.hpp index 539ce709aa..3e8bb0f9ad 100644 --- a/include/boost/utility/value_init.hpp +++ b/include/boost/utility/value_init.hpp @@ -9,6 +9,8 @@ // 23 May 2008 (Fixed operator= const issue, added initialized_value) Niels Dekker, Fernando Cacciola // 21 Ago 2008 (Added swap) Niels Dekker, Fernando Cacciola // 20 Feb 2009 (Fixed logical const-ness issues) Niels Dekker, Fernando Cacciola +// 03 Apr 2010 (Added initialized, suggested by Jeffrey Hellrung, fixing #3472) Niels Dekker +// 30 May 2010 (Made memset call conditional, fixing #3869) Niels Dekker // #ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP #define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP @@ -20,6 +22,7 @@ // contains. More details on these issues are at libs/utility/value_init.htm #include +#include // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION. #include #include #include @@ -28,10 +31,39 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(push) +#if _MSC_VER >= 1310 +// It is safe to ignore the following warning from MSVC 7.1 or higher: +// "warning C4351: new behavior: elements of array will be default initialized" +#pragma warning(disable: 4351) +// It is safe to ignore the following MSVC warning, which may pop up when T is +// a const type: "warning C4512: assignment operator could not be generated". +#pragma warning(disable: 4512) +#endif +#endif + +#ifdef BOOST_NO_COMPLETE_VALUE_INITIALIZATION + // Implementation detail: The macro BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED + // suggests that a workaround should be applied, because of compiler issues + // regarding value-initialization. + #define BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED +#endif + +// Implementation detail: The macro BOOST_DETAIL_VALUE_INIT_WORKAROUND +// switches the value-initialization workaround either on or off. +#ifndef BOOST_DETAIL_VALUE_INIT_WORKAROUND + #ifdef BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED + #define BOOST_DETAIL_VALUE_INIT_WORKAROUND 1 + #else + #define BOOST_DETAIL_VALUE_INIT_WORKAROUND 0 + #endif +#endif + namespace boost { template -class value_initialized +class initialized { private : struct wrapper @@ -40,6 +72,18 @@ class value_initialized typename #endif remove_const::type data; + + wrapper() + : + data() + { + } + + wrapper(T const & arg) + : + data(arg) + { + } }; mutable @@ -55,30 +99,25 @@ class value_initialized public : - value_initialized() + initialized() { +#if BOOST_DETAIL_VALUE_INIT_WORKAROUND std::memset(&x, 0, sizeof(x)); -#ifdef BOOST_MSVC -#pragma warning(push) -#if _MSC_VER >= 1310 -// When using MSVC 7.1 or higher, the following placement new expression may trigger warning C4345: -// "behavior change: an object of POD type constructed with an initializer of the form () -// will be default-initialized". It is safe to ignore this warning when using value_initialized. -#pragma warning(disable: 4345) -#endif #endif new (wrapper_address()) wrapper(); -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif } - value_initialized(value_initialized const & arg) + initialized(initialized const & arg) { new (wrapper_address()) wrapper( static_cast(*(arg.wrapper_address()))); } - value_initialized & operator=(value_initialized const & arg) + explicit initialized(T const & arg) + { + new (wrapper_address()) wrapper(arg); + } + + initialized & operator=(initialized const & arg) { // Assignment is only allowed when T is non-const. BOOST_STATIC_ASSERT( ! is_const::value ); @@ -86,7 +125,7 @@ class value_initialized return *this; } - ~value_initialized() + ~initialized() { wrapper_address()->wrapper::~wrapper(); } @@ -101,17 +140,81 @@ class value_initialized return wrapper_address()->data; } - void swap(value_initialized & arg) + void swap(initialized & arg) { ::boost::swap( this->data(), arg.data() ); } - operator T const &() const { return this->data(); } + operator T const &() const + { + return wrapper_address()->data; + } - operator T&() { return this->data(); } + operator T&() + { + return wrapper_address()->data; + } } ; +template +T const& get ( initialized const& x ) +{ + return x.data() ; +} + +template +T& get ( initialized& x ) +{ + return x.data() ; +} + +template +void swap ( initialized & lhs, initialized & rhs ) +{ + lhs.swap(rhs) ; +} + +template +class value_initialized +{ + private : + + // initialized does value-initialization by default. + initialized m_data; + + public : + + value_initialized() + : + m_data() + { } + + T const & data() const + { + return m_data.data(); + } + + T& data() + { + return m_data.data(); + } + + void swap(value_initialized & arg) + { + m_data.swap(arg.m_data); + } + + operator T const &() const + { + return m_data; + } + + operator T&() + { + return m_data; + } +} ; template @@ -119,6 +222,7 @@ T const& get ( value_initialized const& x ) { return x.data() ; } + template T& get ( value_initialized& x ) { @@ -138,7 +242,7 @@ class initialized_value_t template operator T() const { - return get( value_initialized() ); + return initialized().data(); } }; @@ -147,5 +251,8 @@ initialized_value_t const initialized_value = {} ; } // namespace boost +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif #endif diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 57525c90e7..8916ec771a 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -765,23 +765,30 @@ bool WinEDA_PcbFrame::OnHotkeyMoveItem( int aIdCommand ) break; case TYPE_TEXTE: - evt_type = ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST; + if( aIdCommand == HK_MOVE_ITEM ) + evt_type = ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST; break; case TYPE_MIRE: - evt_type = ID_POPUP_PCB_MOVE_MIRE_REQUEST; + if( aIdCommand == HK_MOVE_ITEM ) + evt_type = ID_POPUP_PCB_MOVE_MIRE_REQUEST; break; case TYPE_ZONE_CONTAINER: - evt_type = ID_POPUP_PCB_MOVE_ZONE_OUTLINES; + if( aIdCommand == HK_MOVE_ITEM ) + evt_type = ID_POPUP_PCB_MOVE_ZONE_OUTLINES; + if( aIdCommand == HK_DRAG_ITEM ) + evt_type = ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT; break; case TYPE_TEXTE_MODULE: - evt_type = ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST; + if( aIdCommand == HK_MOVE_ITEM ) + evt_type = ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST; break; case TYPE_DRAWSEGMENT: - evt_type = ID_POPUP_PCB_MOVE_DRAWING_REQUEST; + if( aIdCommand == HK_MOVE_ITEM ) + evt_type = ID_POPUP_PCB_MOVE_DRAWING_REQUEST; break; default: @@ -844,11 +851,13 @@ bool WinEDA_PcbFrame::OnHotkeyRotateItem( int aIdCommand ) break; case TYPE_TEXTE: - evt_type = ID_POPUP_PCB_ROTATE_TEXTEPCB; + if( aIdCommand == HK_ROTATE_ITEM ) // Rotation + evt_type = ID_POPUP_PCB_ROTATE_TEXTEPCB; break; case TYPE_TEXTE_MODULE: - evt_type = ID_POPUP_PCB_ROTATE_TEXTMODULE; + if( aIdCommand == HK_ROTATE_ITEM ) // Rotation + evt_type = ID_POPUP_PCB_ROTATE_TEXTMODULE; break; default: diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 599507cf94..78c0c2dcfe 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -581,8 +581,9 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu { ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ADD_ZONE_CORNER, _( "Create Corner" ), add_corner_xpm ); + msg = AddHotkeyName( _( "Drag Outline Segment" ), s_Board_Editor_Hokeys_Descr, HK_DRAG_ITEM ); ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT, - _( "Drag Outline Segment" ), drag_outline_segment_xpm ); + msg, drag_outline_segment_xpm ); } zones_menu->AppendSeparator();