* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
+ * 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group.
+ * See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168
+ * Eventually, we should remove "assign" which is now a synonym for "fill" (Marshall Clow)
+ * 10 Mar 2010 - added workaround for SUNCC and !STLPort [trac #3893] (Marshall Clow)
* 29 Jan 2004 - c_array() added, BOOST_NO_PRIVATE_IN_AGGREGATE removed (Nico Josuttis)
* 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries.
* 05 Aug 2001 - minor update (Nico Josuttis)
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(push)
# pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe
+# pragma warning(disable:4510) // boost::array<T,N>' : default constructor could not be generated
+# pragma warning(disable:4610) // warning C4610: class 'boost::array<T,N>' can never be instantiated - user defined constructor required
#endif
#include <cstddef>
reference, iterator, reference> > reverse_iterator;
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
const_reference, iterator, reference> > const_reverse_iterator;
+#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
+ typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
+ value_type, reference, iterator, difference_type> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
+ value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
#else
// workaround for broken reverse_iterator implementations
typedef std::reverse_iterator<iterator,T> reverse_iterator;
}
// assign one value to all elements
- void assign (const T& value)
+ void assign (const T& value) { fill ( value ); } // A synonym for fill
+ void fill (const T& value)
{
std::fill_n(begin(),size(),value);
}
// check range (may be private because it is static)
static void rangecheck (size_type i) {
if (i >= size()) {
- throw std::out_of_range("array<>: index out of range");
+ std::out_of_range e("array<>: index out of range");
+ boost::throw_exception(e);
}
}
reference, iterator, reference> > reverse_iterator;
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
const_reference, iterator, reference> > const_reverse_iterator;
+#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
+ typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
+ value_type, reference, iterator, difference_type> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
+ value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
#else
// workaround for broken reverse_iterator implementations
typedef std::reverse_iterator<iterator,T> reverse_iterator;
}
// assign one value to all elements
- void assign (const T& ) { }
-
+ void assign (const T& value) { fill ( value ); }
+ void fill (const T& ) {}
+
// check range (may be private because it is static)
static reference failed_rangecheck () {
std::out_of_range e("attempt to access element of an empty array");
boost::throw_exception(e);
+#if defined(BOOST_NO_EXCEPTIONS) || !defined(BOOST_MSVC)
//
// We need to return something here to keep
// some compilers happy: however we will never
//
static T placeholder;
return placeholder;
+#endif
}
};
#endif
x.swap(y);
}
+ // Specific for boost::array: simply returns its elems data member.
+ template <typename T, std::size_t N>
+ T(&get_c_array(boost::array<T,N>& arg))[N]
+ {
+ return arg.elems;
+ }
+
+ // Const version.
+ template <typename T, std::size_t N>
+ const T(&get_c_array(const boost::array<T,N>& arg))[N]
+ {
+ return arg.elems;
+ }
+
+#if 0
+ // Overload for std::array, assuming that std::array will have
+ // explicit conversion functions as discussed at the WG21 meeting
+ // in Summit, March 2009.
+ template <typename T, std::size_t N>
+ T(&get_c_array(std::array<T,N>& arg))[N]
+ {
+ return static_cast<T(&)[N]>(arg);
+ }
+
+ // Const version.
+ template <typename T, std::size_t N>
+ const T(&get_c_array(const std::array<T,N>& arg))[N]
+ {
+ return static_cast<T(&)[N]>(arg);
+ }
+#endif
+
} /* namespace boost */
namespace
{
-#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 400)
+#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ < 4)
static inline boost::arg<1> _1() { return boost::arg<1>(); }
static inline boost::arg<2> _2() { return boost::arg<2>(); }
static inline boost::arg<9> _9() { return boost::arg<9>(); }
#elif defined(BOOST_MSVC) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__) || \
- defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ == 400)
+ defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
static boost::arg<1> _1;
static boost::arg<2> _2;
{
f(arg);
}
-
+
+#if (BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(4) \
+ && BOOST_WORKAROUND(__GNUC__, > 3)))
+ // Declare a dummy construktor to make gcc happy.
+ // It seems the compiler can not generate a sensible constructor when this is instantiated with a refence type.
+ // (warning: non-static reference "const double& boost::UnaryFunction<YourClassHere>::arg"
+ // in class without a constructor [-Wuninitialized])
+ UnaryFunction();
+#endif
+
Func f;
Arg arg;
};
// 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
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!
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.
# 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")
# 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")
# 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
# 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")
# 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")
# 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"
# 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
&& 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
# undef BOOST_AUTO_LINK_NOMANGLE
#endif
-
-
-
-
-
-
-
-
-
-
//
// 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
//
//
// 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:
# 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__)
#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
#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
// 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 <cstring> so that Boost.test works:
# include <cstring>
//
// 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
#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
//
// 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
//
//
// 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:
#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
//
// 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
#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
// check for exception handling support:
-#ifndef _CPPUNWIND
+#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS)
# define BOOST_NO_EXCEPTIONS
#endif
# 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
# if __GNUC_MINOR__ < 4
# define BOOST_NO_IS_ABSTRACT
# endif
+# define BOOST_NO_EXTERN_TEMPLATE
#endif
#if __GNUC__ < 4
//
# 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
#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_LAMBDAS
#define BOOST_NO_NULLPTR
-#define BOOST_NO_RAW_LITERALS
#define BOOST_NO_TEMPLATE_ALIASES
-#define BOOST_NO_UNICODE_LITERALS
// C++0x features in 4.3.n and later
//
//
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
+# define BOOST_NO_LAMBDAS
+# define BOOST_NO_RAW_LITERALS
+# define BOOST_NO_UNICODE_LITERALS
#endif
// ConceptGCC compiler:
//
#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__
# 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)
# 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
# define BOOST_NO_INTRINSIC_WCHAR_T
#endif
-#if !__option(exceptions)
+#if !__option(exceptions) && !defined(BOOST_NO_EXCEPTIONS)
# define BOOST_NO_EXCEPTIONS
#endif
// if no threading API is detected.
//
-#if (__PGIC__ >= 7)
+// PGI 10.x doesn't seem to define __PGIC__
+
+// versions earlier than 10.x do define __PGIC__
+#if __PGIC__ >= 10
+
+// options requested by configure --enable-test
+#define BOOST_HAS_PTHREADS
+#define BOOST_HAS_NRVO
+#define BOOST_HAS_LONG_LONG
+
+// options --enable-test wants undefined
+#undef BOOST_NO_STDC_NAMESPACE
+#undef BOOST_NO_EXCEPTION_STD_NAMESPACE
+#undef BOOST_DEDUCED_TYPENAME
+
+#elif __PGIC__ >= 7
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
#define BOOST_NO_SWPRINTF
+#define BOOST_NO_AUTO_MULTIDECLARATIONS
+#define BOOST_NO_AUTO_DECLARATIONS
#else
//
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
//
-#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_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:
//
//
// 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
# 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:
//
// 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)
# 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
//
// check for exception handling support:
-#ifndef _CPPUNWIND
+#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS)
# define BOOST_NO_EXCEPTIONS
#endif
#if (_MSC_VER >= 1200)
# define BOOST_HAS_MS_INT64
#endif
-#if (_MSC_VER >= 1310) && (defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1500))
+#if (_MSC_VER >= 1310) && (defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1400))
# define BOOST_HAS_LONG_LONG
#else
# define BOOST_NO_LONG_LONG
# define BOOST_NO_RTTI
#endif
-//
-// all versions support __declspec:
-//
-#define BOOST_HAS_DECLSPEC
-
//
// C++0x features
//
#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
#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:
//
// 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
# 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
// 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
# define BOOST_CXX_IBMCPP 0
# define BOOST_CXX_MSVC 0
# define BOOST_CXX_PGI 0
+# define BOOST_CXX_NVCC 0
// locate which compiler we are using and define
// GCC-XML emulates other compilers, it has to appear first here!
# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp"
+#elif defined __CUDACC__
+// NVIDIA CUDA C++ compiler for GPU
+# define BOOST_COMPILER_CONFIG "boost/config/compiler/nvcc.hpp"
+
#elif defined __COMO__
// 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"
// vxWorks:
# define BOOST_PLATFORM_CONFIG "boost/config/platform/vxworks.hpp"
+#elif defined(__SYMBIAN32__)
+// Symbian:
+# define BOOST_PLATFORM_CONFIG "boost/config/platform/symbian.hpp"
+
#else
# if defined(unix) \
# define BOOST_NO_STD_LOCALE
#endif
+#include <typeinfo>
+#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
# 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
# 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
# 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
# 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 ---
# 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
# 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
# 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
# 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
# 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
# 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
// Copyright (c) 2002-2003 David Abrahams
// Copyright (c) 2003 Gennaro Prota
// Copyright (c) 2003 Eric Friedman
-//
+// Copyright (c) 2010 Eric Jourdanneau, Joel Falcou
// 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_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 <limits.h>.
// Note that we use limits.h rather than climits for maximal portability,
# 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:
# 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:
#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 <typeinfo>
+namespace std{ using ::typeinfo; }
+#endif
// ---------------------------------------------------------------------------//
# endif
# endif
+//
+// Set some default values GPU support
+//
+# ifndef BOOST_GPU_ENABLED
+# define BOOST_GPU_ENABLED
+# endif
#endif
-
******************************************************/
-#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(INT8_C)
+#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && \
+ (!defined(INT8_C) || !defined(INT16_C) || !defined(INT32_C) || !defined(INT64_C))
+//
+// For the following code we get several warnings along the lines of:
+//
+// boost/cstdint.hpp:428:35: error: use of C99 long long integer constant
+//
+// So we declare this a system header to suppress these warnings.
+//
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#pragma GCC system_header
+#endif
+
#include <limits.h>
# define BOOST__STDC_CONSTANT_MACROS_DEFINED
# if defined(BOOST_HAS_MS_INT64)
//
// Borland/Intel/Microsoft compilers have width specific suffixes:
//
+#ifndef INT8_C
# define INT8_C(value) value##i8
+#endif
+#ifndef INT16_C
# define INT16_C(value) value##i16
+#endif
+#ifndef INT32_C
# define INT32_C(value) value##i32
+#endif
+#ifndef INT64_C
# define INT64_C(value) value##i64
+#endif
# ifdef __BORLANDC__
// Borland bug: appending ui8 makes the type a signed char
# define UINT8_C(value) static_cast<unsigned char>(value##u)
# else
# define UINT8_C(value) value##ui8
# endif
+#ifndef UINT16_C
# define UINT16_C(value) value##ui16
+#endif
+#ifndef UINT32_C
# define UINT32_C(value) value##ui32
+#endif
+#ifndef UINT64_C
# define UINT64_C(value) value##ui64
+#endif
+#ifndef INTMAX_C
# define INTMAX_C(value) value##i64
# define UINTMAX_C(value) value##ui64
+#endif
# else
// do it the old fashioned way:
// 8-bit types ------------------------------------------------------------//
-# if UCHAR_MAX == 0xff
+# if (UCHAR_MAX == 0xff) && !defined(INT8_C)
# define INT8_C(value) static_cast<boost::int8_t>(value)
# define UINT8_C(value) static_cast<boost::uint8_t>(value##u)
# endif
// 16-bit types -----------------------------------------------------------//
-# if USHRT_MAX == 0xffff
+# if (USHRT_MAX == 0xffff) && !defined(INT16_C)
# define INT16_C(value) static_cast<boost::int16_t>(value)
# define UINT16_C(value) static_cast<boost::uint16_t>(value##u)
# endif
// 32-bit types -----------------------------------------------------------//
-
-# if UINT_MAX == 0xffffffff
+#ifndef INT32_C
+# if (UINT_MAX == 0xffffffff)
# define INT32_C(value) value
# define UINT32_C(value) value##u
# elif ULONG_MAX == 0xffffffff
# define INT32_C(value) value##L
# define UINT32_C(value) value##uL
# endif
+#endif
// 64-bit types + intmax_t and uintmax_t ----------------------------------//
-
+#ifndef INT64_C
# if defined(BOOST_HAS_LONG_LONG) && \
(defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_LLONG_MAX))
# define INTMAX_C(value) INT64_C(value)
# define UINTMAX_C(value) UINT64_C(value)
# endif
-
+#endif
# endif // Borland/Microsoft specific width suffixes
#endif // INT#_C macros.
#include <algorithm>
#include <vector>
+#include <boost/range/begin.hpp>
+#include <boost/range/end.hpp>
+#include <boost/range/algorithm/copy.hpp>
+#include <boost/range/algorithm/equal.hpp>
+#include <boost/range/algorithm/sort.hpp>
+#include <boost/range/algorithm/stable_sort.hpp>
+#include <boost/range/algorithm/find_if.hpp>
+#include <boost/range/algorithm/count.hpp>
+#include <boost/range/algorithm/count_if.hpp>
+#include <boost/range/algorithm_ext/is_sorted.hpp>
+#include <boost/range/algorithm_ext/iota.hpp>
namespace boost {
- template <typename Iter1, typename Iter2>
- Iter1 begin(const std::pair<Iter1, Iter2>& p) { return p.first; }
-
- template <typename Iter1, typename Iter2>
- Iter2 end(const std::pair<Iter1, Iter2>& p) { return p.second; }
-
- template <typename Iter1, typename Iter2>
- typename boost::detail::iterator_traits<Iter1>::difference_type
- size(const std::pair<Iter1, Iter2>& p) {
- return std::distance(p.first, p.second);
- }
-
-#if 0
- // These seem to interfere with the std::pair overloads :(
- template <typename Container>
- typename Container::iterator
- begin(Container& c) { return c.begin(); }
-
- template <typename Container>
- typename Container::const_iterator
- begin(const Container& c) { return c.begin(); }
-
- template <typename Container>
- typename Container::iterator
- end(Container& c) { return c.end(); }
-
- template <typename Container>
- typename Container::const_iterator
- end(const Container& c) { return c.end(); }
-
- template <typename Container>
- typename Container::size_type
- size(const Container& c) { return c.size(); }
-#else
- template <typename T>
- typename std::vector<T>::iterator
- begin(std::vector<T>& c) { return c.begin(); }
-
- template <typename T>
- typename std::vector<T>::const_iterator
- begin(const std::vector<T>& c) { return c.begin(); }
-
- template <typename T>
- typename std::vector<T>::iterator
- end(std::vector<T>& c) { return c.end(); }
-
- template <typename T>
- typename std::vector<T>::const_iterator
- end(const std::vector<T>& c) { return c.end(); }
-
- template <typename T>
- typename std::vector<T>::size_type
- size(const std::vector<T>& c) { return c.size(); }
-#endif
-
- template <class ForwardIterator, class T>
- void iota(ForwardIterator first, ForwardIterator last, T value)
- {
- for (; first != last; ++first, ++value)
- *first = value;
- }
- template <typename Container, typename T>
- void iota(Container& c, const T& value)
- {
- iota(begin(c), end(c), value);
- }
-
- // Also do version with 2nd container?
- template <typename Container, typename OutIter>
- OutIter copy(const Container& c, OutIter result) {
- return std::copy(begin(c), end(c), result);
- }
-
- template <typename Container1, typename Container2>
- bool equal(const Container1& c1, const Container2& c2)
- {
- if (size(c1) != size(c2))
- return false;
- return std::equal(begin(c1), end(c1), begin(c2));
- }
-
- template <typename Container>
- void sort(Container& c) { std::sort(begin(c), end(c)); }
-
- template <typename Container, typename Predicate>
- void sort(Container& c, const Predicate& p) {
- std::sort(begin(c), end(c), p);
- }
-
- template <typename Container>
- void stable_sort(Container& c) { std::stable_sort(begin(c), end(c)); }
-
- template <typename Container, typename Predicate>
- void stable_sort(Container& c, const Predicate& p) {
- std::stable_sort(begin(c), end(c), p);
- }
-
template <typename InputIterator, typename Predicate>
bool any_if(InputIterator first, InputIterator last, Predicate p)
{
return std::find_if(first, last, p) != last;
}
+
template <typename Container, typename Predicate>
bool any_if(const Container& c, Predicate p)
{
- return any_if(begin(c), end(c), p);
+ return any_if(boost::begin(c), boost::end(c), p);
}
template <typename InputIterator, typename T>
template <typename Container, typename T>
bool container_contains(const Container& c, const T& value)
{
- return container_contains(begin(c), end(c), value);
- }
-
- template <typename Container, typename T>
- std::size_t count(const Container& c, const T& value)
- {
- return std::count(begin(c), end(c), value);
- }
-
- template <typename Container, typename Predicate>
- std::size_t count_if(const Container& c, Predicate p)
- {
- return std::count_if(begin(c), end(c), p);
- }
-
- template <typename ForwardIterator>
- bool is_sorted(ForwardIterator first, ForwardIterator last)
- {
- if (first == last)
- return true;
-
- ForwardIterator next = first;
- for (++next; next != last; first = next, ++next) {
- if (*next < *first)
- return false;
- }
-
- return true;
- }
-
- template <typename ForwardIterator, typename StrictWeakOrdering>
- bool is_sorted(ForwardIterator first, ForwardIterator last,
- StrictWeakOrdering comp)
- {
- if (first == last)
- return true;
-
- ForwardIterator next = first;
- for (++next; next != last; first = next, ++next) {
- if (comp(*next, *first))
- return false;
- }
-
- return true;
- }
-
- template <typename Container>
- bool is_sorted(const Container& c)
- {
- return is_sorted(begin(c), end(c));
- }
-
- template <typename Container, typename StrictWeakOrdering>
- bool is_sorted(const Container& c, StrictWeakOrdering comp)
- {
- return is_sorted(begin(c), end(c), comp);
+ return container_contains(boost::begin(c), boost::end(c), value);
}
} // namespace boost
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
-#if ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) && defined(_GLIBCXX_DEBUG)) \
+#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) \
+ || ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) \
+ && (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL))) \
|| BOOST_WORKAROUND(__BORLANDC__, > 0x551) \
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \
|| (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
// 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)
# 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__) \
template<class Source, class Target>
inline void lcast_set_precision(std::ios_base& stream, Source*, Target*)
{
- std::streamsize const s = lcast_get_precision((Source*)0);
- std::streamsize const t = lcast_get_precision((Target*)0);
+ std::streamsize const s = lcast_get_precision(static_cast<Source*>(0));
+ std::streamsize const t = lcast_get_precision(static_cast<Target*>(0));
stream.precision(s > t ? s : t);
}
// 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
#ifdef BOOST_NO_SCOPED_ENUMS
-# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_t
+# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type
# define BOOST_SCOPED_ENUM_END };
-# define BOOST_SCOPED_ENUM(name) name::enum_t
+# define BOOST_SCOPED_ENUM(name) name::enum_type
#else
}
};
-template<class T> sp_typeinfo sp_typeid_< T >::ti_( sp_typeid_< T >::name() );
+template<class T> sp_typeinfo sp_typeid_< T >::ti_ = sp_typeid_< T >::name();
template<class T> struct sp_typeid_< T & >: sp_typeid_< T >
{
#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
-//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
//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)
{
public:
- virtual char const * tag_typeid_name() const = 0;
+ virtual std::string tag_typeid_name() const = 0;
virtual std::string value_as_string() const = 0;
protected:
private:
- char const * tag_typeid_name() const;
+ std::string tag_typeid_name() const;
std::string value_as_string() const;
value_type value_;
namespace
boost
{
+ typedef shared_ptr<exception_detail::clone_base const> exception_ptr;
+
+ exception_ptr current_exception();
+
+ template <class T>
+ inline
+ exception_ptr
+ copy_exception( T const & e )
+ {
+ try
+ {
+ throw enable_current_exception(e);
+ }
+ catch(
+ ... )
+ {
+ return current_exception();
+ }
+ }
+
#ifndef BOOST_NO_RTTI
typedef error_info<struct tag_original_exception_type,std::type_info const *> original_exception_type;
}
#endif
- class exception_ptr;
- exception_ptr current_exception();
- void rethrow_exception( exception_ptr const & );
-
- class
- exception_ptr
+ namespace
+ exception_detail
{
- typedef bool exception_ptr::*unspecified_bool_type;
- friend exception_ptr current_exception();
- friend void rethrow_exception( exception_ptr const & );
-
- shared_ptr<exception_detail::clone_base const> c_;
- bool bad_alloc_;
-
struct
- bad_alloc_tag
- {
- };
-
- explicit
- exception_ptr( bad_alloc_tag ):
- bad_alloc_(true)
- {
- }
-
- explicit
- exception_ptr( shared_ptr<exception_detail::clone_base const> const & c ):
- c_(c),
- bad_alloc_(false)
- {
- BOOST_ASSERT(c);
- }
-
- void
- rethrow() const
- {
- BOOST_ASSERT(*this);
- if( bad_alloc_ )
- throw enable_current_exception(std::bad_alloc());
- else
- c_->rethrow();
- }
-
- bool
- empty() const
- {
- return !bad_alloc_ && !c_;
- }
-
- public:
-
- exception_ptr():
- bad_alloc_(false)
- {
- }
-
- ~exception_ptr() throw()
- {
- }
+ bad_alloc_:
+ boost::exception,
+ std::bad_alloc
+ {
+ };
- operator unspecified_bool_type() const
+ template <int Dummy>
+ exception_ptr
+ get_bad_alloc()
{
- return empty() ? 0 : &exception_ptr::bad_alloc_;
+ bad_alloc_ ba;
+ exception_detail::clone_impl<bad_alloc_> c(ba);
+ c <<
+ throw_function(BOOST_CURRENT_FUNCTION) <<
+ throw_file(__FILE__) <<
+ throw_line(__LINE__);
+ static exception_ptr ep(new exception_detail::clone_impl<bad_alloc_>(c));
+ return ep;
}
- friend
- bool
- operator==( exception_ptr const & a, exception_ptr const & b )
+ template <int Dummy>
+ struct
+ exception_ptr_bad_alloc
{
- return a.c_==b.c_ && a.bad_alloc_==b.bad_alloc_;
- }
+ static exception_ptr const e;
+ };
- friend
- bool
- operator!=( exception_ptr const & a, exception_ptr const & b )
- {
- return !(a==b);
- }
- };
+ template <int Dummy>
+ exception_ptr const
+ exception_ptr_bad_alloc<Dummy>::
+ e = get_bad_alloc<Dummy>();
+ }
class
unknown_exception:
- public exception,
- public std::exception,
- public exception_detail::clone_base
+ public boost::exception,
+ public std::exception
{
public:
private:
- exception_detail::clone_base const *
- clone() const
- {
- return new unknown_exception(*this);
- }
-
- void
- rethrow() const
- {
- throw*this;
- }
-
template <class E>
void
add_original_type( E const & e )
class
current_exception_std_exception_wrapper:
public T,
- public boost::exception,
- public clone_base
+ public boost::exception
{
public:
private:
- clone_base const *
- clone() const
- {
- return new current_exception_std_exception_wrapper(*this);
- }
-
- void
- rethrow() const
- {
- throw *this;
- }
-
template <class E>
void
add_original_type( E const & e )
#ifdef BOOST_NO_RTTI
template <class T>
- exception const *
+ boost::exception const *
get_boost_exception( T const * )
{
try
throw;
}
catch(
- exception & x )
+ boost::exception & x )
{
return &x;
}
}
#else
template <class T>
- exception const *
+ boost::exception const *
get_boost_exception( T const * x )
{
- return dynamic_cast<exception const *>(x);
+ return dynamic_cast<boost::exception const *>(x);
}
#endif
template <class T>
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_std_exception( T const & e1 )
{
if( boost::exception const * e2 = get_boost_exception(&e1) )
- return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1,*e2));
+ return boost::copy_exception(current_exception_std_exception_wrapper<T>(e1,*e2));
else
- return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1));
+ return boost::copy_exception(current_exception_std_exception_wrapper<T>(e1));
}
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_unknown_exception()
{
- return shared_ptr<unknown_exception const>(new unknown_exception());
+ return boost::copy_exception(unknown_exception());
}
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_unknown_boost_exception( boost::exception const & e )
{
- return shared_ptr<unknown_exception const>(new unknown_exception(e));
+ return boost::copy_exception(unknown_exception(e));
}
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_unknown_std_exception( std::exception const & e )
{
if( boost::exception const * be = get_boost_exception(&e) )
return current_exception_unknown_boost_exception(*be);
else
- return shared_ptr<unknown_exception const>(new unknown_exception(e));
+ return boost::copy_exception(unknown_exception(e));
}
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_impl()
{
try
catch(
exception_detail::clone_base & e )
{
- return shared_ptr<exception_detail::clone_base const>(e.clone());
+ return exception_ptr(e.clone());
}
catch(
std::domain_error & e )
exception_ptr
current_exception()
{
+ exception_ptr ret;
+ BOOST_ASSERT(!ret);
try
{
- return exception_ptr(exception_detail::current_exception_impl());
+ ret=exception_detail::current_exception_impl();
}
catch(
std::bad_alloc & )
{
+ ret=exception_detail::exception_ptr_bad_alloc<42>::e;
}
catch(
... )
{
try
{
- return exception_ptr(exception_detail::current_exception_std_exception(std::bad_exception()));
+ ret=exception_detail::current_exception_std_exception(std::bad_exception());
}
catch(
std::bad_alloc & )
{
+ ret=exception_detail::exception_ptr_bad_alloc<42>::e;
}
catch(
... )
BOOST_ASSERT(0);
}
}
- return exception_ptr(exception_ptr::bad_alloc_tag());
- }
-
- template <class T>
- inline
- exception_ptr
- copy_exception( T const & e )
- {
- try
- {
- throw enable_current_exception(e);
- }
- catch(
- ... )
- {
- return current_exception();
- }
+ BOOST_ASSERT(ret);
+ return ret;
}
inline
void
rethrow_exception( exception_ptr const & p )
{
- p.rethrow();
+ BOOST_ASSERT(p);
+ p->rethrow();
}
inline
namespace
to_string_detail
{
- template <class T,class CharT,class Traits>
- char operator<<( std::basic_ostream<CharT,Traits> &, T const & );
+ struct
+ partial_ordering_helper1
+ {
+ template <class CharT,class Traits>
+ partial_ordering_helper1( std::basic_ostream<CharT,Traits> & );
+ };
+
+ struct
+ partial_ordering_helper2
+ {
+ template <class T>
+ partial_ordering_helper2( T const & );
+ };
+
+ char operator<<( partial_ordering_helper1, partial_ordering_helper2 );
template <class T,class CharT,class Traits>
struct
-//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/current_function.hpp>
#include <boost/config.hpp>
+#ifndef BOOST_NO_TYPEID
+#include <boost/units/detail/utility.hpp>
+#endif
+#include <string>
namespace
boost
{
template <class T>
inline
- char const *
+ std::string
tag_type_name()
{
#ifdef BOOST_NO_TYPEID
return BOOST_CURRENT_FUNCTION;
#else
- return typeid(T*).name();
+ return units::detail::demangle(typeid(T*).name());
#endif
}
template <class T>
inline
- char const *
+ std::string
type_name()
{
#ifdef BOOST_NO_TYPEID
return BOOST_CURRENT_FUNCTION;
#else
- return typeid(T).name();
+ return units::detail::demangle(typeid(T).name());
#endif
}
-//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/config.hpp>
#include <boost/exception/get_error_info.hpp>
#include <boost/utility/enable_if.hpp>
-#include <boost/config.hpp>
+#ifndef BOOST_NO_RTTI
+#include <boost/units/detail/utility.hpp>
+#endif
#include <exception>
#include <sstream>
#include <string>
}
#ifndef BOOST_NO_RTTI
tmp << std::string("Dynamic exception type: ") <<
- (be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).type_.name() << '\n';
+ units::detail::demangle((be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).type_.name()) << '\n';
#endif
if( with_what && se )
tmp << "std::exception::what: " << wh << '\n';
namespace
boost
{
+ namespace exception_detail { class clone_base; };
template <class Tag,class T> class error_info;
- class exception_ptr;
+ template <class T> class shared_ptr;
+ typedef shared_ptr<exception_detail::clone_base const> exception_ptr;
typedef error_info<struct errinfo_nested_exception_,exception_ptr> errinfo_nested_exception;
}
void
release()
{
- if( px_ )
- px_->release();
+ if( px_ && px_->release() )
+ px_=0;
}
};
}
}
};
- template <class E,class Tag,class T>
- E const & operator<<( E const &, error_info<Tag,T> const & );
-
- template <class E>
- E const & operator<<( E const &, throw_function const & );
-
- template <class E>
- E const & operator<<( E const &, throw_file const & );
-
- template <class E>
- E const & operator<<( E const &, throw_line const & );
-
class exception;
- template <class>
+ template <class T>
class shared_ptr;
namespace
virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
virtual void add_ref() const = 0;
- virtual void release() const = 0;
+ virtual bool release() const = 0;
+ virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
protected:
struct get_info<throw_line>;
char const * get_diagnostic_information( exception const &, char const * );
+
+ void copy_boost_exception( exception *, exception const * );
+
+ template <class E,class Tag,class T>
+ E const & set_info( E const &, error_info<Tag,T> const & );
+
+ template <class E>
+ E const & set_info( E const &, throw_function const & );
+
+ template <class E>
+ E const & set_info( E const &, throw_file const & );
+
+ template <class E>
+ E const & set_info( E const &, throw_line const & );
}
class
#endif
;
-#if defined(__MWERKS__) && __MWERKS__<=0x3207
+#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310)
public:
#else
private:
template <class E>
- friend E const & operator<<( E const &, throw_function const & );
+ friend E const & exception_detail::set_info( E const &, throw_function const & );
template <class E>
- friend E const & operator<<( E const &, throw_file const & );
+ friend E const & exception_detail::set_info( E const &, throw_file const & );
template <class E>
- friend E const & operator<<( E const &, throw_line const & );
-
- friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
+ friend E const & exception_detail::set_info( E const &, throw_line const & );
template <class E,class Tag,class T>
- friend E const & operator<<( E const &, error_info<Tag,T> const & );
+ friend E const & exception_detail::set_info( E const &, error_info<Tag,T> const & );
+
+ friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
template <class>
friend struct exception_detail::get_info;
friend struct exception_detail::get_info<throw_function>;
friend struct exception_detail::get_info<throw_file>;
friend struct exception_detail::get_info<throw_line>;
+ friend void exception_detail::copy_boost_exception( exception *, exception const * );
#endif
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
mutable char const * throw_function_;
{
}
- template <class E>
- E const &
- operator<<( E const & x, throw_function const & y )
+ namespace
+ exception_detail
{
- x.throw_function_=y.v_;
- return x;
- }
+ template <class E>
+ E const &
+ set_info( E const & x, throw_function const & y )
+ {
+ x.throw_function_=y.v_;
+ return x;
+ }
- template <class E>
- E const &
- operator<<( E const & x, throw_file const & y )
- {
- x.throw_file_=y.v_;
- return x;
- }
+ template <class E>
+ E const &
+ set_info( E const & x, throw_file const & y )
+ {
+ x.throw_file_=y.v_;
+ return x;
+ }
- template <class E>
- E const &
- operator<<( E const & x, throw_line const & y )
- {
- x.throw_line_=y.v_;
- return x;
+ template <class E>
+ E const &
+ set_info( E const & x, throw_line const & y )
+ {
+ x.throw_line_=y.v_;
+ return x;
+ }
}
////////////////////////////////////////////////////////////////////////
};
struct large_size { char c[256]; };
- large_size dispatch( exception * );
+ large_size dispatch_boost_exception( exception const * );
struct small_size { };
- small_size dispatch( void * );
+ small_size dispatch_boost_exception( void const * );
template <class,int>
struct enable_error_info_helper;
struct
enable_error_info_return_type
{
- typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch((T*)0))>::type type;
+ typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception((T*)0))>::type type;
};
}
void
copy_boost_exception( exception * a, exception const * b )
{
- *a = *b;
+ refcount_ptr<error_info_container> data;
+ if( error_info_container * d=b->data_.get() )
+ data = d->clone();
+ a->throw_file_ = b->throw_file_;
+ a->throw_line_ = b->throw_line_;
+ a->throw_function_ = b->throw_function_;
+ a->data_ = data;
}
inline
-//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc.
//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)
template <class Tag,class T>
inline
- char const *
+ std::string
error_info<Tag,T>::
tag_typeid_name() const
{
tmp << header;
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
{
- shared_ptr<error_info_base const> const & x = i->second;
- tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << '\n';
+ error_info_base const & x = *i->second;
+ tmp << '[' << x.tag_typeid_name() << "] = " << x.value_as_string() << '\n';
}
tmp.str().swap(diagnostic_info_str_);
}
mutable std::string diagnostic_info_str_;
mutable int count_;
+ error_info_container_impl( error_info_container_impl const & );
+ error_info_container_impl & operator=( error_info_container const & );
+
void
add_ref() const
{
++count_;
}
- void
+ bool
release() const
{
- if( !--count_ )
+ if( --count_ )
+ return false;
+ else
+ {
delete this;
+ return true;
+ }
+ }
+
+ refcount_ptr<error_info_container>
+ clone() const
+ {
+ refcount_ptr<error_info_container> p;
+ error_info_container_impl * c=new error_info_container_impl;
+ p.adopt(c);
+ c->info_ = info_;
+ return p;
}
};
+
+ template <class E,class Tag,class T>
+ inline
+ E const &
+ set_info( E const & x, error_info<Tag,T> const & v )
+ {
+ typedef error_info<Tag,T> error_info_tag_t;
+ shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );
+ exception_detail::error_info_container * c=x.data_.get();
+ if( !c )
+ x.data_.adopt(c=new exception_detail::error_info_container_impl);
+ c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
+ return x;
+ }
+
+ template <class T>
+ struct
+ derives_boost_exception
+ {
+ enum e { value = (sizeof(dispatch_boost_exception((T*)0))==sizeof(large_size)) };
+ };
}
template <class E,class Tag,class T>
inline
- E const &
+ typename enable_if<exception_detail::derives_boost_exception<E>,E const &>::type
operator<<( E const & x, error_info<Tag,T> const & v )
{
- typedef error_info<Tag,T> error_info_tag_t;
- shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );
- exception_detail::error_info_container * c=x.data_.get();
- if( !c )
- x.data_.adopt(c=new exception_detail::error_info_container_impl);
- c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
- return x;
+ return exception_detail::set_info(x,v);
}
}
str (const string_type& s) {
size_type sz=s.size();
if(sz != 0 && mode_ & (::std::ios_base::in | ::std::ios_base::out) ) {
+#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
+ void *vd_ptr = alloc_.allocate(sz, is_allocated_? eback() : 0);
+ Ch *new_ptr = static_cast<Ch *>(vd_ptr);
+#else
Ch *new_ptr = alloc_.allocate(sz, is_allocated_? eback() : 0);
+#endif
// if this didnt throw, we're safe, update the buffer
dealloc();
sz = s.copy(new_ptr, sz);
typename basic_altstringbuf<Ch, Tr, Alloc>::pos_type
basic_altstringbuf<Ch, Tr, Alloc>::
seekpos (pos_type pos, ::std::ios_base::openmode which) {
- off_type off = off_type(pos); // operation guaranteed by §27.4.3.2 table 88
+ off_type off = off_type(pos); // operation guaranteed by 27.4.3.2 table 88
if(pptr() != NULL && putend_ < pptr())
putend_ = pptr();
if(off != off_type(-1)) {
add_size /= 2;
if(0 < add_size) {
new_size += add_size;
+#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
+ void *vdptr = alloc_.allocate(new_size, is_allocated_? oldptr : 0);
+ newptr = static_cast<Ch *>(vdptr);
+#else
newptr = alloc_.allocate(new_size, is_allocated_? oldptr : 0);
+#endif
}
if(0 < prev_size)
{ return io::detail::feed<CharT, Tr, Alloc, T&>(*this,x); }
#endif
+#if defined(__GNUC__)
+ // GCC can't handle anonymous enums without some help
+ // ** arguments passing ** //
+ basic_format& operator%(const int& x)
+ { return io::detail::feed<CharT, Tr, Alloc, const int&>(*this,x); }
+
+#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
+ basic_format& operator%(int& x)
+ { return io::detail::feed<CharT, Tr, Alloc, int&>(*this,x); }
+#endif
+#endif
+
+ // The total number of arguments expected to be passed to the format objectt
+ int expected_args() const
+ { return num_args_; }
+ // The number of arguments currently bound (see bind_arg(..) )
+ int bound_args() const;
+ // The number of arguments currently fed to the format object
+ int fed_args() const;
+ // The index (1-based) of the current argument (i.e. next to be formatted)
+ int cur_arg() const;
+ // The number of arguments still required to be fed
+ int remaining_args() const; // same as expected_args() - bound_args() - fed_args()
+
+
// ** object modifying **//
template<class T>
basic_format& bind_arg(int argN, const T& val)
template< class Ch, class Tr, class Alloc> // just don't copy the buf_ member
basic_format<Ch, Tr, Alloc>:: basic_format(const basic_format& x)
: items_(x.items_), bound_(x.bound_), style_(x.style_),
- cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false),
+ cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(x.dumped_),
prefix_(x.prefix_), exceptions_(x.exceptions_), loc_(x.loc_)
{
}
return *this;
}
+ template< class Ch, class Tr, class Alloc>
+ int basic_format<Ch,Tr, Alloc>::
+ bound_args() const {
+ if(bound_.size()==0)
+ return 0;
+ int n=0;
+ for(int i=0; i<num_args_ ; ++i)
+ if(bound_[i])
+ ++n;
+ return n;
+ }
+
+ template< class Ch, class Tr, class Alloc>
+ int basic_format<Ch,Tr, Alloc>::
+ fed_args() const {
+ if(bound_.size()==0)
+ return cur_arg_;
+ int n=0;
+ for(int i=0; i<cur_arg_ ; ++i)
+ if(!bound_[i])
+ ++n;
+ return n;
+ }
+
+ template< class Ch, class Tr, class Alloc>
+ int basic_format<Ch,Tr, Alloc>::
+ cur_arg() const {
+ return cur_arg_+1; }
+
+ template< class Ch, class Tr, class Alloc>
+ int basic_format<Ch,Tr, Alloc>::
+ remaining_args() const {
+ if(bound_.size()==0)
+ return num_args_-cur_arg_;
+ int n=0;
+ for(int i=cur_arg_; i<num_args_ ; ++i)
+ if(!bound_[i])
+ ++n;
+ return n;
+ }
+
template< class Ch, class Tr, class Alloc>
typename basic_format<Ch, Tr, Alloc>::string_type
basic_format<Ch,Tr, Alloc>::
while(self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_])
++self.cur_arg_;
}
- // In any case, we either have all args, or are on a non-binded arg :
+ // In any case, we either have all args, or are on an unbound arg :
BOOST_ASSERT( self.cur_arg_ >= self.num_args_ || ! self.bound_[self.cur_arg_]);
return self;
}
template<class Ch, class Tr> inline
void stream_format_state<Ch,Tr>:: reset(Ch fill) {
- // set our params to standard's default state. cf § 27.4.4.1 of the C++ norm
+ // set our params to standard's default state. cf 27.4.4.1 of the C++ norm
width_=0; precision_=6;
fill_=fill; // default is widen(' '), but we cant compute it without the locale
flags_ = std::ios_base::dec | std::ios_base::skipws;
A(a)
{
}
-
- functor_wrapper(const functor_wrapper& f) :
+
+ functor_wrapper(const functor_wrapper& f) :
F(static_cast<const F&>(f)),
A(static_cast<const A&>(f))
- {
- }
+ {
+ }
};
/**
limits<T>::min_exponent;
}
- // The result of frexp is always between 0.5 and 1, so its
- // top bit will always be 1. Subtract by 0.5 to remove that.
- v -= T(0.5);
- v = ldexp(v, limits<std::size_t>::digits + 1);
+ v = ldexp(v, limits<std::size_t>::digits);
std::size_t seed = static_cast<std::size_t>(v);
v -= seed;
// ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
std::size_t const length
= (limits<T>::digits *
- boost::static_log2<limits<T>::radix>::value - 1)
+ boost::static_log2<limits<T>::radix>::value
+ + limits<std::size_t>::digits - 1)
/ limits<std::size_t>::digits;
for(std::size_t i = 0; i != length; ++i)
#include <string>
#include <boost/limits.hpp>
+#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
+#include <boost/static_assert.hpp>
+#endif
+
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
#include <boost/type_traits/is_pointer.hpp>
#endif
namespace boost
{
+#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
+
+ // If you get a static assertion here, it's because hash_value
+ // isn't declared for your type.
+ template <typename T>
+ std::size_t hash_value(T const&) {
+ BOOST_STATIC_ASSERT((T*) 0 && false);
+ return 0;
+ }
+
+#endif
+
std::size_t hash_value(bool);
std::size_t hash_value(char);
std::size_t hash_value(unsigned char);
std::size_t hash_value(wchar_t);
#endif
-#if defined(BOOST_HAS_LONG_LONG)
+#if !defined(BOOST_NO_LONG_LONG)
std::size_t hash_value(boost::long_long_type);
std::size_t hash_value(boost::ulong_long_type);
#endif
}
#endif
-#if defined(BOOST_HAS_LONG_LONG)
+#if !defined(BOOST_NO_LONG_LONG)
inline std::size_t hash_value(boost::long_long_type v)
{
return hash_detail::hash_value_signed(v);
BOOST_HASH_SPECIALIZE_REF(std::wstring)
#endif
-#if defined(BOOST_HAS_LONG_LONG)
+#if !defined(BOOST_NO_LONG_LONG)
BOOST_HASH_SPECIALIZE(boost::long_long_type)
BOOST_HASH_SPECIALIZE(boost::ulong_long_type)
#endif
// no specializations for 0 and 5: requests for a type > long are in error
#ifdef BOOST_HAS_LONG_LONG
template<> struct int_least_helper<1> { typedef boost::long_long_type least; };
+#elif defined(BOOST_HAS_MS_INT64)
+ template<> struct int_least_helper<1> { typedef __int64 least; };
#endif
template<> struct int_least_helper<2> { typedef long least; };
template<> struct int_least_helper<3> { typedef int least; };
template<> struct int_least_helper<5> { typedef signed char least; };
#ifdef BOOST_HAS_LONG_LONG
template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; };
+#elif defined(BOOST_HAS_MS_INT64)
+ template<> struct int_least_helper<6> { typedef unsigned __int64 least; };
#endif
template<> struct int_least_helper<7> { typedef unsigned long least; };
template<> struct int_least_helper<8> { typedef unsigned int least; };
template < >
class integer_traits< unsigned long >;
-#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64))
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template < >
- class integer_traits< ::boost::long_long_type>;
+class integer_traits< ::boost::long_long_type>;
template < >
- class integer_traits< ::boost::ulong_long_type >;
+class integer_traits< ::boost::ulong_long_type >;
+#elif !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_MS_INT64)
+template < >
+class integer_traits<__int64>;
+
+template < >
+class integer_traits<unsigned __int64>;
#endif
#ifndef BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
#define BOOST_TRANSFORM_ITERATOR_23022003THW_HPP
-#include <boost/function.hpp>
#include <boost/iterator.hpp>
#include <boost/iterator/detail/enable_if.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
//
// 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 <boost/mpl/aux_/config/overload_resolution.hpp>
#include <boost/mpl/aux_/config/workaround.hpp>
)
# define BOOST_MPL_CFG_NO_HAS_XXX
+# define BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE
#endif
// http://www.boost.org/LICENSE_1_0.txt)
//
-// Preprocessed version of "boost/mpl/aux_/template_arity.hpp" header
+// *Preprocessed* version of the main "template_arity.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl { namespace aux {
-
template< int N > struct arity_tag
{
typedef char (&type)[N + 1];
{
BOOST_STATIC_CONSTANT(int, value =
( C6 > 0 ? C6 : ( C5 > 0 ? C5 : ( C4 > 0 ? C4 : ( C3 > 0 ? C3 : ( C2 > 0 ? C2 : ( C1 > 0 ? C1 : -1 ) ) ) ) ) )
-
);
};
struct template_arity_impl
{
BOOST_STATIC_CONSTANT(int, value =
- sizeof(arity_helper(type_wrapper<F>(), arity_tag<N>())) - 1
+ sizeof(::boost::mpl::aux::arity_helper(type_wrapper<F>(), arity_tag<N>())) - 1
);
};
{
BOOST_STATIC_CONSTANT(int, value = (
max_arity< template_arity_impl< F,1 >::value, template_arity_impl< F,2 >::value, template_arity_impl< F,3 >::value, template_arity_impl< F,4 >::value, template_arity_impl< F,5 >::value, template_arity_impl< F,6 >::value >::value
-
));
-
typedef mpl::int_<value> type;
};
//
// See http://www.boost.org/libs/mpl for documentation.
-// $Id: template_arity.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
-// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
-// $Revision: 49267 $
+// $Id: template_arity.hpp 61584 2010-04-26 18:48:26Z agurtovoy $
+// $Date: 2010-04-26 14:48:26 -0400 (Mon, 26 Apr 2010) $
+// $Revision: 61584 $
#include <boost/mpl/aux_/config/ttp.hpp>
#include <boost/mpl/aux_/config/lambda.hpp>
struct template_arity_impl
{
BOOST_STATIC_CONSTANT(int, value =
- sizeof(arity_helper(type_wrapper<F>(),arity_tag<N>())) - 1
+ sizeof(::boost::mpl::aux::arity_helper(type_wrapper<F>(),arity_tag<N>())) - 1
);
};
#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.
//
// 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 <iso646.h> 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 <boost/mpl/aux_/arithmetic_op.hpp>
+#if defined(_MSC_VER)
+#ifndef __GCCXML__
+#if defined(bitand)
+# pragma pop_macro("bitand")
+#endif
+#endif
+#endif
+
#endif // BOOST_MPL_BITAND_HPP_INCLUDED
#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.
//
// 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 <iso646.h> 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 <boost/mpl/aux_/arithmetic_op.hpp>
+#if defined(_MSC_VER)
+#ifndef __GCCXML__
+#if defined(bitor)
+# pragma pop_macro("bitor")
+#endif
+#endif
+#endif
+
#endif // BOOST_MPL_BITOR_HPP_INCLUDED
//
// 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 <boost/mpl/if.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
// 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
//
// 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 <boost/mpl/bool.hpp>
+#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/type_wrapper.hpp>
#include <boost/mpl/aux_/yes_no.hpp>
+#include <boost/mpl/aux_/config/gcc.hpp>
#include <boost/mpl/aux_/config/has_xxx.hpp>
#include <boost/mpl/aux_/config/msvc_typename.hpp>
#include <boost/mpl/aux_/config/msvc.hpp>
#include <boost/mpl/aux_/config/static_constant.hpp>
#include <boost/mpl/aux_/config/workaround.hpp>
+#include <boost/preprocessor/array/elem.hpp>
#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x590) )
# include <boost/type_traits/is_class.hpp>
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
};
};
+ template<typename Tag>
+ struct has_push_back_impl;
+
+ template<>
+ struct has_push_back_impl<mpl::string_tag>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::true_
+ {};
+ };
+
template<typename Tag>
struct pop_back_impl;
#undef M0
};
+ template<typename Tag>
+ struct has_pop_back_impl;
+
+ template<>
+ struct has_pop_back_impl<mpl::string_tag>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::true_
+ {};
+ };
+
template<typename Tag>
struct push_front_impl;
};
};
+ template<typename Tag>
+ struct has_push_front_impl;
+
+ template<>
+ struct has_push_front_impl<mpl::string_tag>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::true_
+ {};
+ };
+
template<typename Tag>
struct pop_front_impl;
};
};
+ template<typename Tag>
+ struct has_pop_front_impl;
+
+ template<>
+ struct has_pop_front_impl<mpl::string_tag>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::true_
+ {};
+ };
+
template<typename Tag>
struct insert_range_impl;
#ifndef BOOST_MPL_ZIP_VIEW_HPP_INCLUDED
#define BOOST_MPL_ZIP_VIEW_HPP_INCLUDED
-// Copyright Aleksey Gurtovoy 2000-2002
+// Copyright Aleksey Gurtovoy 2000-2010
// Copyright David Abrahams 2000-2002
//
// Distributed under the Boost Software License, Version 1.0.
//
// See http://www.boost.org/libs/mpl for documentation.
-// $Id: zip_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
-// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
-// $Revision: 49267 $
+// $Id: zip_view.hpp 61591 2010-04-26 21:31:09Z agurtovoy $
+// $Date: 2010-04-26 17:31:09 -0400 (Mon, 26 Apr 2010) $
+// $Revision: 61591 $
#include <boost/mpl/transform.hpp>
#include <boost/mpl/begin_end.hpp>
public:
typedef nested_begin_end_tag tag;
+ typedef zip_view type;
typedef zip_iterator<first_ones_> begin;
typedef zip_iterator<last_ones_> end;
};
// 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
typedef BOOST_DEDUCED_TYPENAME is_reference<T>::type is_reference_predicate ;
+ public:
typedef BOOST_DEDUCED_TYPENAME mpl::if_<is_reference_predicate,types_when_ref,types_when_not_ref>::type types ;
+ protected:
typedef bool (this_type::*unspecified_bool_type)() const;
typedef BOOST_DEDUCED_TYPENAME types::reference_type reference_type ;
// 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
// 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
typedef boost::char_architype char_type;
};
}
+//
+// Allocator architype:
+//
+template <class T>
+class allocator_architype
+{
+public:
+ typedef T* pointer;
+ typedef const T* const_pointer;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef T value_type;
+ typedef unsigned size_type;
+ typedef int difference_type;
+
+ template <class U>
+ struct rebind
+ {
+ typedef allocator_architype<U> other;
+ };
+
+ pointer address(reference r);
+ const_pointer address(const_reference r);
+ pointer allocate(size_type);
+ pointer allocate(size_type, pointer);
+ void deallocate(pointer, size_type);
+ size_type max_size()const;
+
+ allocator_architype();
+ allocator_architype(const allocator_architype&);
+
+ template <class Other>
+ allocator_architype(const allocator_architype<Other>&);
+
+ void construct(pointer, const_reference);
+ void destroy(pointer);
+};
+
+template <class T>
+bool operator == (const allocator_architype<T>&, const allocator_architype<T>&);
+template <class T>
+bool operator != (const allocator_architype<T>&, const allocator_architype<T>&);
+
namespace boost{
//
// regex_traits_architype:
typedef const value_type* pointer_type;
typedef bidirectional_iterator_archetype<value_type> BidiIterator;
typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
- typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
+ typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
+ typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
typedef output_iterator_archetype<value_type> OutIterator;
typedef typename regex_traits_computer<Regex>::type traits_type;
typedef global_regex_namespace::regex_iterator<BidiIterator, value_type, traits_type> regex_iterator_type;
const global_regex_namespace::regex_error except(e1);
e1 = except.code();
- typedef typename Regex::value_type value_type;
+ typedef typename Regex::value_type regex_value_type;
function_requires< RegexTraitsConcept<global_regex_namespace::regex_traits<char> > >();
function_requires< BaseRegexConcept<global_regex_namespace::basic_regex<char> > >();
}
typedef typename regex_iterator_type::reference rit_reference;
typedef typename regex_iterator_type::iterator_category rit_iterator_category;
BOOST_STATIC_ASSERT((::boost::is_same<rit_regex_type, Regex>::value));
- BOOST_STATIC_ASSERT((::boost::is_same<rit_value_type, match_results_type>::value));
+ BOOST_STATIC_ASSERT((::boost::is_same<rit_value_type, match_results_default_type>::value));
BOOST_STATIC_ASSERT((::boost::is_same<rit_difference_type, std::ptrdiff_t>::value));
- BOOST_STATIC_ASSERT((::boost::is_same<rit_pointer, const match_results_type*>::value));
- BOOST_STATIC_ASSERT((::boost::is_same<rit_reference, const match_results_type&>::value));
+ BOOST_STATIC_ASSERT((::boost::is_same<rit_pointer, const match_results_default_type*>::value));
+ BOOST_STATIC_ASSERT((::boost::is_same<rit_reference, const match_results_default_type&>::value));
BOOST_STATIC_ASSERT((::boost::is_convertible<rit_iterator_category*, std::forward_iterator_tag*>::value));
// this takes care of most of the checks needed:
function_requires<ForwardIteratorConcept<regex_iterator_type> >();
OutIterator m_out;
BidiIterator m_in;
global_regex_namespace::regex_constants::match_flag_type m_mft;
- global_regex_namespace::match_results<pointer_type> m_pmatch;
+ global_regex_namespace::match_results<
+ pointer_type,
+ allocator_architype<global_regex_namespace::sub_match<pointer_type> > >
+ m_pmatch;
BaseRegexConcept();
BaseRegexConcept(const BaseRegexConcept&);
typedef std::basic_string<value_type> string_type;
typedef boost::bidirectional_iterator_archetype<value_type> BidiIterator;
typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
- typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
+ typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
typedef output_iterator_archetype<value_type> OutIterator;
OutIterator m_out;
BidiIterator m_in;
global_regex_namespace::regex_constants::match_flag_type m_mft;
- global_regex_namespace::match_results<typename string_type::const_iterator> m_smatch;
+ global_regex_namespace::match_results<typename string_type::const_iterator, allocator_architype<global_regex_namespace::sub_match<typename string_type::const_iterator> > > m_smatch;
RegexConcept();
RegexConcept(const RegexConcept&);
struct functor1
{
typedef typename M::char_type char_type;
- const char_type* operator()(const M&)
+ const char_type* operator()(const M&)const
{
static const char_type c = static_cast<char_type>(0);
return &c;
struct functor1b
{
typedef typename M::char_type char_type;
- std::vector<char_type> operator()(const M&)
+ std::vector<char_type> operator()(const M&)const
{
static const std::vector<char_type> c;
return c;
struct functor2
{
template <class O>
- O operator()(const M& /*m*/, O i)
+ O operator()(const M& /*m*/, O i)const
{
return i;
}
struct functor3
{
template <class O>
- O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)
+ O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)const
{
return i;
}
typedef bidirectional_iterator_archetype<value_type> BidiIterator;
typedef output_iterator_archetype<value_type> OutputIterator;
typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
- typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
+ typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
+ typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
void constraints()
{
//
regex_constants::match_flag_type f = regex_constants::match_default;
OutputIterator out = static_object<OutputIterator>::get();
- functor3<match_results_type> func3;
- out = regex_format(out, m_cresults, func3, f);
- out = regex_format(out, m_cresults, func3);
- functor2<match_results_type> func2;
- out = regex_format(out, m_cresults, func2, f);
- out = regex_format(out, m_cresults, func2);
- functor1<match_results_type> func1;
- out = regex_format(out, m_cresults, func1, f);
- out = regex_format(out, m_cresults, func1);
-
- m_string += regex_format(m_cresults, func3, f);
- m_string += regex_format(m_cresults, func3);
- m_string += regex_format(m_cresults, func2, f);
- m_string += regex_format(m_cresults, func2);
- m_string += regex_format(m_cresults, func1, f);
- m_string += regex_format(m_cresults, func1);
-
- out = m_cresults.format(out, func3, f);
- out = m_cresults.format(out, func3);
- out = m_cresults.format(out, func2, f);
- out = m_cresults.format(out, func2);
- out = m_cresults.format(out, func1, f);
- out = m_cresults.format(out, func1);
-
- m_string += m_cresults.format(func3, f);
- m_string += m_cresults.format(func3);
- m_string += m_cresults.format(func2, f);
- m_string += m_cresults.format(func2);
- m_string += m_cresults.format(func1, f);
- m_string += m_cresults.format(func1);
+
+ functor3<match_results_default_type> func3;
+ functor2<match_results_default_type> func2;
+ functor1<match_results_default_type> func1;
+
+ functor3<match_results_type> func3b;
+ functor2<match_results_type> func2b;
+ functor1<match_results_type> func1b;
+
+ out = regex_format(out, m_cresults, func3b, f);
+ out = regex_format(out, m_cresults, func3b);
+ out = regex_format(out, m_cresults, func2b, f);
+ out = regex_format(out, m_cresults, func2b);
+ out = regex_format(out, m_cresults, func1b, f);
+ out = regex_format(out, m_cresults, func1b);
+ out = regex_format(out, m_cresults, boost::ref(func3b), f);
+ out = regex_format(out, m_cresults, boost::ref(func3b));
+ out = regex_format(out, m_cresults, boost::ref(func2b), f);
+ out = regex_format(out, m_cresults, boost::ref(func2b));
+ out = regex_format(out, m_cresults, boost::ref(func1b), f);
+ out = regex_format(out, m_cresults, boost::ref(func1b));
+ out = regex_format(out, m_cresults, boost::cref(func3b), f);
+ out = regex_format(out, m_cresults, boost::cref(func3b));
+ out = regex_format(out, m_cresults, boost::cref(func2b), f);
+ out = regex_format(out, m_cresults, boost::cref(func2b));
+ out = regex_format(out, m_cresults, boost::cref(func1b), f);
+ out = regex_format(out, m_cresults, boost::cref(func1b));
+
+ m_string += regex_format(m_cresults, func3b, f);
+ m_string += regex_format(m_cresults, func3b);
+ m_string += regex_format(m_cresults, func2b, f);
+ m_string += regex_format(m_cresults, func2b);
+ m_string += regex_format(m_cresults, func1b, f);
+ m_string += regex_format(m_cresults, func1b);
+ m_string += regex_format(m_cresults, boost::ref(func3b), f);
+ m_string += regex_format(m_cresults, boost::ref(func3b));
+ m_string += regex_format(m_cresults, boost::ref(func2b), f);
+ m_string += regex_format(m_cresults, boost::ref(func2b));
+ m_string += regex_format(m_cresults, boost::ref(func1b), f);
+ m_string += regex_format(m_cresults, boost::ref(func1b));
+ m_string += regex_format(m_cresults, boost::cref(func3b), f);
+ m_string += regex_format(m_cresults, boost::cref(func3b));
+ m_string += regex_format(m_cresults, boost::cref(func2b), f);
+ m_string += regex_format(m_cresults, boost::cref(func2b));
+ m_string += regex_format(m_cresults, boost::cref(func1b), f);
+ m_string += regex_format(m_cresults, boost::cref(func1b));
+
+ out = m_cresults.format(out, func3b, f);
+ out = m_cresults.format(out, func3b);
+ out = m_cresults.format(out, func2b, f);
+ out = m_cresults.format(out, func2b);
+ out = m_cresults.format(out, func1b, f);
+ out = m_cresults.format(out, func1b);
+ out = m_cresults.format(out, boost::ref(func3b), f);
+ out = m_cresults.format(out, boost::ref(func3b));
+ out = m_cresults.format(out, boost::ref(func2b), f);
+ out = m_cresults.format(out, boost::ref(func2b));
+ out = m_cresults.format(out, boost::ref(func1b), f);
+ out = m_cresults.format(out, boost::ref(func1b));
+ out = m_cresults.format(out, boost::cref(func3b), f);
+ out = m_cresults.format(out, boost::cref(func3b));
+ out = m_cresults.format(out, boost::cref(func2b), f);
+ out = m_cresults.format(out, boost::cref(func2b));
+ out = m_cresults.format(out, boost::cref(func1b), f);
+ out = m_cresults.format(out, boost::cref(func1b));
+
+ m_string += m_cresults.format(func3b, f);
+ m_string += m_cresults.format(func3b);
+ m_string += m_cresults.format(func2b, f);
+ m_string += m_cresults.format(func2b);
+ m_string += m_cresults.format(func1b, f);
+ m_string += m_cresults.format(func1b);
+ m_string += m_cresults.format(boost::ref(func3b), f);
+ m_string += m_cresults.format(boost::ref(func3b));
+ m_string += m_cresults.format(boost::ref(func2b), f);
+ m_string += m_cresults.format(boost::ref(func2b));
+ m_string += m_cresults.format(boost::ref(func1b), f);
+ m_string += m_cresults.format(boost::ref(func1b));
+ m_string += m_cresults.format(boost::cref(func3b), f);
+ m_string += m_cresults.format(boost::cref(func3b));
+ m_string += m_cresults.format(boost::cref(func2b), f);
+ m_string += m_cresults.format(boost::cref(func2b));
+ m_string += m_cresults.format(boost::cref(func1b), f);
+ m_string += m_cresults.format(boost::cref(func1b));
out = regex_replace(out, m_in, m_in, ce, func3, f);
out = regex_replace(out, m_in, m_in, ce, func3);
out = regex_replace(out, m_in, m_in, ce, func2);
out = regex_replace(out, m_in, m_in, ce, func1, f);
out = regex_replace(out, m_in, m_in, ce, func1);
+ out = regex_replace(out, m_in, m_in, ce, boost::ref(func3), f);
+ out = regex_replace(out, m_in, m_in, ce, boost::ref(func3));
+ out = regex_replace(out, m_in, m_in, ce, boost::ref(func2), f);
+ out = regex_replace(out, m_in, m_in, ce, boost::ref(func2));
+ out = regex_replace(out, m_in, m_in, ce, boost::ref(func1), f);
+ out = regex_replace(out, m_in, m_in, ce, boost::ref(func1));
+ out = regex_replace(out, m_in, m_in, ce, boost::cref(func3), f);
+ out = regex_replace(out, m_in, m_in, ce, boost::cref(func3));
+ out = regex_replace(out, m_in, m_in, ce, boost::cref(func2), f);
+ out = regex_replace(out, m_in, m_in, ce, boost::cref(func2));
+ out = regex_replace(out, m_in, m_in, ce, boost::cref(func1), f);
+ out = regex_replace(out, m_in, m_in, ce, boost::cref(func1));
functor3<match_results<typename string_type::const_iterator> > func3s;
functor2<match_results<typename string_type::const_iterator> > func2s;
m_string += regex_replace(m_string, ce, func2s);
m_string += regex_replace(m_string, ce, func1s, f);
m_string += regex_replace(m_string, ce, func1s);
+ m_string += regex_replace(m_string, ce, boost::ref(func3s), f);
+ m_string += regex_replace(m_string, ce, boost::ref(func3s));
+ m_string += regex_replace(m_string, ce, boost::ref(func2s), f);
+ m_string += regex_replace(m_string, ce, boost::ref(func2s));
+ m_string += regex_replace(m_string, ce, boost::ref(func1s), f);
+ m_string += regex_replace(m_string, ce, boost::ref(func1s));
+ m_string += regex_replace(m_string, ce, boost::cref(func3s), f);
+ m_string += regex_replace(m_string, ce, boost::cref(func3s));
+ m_string += regex_replace(m_string, ce, boost::cref(func2s), f);
+ m_string += regex_replace(m_string, ce, boost::cref(func2s));
+ m_string += regex_replace(m_string, ce, boost::cref(func1s), f);
+ m_string += regex_replace(m_string, ce, boost::cref(func1s));
}
std::basic_ostream<value_type> m_stream;
*
****************************************************************************/
-#if defined(BOOST_HAS_DECLSPEC) && (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK)
+#ifndef BOOST_SYMBOL_EXPORT
+# define BOOST_SYMBOL_EXPORT
+# define BOOST_SYMBOL_IMPORT
+#endif
+
+#if (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK)
# if defined(BOOST_REGEX_SOURCE)
-# define BOOST_REGEX_DECL __declspec(dllexport)
+# define BOOST_REGEX_DECL BOOST_SYMBOL_EXPORT
# define BOOST_REGEX_BUILD_DLL
# else
-# define BOOST_REGEX_DECL __declspec(dllimport)
+# define BOOST_REGEX_DECL BOOST_SYMBOL_IMPORT
# endif
-#endif
-
-#ifndef BOOST_REGEX_DECL
+#else
# define BOOST_REGEX_DECL
#endif
#include <boost/mpl/int_fwd.hpp>
#include <bitset>
+#ifdef BOOST_MSVC
+#pragma warning (push)
+#pragma warning (disable: 4251)
+#endif
namespace boost{
} // namespace boost.
+#ifdef BOOST_MSVC
+#pragma warning (pop)
+#endif
+
#include <boost/regex/v4/u32regex_iterator.hpp>
#include <boost/regex/v4/u32regex_token_iterator.hpp>
case syntax_element_assert_backref:
{
// just check that the index is valid:
- int id = static_cast<const re_brace*>(state)->index;
- if(id < 0)
+ int idx = static_cast<const re_brace*>(state)->index;
+ if(idx < 0)
{
- id = -id-1;
- if(id >= 10000)
+ idx = -idx-1;
+ if(idx >= 10000)
{
- id = m_pdata->get_id(id);
- if(id <= 0)
+ idx = m_pdata->get_id(idx);
+ if(idx <= 0)
{
// check of sub-expression that doesn't exist:
if(0 == this->m_pdata->m_status) // update the error code if not already set
{
bool ok = false;
re_syntax_base* p = base;
- int id = static_cast<re_jump*>(state)->alt.i;
- if(id > 10000)
- id = m_pdata->get_id(id);
+ std::ptrdiff_t idx = static_cast<re_jump*>(state)->alt.i;
+ if(idx > 10000)
+ idx = m_pdata->get_id(idx);
while(p)
{
- if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == id))
+ if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == idx))
{
//
// We've found the target of the recursion, set the jump target:
next_rep_id = static_cast<re_repeat*>(p)->state_id;
break;
case syntax_element_endmark:
- if(static_cast<const re_brace*>(p)->index == id)
+ if(static_cast<const re_brace*>(p)->index == idx)
next_rep_id = -1;
break;
default:
case syntax_element_jump:
state = static_cast<re_jump*>(state)->alt.p;
continue;
+ case syntax_element_alt:
+ {
+ int r1 = calculate_backstep(state->next.p);
+ int r2 = calculate_backstep(static_cast<re_alt*>(state)->alt.p);
+ if((r1 < 0) || (r1 != r2))
+ return -1;
+ return result + r1;
+ }
default:
break;
}
#endif
#endif
+
m_has_case_change = false;
charT name_delim;
int mark_reset = m_mark_reset;
+ int max_mark = m_max_mark;
m_mark_reset = -1;
+ m_max_mark = m_mark_count;
int v;
//
// select the actual extension used:
m_mark_count = m_max_mark;
}
m_mark_reset = mark_reset;
+ m_max_mark = max_mark;
if(markid > 0)
#ifdef BOOST_MSVC
#pragma warning(push)
-#pragma warning(disable:4786)
+#pragma warning(disable:4786 4251)
#endif
namespace boost{
#undef BOOST_REGEX_TEMPLATE_DECL
-#elif (defined(__GNUC__) && (__GNUC__ >= 3))
+#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_EXTERN_TEMPLATE)
# ifndef BOOST_REGEX_INSTANTIATE
-# define template __extension__ extern template
+# ifdef __GNUC__
+# define template __extension__ extern template
+# else
+# define template extern template
+# endif
# endif
#if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_REGEX_ICU_INSTANCES)
std::swap(m_subs, that.m_subs);
std::swap(m_named_subs, that.m_named_subs);
std::swap(m_last_closed_paren, that.m_last_closed_paren);
- std::swap(m_is_singular, that.m_is_singular);
if(m_is_singular)
{
if(!that.m_is_singular)
std::swap(m_base, that.m_base);
std::swap(m_null, that.m_null);
}
+ std::swap(m_is_singular, that.m_is_singular);
}
bool operator==(const match_results& that)const
{
void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false)
{
if(pos)
- m_last_closed_paren = pos;
+ m_last_closed_paren = static_cast<int>(pos);
pos += 2;
BOOST_ASSERT(m_subs.size() > pos);
m_subs[pos].second = i;
{
typedef typename Results::value_type value_type;
typedef typename value_type::iterator iterator;
- int id;
+ int idx;
const re_syntax_base* preturn_address;
Results results;
repeater_count<iterator>* repeater_stack;
BidiIterator l_base)
: m_result(what), base(first), last(end),
position(first), backstop(l_base), re(e), traits_inst(e.get_traits()),
- m_independent(false), next_count(&rep_obj), rep_obj(&next_count), recursion_stack_position(0)
+ m_independent(false), next_count(&rep_obj), rep_obj(&next_count)
{
construct_init(e, f);
}
// matching flags in use:
match_flag_type m_match_flags;
// how many states we have examined so far:
- boost::uintmax_t state_count;
+ std::ptrdiff_t state_count;
// max number of states to examine before giving up:
- boost::uintmax_t max_state_count;
+ std::ptrdiff_t max_state_count;
// whether we should ignore case or not:
bool icase;
// set to true when (position == last), indicates that we may have a partial match:
// the bitmask to use when determining whether a match_any matches a newline or not:
unsigned char match_any_mask;
// recursion information:
- recursion_info<results_type> recursion_stack[50];
- unsigned recursion_stack_position;
+ std::vector<recursion_info<results_type> > recursion_stack;
#ifdef BOOST_REGEX_NON_RECURSIVE
//
void push_repeater_count(int i, repeater_count<BidiIterator>** s);
void push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int state_id);
void push_non_greedy_repeat(const re_syntax_base* ps);
- void push_recursion(int id, const re_syntax_base* p, results_type* presults);
+ void push_recursion(int idx, const re_syntax_base* p, results_type* presults);
void push_recursion_pop();
// pointer to base of stack:
//
// Calculate NS^2 first:
//
- static const boost::uintmax_t k = 100000;
- boost::uintmax_t dist = boost::re_detail::distance(base, last);
+ static const std::ptrdiff_t k = 100000;
+ std::ptrdiff_t dist = boost::re_detail::distance(base, last);
if(dist == 0)
dist = 1;
- boost::uintmax_t states = re.size();
+ std::ptrdiff_t states = re.size();
if(states == 0)
states = 1;
states *= states;
- if((std::numeric_limits<boost::uintmax_t>::max)() / dist < states)
+ if((std::numeric_limits<std::ptrdiff_t>::max)() / dist < states)
{
- max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2;
+ max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2);
return;
}
states *= dist;
- if((std::numeric_limits<boost::uintmax_t>::max)() - k < states)
+ if((std::numeric_limits<std::ptrdiff_t>::max)() - k < states)
{
- max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2;
+ max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2);
return;
}
states += k;
// Now calculate N^2:
//
states = dist;
- if((std::numeric_limits<boost::uintmax_t>::max)() / dist < states)
+ if((std::numeric_limits<std::ptrdiff_t>::max)() / dist < states)
{
- max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2;
+ max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2);
return;
}
states *= dist;
- if((std::numeric_limits<boost::uintmax_t>::max)() - k < states)
+ if((std::numeric_limits<std::ptrdiff_t>::max)() - k < states)
{
- max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2;
+ max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2);
return;
}
states += k;
{
// Have we recursed into subexpression "index"?
// If index == 0 then check for any recursion at all, otherwise for recursion to -index-1.
- int id = -index-1;
- if(id >= 10000)
- id = re.get_data().get_id(id);
- result = recursion_stack_position && ((recursion_stack[recursion_stack_position-1].id == id) || (index == 0));
+ int idx = -index-1;
+ if(idx >= 10000)
+ idx = re.get_data().get_id(idx);
+ result = !recursion_stack.empty() && ((recursion_stack.back().idx == idx) || (index == 0));
pstate = pstate->next.p;
}
return result;
template <class Results>
struct saved_recursion : public saved_state
{
- saved_recursion(int id, const re_syntax_base* p, Results* pr)
- : saved_state(14), recursion_id(id), preturn_address(p), results(*pr)
+ saved_recursion(int idx, const re_syntax_base* p, Results* pr)
+ : saved_state(14), recursion_id(idx), preturn_address(p), results(*pr)
{}
int recursion_id;
const re_syntax_base* preturn_address;
}
template <class BidiIterator, class Allocator, class traits>
-inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion(int id, const re_syntax_base* p, results_type* presults)
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion(int idx, const re_syntax_base* p, results_type* presults)
{
saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
--pmp;
pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
--pmp;
}
- (void) new (pmp)saved_recursion<results_type>(id, p, presults);
+ (void) new (pmp)saved_recursion<results_type>(idx, p, presults);
m_backup_state = pmp;
}
//
// Set new call stack:
//
- if(recursion_stack_position >= static_cast<int>(sizeof(recursion_stack)/sizeof(recursion_stack[0])))
+ if(recursion_stack.capacity() == 0)
{
- return false;
+ recursion_stack.reserve(50);
}
- recursion_stack[recursion_stack_position].preturn_address = pstate->next.p;
- recursion_stack[recursion_stack_position].results = *m_presult;
+ recursion_stack.push_back(recursion_info<results_type>());
+ recursion_stack.back().preturn_address = pstate->next.p;
+ recursion_stack.back().results = *m_presult;
if(static_cast<const re_recurse*>(pstate)->state_id > 0)
{
push_repeater_count(static_cast<const re_recurse*>(pstate)->state_id, &next_count);
}
pstate = static_cast<const re_jump*>(pstate)->alt.p;
- recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index;
- ++recursion_stack_position;
- //BOOST_ASSERT(recursion_stack[recursion_stack_position-1].id);
+ recursion_stack.back().idx = static_cast<const re_brace*>(pstate)->index;
return true;
}
{
m_presult->set_second(position, index);
}
- if(recursion_stack_position)
+ if(!recursion_stack.empty())
{
- if(index == recursion_stack[recursion_stack_position-1].id)
+ if(index == recursion_stack.back().idx)
{
- --recursion_stack_position;
- pstate = recursion_stack[recursion_stack_position].preturn_address;
- *m_presult = recursion_stack[recursion_stack_position].results;
- push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results);
+ pstate = recursion_stack.back().preturn_address;
+ *m_presult = recursion_stack.back().results;
+ push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, &recursion_stack.back().results);
+ recursion_stack.pop_back();
}
}
}
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
{
- if(recursion_stack_position)
+ if(!recursion_stack.empty())
{
- BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id);
- --recursion_stack_position;
- pstate = recursion_stack[recursion_stack_position].preturn_address;
- *m_presult = recursion_stack[recursion_stack_position].results;
- push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results);
+ BOOST_ASSERT(0 == recursion_stack.back().idx);
+ pstate = recursion_stack.back().preturn_address;
+ *m_presult = recursion_stack.back().results;
+ push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, &recursion_stack.back().results);
+ recursion_stack.pop_back();
return true;
}
if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first))
saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
if(!r)
{
- recursion_stack[recursion_stack_position].id = pmp->recursion_id;
- recursion_stack[recursion_stack_position].preturn_address = pmp->preturn_address;
- recursion_stack[recursion_stack_position].results = pmp->results;
- ++recursion_stack_position;
+ recursion_stack.push_back(recursion_info<results_type>());
+ recursion_stack.back().idx = pmp->recursion_id;
+ recursion_stack.back().preturn_address = pmp->preturn_address;
+ recursion_stack.back().results = pmp->results;
}
boost::re_detail::inplace_destroy(pmp++);
m_backup_state = pmp;
saved_state* pmp = static_cast<saved_state*>(m_backup_state);
if(!r)
{
- --recursion_stack_position;
+ recursion_stack.pop_back();
}
boost::re_detail::inplace_destroy(pmp++);
m_backup_state = pmp;
//
// Set new call stack:
//
- if(recursion_stack_position >= static_cast<int>(sizeof(recursion_stack)/sizeof(recursion_stack[0])))
+ if(recursion_stack.capacity() == 0)
{
- return false;
+ recursion_stack.reserve(50);
}
- recursion_stack[recursion_stack_position].preturn_address = pstate->next.p;
- recursion_stack[recursion_stack_position].results = *m_presult;
- recursion_stack[recursion_stack_position].repeater_stack = next_count;
+ recursion_stack.push_back(recursion_info<results_type>());
+ recursion_stack.back().preturn_address = pstate->next.p;
+ recursion_stack.back().results = *m_presult;
+ recursion_stack.back().repeater_stack = next_count;
pstate = static_cast<const re_jump*>(pstate)->alt.p;
- recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index;
- ++recursion_stack_position;
+ recursion_stack.back().idx = static_cast<const re_brace*>(pstate)->index;
repeater_count<BidiIterator>* saved = next_count;
repeater_count<BidiIterator> r(&next_count); // resets all repeat counts since we're recursing and starting fresh on those
if(!result)
{
- --recursion_stack_position;
- next_count = recursion_stack[recursion_stack_position].repeater_stack;
- *m_presult = recursion_stack[recursion_stack_position].results;
+ next_count = recursion_stack.back().repeater_stack;
+ *m_presult = recursion_stack.back().results;
+ recursion_stack.pop_back();
return false;
}
return true;
{
m_presult->set_second(position, index);
}
- if(recursion_stack_position)
+ if(!recursion_stack.empty())
{
- if(index == recursion_stack[recursion_stack_position-1].id)
+ if(index == recursion_stack.back().idx)
{
- --recursion_stack_position;
- recursion_info<results_type> saved = recursion_stack[recursion_stack_position];
+ recursion_info<results_type> saved = recursion_stack.back();
+ recursion_stack.pop_back();
const re_syntax_base* saved_state = pstate = saved.preturn_address;
repeater_count<BidiIterator>* saved_count = next_count;
next_count = saved.repeater_stack;
*m_presult = saved.results;
if(!match_all_states())
{
- recursion_stack[recursion_stack_position] = saved;
- ++recursion_stack_position;
+ recursion_stack.push_back(saved);
next_count = saved_count;
return false;
}
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
{
- if(recursion_stack_position)
+ if(!recursion_stack.empty())
{
- BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id);
- --recursion_stack_position;
- const re_syntax_base* saved_state = pstate = recursion_stack[recursion_stack_position].preturn_address;
- *m_presult = recursion_stack[recursion_stack_position].results;
+ BOOST_ASSERT(0 == recursion_stack.back().idx);
+ const re_syntax_base* saved_state = pstate = recursion_stack.back().preturn_address;
+ *m_presult = recursion_stack.back().results;
+ recursion_stack.pop_back();
if(!match_all_states())
{
- recursion_stack[recursion_stack_position].preturn_address = saved_state;
- recursion_stack[recursion_stack_position].results = *m_presult;
- ++recursion_stack_position;
+ recursion_stack.push_back(recursion_info<results_type>());
+ recursion_stack.back().preturn_address = saved_state;
+ recursion_stack.back().results = *m_presult;
return false;
}
return true;
#ifndef BOOST_NO_SFINAE
#include <boost/mpl/has_xxx.hpp>
#endif
+#include <boost/ref.hpp>
namespace boost{
m_position = --base;
}
}
- put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]);
+ put((this->m_results)[this->m_results.size() > 1 ? static_cast<int>(this->m_results.size() - 1) : 1]);
break;
case '{':
have_brace = true;
if(have_brace && (*m_position == '^'))
++m_position;
- int max_len = m_end - m_position;
+ std::ptrdiff_t max_len = m_end - m_position;
if((max_len >= 5) && std::equal(m_position, m_position + 5, MATCH))
{
return false;
}
}
- put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]);
+ put((this->m_results)[this->m_results.size() > 1 ? static_cast<int>(this->m_results.size() - 1) : 1]);
return true;
}
if((max_len >= 20) && std::equal(m_position, m_position + 20, LAST_SUBMATCH_RESULT))
// F must be a pointer, a function, or a class with a function call operator:
//
BOOST_STATIC_ASSERT((::boost::is_pointer<F>::value || ::boost::is_function<F>::value || ::boost::is_class<F>::value));
- static formatter_wrapper<F> f;
+ static formatter_wrapper<typename unwrap_reference<F>::type> f;
static M m;
static O out;
static boost::regex_constants::match_flag_type flags;
template <class OutputIter>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f)
{
- return func(m, i, f);
+ return boost::unwrap_ref(func)(m, i, f);
}
template <class OutputIter, class Traits>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
template <class OutputIter>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/)
{
- return func(m, i);
+ return boost::unwrap_ref(func)(m, i);
}
template <class OutputIter, class Traits>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
template <class OutputIter>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/)
{
- return do_format_string(func(m), i);
+ return do_format_string(boost::unwrap_ref(func)(m), i);
}
template <class OutputIter, class Traits>
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
{
return stdext::unchecked_equal(first, last, with);
}
-
+#elif BOOST_WORKAROUND(BOOST_MSVC, > 1500)
+ //
+ // MSVC 10 will either emit warnings or else refuse to compile
+ // code that makes perfectly legitimate use of std::copy, when
+ // the OutputIterator type is a user-defined class (apparently all user
+ // defined iterators are "unsafe"). What's more Microsoft have removed their
+ // non-standard "unchecked" versions, even though their still in the MS
+ // documentation!! Work around this as best we can:
+ //
+ template<class InputIterator, class OutputIterator>
+ inline OutputIterator copy(
+ InputIterator first,
+ InputIterator last,
+ OutputIterator dest
+ )
+ {
+ while(first != last)
+ *dest++ = *first++;
+ return dest;
+ }
+ template<class InputIterator1, class InputIterator2>
+ inline bool equal(
+ InputIterator1 first,
+ InputIterator1 last,
+ InputIterator2 with
+ )
+ {
+ while(first != last)
+ if(*first++ != *with++) return false;
+ return true;
+ }
#else
using std::copy;
using std::equal;
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
{
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
- return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
+ return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m);
}
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
{
# define BOOST_SP_NO_SP_CONVERTIBLE
#endif
-#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x620 )
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x630 )
# define BOOST_SP_NO_SP_CONVERTIBLE
#endif
static yes f( T* );
static no f( ... );
- enum _vt { value = sizeof( f( static_cast<Y*>(0) ) ) == sizeof(yes) };
+ enum _vt { value = sizeof( (f)( static_cast<Y*>(0) ) ) == sizeof(yes) };
};
struct sp_empty
{
#if !defined( BOOST_USE_WINDOWS_H )
- extern "C" void __stdcall Sleep( unsigned ms );
+ extern "C" void __stdcall Sleep( unsigned long ms );
#endif
inline void yield( unsigned k )
};
#if defined( BOOST_HAS_RVALUE_REFS )
-template< class T > T&& forward( T &&t )
+
+template< class T > T&& sp_forward( T & t )
{
- return t;
+ return static_cast< T&& >( t );
}
+
#endif
} // namespace detail
template< class T > boost::shared_ptr< T > make_shared()
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
// Variadic templates, rvalue reference
-template< class T, class... Args > boost::shared_ptr< T > make_shared( Args && ... args )
+template< class T, class Arg1, class... Args > boost::shared_ptr< T > make_shared( Arg1 && arg1, Args && ... args )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
- ::new( pv ) T( detail::forward<Args>( args )... );
+ ::new( pv ) T( boost::detail::sp_forward<Arg1>( arg1 ), boost::detail::sp_forward<Args>( args )... );
pd->set_initialized();
T * pt2 = static_cast< T* >( pv );
return boost::shared_ptr< T >( pt, pt2 );
}
-template< class T, class A, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Args && ... args )
+template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Arg1 && arg1, Args && ... args )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
- ::new( pv ) T( detail::forward<Args>( args )... );
+ ::new( pv ) T( boost::detail::sp_forward<Arg1>( arg1 ), boost::detail::sp_forward<Args>( args )... );
pd->set_initialized();
T * pt2 = static_cast< T* >( pv );
template< class T, class A1 >
boost::shared_ptr< T > make_shared( A1 const & a1 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A, class A1 >
boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A1, class A2 >
boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A, class A1, class A2 >
boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A1, class A2, class A3 >
boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A, class A1, class A2, class A3 >
boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A1, class A2, class A3, class A4 >
boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A, class A1, class A2, class A3, class A4 >
boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A1, class A2, class A3, class A4, class A5 >
boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A, class A1, class A2, class A3, class A4, class A5 >
boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A1, class A2, class A3, class A4, class A5, class A6 >
boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 >
boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 >
boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 >
boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 >
boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 >
boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 >
boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 >
boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 )
{
- boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a );
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
- detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt );
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
void * pv = pd->address();
#if !defined( BOOST_EXCEPTION_DISABLE )
# include <boost/exception/exception.hpp>
# include <boost/current_function.hpp>
-# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(::boost::enable_error_info(x) <<\
- ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
- ::boost::throw_file(__FILE__) <<\
- ::boost::throw_line(__LINE__))
+# define BOOST_THROW_EXCEPTION(x) ::boost::exception_detail::throw_exception_(x,BOOST_CURRENT_FUNCTION,__FILE__,__LINE__)
#else
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
#endif
namespace boost
{
-
#ifdef BOOST_NO_EXCEPTIONS
void throw_exception( std::exception const & e ); // user defined
#endif
+#if !defined( BOOST_EXCEPTION_DISABLE )
+ namespace
+ exception_detail
+ {
+ template <class E>
+ BOOST_ATTRIBUTE_NORETURN
+ void
+ throw_exception_( E const & x, char const * current_function, char const * file, int line )
+ {
+ boost::throw_exception(
+ set_info(
+ set_info(
+ set_info(
+ enable_error_info(x),
+ throw_function(current_function)),
+ throw_file(file)),
+ throw_line(line)));
+ }
+ }
+#endif
} // namespace boost
#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED
#include <boost/assert.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/mpl/if.hpp>
+#if !defined(BOOST_NO_CWCTYPE)
+#include <cwctype>
+#endif
//
// the following must not be macros if we are to prefix them
#ifdef ispunct
# undef ispunct
#endif
+#ifdef iswpunct
+# undef iswpunct
+#endif
#ifdef isspace
# undef isspace
#endif
+#ifdef iswspace
+# undef iswspace
+#endif
//
// fix namespace problems:
//
namespace std{
using ::ispunct;
using ::isspace;
+#if !defined(BOOST_NO_CWCTYPE)
+ using ::iswpunct;
+ using ::iswspace;
+#endif
}
#endif
namespace boost{
-
//===========================================================================
// The escaped_list_separator class. Which is a model of TokenizerFunction
// An escaped list is a super-set of what is commonly known as a comma
struct escaped_list_error : public std::runtime_error{
escaped_list_error(const std::string& what_arg):std::runtime_error(what_arg) { }
};
-
+
// The out of the box GCC 2.95 on cygwin does not have a char_traits class.
// MSVC does not like the following typename
-#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
- template <class Char,
- class Traits = typename std::basic_string<Char>::traits_type >
-#else
- template <class Char,
- class Traits = std::basic_string<Char>::traits_type >
-#endif
+ template <class Char,
+ class Traits = BOOST_DEDUCED_TYPENAME std::basic_string<Char>::traits_type >
class escaped_list_separator {
private:
};
string_type escape_;
string_type c_;
- string_type quote_;
+ string_type quote_;
bool last_;
bool is_escape(Char e) {
}
public:
-
+
explicit escaped_list_separator(Char e = '\\',
Char c = ',',Char q = '\"')
: escape_(1,e), c_(1,c), quote_(1,q), last_(false) { }
-
+
escaped_list_separator(string_type e, string_type c, string_type q)
: escape_(e), c_(c), quote_(q), last_(false) { }
-
+
void reset() {last_=false;}
template <typename InputIterator, typename Token>
bool operator()(InputIterator& next,InputIterator end,Token& tok) {
bool bInQuote = false;
tok = Token();
-
+
if (next == end) {
if (last_) {
last_ = false;
//===========================================================================
// The classes here are used by offset_separator and char_separator to implement
// faster assigning of tokens using assign instead of +=
-
+
namespace tokenizer_detail {
+ //===========================================================================
+ // Tokenizer was broken for wide character separators, at least on Windows, since
+ // CRT functions isspace etc only expect values in [0, 0xFF]. Debug build asserts
+ // if higher values are passed in. The traits extension class should take care of this.
+ // Assuming that the conditional will always get optimized out in the function
+ // implementations, argument types are not a problem since both forms of character classifiers
+ // expect an int.
+ // In case there is no cwctype header, we implement the checks manually.
+ // We make use of the fact that the tested categories should fit in ASCII.
+ template<typename traits>
+ struct traits_extension : public traits {
+ typedef typename traits::char_type char_type;
+ static bool isspace(char_type c)
+ {
+#if !defined(BOOST_NO_CWCTYPE)
+ if (sizeof(char_type) == 1)
+ return std::isspace(c) != 0;
+ else
+ return std::iswspace(c) != 0;
+#else
+ return static_cast< unsigned >(c) <= 255 && std::isspace(c) != 0;
+#endif
+ }
+
+ static bool ispunct(char_type c)
+ {
+#if !defined(BOOST_NO_CWCTYPE)
+ if (sizeof(char_type) == 1)
+ return std::ispunct(c) != 0;
+ else
+ return std::iswpunct(c) != 0;
+#else
+ return static_cast< unsigned >(c) <= 255 && std::ispunct(c) != 0;
+#endif
+ }
+ };
// The assign_or_plus_equal struct contains functions that implement
// assign, +=, and clearing based on the iterator type. The
}
- template<class Token, class Value>
- static void plus_equal(Token &, const Value &) {
-
- }
+ template<class Token, class Value>
+ static void plus_equal(Token &, const Value &) { }
// If we are doing an assign, there is no need for the
- // the clear.
+ // the clear.
//
template<class Token>
- static void clear(Token &) {
-
- }
+ static void clear(Token &) { }
};
template <>
struct assign_or_plus_equal<std::input_iterator_tag> {
template<class Iterator, class Token>
- static void assign(Iterator b, Iterator e, Token &t) {
-
- }
+ static void assign(Iterator b, Iterator e, Token &t) { }
template<class Token, class Value>
static void plus_equal(Token &t, const Value &v) {
t += v;
typedef typename cat::type iterator_category;
};
-
-}
-
+ } // namespace tokenizer_detail
+
+
//===========================================================================
// The offset_separator class, which is a model of TokenizerFunction.
// Offset breaks a string into tokens based on a range of offsets
unsigned int current_offset_;
bool wrap_offsets_;
bool return_partial_last_;
-
+
public:
template <typename Iter>
offset_separator(Iter begin, Iter end, bool wrap_offsets = true,
: offsets_(begin,end), current_offset_(0),
wrap_offsets_(wrap_offsets),
return_partial_last_(return_partial_last) { }
-
+
offset_separator()
: offsets_(1,1), current_offset_(),
wrap_offsets_(true), return_partial_last_(true) { }
bool operator()(InputIterator& next, InputIterator end, Token& tok)
{
typedef tokenizer_detail::assign_or_plus_equal<
-#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
- typename
-#endif
- tokenizer_detail::get_iterator_category<
- InputIterator>::iterator_category> assigner;
-
+ BOOST_DEDUCED_TYPENAME tokenizer_detail::get_iterator_category<
+ InputIterator
+ >::iterator_category
+ > assigner;
BOOST_ASSERT(!offsets_.empty());
-
+
assigner::clear(tok);
InputIterator start(next);
-
+
if (next == end)
return false;
else
return false;
}
-
+
int c = offsets_[current_offset_];
int i = 0;
for (; i < c; ++i) {
assigner::plus_equal(tok,*next++);
}
assigner::assign(start,next,tok);
-
+
if (!return_partial_last_)
if (i < (c-1) )
return false;
-
+
++current_offset_;
return true;
}
enum empty_token_policy { drop_empty_tokens, keep_empty_tokens };
// The out of the box GCC 2.95 on cygwin does not have a char_traits class.
-#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
- template <typename Char,
- typename Traits = typename std::basic_string<Char>::traits_type >
-#else
- template <typename Char,
- typename Traits = std::basic_string<Char>::traits_type >
-#endif
+ template <typename Char,
+ typename Tr = BOOST_DEDUCED_TYPENAME std::basic_string<Char>::traits_type >
class char_separator
{
+ typedef tokenizer_detail::traits_extension<Tr> Traits;
typedef std::basic_string<Char,Traits> string_type;
public:
explicit
// use ispunct() for kept delimiters and isspace for dropped.
explicit
char_separator()
- : m_use_ispunct(true),
- m_use_isspace(true),
+ : m_use_ispunct(true),
+ m_use_isspace(true),
m_empty_tokens(drop_empty_tokens) { }
void reset() { }
bool operator()(InputIterator& next, InputIterator end, Token& tok)
{
typedef tokenizer_detail::assign_or_plus_equal<
-#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
- typename
-#endif
- tokenizer_detail::get_iterator_category<
- InputIterator>::iterator_category> assigner;
+ BOOST_DEDUCED_TYPENAME tokenizer_detail::get_iterator_category<
+ InputIterator
+ >::iterator_category
+ > assigner;
assigner::clear(tok);
if (m_empty_tokens == drop_empty_tokens)
for (; next != end && is_dropped(*next); ++next)
{ }
-
+
InputIterator start(next);
if (m_empty_tokens == drop_empty_tokens) {
// append all the non delim characters
for (; next != end && !is_dropped(*next) && !is_kept(*next); ++next)
assigner::plus_equal(tok,*next);
- }
+ }
else { // m_empty_tokens == keep_empty_tokens
-
+
// Handle empty token at the end
if (next == end)
{
- if (m_output_done == false)
+ if (m_output_done == false)
{
m_output_done = true;
assigner::assign(start,next,tok);
else
return false;
}
-
+
if (is_kept(*next)) {
if (m_output_done == false)
m_output_done = true;
bool m_use_isspace;
empty_token_policy m_empty_tokens;
bool m_output_done;
-
+
bool is_kept(Char E) const
- {
+ {
if (m_kept_delims.length())
return m_kept_delims.find(E) != string_type::npos;
else if (m_use_ispunct) {
- return std::ispunct(E) != 0;
+ return Traits::ispunct(E) != 0;
} else
return false;
}
if (m_dropped_delims.length())
return m_dropped_delims.find(E) != string_type::npos;
else if (m_use_isspace) {
- return std::isspace(E) != 0;
+ return Traits::isspace(E) != 0;
} else
return false;
}
// cannot be returned as tokens. These are often whitespace
// The out of the box GCC 2.95 on cygwin does not have a char_traits class.
-#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
- template <class Char,
- class Traits = typename std::basic_string<Char>::traits_type >
-#else
- template <class Char,
- class Traits = std::basic_string<Char>::traits_type >
-#endif
+ template <class Char,
+ class Tr = BOOST_DEDUCED_TYPENAME std::basic_string<Char>::traits_type >
class char_delimiters_separator {
- private:
+ private:
+ typedef tokenizer_detail::traits_extension<Tr> Traits;
typedef std::basic_string<Char,Traits> string_type;
string_type returnable_;
string_type nonreturnable_;
bool return_delims_;
bool no_ispunct_;
bool no_isspace_;
-
+
bool is_ret(Char E)const
- {
+ {
if (returnable_.length())
return returnable_.find(E) != string_type::npos;
else{
if (no_ispunct_) {return false;}
else{
- int r = std::ispunct(E);
+ int r = Traits::ispunct(E);
return r != 0;
}
}
else{
if (no_isspace_) {return false;}
else{
- int r = std::isspace(E);
+ int r = Traits::isspace(E);
return r != 0;
}
}
}
-
+
public:
explicit char_delimiters_separator(bool return_delims = false,
const Char* returnable = 0,
nonreturnable_(nonreturnable ? nonreturnable:string_type().c_str()),
return_delims_(return_delims), no_ispunct_(returnable!=0),
no_isspace_(nonreturnable!=0) { }
-
+
void reset() { }
public:
template <typename InputIterator, typename Token>
bool operator()(InputIterator& next, InputIterator end,Token& tok) {
tok = Token();
-
+
// skip past all nonreturnable delims
// skip past the returnable only if we are not returning delims
for (;next!=end && ( is_nonret(*next) || (is_ret(*next)
&& !return_delims_ ) );++next) { }
-
+
if (next == end) {
return false;
}
-
+
// if we are to return delims and we are one a returnable one
// move past it and stop
if (is_ret(*next) && return_delims_) {
// append all the non delim characters
for (;next!=end && !is_nonret(*next) && !is_ret(*next);++next)
tok+=*next;
-
-
+
+
return true;
}
};
} //namespace boost
-
-#endif
-
-
-
-
-
+#endif
#include "boost/type_traits/add_reference.hpp"
#include "boost/type_traits/add_volatile.hpp"
#include "boost/type_traits/alignment_of.hpp"
+#if !defined(__BORLANDC__) && !defined(__CUDACC__)
+#include "boost/type_traits/has_new_operator.hpp"
+#endif
#include "boost/type_traits/has_nothrow_assign.hpp"
#include "boost/type_traits/has_nothrow_constructor.hpp"
#include "boost/type_traits/has_nothrow_copy.hpp"
#include "boost/type_traits/is_polymorphic.hpp"
#include "boost/type_traits/is_pointer.hpp"
#include "boost/type_traits/is_reference.hpp"
+#include "boost/type_traits/is_rvalue_reference.hpp"
+#include "boost/type_traits/is_lvalue_reference.hpp"
#include "boost/type_traits/is_same.hpp"
#include "boost/type_traits/is_scalar.hpp"
#include "boost/type_traits/is_stateless.hpp"
#include "boost/type_traits/is_union.hpp"
#include "boost/type_traits/is_void.hpp"
+#include "boost/type_traits/is_virtual_base_of.hpp"
#include "boost/type_traits/is_volatile.hpp"
#include "boost/type_traits/rank.hpp"
#include "boost/type_traits/extent.hpp"
};
#else
+//
+// We can't filter out rvalue_references at the same level as
+// references or we get ambiguities from msvc:
+//
template <typename T>
-struct add_reference_impl
+struct add_reference_rvalue_layer
{
typedef T& type;
};
+#ifndef BOOST_NO_RVALUE_REFERENCES
+template <typename T>
+struct add_reference_rvalue_layer<T&&>
+{
+ typedef T&& type;
+};
+#endif
+
+template <typename T>
+struct add_reference_impl
+{
+ typedef typename add_reference_rvalue_layer<T>::type type;
+};
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&)
#endif
template<typename Function>
struct function_traits :
- public detail::function_traits_helper<typename boost::add_pointer<Function>::type>
+ public boost::detail::function_traits_helper<typename boost::add_pointer<Function>::type>
{
};
template<typename Function>
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
}
-BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_complex,T,(::boost::is_convertible<T, detail::is_convertible_from_tester>::value))
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_complex,T,(::boost::is_convertible<T, boost::detail::is_convertible_from_tester>::value))
} // namespace boost
#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
-//* is a type T declared const - is_const<T>
+namespace detail{
+//
+// We can't filter out rvalue_references at the same level as
+// references or we get ambiguities from msvc:
+//
+template <class T>
+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<typename remove_bounds<T>::type*>::is_const)
+ BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<typename boost::remove_bounds<T>::type*>::is_const);
#else
- BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::cv_traits_imp<T*>::is_const)
+ BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<T*>::is_const);
+#endif
+};
+#ifndef BOOST_NO_RVALUE_REFERENCES
+template <class T>
+struct is_const_rvalue_filter<T&&>
+{
+ BOOST_STATIC_CONSTANT(bool, value = false);
+};
#endif
+}
+
+//* is a type T declared const - is_const<T>
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::is_const_rvalue_filter<T>::value)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T&,false)
#if defined(BOOST_ILLEGAL_CV_REFERENCES)
{
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))
));
};
};
{
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))
));
};
};
struct is_convertible_basic_impl
{
static From _m_from;
- static bool const value = sizeof( detail::checker<To>::_m_check(_m_from, 0) )
+ static bool const value = sizeof( boost::detail::checker<To>::_m_check(_m_from, 0) )
== sizeof(::boost::type_traits::yes_type);
};
namespace detail {
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4624) // destructor could not be generated
+#endif
+
template <typename T>
struct empty_helper_t1 : public T
{
empty_helper_t1& operator=(const empty_helper_t1&);
};
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
struct empty_helper_t2 { int i[256]; };
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
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<T>::value)
+#ifndef BOOST_NO_RVALUE_REFERENCES
+BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_function,T&&,false)
+#endif
#endif
} // namespace boost
--- /dev/null
+
+// (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<Programming>:
+// 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 <boost/type_traits/config.hpp>
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+# include <boost/type_traits/detail/yes_no_type.hpp>
+# include <boost/type_traits/detail/wrap.hpp>
+#endif
+
+// should be the last #include
+#include <boost/type_traits/detail/bool_trait_def.hpp>
+
+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<T>::value)
+BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T volatile ,::boost::is_lvalue_reference<T>::value)
+BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_lvalue_reference,T const volatile ,::boost::is_lvalue_reference<T>::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 <class T> T&(* is_lvalue_reference_helper1(wrap<T>) )(wrap<T>);
+char is_lvalue_reference_helper1(...);
+
+template <class T> no_type is_lvalue_reference_helper2(T&(*)(wrap<T>));
+yes_type is_lvalue_reference_helper2(...);
+
+template <typename T>
+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<T>()))) == 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<T>::value)
+
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+} // namespace boost
+
+#include <boost/type_traits/detail/bool_trait_undef.hpp>
+
+#endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED
+
// (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,
//
// 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<Programming>:
-// 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 <boost/type_traits/config.hpp>
-
-#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-# include <boost/type_traits/detail/yes_no_type.hpp>
-# include <boost/type_traits/detail/wrap.hpp>
-#endif
+#include <boost/type_traits/is_lvalue_reference.hpp>
+#include <boost/type_traits/is_rvalue_reference.hpp>
+#include <boost/type_traits/ice.hpp>
// should be the last #include
#include <boost/type_traits/detail/bool_trait_def.hpp>
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<T>::value)
-BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T volatile ,::boost::is_reference<T>::value)
-BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T const volatile ,::boost::is_reference<T>::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 <class T> T&(* is_reference_helper1(wrap<T>) )(wrap<T>);
-char is_reference_helper1(...);
-
-template <class T> no_type is_reference_helper2(T&(*)(wrap<T>));
-yes_type is_reference_helper2(...);
-
template <typename T>
struct is_reference_impl
{
- BOOST_STATIC_CONSTANT(
- bool, value = sizeof(
- ::boost::detail::is_reference_helper2(
- ::boost::detail::is_reference_helper1(::boost::type_traits::wrap<T>()))) == 1
- );
+ BOOST_STATIC_CONSTANT(bool, value =
+ (::boost::type_traits::ice_or<
+ ::boost::is_lvalue_reference<T>::value, ::boost::is_rvalue_reference<T>::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<T>::value)
-#ifdef BOOST_MSVC
-# pragma warning(pop)
-#endif
-
-#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
} // namespace boost
#include <boost/type_traits/detail/bool_trait_undef.hpp>
--- /dev/null
+
+// (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 <boost/type_traits/config.hpp>
+
+// should be the last #include
+#include <boost/type_traits/detail/bool_trait_def.hpp>
+
+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 <boost/type_traits/detail/bool_trait_undef.hpp>
+
+#endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED
+
template< typename T1, typename T2 >
struct is_same_impl
{
- enum { value = detail::is_same_part_1<T1>::template part_2<T2>::value };
+ enum { value = boost::detail::is_same_part_1<T1>::template part_2<T2>::value };
};
#else // generic "no-partial-specialization" version
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<T>::value == ::boost::is_reference<U>::value),
(sizeof(T) == sizeof(U))
>::value));
namespace boost {
+namespace detail{
+template <class T>
+struct is_volatile_rval_filter
+{
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
+ BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<typename boost::remove_bounds<T>::type*>::is_volatile);
+#else
+ BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp<T*>::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 <class T>
+struct is_volatile_rval_filter<T&&>
+{
+ 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<T>
-#if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
- BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp<typename boost::remove_bounds<T>::type*>::is_volatile)
-#else
- BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp<T*>::is_volatile)
-#endif
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::is_volatile_rval_filter<T>::value)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T&,false)
#if defined(BOOST_ILLEGAL_CV_REFERENCES)
{
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))
));
};
};
{
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))
));
};
};
template<typename T>
struct remove_all_extents {
- typedef typename detail::remove_all_extents_impl_typeof<
+ typedef typename boost::detail::remove_all_extents_impl_typeof<
boost::is_array<T>::value
>::template inner<T,remove_all_extents<T> >::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_all_extents,T)
template<typename T>
struct remove_bounds {
- typedef typename detail::remove_bounds_impl_typeof<
+ typedef typename boost::detail::remove_bounds_impl_typeof<
boost::is_array<T>::value
>::template inner<T,remove_bounds<T> >::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_bounds,T)
template<typename T>
struct remove_const {
- typedef detail::remove_const_impl_typeof<
+ typedef boost::detail::remove_const_impl_typeof<
boost::is_pointer<T>::value,
boost::is_array<T>::value,
boost::is_const<T>::value,
template<typename T>
struct remove_cv {
- typedef detail::remove_cv_impl_typeof<
+ typedef boost::detail::remove_cv_impl_typeof<
boost::is_pointer<T>::value,
boost::is_array<T>::value,
boost::is_const<T>::value,
template<typename T>
struct remove_extent {
- typedef typename detail::remove_extent_impl_typeof<
+ typedef typename boost::detail::remove_extent_impl_typeof<
boost::is_array<T>::value
>::template inner<T,remove_extent<T> >::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_extent,T)
template<typename T>
struct remove_pointer {
- typedef typename detail::remove_pointer_impl_typeof<
+ typedef typename boost::detail::remove_pointer_impl_typeof<
boost::is_pointer<T>::value
>::template inner<T,remove_pointer<T> >::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_pointer,T)
template<typename T>
struct remove_reference {
- typedef typename detail::remove_reference_impl_typeof<
+ typedef typename boost::detail::remove_reference_impl_typeof<
boost::is_reference<T>::value
>::template inner<T,remove_reference<T> >::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_reference,T)
template<typename T>
struct remove_volatile {
- typedef detail::remove_volatile_impl_typeof<
+ typedef boost::detail::remove_volatile_impl_typeof<
boost::is_pointer<T>::value,
boost::is_array<T>::value,
boost::is_const<T>::value,
>::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 <typename T>
+struct remove_const_impl<T&&>
+{
+ typedef T&& type;
+};
+#endif
+
} // namespace detail
// * convert a type T to non-const type - remove_const<T>
namespace boost {
+namespace detail{
+
+template <class T>
+struct rvalue_ref_filter_rem_cv
+{
+ typedef typename boost::detail::cv_traits_imp<T*>::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 <class T>
+struct rvalue_ref_filter_rem_cv<T&&>
+{
+ typedef T&& type;
+};
+#endif
+
+}
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// convert a type T to a non-cv-qualified type - remove_cv<T>
-BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::cv_traits_imp<T*>::unqualified_type)
+BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::rvalue_ref_filter_rem_cv<T>::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])
#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 <class T>
+struct remove_rvalue_ref
+{
+ typedef T type;
+};
+#ifndef BOOST_NO_RVALUE_REFERENCES
+template <class T>
+struct remove_rvalue_ref<T&&>
+{
+ typedef T type;
+};
+#endif
+
+} // namespace detail
+
+BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,typename boost::detail::remove_rvalue_ref<T>::type)
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T&,T)
#if defined(BOOST_ILLEGAL_CV_REFERENCES)
>::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 <typename T>
+struct remove_volatile_impl<T&&>
+{
+ typedef T&& type;
+};
+#endif
} // namespace detail
// * convert a type T to a non-volatile type - remove_volatile<T>
template<> class type_with_alignment<8>
{
typedef mpl::if_c<
- ::boost::alignment_of<detail::max_align>::value < 8,
+ ::boost::alignment_of<boost::detail::max_align>::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<detail::max_align>::value < 16,
+ ::boost::alignment_of<boost::detail::max_align>::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<detail::max_align>::value < 32,
+ ::boost::alignment_of<boost::detail::max_align>::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<detail::max_align>::value < 64,
+ ::boost::alignment_of<boost::detail::max_align>::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<detail::max_align>::value < 128,
+ ::boost::alignment_of<boost::detail::max_align>::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;
};
// 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
// 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
// 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
# define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)
#endif
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
+ : mpl::if_<
+ mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
+ , boost::detail::tr1_result_of_impl<
+ typename remove_cv<F>::type,
+ typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
+ (boost::detail::has_result_type<F>::value)>
+ , boost::detail::tr1_result_of_impl<
+ F,
+ F(BOOST_RESULT_OF_ARGS),
+ (boost::detail::has_result_type<F>::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<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
+ : mpl::if_<
+ mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
+ , detail::tr1_result_of_impl<
+ typename remove_cv<F>::type,
+ typename remove_cv<F>::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<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
+class cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
+{
+ 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<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
struct result_of<F(BOOST_RESULT_OF_ARGS)>
- : boost::detail::result_of_impl<F, F(BOOST_RESULT_OF_ARGS), (boost::detail::has_result_type<F>::value)> {};
+ : tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { };
#endif
+#endif // defined(BOOST_NO_DECLTYPE)
+
#undef BOOST_RESULT_OF_ARGS
#if BOOST_PP_ITERATION() >= 1
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
+struct tr1_result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
{
typedef R type;
};
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
+struct tr1_result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
{
typedef R type;
};
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (T0::*)
+struct tr1_result_of_impl<R (T0::*)
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),
FArgs, false>
{
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (T0::*)
+struct tr1_result_of_impl<R (T0::*)
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
const,
FArgs, false>
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (T0::*)
+struct tr1_result_of_impl<R (T0::*)
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
volatile,
FArgs, false>
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
-struct result_of_impl<R (T0::*)
+struct tr1_result_of_impl<R (T0::*)
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
const volatile,
FArgs, false>
// 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
#define BOOST_RESULT_OF_HPP
#include <boost/config.hpp>
-#include <boost/type_traits/ice.hpp>
-#include <boost/type.hpp>
-#include <boost/preprocessor.hpp>
+#include <boost/preprocessor/iteration/iterate.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_member_function_pointer.hpp>
+#include <boost/type_traits/remove_cv.hpp>
#ifndef BOOST_RESULT_OF_NUM_ARGS
# define BOOST_RESULT_OF_NUM_ARGS 10
namespace boost {
template<typename F> struct result_of;
+template<typename F> 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<typename F, typename FArgs, bool HasResultType> struct result_of_impl;
+template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl;
+template<typename F> struct cpp0x_result_of_impl;
template<typename F>
struct result_of_void_impl
typedef R type;
};
+// Determine the return type of a function pointer or pointer to member.
template<typename F, typename FArgs>
-struct result_of_impl<F, FArgs, true>
+struct result_of_pointer
+ : tr1_result_of_impl<typename remove_cv<F>::type, FArgs, false> { };
+
+template<typename F, typename FArgs>
+struct tr1_result_of_impl<F, FArgs, true>
{
typedef typename F::result_type type;
};
{};
template<typename F, typename FArgs>
-struct result_of_impl<F, FArgs, false>
+struct tr1_result_of_impl<F, FArgs, false>
: mpl::if_<is_function_with_no_args<FArgs>,
result_of_void_impl<F>,
result_of_nested_result<F, FArgs> >::type
// 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
// 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<T>, 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
// contains. More details on these issues are at libs/utility/value_init.htm
#include <boost/aligned_storage.hpp>
+#include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION.
#include <boost/detail/workaround.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/cv_traits.hpp>
#include <cstring>
#include <new>
+#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 T>
-class value_initialized
+class initialized
{
private :
struct wrapper
typename
#endif
remove_const<T>::type data;
+
+ wrapper()
+ :
+ data()
+ {
+ }
+
+ wrapper(T const & arg)
+ :
+ data(arg)
+ {
+ }
};
mutable
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<wrapper const &>(*(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<T>::value );
return *this;
}
- ~value_initialized()
+ ~initialized()
{
wrapper_address()->wrapper::~wrapper();
}
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<class T>
+T const& get ( initialized<T> const& x )
+{
+ return x.data() ;
+}
+
+template<class T>
+T& get ( initialized<T>& x )
+{
+ return x.data() ;
+}
+
+template<class T>
+void swap ( initialized<T> & lhs, initialized<T> & rhs )
+{
+ lhs.swap(rhs) ;
+}
+
+template<class T>
+class value_initialized
+{
+ private :
+
+ // initialized<T> does value-initialization by default.
+ initialized<T> 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<class T>
{
return x.data() ;
}
+
template<class T>
T& get ( value_initialized<T>& x )
{
template <class T> operator T() const
{
- return get( value_initialized<T>() );
+ return initialized<T>().data();
}
};
} // namespace boost
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
#endif
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
-#define BOOST_VERSION 104200
+#define BOOST_VERSION 104400
//
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
// number, y is the minor version number, and z is the patch level if not 0.
// This is used by <config/auto_link.hpp> to select which library version to link to.
-#define BOOST_LIB_VERSION "1_42"
+#define BOOST_LIB_VERSION "1_44"
#endif