mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
boost: update to 1.47.0
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39481 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2e249325cf
commit
3ac441d272
@ -322,7 +322,7 @@ namespace boost {
|
||||
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)
|
||||
#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__))
|
||||
//
|
||||
// We need to return something here to keep
|
||||
// some compilers happy: however we will never
|
||||
|
@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
// if we don't have a std library config set, try and find one:
|
||||
#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG)
|
||||
#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) && defined(__cplusplus)
|
||||
# include <boost/config/select_stdlib_config.hpp>
|
||||
#endif
|
||||
// if we have a std library config, include it now:
|
||||
|
@ -56,8 +56,13 @@
|
||||
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
# define BOOST_NO_DEDUCED_TYPENAME
|
||||
// workaround for missing WCHAR_MAX/WCHAR_MIN:
|
||||
#ifdef __cplusplus
|
||||
#include <climits>
|
||||
#include <cwchar>
|
||||
#else
|
||||
#include <limits.h>
|
||||
#include <wchar.h>
|
||||
#endif // __cplusplus
|
||||
#ifndef WCHAR_MAX
|
||||
# define WCHAR_MAX 0xffff
|
||||
#endif
|
||||
@ -69,7 +74,7 @@
|
||||
// Borland C++ Builder 6 and below:
|
||||
#if (__BORLANDC__ <= 0x564)
|
||||
|
||||
# ifdef NDEBUG
|
||||
# if defined(NDEBUG) && defined(__cplusplus)
|
||||
// fix broken <cstring> so that Boost.test works:
|
||||
# include <cstring>
|
||||
# undef strcmp
|
||||
@ -166,7 +171,6 @@
|
||||
|
||||
#define BOOST_NO_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_DELETED_FUNCTIONS
|
||||
@ -181,6 +185,8 @@
|
||||
#define BOOST_NO_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
#if __BORLANDC__ >= 0x590
|
||||
# define BOOST_HAS_TR1_HASH
|
||||
@ -275,3 +281,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
||||
// (Niels Dekker, LKEB, April 2010)
|
||||
# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
|
||||
|
||||
# ifdef NDEBUG
|
||||
# if defined(NDEBUG) && defined(__cplusplus)
|
||||
// fix broken <cstring> so that Boost.test works:
|
||||
# include <cstring>
|
||||
# undef strcmp
|
||||
@ -93,7 +93,6 @@
|
||||
|
||||
#define BOOST_NO_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
#define BOOST_NO_DELETED_FUNCTIONS
|
||||
@ -101,6 +100,7 @@
|
||||
#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#define BOOST_NO_LAMBDAS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_RVALUE_REFERENCES
|
||||
@ -108,6 +108,7 @@
|
||||
#define BOOST_NO_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_UNICODE_LITERALS
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
//
|
||||
// TR1 macros:
|
||||
|
@ -74,7 +74,6 @@
|
||||
#define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CHAR16_T
|
||||
#define BOOST_NO_CHAR32_T
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_DECLTYPE
|
||||
#define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
@ -82,6 +81,7 @@
|
||||
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
|
||||
#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_LAMBDAS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_RVALUE_REFERENCES
|
||||
@ -91,6 +91,7 @@
|
||||
#define BOOST_NO_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_UNICODE_LITERALS
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
#ifdef c_plusplus
|
||||
// EDG has "long long" in non-strict mode
|
||||
|
@ -44,7 +44,9 @@
|
||||
//
|
||||
// Is this really the best way to detect whether the std lib is in namespace std?
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#endif
|
||||
#if !defined(__STL_IMPORT_VENDOR_CSTD) && !defined(_STLP_IMPORT_VENDOR_CSTD)
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
#endif
|
||||
@ -62,7 +64,6 @@
|
||||
#define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CHAR16_T
|
||||
#define BOOST_NO_CHAR32_T
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_DECLTYPE
|
||||
#define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
@ -71,6 +72,7 @@
|
||||
#define BOOST_NO_EXTERN_TEMPLATE
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#define BOOST_NO_LAMBDAS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_RVALUE_REFERENCES
|
||||
@ -80,6 +82,8 @@
|
||||
#define BOOST_NO_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_UNICODE_LITERALS
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
#if (__DMC__ < 0x812)
|
||||
#define BOOST_NO_VARIADIC_MACROS
|
||||
#endif
|
||||
|
@ -168,7 +168,7 @@
|
||||
|
||||
// Variadic templates compiler:
|
||||
// http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html
|
||||
# ifdef __VARIADIC_TEMPLATES
|
||||
# if defined(__VARIADIC_TEMPLATES) || (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4) && defined(__GXX_EXPERIMENTAL_CXX0X__))
|
||||
# define BOOST_HAS_VARIADIC_TMPL
|
||||
# else
|
||||
# define BOOST_NO_VARIADIC_TEMPLATES
|
||||
@ -182,25 +182,16 @@
|
||||
# define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
# define BOOST_NO_CHAR16_T
|
||||
# define BOOST_NO_CHAR32_T
|
||||
# define BOOST_NO_INITIALIZER_LISTS
|
||||
# define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
# define BOOST_NO_DELETED_FUNCTIONS
|
||||
# define BOOST_NO_INITIALIZER_LISTS
|
||||
# define BOOST_NO_SCOPED_ENUMS
|
||||
#endif
|
||||
|
||||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)
|
||||
# define BOOST_NO_SFINAE_EXPR
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.4.1 and later
|
||||
//
|
||||
#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40401) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS before 4.4.1
|
||||
// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064
|
||||
# define BOOST_NO_SCOPED_ENUMS
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.5.n and later
|
||||
// C++0x features in 4.5.0 and later
|
||||
//
|
||||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
|
||||
@ -209,11 +200,25 @@
|
||||
# define BOOST_NO_UNICODE_LITERALS
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.5.n and later
|
||||
// C++0x features in 4.5.1 and later
|
||||
//
|
||||
#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40501) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS before 4.5.1
|
||||
// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064
|
||||
# define BOOST_NO_SCOPED_ENUMS
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.6.n and later
|
||||
//
|
||||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
# define BOOST_COMPILER "GNU C++ version " __VERSION__
|
||||
#endif
|
||||
|
||||
// ConceptGCC compiler:
|
||||
@ -221,15 +226,8 @@
|
||||
#ifdef __GXX_CONCEPTS__
|
||||
# define BOOST_HAS_CONCEPTS
|
||||
# define BOOST_COMPILER "ConceptGCC version " __VERSION__
|
||||
#else
|
||||
# define BOOST_NO_CONCEPTS
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
# define BOOST_COMPILER "GNU C++ version " __VERSION__
|
||||
#endif
|
||||
|
||||
//
|
||||
// versions check:
|
||||
// we don't know gcc prior to version 2.90:
|
||||
#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90)
|
||||
|
@ -50,6 +50,8 @@
|
||||
# define BOOST_NO_LAMBDAS
|
||||
# define BOOST_NO_RAW_LITERALS
|
||||
# define BOOST_NO_UNICODE_LITERALS
|
||||
# define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
#define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__
|
||||
|
||||
|
@ -96,7 +96,6 @@
|
||||
#define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CHAR16_T
|
||||
#define BOOST_NO_CHAR32_T
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_DECLTYPE
|
||||
#define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
@ -106,6 +105,7 @@
|
||||
#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#define BOOST_NO_LAMBDAS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_RVALUE_REFERENCES
|
||||
|
@ -121,6 +121,7 @@
|
||||
// in type_traits code among other things, getting this correct
|
||||
// for the Intel compiler is actually remarkably fragile and tricky:
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#if defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
#include <cwchar>
|
||||
template< typename T > struct assert_no_intrinsic_wchar_t;
|
||||
@ -134,8 +135,9 @@ template<> struct assert_intrinsic_wchar_t<wchar_t> {};
|
||||
// if you see an error here then define BOOST_NO_INTRINSIC_WCHAR_T on the command line:
|
||||
template<> struct assert_intrinsic_wchar_t<unsigned short> {};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if _MSC_VER+0 >= 1000
|
||||
#if defined(_MSC_VER) && (_MSC_VER+0 >= 1000)
|
||||
# if _MSC_VER >= 1200
|
||||
# define BOOST_HAS_MS_INT64
|
||||
# endif
|
||||
@ -209,7 +211,7 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {};
|
||||
|
||||
#if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION >= 1200)
|
||||
# undef BOOST_NO_RVALUE_REFERENCES
|
||||
# undef BOOST_NO_SCOPED_ENUMS
|
||||
//# undef BOOST_NO_SCOPED_ENUMS // doesn't really work!!
|
||||
# undef BOOST_NO_DELETED_FUNCTIONS
|
||||
# undef BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
# undef BOOST_NO_LAMBDAS
|
||||
@ -218,9 +220,16 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {};
|
||||
# undef BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#endif
|
||||
|
||||
#if (BOOST_INTEL_CXX_VERSION < 1200)
|
||||
//
|
||||
// fenv.h appears not to work with Intel prior to 12.0:
|
||||
//
|
||||
# define BOOST_NO_FENV_H
|
||||
#endif
|
||||
|
||||
//
|
||||
// last known and checked version:
|
||||
#if (BOOST_INTEL_CXX_VERSION > 1110)
|
||||
#if (BOOST_INTEL_CXX_VERSION > 1200)
|
||||
# if defined(BOOST_ASSERT_CONFIG)
|
||||
# error "Unknown compiler version - please run the configure tests and report the results"
|
||||
# elif defined(_MSC_VER)
|
||||
|
@ -96,7 +96,6 @@
|
||||
#define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CHAR16_T
|
||||
#define BOOST_NO_CHAR32_T
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_DECLTYPE
|
||||
#define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
@ -106,6 +105,7 @@
|
||||
#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#define BOOST_NO_LAMBDAS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_SCOPED_ENUMS
|
||||
@ -115,6 +115,7 @@
|
||||
#define BOOST_NO_UNICODE_LITERALS
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_VARIADIC_MACROS
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
#define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
||||
#define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CHAR16_T
|
||||
#define BOOST_NO_CHAR32_T
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_DECLTYPE
|
||||
#define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
@ -54,6 +53,7 @@
|
||||
#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#define BOOST_NO_LAMBDAS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_RVALUE_REFERENCES
|
||||
@ -64,6 +64,7 @@
|
||||
#define BOOST_NO_UNICODE_LITERALS
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_VARIADIC_MACROS
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
//
|
||||
// versions check:
|
||||
|
@ -51,7 +51,6 @@
|
||||
//
|
||||
#define BOOST_NO_CHAR16_T
|
||||
#define BOOST_NO_CHAR32_T
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_DECLTYPE
|
||||
#define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
@ -61,6 +60,7 @@
|
||||
#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#define BOOST_NO_LAMBDAS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_RVALUE_REFERENCES
|
||||
@ -71,6 +71,7 @@
|
||||
#define BOOST_NO_UNICODE_LITERALS
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_VARIADIC_MACROS
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
//
|
||||
// version check:
|
||||
|
@ -103,7 +103,6 @@
|
||||
#define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_CHAR16_T
|
||||
#define BOOST_NO_CHAR32_T
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#define BOOST_NO_DECLTYPE
|
||||
#define BOOST_NO_DEFAULTED_FUNCTIONS
|
||||
@ -113,6 +112,7 @@
|
||||
#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#define BOOST_NO_LAMBDAS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_RVALUE_REFERENCES
|
||||
@ -123,6 +123,7 @@
|
||||
#define BOOST_NO_UNICODE_LITERALS
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_VARIADIC_MACROS
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
|
||||
//
|
||||
// Version
|
||||
|
@ -78,7 +78,6 @@
|
||||
# define BOOST_NO_CHAR16_T
|
||||
# define BOOST_NO_CHAR32_T
|
||||
#endif
|
||||
#define BOOST_NO_CONCEPTS
|
||||
#define BOOST_NO_CONSTEXPR
|
||||
#if ! __IBMCPP_DECLTYPE
|
||||
# define BOOST_NO_DECLTYPE
|
||||
@ -97,11 +96,13 @@
|
||||
#endif
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#define BOOST_NO_LAMBDAS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_RVALUE_REFERENCES
|
||||
#define BOOST_NO_SCOPED_ENUMS
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#if ! __IBMCPP_STATIC_ASSERT
|
||||
# define BOOST_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
@ -129,11 +129,15 @@
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32_WCE) || defined(UNDER_CE)
|
||||
# define BOOST_NO_THREADEX
|
||||
# define BOOST_NO_GETSYSTEMTIMEASFILETIME
|
||||
# define BOOST_NO_SWPRINTF
|
||||
#endif
|
||||
|
||||
// we have ThreadEx or GetSystemTimeAsFileTime unless we're running WindowsCE
|
||||
#if !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
# define BOOST_HAS_THREADEX
|
||||
# define BOOST_HAS_GETSYSTEMTIMEASFILETIME
|
||||
#endif
|
||||
|
||||
//
|
||||
// check for exception handling support:
|
||||
#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS)
|
||||
@ -179,6 +183,7 @@
|
||||
#define BOOST_NO_RVALUE_REFERENCES
|
||||
#define BOOST_NO_STATIC_ASSERT
|
||||
#define BOOST_NO_NULLPTR
|
||||
#define BOOST_NO_DECLTYPE
|
||||
#endif // _MSC_VER < 1600
|
||||
|
||||
#if _MSC_VER >= 1600
|
||||
@ -188,14 +193,13 @@
|
||||
// C++0x features not supported by any versions
|
||||
#define BOOST_NO_CHAR16_T
|
||||
#define BOOST_NO_CHAR32_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_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#define BOOST_NO_NOEXCEPT
|
||||
#define BOOST_NO_RAW_LITERALS
|
||||
#define BOOST_NO_SCOPED_ENUMS
|
||||
#define BOOST_NO_TEMPLATE_ALIASES
|
||||
@ -203,6 +207,7 @@
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define BOOST_NO_SFINAE_EXPR
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX
|
||||
//
|
||||
// prefix and suffix headers:
|
||||
//
|
||||
|
@ -11,7 +11,11 @@
|
||||
#define BOOST_PLATFORM "linux"
|
||||
|
||||
// make sure we have __GLIBC_PREREQ if available at all
|
||||
#ifdef __cplusplus
|
||||
#include <cstdlib>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
// <stdint.h> added to glibc 2.1.1
|
||||
@ -68,6 +72,7 @@
|
||||
// boilerplate code:
|
||||
#define BOOST_HAS_UNISTD_H
|
||||
#include <boost/config/posix_features.hpp>
|
||||
#define BOOST_HAS_PTHREAD_YIELD
|
||||
|
||||
#ifndef __GNUC__
|
||||
//
|
||||
|
@ -64,16 +64,17 @@
|
||||
# if ( defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON ) || ( defined(TARGET_CARBON) && TARGET_CARBON )
|
||||
|
||||
# if !defined(BOOST_HAS_PTHREADS)
|
||||
# define BOOST_HAS_MPTASKS
|
||||
// MPTasks support is deprecated/removed from Boost:
|
||||
//# define BOOST_HAS_MPTASKS
|
||||
# elif ( __dest_os == __mac_os_x )
|
||||
// We are doing a Carbon/Mach-O/MSL build which has pthreads, but only the
|
||||
// gettimeofday and no posix.
|
||||
# define BOOST_HAS_GETTIMEOFDAY
|
||||
# endif
|
||||
|
||||
// The MP task implementation of Boost Threads aims to replace MP-unsafe
|
||||
// parts of the MSL, so we turn on threads unconditionally.
|
||||
# define BOOST_HAS_THREADS
|
||||
#ifdef BOOST_HAS_PTHREADS
|
||||
# define BOOST_HAS_THREADS
|
||||
#endif
|
||||
|
||||
// The remote call manager depends on this.
|
||||
# define BOOST_BIND_ENABLE_PASCAL
|
||||
|
@ -10,33 +10,6 @@
|
||||
|
||||
// See http://www.boost.org/ for most recent version.
|
||||
|
||||
|
||||
// one identification macro for each of the
|
||||
// compilers we support:
|
||||
|
||||
# define BOOST_CXX_GCCXML 0
|
||||
# define BOOST_CXX_NVCC 0
|
||||
# define BOOST_CXX_COMO 0
|
||||
# define BOOST_CXX_PATHSCALE 0
|
||||
# define BOOST_CXX_CLANG 0
|
||||
# define BOOST_CXX_DMC 0
|
||||
# define BOOST_CXX_INTEL 0
|
||||
# define BOOST_CXX_GNUC 0
|
||||
# define BOOST_CXX_KCC 0
|
||||
# define BOOST_CXX_SGI 0
|
||||
# define BOOST_CXX_TRU64 0
|
||||
# define BOOST_CXX_GHS 0
|
||||
# define BOOST_CXX_BORLAND 0
|
||||
# define BOOST_CXX_CW 0
|
||||
# define BOOST_CXX_SUNPRO 0
|
||||
# define BOOST_CXX_HPACC 0
|
||||
# define BOOST_CXX_MPW 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
|
||||
// BOOST_COMPILER_CONFIG as needed:
|
||||
|
||||
|
@ -14,7 +14,11 @@
|
||||
// First include <cstddef> to determine if some version of STLport is in use as the std lib
|
||||
// (do not rely on this header being included since users can short-circuit this header
|
||||
// if they know whose std lib they are using.)
|
||||
#include <cstddef>
|
||||
#ifdef __cplusplus
|
||||
# include <cstddef>
|
||||
#else
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
// STLPort library; this _must_ come first, otherwise since
|
||||
|
@ -87,7 +87,7 @@
|
||||
#endif
|
||||
|
||||
#include <typeinfo>
|
||||
#if !_HAS_EXCEPTIONS
|
||||
#if ( (!_HAS_EXCEPTIONS && !defined(__ghs__)) || (!_HAS_NAMESPACE && defined(__ghs__)) )
|
||||
# define BOOST_NO_STD_TYPEINFO
|
||||
#endif
|
||||
|
||||
@ -101,7 +101,6 @@
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
# define BOOST_NO_0X_HDR_REGEX
|
||||
# define BOOST_NO_0X_HDR_SYSTEM_ERROR
|
||||
# define BOOST_NO_0X_HDR_TYPE_TRAITS
|
||||
# define BOOST_NO_STD_UNORDERED // deprecated; see following
|
||||
# define BOOST_NO_0X_HDR_UNORDERED_MAP
|
||||
# define BOOST_NO_0X_HDR_UNORDERED_SET
|
||||
@ -113,16 +112,13 @@
|
||||
#if !defined(_HAS_TR1_IMPORTS) && !defined(BOOST_NO_0X_HDR_TUPLE)
|
||||
# define BOOST_NO_0X_HDR_TUPLE
|
||||
#endif
|
||||
|
||||
// C++0x headers not yet implemented
|
||||
//
|
||||
// C++0x headers not yet (fully) implemented:
|
||||
//
|
||||
# define BOOST_NO_0X_HDR_TYPE_TRAITS
|
||||
# define BOOST_NO_0X_HDR_CHRONO
|
||||
# define BOOST_NO_0X_HDR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
|
||||
# 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_MUTEX
|
||||
# define BOOST_NO_0X_HDR_RATIO
|
||||
# define BOOST_NO_0X_HDR_THREAD
|
||||
|
@ -38,14 +38,10 @@
|
||||
# define BOOST_NO_0X_HDR_ARRAY
|
||||
# define BOOST_NO_0X_HDR_CHRONO
|
||||
# define BOOST_NO_0X_HDR_CODECVT
|
||||
# define BOOST_NO_0X_HDR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_0X_HDR_FUTURE
|
||||
# define BOOST_NO_0X_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MUTEX
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
# define BOOST_NO_0X_HDR_RATIO
|
||||
|
@ -104,10 +104,8 @@
|
||||
//
|
||||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define BOOST_NO_0X_HDR_ARRAY
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
# define BOOST_NO_0X_HDR_REGEX
|
||||
# define BOOST_NO_0X_HDR_TUPLE
|
||||
# define BOOST_NO_0X_HDR_TYPE_TRAITS
|
||||
# define BOOST_NO_STD_UNORDERED // deprecated; see following
|
||||
# define BOOST_NO_0X_HDR_UNORDERED_MAP
|
||||
# define BOOST_NO_0X_HDR_UNORDERED_SET
|
||||
@ -123,23 +121,33 @@
|
||||
# define BOOST_NO_0X_HDR_MUTEX
|
||||
# define BOOST_NO_0X_HDR_RATIO
|
||||
# define BOOST_NO_0X_HDR_SYSTEM_ERROR
|
||||
# define BOOST_NO_0X_HDR_THREAD
|
||||
#else
|
||||
# define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
|
||||
# define BOOST_HAS_TR1_COMPLEX_OVERLOADS
|
||||
#endif
|
||||
|
||||
#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1)) && (!defined(BOOST_NO_0X_HDR_CONDITION_VARIABLE) || !defined(BOOST_NO_0X_HDR_MUTEX))
|
||||
# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_0X_HDR_MUTEX
|
||||
#endif
|
||||
|
||||
// C++0x features in GCC 4.5.0 and later
|
||||
//
|
||||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define BOOST_NO_NUMERIC_LIMITS_LOWEST
|
||||
# define BOOST_NO_0X_HDR_FUTURE
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
#endif
|
||||
|
||||
// C++0x headers not yet implemented
|
||||
// C++0x features in GCC 4.5.0 and later
|
||||
//
|
||||
# define BOOST_NO_0X_HDR_CODECVT
|
||||
# define BOOST_NO_0X_HDR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_FUTURE
|
||||
# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
|
||||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define BOOST_NO_0X_HDR_TYPEINDEX
|
||||
#endif
|
||||
// C++0x headers not yet (fully!) implemented
|
||||
//
|
||||
# define BOOST_NO_0X_HDR_THREAD
|
||||
# define BOOST_NO_0X_HDR_TYPE_TRAITS
|
||||
# define BOOST_NO_0X_HDR_CODECVT
|
||||
|
||||
// --- end ---
|
||||
|
@ -27,14 +27,10 @@
|
||||
# define BOOST_NO_0X_HDR_ARRAY
|
||||
# define BOOST_NO_0X_HDR_CHRONO
|
||||
# define BOOST_NO_0X_HDR_CODECVT
|
||||
# define BOOST_NO_0X_HDR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_0X_HDR_FUTURE
|
||||
# define BOOST_NO_0X_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MUTEX
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
# define BOOST_NO_0X_HDR_RATIO
|
||||
|
@ -51,14 +51,10 @@
|
||||
# define BOOST_NO_0X_HDR_ARRAY
|
||||
# define BOOST_NO_0X_HDR_CHRONO
|
||||
# define BOOST_NO_0X_HDR_CODECVT
|
||||
# define BOOST_NO_0X_HDR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_0X_HDR_FUTURE
|
||||
# define BOOST_NO_0X_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MUTEX
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
# define BOOST_NO_0X_HDR_RATIO
|
||||
|
@ -154,22 +154,20 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// C++0x headers not yet implemented
|
||||
//
|
||||
#if _RWSTD_VER < 0x05000000
|
||||
# define BOOST_NO_0X_HDR_ARRAY
|
||||
# define BOOST_NO_0X_HDR_TYPE_TRAITS
|
||||
#endif
|
||||
// type_traits header is incomplete:
|
||||
# define BOOST_NO_0X_HDR_TYPE_TRAITS
|
||||
//
|
||||
// C++0x headers not yet implemented
|
||||
//
|
||||
# define BOOST_NO_0X_HDR_CHRONO
|
||||
# define BOOST_NO_0X_HDR_CODECVT
|
||||
# define BOOST_NO_0X_HDR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_0X_HDR_FUTURE
|
||||
# define BOOST_NO_0X_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MUTEX
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
# define BOOST_NO_0X_HDR_RATIO
|
||||
|
@ -121,14 +121,10 @@
|
||||
# define BOOST_NO_0X_HDR_ARRAY
|
||||
# define BOOST_NO_0X_HDR_CHRONO
|
||||
# define BOOST_NO_0X_HDR_CODECVT
|
||||
# define BOOST_NO_0X_HDR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_0X_HDR_FUTURE
|
||||
# define BOOST_NO_0X_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MUTEX
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
# define BOOST_NO_0X_HDR_RATIO
|
||||
|
@ -215,14 +215,10 @@ namespace boost { using std::min; using std::max; }
|
||||
# define BOOST_NO_0X_HDR_ARRAY
|
||||
# define BOOST_NO_0X_HDR_CHRONO
|
||||
# define BOOST_NO_0X_HDR_CODECVT
|
||||
# define BOOST_NO_0X_HDR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_0X_HDR_FUTURE
|
||||
# define BOOST_NO_0X_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MUTEX
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
# define BOOST_NO_0X_HDR_RATIO
|
||||
|
@ -27,14 +27,10 @@
|
||||
# define BOOST_NO_0X_HDR_ARRAY
|
||||
# define BOOST_NO_0X_HDR_CHRONO
|
||||
# define BOOST_NO_0X_HDR_CODECVT
|
||||
# define BOOST_NO_0X_HDR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_0X_HDR_FUTURE
|
||||
# define BOOST_NO_0X_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
|
||||
# define BOOST_NO_0X_HDR_MUTEX
|
||||
# define BOOST_NO_0X_HDR_RANDOM
|
||||
# define BOOST_NO_0X_HDR_RATIO
|
||||
|
@ -341,6 +341,9 @@
|
||||
#if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS)
|
||||
# define BOOST_NO_INITIALIZER_LISTS
|
||||
#endif
|
||||
#if defined(BOOST_NO_INITIALIZER_LISTS) && !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
# define BOOST_NO_0X_HDR_INITIALIZER_LIST
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined
|
||||
@ -376,7 +379,7 @@
|
||||
// works as expected with standard conforming compilers. The resulting
|
||||
// double inclusion of <cstddef> is harmless.
|
||||
|
||||
# ifdef BOOST_NO_STDC_NAMESPACE
|
||||
# if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus)
|
||||
# include <cstddef>
|
||||
namespace std { using ::ptrdiff_t; using ::size_t; }
|
||||
# endif
|
||||
@ -395,7 +398,7 @@
|
||||
|
||||
// BOOST_NO_STD_MIN_MAX workaround -----------------------------------------//
|
||||
|
||||
# ifdef BOOST_NO_STD_MIN_MAX
|
||||
# if defined(BOOST_NO_STD_MIN_MAX) && defined(__cplusplus)
|
||||
|
||||
namespace std {
|
||||
template <class _Tp>
|
||||
@ -506,7 +509,7 @@ namespace std {
|
||||
// but it's use may generate either warnings (with -ansi), or errors
|
||||
// (with -pedantic -ansi) unless it's use is prefixed by __extension__
|
||||
//
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
#if defined(BOOST_HAS_LONG_LONG) && defined(__cplusplus)
|
||||
namespace boost{
|
||||
# ifdef __GNUC__
|
||||
__extension__ typedef long long long_long_type;
|
||||
@ -560,7 +563,7 @@ namespace boost{
|
||||
//
|
||||
|
||||
|
||||
#if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
|
||||
#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) && defined(__cplusplus)
|
||||
|
||||
# include "boost/type.hpp"
|
||||
# include "boost/non_type.hpp"
|
||||
@ -598,7 +601,7 @@ namespace boost{
|
||||
|
||||
// When BOOST_NO_STD_TYPEINFO is defined, we can just import
|
||||
// the global definition into std namespace:
|
||||
#ifdef BOOST_NO_STD_TYPEINFO
|
||||
#if defined(BOOST_NO_STD_TYPEINFO) && defined(__cplusplus)
|
||||
#include <typeinfo>
|
||||
namespace std{ using ::type_info; }
|
||||
#endif
|
||||
|
@ -23,7 +23,7 @@
|
||||
// Note that THIS HEADER MUST NOT INCLUDE ANY OTHER HEADERS:
|
||||
// not even std library ones! Doing so may turn the warning
|
||||
// off too late to be of any use. For example the VC++ C4996
|
||||
// warning can be omitted from <iosfwd> if that header is included
|
||||
// warning can be emitted from <iosfwd> if that header is included
|
||||
// before or by this one :-(
|
||||
//
|
||||
|
||||
|
@ -18,7 +18,8 @@
|
||||
&& (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL))) \
|
||||
|| BOOST_WORKAROUND(__BORLANDC__, > 0x551) \
|
||||
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \
|
||||
|| (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
|| (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) \
|
||||
|| (defined(_LIBCPP_VERSION))
|
||||
|
||||
#include <deque>
|
||||
#include <list>
|
||||
|
@ -106,17 +106,29 @@ extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
|
||||
|
||||
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
|
||||
|
||||
#if defined(__MINGW64__)
|
||||
#define BOOST_INTERLOCKED_IMPORT
|
||||
#else
|
||||
#define BOOST_INTERLOCKED_IMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * );
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * );
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long );
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long );
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long );
|
||||
extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedIncrement( long volatile * );
|
||||
extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedDecrement( long volatile * );
|
||||
extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedCompareExchange( long volatile *, long, long );
|
||||
extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedExchange( long volatile *, long );
|
||||
extern "C"BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedExchangeAdd( long volatile *, long );
|
||||
|
||||
# if defined(_M_IA64) || defined(_M_AMD64)
|
||||
extern "C"BOOST_INTERLOCKED_IMPORT void* __stdcall InterlockedCompareExchangePointer( void* volatile *, void*, void* );
|
||||
extern "C"BOOST_INTERLOCKED_IMPORT void* __stdcall InterlockedExchangePointer( void* volatile *, void* );
|
||||
# endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@ -128,10 +140,15 @@ extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long vol
|
||||
# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd
|
||||
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||
# if defined(_M_IA64) || defined(_M_AMD64)
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER ::boost::detail::InterlockedCompareExchangePointer
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER ::boost::detail::InterlockedExchangePointer
|
||||
# else
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
// boost/detail/lightweight_test.hpp - lightweight test library
|
||||
//
|
||||
// Copyright (c) 2002, 2009 Peter Dimov
|
||||
// Copyright (2) Beman Dawes 2010, 2011
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -23,9 +24,15 @@
|
||||
// int boost::report_errors()
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <iostream>
|
||||
|
||||
// IDE's like Visual Studio perform better if output goes to std::cout or
|
||||
// some other stream, so allow user to configure output stream:
|
||||
#ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
# define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -58,30 +65,52 @@ inline int & test_errors()
|
||||
|
||||
inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
|
||||
{
|
||||
std::cerr << file << "(" << line << "): test '" << expr << "' failed in function '" << function << "'" << std::endl;
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr << "' failed in function '"
|
||||
<< function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
inline void error_impl(char const * msg, char const * file, int line, char const * function)
|
||||
{
|
||||
std::cerr << file << "(" << line << "): " << msg << " in function '" << function << "'" << std::endl;
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): " << msg << " in function '"
|
||||
<< function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, T const & t, U const & u )
|
||||
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, T const & t, U const & u )
|
||||
{
|
||||
if( t == u )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << t << "' != '" << u << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, class U> inline void test_ne_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, T const & t, U const & u )
|
||||
{
|
||||
if( t != u )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " != " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << t << "' == '" << u << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
inline int report_errors()
|
||||
@ -92,12 +121,14 @@ inline int report_errors()
|
||||
|
||||
if( errors == 0 )
|
||||
{
|
||||
std::cerr << "No errors detected." << std::endl;
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< "No errors detected." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -107,5 +138,6 @@ inline int report_errors()
|
||||
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
|
||||
#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
|
||||
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
||||
|
@ -20,18 +20,52 @@
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <boost/exception/detail/clone_current_exception.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdexcept>
|
||||
#include <new>
|
||||
#include <ios>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
typedef shared_ptr<exception_detail::clone_base const> exception_ptr;
|
||||
|
||||
class exception_ptr;
|
||||
BOOST_ATTRIBUTE_NORETURN void rethrow_exception( exception_ptr const & );
|
||||
exception_ptr current_exception();
|
||||
|
||||
class
|
||||
exception_ptr
|
||||
{
|
||||
typedef boost::shared_ptr<exception_detail::clone_base const> impl;
|
||||
impl ptr_;
|
||||
friend void rethrow_exception( exception_ptr const & );
|
||||
typedef exception_detail::clone_base const * (impl::*unspecified_bool_type)() const;
|
||||
public:
|
||||
exception_ptr()
|
||||
{
|
||||
}
|
||||
explicit
|
||||
exception_ptr( impl const & ptr ):
|
||||
ptr_(ptr)
|
||||
{
|
||||
}
|
||||
bool
|
||||
operator==( exception_ptr const & other ) const
|
||||
{
|
||||
return ptr_==other.ptr_;
|
||||
}
|
||||
bool
|
||||
operator!=( exception_ptr const & other ) const
|
||||
{
|
||||
return ptr_!=other.ptr_;
|
||||
}
|
||||
operator unspecified_bool_type() const
|
||||
{
|
||||
return ptr_?&impl::get:0;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
exception_ptr
|
||||
@ -67,35 +101,49 @@ boost
|
||||
boost::exception,
|
||||
std::bad_alloc
|
||||
{
|
||||
~bad_alloc_() throw() { }
|
||||
};
|
||||
|
||||
template <int Dummy>
|
||||
struct
|
||||
bad_exception_:
|
||||
boost::exception,
|
||||
std::bad_exception
|
||||
{
|
||||
~bad_exception_() throw() { }
|
||||
};
|
||||
|
||||
template <class Exception>
|
||||
exception_ptr
|
||||
get_bad_alloc()
|
||||
get_static_exception_object()
|
||||
{
|
||||
bad_alloc_ ba;
|
||||
exception_detail::clone_impl<bad_alloc_> c(ba);
|
||||
Exception ba;
|
||||
exception_detail::clone_impl<Exception> 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));
|
||||
static exception_ptr ep(shared_ptr<exception_detail::clone_base const>(new exception_detail::clone_impl<Exception>(c)));
|
||||
return ep;
|
||||
}
|
||||
|
||||
template <int Dummy>
|
||||
template <class Exception>
|
||||
struct
|
||||
exception_ptr_bad_alloc
|
||||
exception_ptr_static_exception_object
|
||||
{
|
||||
static exception_ptr const e;
|
||||
};
|
||||
|
||||
template <int Dummy>
|
||||
template <class Exception>
|
||||
exception_ptr const
|
||||
exception_ptr_bad_alloc<Dummy>::
|
||||
e = get_bad_alloc<Dummy>();
|
||||
exception_ptr_static_exception_object<Exception>::
|
||||
e = get_static_exception_object<Exception>();
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class
|
||||
unknown_exception:
|
||||
public boost::exception,
|
||||
@ -135,6 +183,11 @@ boost
|
||||
#endif
|
||||
}
|
||||
};
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
@ -244,101 +297,131 @@ boost
|
||||
exception_ptr
|
||||
current_exception_impl()
|
||||
{
|
||||
try
|
||||
exception_detail::clone_base const * e=0;
|
||||
switch(
|
||||
exception_detail::clone_current_exception(e) )
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
exception_detail::clone_base & e )
|
||||
{
|
||||
return exception_ptr(e.clone());
|
||||
}
|
||||
catch(
|
||||
std::domain_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::invalid_argument & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::length_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::out_of_range & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::logic_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::range_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::overflow_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::underflow_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::ios_base::failure & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::runtime_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::bad_alloc & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
case exception_detail::clone_current_exception_result::
|
||||
success:
|
||||
{
|
||||
BOOST_ASSERT(e!=0);
|
||||
return exception_ptr(shared_ptr<exception_detail::clone_base const>(e));
|
||||
}
|
||||
case exception_detail::clone_current_exception_result::
|
||||
bad_alloc:
|
||||
{
|
||||
BOOST_ASSERT(!e);
|
||||
return exception_detail::exception_ptr_static_exception_object<bad_alloc_>::e;
|
||||
}
|
||||
case exception_detail::clone_current_exception_result::
|
||||
bad_exception:
|
||||
{
|
||||
BOOST_ASSERT(!e);
|
||||
return exception_detail::exception_ptr_static_exception_object<bad_exception_>::e;
|
||||
}
|
||||
default:
|
||||
BOOST_ASSERT(0);
|
||||
case exception_detail::clone_current_exception_result::
|
||||
not_supported:
|
||||
{
|
||||
BOOST_ASSERT(!e);
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
exception_detail::clone_base & e )
|
||||
{
|
||||
return exception_ptr(shared_ptr<exception_detail::clone_base const>(e.clone()));
|
||||
}
|
||||
catch(
|
||||
std::domain_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::invalid_argument & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::length_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::out_of_range & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::logic_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::range_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::overflow_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::underflow_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::ios_base::failure & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::runtime_error & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::bad_alloc & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
#ifndef BOOST_NO_TYPEID
|
||||
catch(
|
||||
std::bad_cast & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::bad_typeid & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::bad_cast & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::bad_typeid & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
#endif
|
||||
catch(
|
||||
std::bad_exception & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::exception & e )
|
||||
{
|
||||
return exception_detail::current_exception_unknown_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
boost::exception & e )
|
||||
{
|
||||
return exception_detail::current_exception_unknown_boost_exception(e);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
return exception_detail::current_exception_unknown_exception();
|
||||
catch(
|
||||
std::bad_exception & e )
|
||||
{
|
||||
return exception_detail::current_exception_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
std::exception & e )
|
||||
{
|
||||
return exception_detail::current_exception_unknown_std_exception(e);
|
||||
}
|
||||
catch(
|
||||
boost::exception & e )
|
||||
{
|
||||
return exception_detail::current_exception_unknown_boost_exception(e);
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
return exception_detail::current_exception_unknown_exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -348,7 +431,6 @@ boost
|
||||
current_exception()
|
||||
{
|
||||
exception_ptr ret;
|
||||
BOOST_ASSERT(!ret);
|
||||
try
|
||||
{
|
||||
ret=exception_detail::current_exception_impl();
|
||||
@ -356,36 +438,26 @@ boost
|
||||
catch(
|
||||
std::bad_alloc & )
|
||||
{
|
||||
ret=exception_detail::exception_ptr_bad_alloc<42>::e;
|
||||
ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_alloc_>::e;
|
||||
}
|
||||
catch(
|
||||
... )
|
||||
{
|
||||
try
|
||||
{
|
||||
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);
|
||||
}
|
||||
ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_exception_>::e;
|
||||
}
|
||||
BOOST_ASSERT(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOST_ATTRIBUTE_NORETURN
|
||||
inline
|
||||
void
|
||||
rethrow_exception( exception_ptr const & p )
|
||||
{
|
||||
BOOST_ASSERT(p);
|
||||
p->rethrow();
|
||||
p.ptr_->rethrow();
|
||||
BOOST_ASSERT(0);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
inline
|
||||
|
@ -53,11 +53,11 @@ boost
|
||||
struct
|
||||
type_info_
|
||||
{
|
||||
detail::sp_typeinfo const & type_;
|
||||
detail::sp_typeinfo const * type_;
|
||||
|
||||
explicit
|
||||
type_info_( detail::sp_typeinfo const & type ):
|
||||
type_(type)
|
||||
type_(&type)
|
||||
{
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ boost
|
||||
bool
|
||||
operator<( type_info_ const & a, type_info_ const & b )
|
||||
{
|
||||
return 0!=(a.type_.before(b.type_));
|
||||
return 0!=(a.type_->before(*b.type_));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#ifndef BOOST_NO_RTTI
|
||||
#include <boost/units/detail/utility.hpp>
|
||||
@ -85,19 +86,23 @@ boost
|
||||
char const *
|
||||
get_diagnostic_information( exception const & x, char const * header )
|
||||
{
|
||||
if( error_info_container * c=x.data_.get() )
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
#endif
|
||||
return c->diagnostic_information(header);
|
||||
error_info_container * c=x.data_.get();
|
||||
if( !c )
|
||||
x.data_.adopt(c=new exception_detail::error_info_container_impl);
|
||||
char const * di=c->diagnostic_information(header);
|
||||
BOOST_ASSERT(di!=0);
|
||||
return di;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline
|
||||
@ -122,22 +127,30 @@ boost
|
||||
std::ostringstream tmp;
|
||||
if( be )
|
||||
{
|
||||
if( char const * const * f=get_error_info<throw_file>(*be) )
|
||||
{
|
||||
tmp << *f;
|
||||
if( int const * l=get_error_info<throw_line>(*be) )
|
||||
tmp << '(' << *l << "): ";
|
||||
}
|
||||
tmp << "Throw in function ";
|
||||
if( char const * const * fn=get_error_info<throw_function>(*be) )
|
||||
tmp << *fn;
|
||||
char const * const * f=get_error_info<throw_file>(*be);
|
||||
int const * l=get_error_info<throw_line>(*be);
|
||||
char const * const * fn=get_error_info<throw_function>(*be);
|
||||
if( !f && !l && !fn )
|
||||
tmp << "Throw location unknown (consider using BOOST_THROW_EXCEPTION)\n";
|
||||
else
|
||||
tmp << "(unknown)";
|
||||
tmp << '\n';
|
||||
{
|
||||
if( f )
|
||||
{
|
||||
tmp << *f;
|
||||
if( int const * l=get_error_info<throw_line>(*be) )
|
||||
tmp << '(' << *l << "): ";
|
||||
}
|
||||
tmp << "Throw in function ";
|
||||
if( char const * const * fn=get_error_info<throw_function>(*be) )
|
||||
tmp << *fn;
|
||||
else
|
||||
tmp << "(unknown)";
|
||||
tmp << '\n';
|
||||
}
|
||||
}
|
||||
#ifndef BOOST_NO_RTTI
|
||||
tmp << std::string("Dynamic exception type: ") <<
|
||||
units::detail::demangle((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';
|
||||
@ -166,7 +179,10 @@ boost
|
||||
{
|
||||
#endif
|
||||
(void) exception_detail::diagnostic_information_impl(&e,0,false);
|
||||
return exception_detail::get_diagnostic_information(e,0);
|
||||
if( char const * di=exception_detail::get_diagnostic_information(e,0) )
|
||||
return di;
|
||||
else
|
||||
return "Failed to produce boost::diagnostic_information_what()";
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(
|
||||
|
@ -9,10 +9,9 @@
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace exception_detail { class clone_base; };
|
||||
namespace exception_detail { class clone_base; }
|
||||
template <class Tag,class T> class error_info;
|
||||
template <class T> class shared_ptr;
|
||||
typedef shared_ptr<exception_detail::clone_base const> exception_ptr;
|
||||
class exception_ptr;
|
||||
typedef error_info<struct errinfo_nested_exception_,exception_ptr> errinfo_nested_exception;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,17 @@ boost
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class exception;
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
class shared_ptr;
|
||||
@ -189,6 +199,11 @@ boost
|
||||
E const & set_info( E const &, throw_line const & );
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class
|
||||
exception
|
||||
{
|
||||
@ -250,6 +265,11 @@ boost
|
||||
mutable char const * throw_file_;
|
||||
mutable int throw_line_;
|
||||
};
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
inline
|
||||
exception::
|
||||
@ -334,7 +354,7 @@ boost
|
||||
struct
|
||||
enable_error_info_return_type
|
||||
{
|
||||
typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception((T*)0))>::type type;
|
||||
typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception(static_cast<T *>(0)))>::type type;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,6 @@ boost
|
||||
{
|
||||
if( header )
|
||||
{
|
||||
BOOST_ASSERT(*header!=0);
|
||||
std::ostringstream tmp;
|
||||
tmp << header;
|
||||
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
|
||||
|
@ -23,8 +23,8 @@
|
||||
// in anything that may be included by function_template.hpp doesn't break
|
||||
#include <boost/function/detail/prologue.hpp>
|
||||
|
||||
// Visual Age C++ doesn't handle the file iteration well
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, >= 500)
|
||||
// Older Visual Age C++ version do not handle the file iteration well
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, >= 500) && BOOST_WORKAROUND(__IBMCPP__, < 800)
|
||||
# if BOOST_FUNCTION_MAX_ARGS >= 0
|
||||
# include <boost/function/function0.hpp>
|
||||
# endif
|
||||
|
@ -203,11 +203,11 @@ namespace boost {
|
||||
{
|
||||
switch (op) {
|
||||
case clone_functor_tag:
|
||||
out_buffer.obj_ref.obj_ptr = in_buffer.obj_ref.obj_ptr;
|
||||
out_buffer.obj_ref = in_buffer.obj_ref;
|
||||
return;
|
||||
|
||||
case move_functor_tag:
|
||||
out_buffer.obj_ref.obj_ptr = in_buffer.obj_ref.obj_ptr;
|
||||
out_buffer.obj_ref = in_buffer.obj_ref;
|
||||
in_buffer.obj_ref.obj_ptr = 0;
|
||||
return;
|
||||
|
||||
@ -315,14 +315,18 @@ namespace boost {
|
||||
if (op == clone_functor_tag || op == move_functor_tag) {
|
||||
const functor_type* in_functor =
|
||||
reinterpret_cast<const functor_type*>(&in_buffer.data);
|
||||
new ((void*)&out_buffer.data) functor_type(*in_functor);
|
||||
new (reinterpret_cast<void*>(&out_buffer.data)) functor_type(*in_functor);
|
||||
|
||||
if (op == move_functor_tag) {
|
||||
reinterpret_cast<functor_type*>(&in_buffer.data)->~Functor();
|
||||
functor_type* f = reinterpret_cast<functor_type*>(&in_buffer.data);
|
||||
(void)f; // suppress warning about the value of f not being used (MSVC)
|
||||
f->~Functor();
|
||||
}
|
||||
} else if (op == destroy_functor_tag) {
|
||||
// Some compilers (Borland, vc6, ...) are unhappy with ~functor_type.
|
||||
reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor();
|
||||
functor_type* f = reinterpret_cast<functor_type*>(&out_buffer.data);
|
||||
(void)f; // suppress warning about the value of f not being used (MSVC)
|
||||
f->~Functor();
|
||||
} else if (op == check_functor_type_tag) {
|
||||
const detail::sp_typeinfo& check_type
|
||||
= *out_buffer.type.type;
|
||||
@ -369,8 +373,10 @@ namespace boost {
|
||||
// Clone the functor
|
||||
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
|
||||
// can't do the static_cast that we should do.
|
||||
// jewillco: Changing this to static_cast because GCC 2.95.3 is
|
||||
// obsolete.
|
||||
const functor_type* f =
|
||||
(const functor_type*)(in_buffer.obj_ptr);
|
||||
static_cast<const functor_type*>(in_buffer.obj_ptr);
|
||||
functor_type* new_f = new functor_type(*f);
|
||||
out_buffer.obj_ptr = new_f;
|
||||
} else if (op == move_functor_tag) {
|
||||
@ -474,7 +480,7 @@ namespace boost {
|
||||
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
|
||||
// can't do the static_cast that we should do.
|
||||
const functor_wrapper_type* f =
|
||||
(const functor_wrapper_type*)(in_buffer.obj_ptr);
|
||||
static_cast<const functor_wrapper_type*>(in_buffer.obj_ptr);
|
||||
wrapper_allocator_type wrapper_allocator(static_cast<Allocator const &>(*f));
|
||||
wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1);
|
||||
wrapper_allocator.construct(copy, *f);
|
||||
@ -671,7 +677,7 @@ public:
|
||||
detail::function::check_functor_type_tag);
|
||||
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
|
||||
// can't do the static_cast that we should do.
|
||||
return (const Functor*)(type_result.obj_ptr);
|
||||
return static_cast<const Functor*>(type_result.obj_ptr);
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
@ -715,7 +721,7 @@ public:
|
||||
public: // should be protected, but GCC 2.95.3 will fail to allow access
|
||||
detail::function::vtable_base* get_vtable() const {
|
||||
return reinterpret_cast<detail::function::vtable_base*>(
|
||||
reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01);
|
||||
reinterpret_cast<std::size_t>(vtable) & ~static_cast<std::size_t>(0x01));
|
||||
}
|
||||
|
||||
bool has_trivial_copy_and_destroy() const {
|
||||
|
@ -486,19 +486,19 @@ namespace boost {
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS);
|
||||
|
||||
template<typename F>
|
||||
bool assign_to(F f, function_buffer& functor)
|
||||
bool assign_to(F f, function_buffer& functor) const
|
||||
{
|
||||
typedef typename get_function_tag<F>::type tag;
|
||||
return assign_to(f, functor, tag());
|
||||
}
|
||||
template<typename F,typename Allocator>
|
||||
bool assign_to_a(F f, function_buffer& functor, Allocator a)
|
||||
bool assign_to_a(F f, function_buffer& functor, Allocator a) const
|
||||
{
|
||||
typedef typename get_function_tag<F>::type tag;
|
||||
return assign_to_a(f, functor, a, tag());
|
||||
}
|
||||
|
||||
void clear(function_buffer& functor)
|
||||
void clear(function_buffer& functor) const
|
||||
{
|
||||
if (base.manager)
|
||||
base.manager(functor, functor, destroy_functor_tag);
|
||||
@ -508,13 +508,13 @@ namespace boost {
|
||||
// Function pointers
|
||||
template<typename FunctionPtr>
|
||||
bool
|
||||
assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag)
|
||||
assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) const
|
||||
{
|
||||
this->clear(functor);
|
||||
if (f) {
|
||||
// should be a reinterpret cast, but some compilers insist
|
||||
// on giving cv-qualifiers to free functions
|
||||
functor.func_ptr = (void (*)())(f);
|
||||
functor.func_ptr = reinterpret_cast<void (*)()>(f);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -522,7 +522,7 @@ namespace boost {
|
||||
}
|
||||
template<typename FunctionPtr,typename Allocator>
|
||||
bool
|
||||
assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag)
|
||||
assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag) const
|
||||
{
|
||||
return assign_to(f,functor,function_ptr_tag());
|
||||
}
|
||||
@ -530,26 +530,26 @@ namespace boost {
|
||||
// Member pointers
|
||||
#if BOOST_FUNCTION_NUM_ARGS > 0
|
||||
template<typename MemberPtr>
|
||||
bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag)
|
||||
bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) const
|
||||
{
|
||||
// DPG TBD: Add explicit support for member function
|
||||
// objects, so we invoke through mem_fn() but we retain the
|
||||
// right target_type() values.
|
||||
if (f) {
|
||||
this->assign_to(mem_fn(f), functor);
|
||||
this->assign_to(boost::mem_fn(f), functor);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
template<typename MemberPtr,typename Allocator>
|
||||
bool assign_to_a(MemberPtr f, function_buffer& functor, Allocator a, member_ptr_tag)
|
||||
bool assign_to_a(MemberPtr f, function_buffer& functor, Allocator a, member_ptr_tag) const
|
||||
{
|
||||
// DPG TBD: Add explicit support for member function
|
||||
// objects, so we invoke through mem_fn() but we retain the
|
||||
// right target_type() values.
|
||||
if (f) {
|
||||
this->assign_to_a(mem_fn(f), functor, a);
|
||||
this->assign_to_a(boost::mem_fn(f), functor, a);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -561,13 +561,13 @@ namespace boost {
|
||||
// Assign to a function object using the small object optimization
|
||||
template<typename FunctionObj>
|
||||
void
|
||||
assign_functor(FunctionObj f, function_buffer& functor, mpl::true_)
|
||||
assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) const
|
||||
{
|
||||
new ((void*)&functor.data) FunctionObj(f);
|
||||
new (reinterpret_cast<void*>(&functor.data)) FunctionObj(f);
|
||||
}
|
||||
template<typename FunctionObj,typename Allocator>
|
||||
void
|
||||
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_)
|
||||
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) const
|
||||
{
|
||||
assign_functor(f,functor,mpl::true_());
|
||||
}
|
||||
@ -575,13 +575,13 @@ namespace boost {
|
||||
// Assign to a function object allocated on the heap.
|
||||
template<typename FunctionObj>
|
||||
void
|
||||
assign_functor(FunctionObj f, function_buffer& functor, mpl::false_)
|
||||
assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) const
|
||||
{
|
||||
functor.obj_ptr = new FunctionObj(f);
|
||||
}
|
||||
template<typename FunctionObj,typename Allocator>
|
||||
void
|
||||
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_)
|
||||
assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) const
|
||||
{
|
||||
typedef functor_wrapper<FunctionObj,Allocator> functor_wrapper_type;
|
||||
typedef typename Allocator::template rebind<functor_wrapper_type>::other
|
||||
@ -596,7 +596,7 @@ namespace boost {
|
||||
|
||||
template<typename FunctionObj>
|
||||
bool
|
||||
assign_to(FunctionObj f, function_buffer& functor, function_obj_tag)
|
||||
assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) const
|
||||
{
|
||||
if (!boost::detail::function::has_empty_target(boost::addressof(f))) {
|
||||
assign_functor(f, functor,
|
||||
@ -608,7 +608,7 @@ namespace boost {
|
||||
}
|
||||
template<typename FunctionObj,typename Allocator>
|
||||
bool
|
||||
assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag)
|
||||
assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag) const
|
||||
{
|
||||
if (!boost::detail::function::has_empty_target(boost::addressof(f))) {
|
||||
assign_functor_a(f, functor, a,
|
||||
@ -623,9 +623,9 @@ namespace boost {
|
||||
template<typename FunctionObj>
|
||||
bool
|
||||
assign_to(const reference_wrapper<FunctionObj>& f,
|
||||
function_buffer& functor, function_obj_ref_tag)
|
||||
function_buffer& functor, function_obj_ref_tag) const
|
||||
{
|
||||
functor.obj_ref.obj_ptr = (void *)f.get_pointer();
|
||||
functor.obj_ref.obj_ptr = (void *)(f.get_pointer());
|
||||
functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value;
|
||||
functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value;
|
||||
return true;
|
||||
@ -633,7 +633,7 @@ namespace boost {
|
||||
template<typename FunctionObj,typename Allocator>
|
||||
bool
|
||||
assign_to_a(const reference_wrapper<FunctionObj>& f,
|
||||
function_buffer& functor, Allocator, function_obj_ref_tag)
|
||||
function_buffer& functor, Allocator, function_obj_ref_tag) const
|
||||
{
|
||||
return assign_to(f,functor,function_obj_ref_tag());
|
||||
}
|
||||
@ -677,7 +677,7 @@ namespace boost {
|
||||
|
||||
vtable_type* get_vtable() const {
|
||||
return reinterpret_cast<vtable_type*>(
|
||||
reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01);
|
||||
reinterpret_cast<std::size_t>(vtable) & ~static_cast<size_t>(0x01));
|
||||
}
|
||||
|
||||
struct clear_type {};
|
||||
@ -751,9 +751,6 @@ namespace boost {
|
||||
|
||||
~BOOST_FUNCTION_FUNCTION() { clear(); }
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
// MSVC 6.0 and prior require all definitions to be inline, but
|
||||
// these definitions can become very costly.
|
||||
result_type operator()(BOOST_FUNCTION_PARMS) const
|
||||
{
|
||||
if (this->empty())
|
||||
@ -762,9 +759,6 @@ namespace boost {
|
||||
return get_vtable()->invoker
|
||||
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
||||
}
|
||||
#else
|
||||
result_type operator()(BOOST_FUNCTION_PARMS) const;
|
||||
#endif
|
||||
|
||||
// The distinction between when to use BOOST_FUNCTION_FUNCTION and
|
||||
// when to use self_type is obnoxious. MSVC cannot handle self_type as
|
||||
@ -909,7 +903,7 @@ namespace boost {
|
||||
// static initialization. Otherwise, we will have a race
|
||||
// condition here in multi-threaded code. See
|
||||
// http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/.
|
||||
static vtable_type stored_vtable =
|
||||
static const vtable_type stored_vtable =
|
||||
{ { &manager_type::manage }, &invoker_type::invoke };
|
||||
|
||||
if (stored_vtable.assign_to(f, functor)) {
|
||||
@ -917,7 +911,7 @@ namespace boost {
|
||||
if (boost::has_trivial_copy_constructor<Functor>::value &&
|
||||
boost::has_trivial_destructor<Functor>::value &&
|
||||
detail::function::function_allows_small_object_optimization<Functor>::value)
|
||||
value |= (std::size_t)0x01;
|
||||
value |= static_cast<size_t>(0x01);
|
||||
vtable = reinterpret_cast<detail::function::vtable_base *>(value);
|
||||
} else
|
||||
vtable = 0;
|
||||
@ -943,7 +937,7 @@ namespace boost {
|
||||
// static initialization. Otherwise, we will have a race
|
||||
// condition here in multi-threaded code. See
|
||||
// http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/.
|
||||
static vtable_type stored_vtable =
|
||||
static const vtable_type stored_vtable =
|
||||
{ { &manager_type::manage }, &invoker_type::invoke };
|
||||
|
||||
if (stored_vtable.assign_to_a(f, functor, a)) {
|
||||
@ -951,7 +945,7 @@ namespace boost {
|
||||
if (boost::has_trivial_copy_constructor<Functor>::value &&
|
||||
boost::has_trivial_destructor<Functor>::value &&
|
||||
detail::function::function_allows_small_object_optimization<Functor>::value)
|
||||
value |= (std::size_t)0x01;
|
||||
value |= static_cast<std::size_t>(0x01);
|
||||
vtable = reinterpret_cast<detail::function::vtable_base *>(value);
|
||||
} else
|
||||
vtable = 0;
|
||||
@ -998,22 +992,6 @@ namespace boost {
|
||||
f1.swap(f2);
|
||||
}
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS>
|
||||
typename BOOST_FUNCTION_FUNCTION<
|
||||
R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>::result_type
|
||||
inline
|
||||
BOOST_FUNCTION_FUNCTION<R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>
|
||||
::operator()(BOOST_FUNCTION_PARMS) const
|
||||
{
|
||||
if (this->empty())
|
||||
boost::throw_exception(bad_function_call());
|
||||
|
||||
return get_vtable()->invoker
|
||||
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Poison comparisons between boost::function objects of the same type.
|
||||
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS>
|
||||
void operator==(const BOOST_FUNCTION_FUNCTION<
|
||||
|
@ -5,7 +5,7 @@
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* $Id: integer_traits.hpp 58381 2009-12-14 18:14:48Z johnmaddock $
|
||||
* $Id: integer_traits.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $
|
||||
*
|
||||
* Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
|
||||
*/
|
||||
@ -227,7 +227,7 @@ class integer_traits< ::boost::ulong_long_type>
|
||||
template<>
|
||||
class integer_traits< ::boost::long_long_type>
|
||||
: public std::numeric_limits< ::boost::long_long_type>,
|
||||
public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) - 1)), ~(1LL << (sizeof(::boost::long_long_type) - 1))>
|
||||
public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1)), ~(1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1))>
|
||||
{ };
|
||||
|
||||
template<>
|
||||
|
@ -1,4 +1,4 @@
|
||||
// interator.hpp workarounds for non-conforming standard libraries ---------//
|
||||
// iterator.hpp workarounds for non-conforming standard libraries ---------//
|
||||
|
||||
// (C) Copyright Beman Dawes 2000. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
|
@ -24,15 +24,9 @@
|
||||
|
||||
#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
# if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# endif
|
||||
|
||||
#else
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/iterator/detail/config_def.hpp>
|
||||
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
||||
# include <boost/type_traits/is_base_and_derived.hpp>
|
||||
@ -35,33 +37,16 @@ namespace boost
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <class UnaryFunc>
|
||||
struct function_object_result
|
||||
{
|
||||
typedef typename UnaryFunc::result_type type;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class Return, class Argument>
|
||||
struct function_object_result<Return(*)(Argument)>
|
||||
{
|
||||
typedef Return type;
|
||||
};
|
||||
#endif
|
||||
|
||||
// Compute the iterator_adaptor instantiation to be used for transform_iterator
|
||||
template <class UnaryFunc, class Iterator, class Reference, class Value>
|
||||
struct transform_iterator_base
|
||||
{
|
||||
private:
|
||||
// By default, dereferencing the iterator yields the same as
|
||||
// the function. Do we need to adjust the way
|
||||
// function_object_result is computed for the standard
|
||||
// proposal (e.g. using Doug's result_of)?
|
||||
// the function.
|
||||
typedef typename ia_dflt_help<
|
||||
Reference
|
||||
, function_object_result<UnaryFunc>
|
||||
, result_of<UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
|
||||
>::type reference;
|
||||
|
||||
// To get the default for Value: remove any reference on the
|
||||
@ -113,7 +98,7 @@ namespace boost
|
||||
#endif
|
||||
}
|
||||
|
||||
template<
|
||||
template <
|
||||
class OtherUnaryFunction
|
||||
, class OtherIterator
|
||||
, class OtherReference
|
||||
|
@ -357,7 +357,7 @@ namespace boost {
|
||||
{
|
||||
typedef typename tuple_impl_specific::tuple_meta_transform<
|
||||
IteratorTuple
|
||||
, iterator_traversal<>
|
||||
, pure_traversal_tag<iterator_traversal<> >
|
||||
>::type tuple_of_traversal_tags;
|
||||
|
||||
typedef typename tuple_impl_specific::tuple_meta_accumulate<
|
||||
|
@ -11,8 +11,8 @@
|
||||
// enhanced with contributions from Terje Slettebo,
|
||||
// with additional fixes and suggestions from Gennaro Prota,
|
||||
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
|
||||
// Alexander Nasonov and other Boosters
|
||||
// when: November 2000, March 2003, June 2005, June 2006
|
||||
// Alexander Nasonov, Antony Polukhin and other Boosters
|
||||
// when: November 2000, March 2003, June 2005, June 2006, March 2011
|
||||
|
||||
#include <climits>
|
||||
#include <cstddef>
|
||||
@ -20,12 +20,18 @@
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
#include <exception>
|
||||
#include <cmath>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
#include <boost/type_traits/is_signed.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/lcast_precision.hpp>
|
||||
@ -55,7 +61,13 @@
|
||||
namespace boost
|
||||
{
|
||||
// exception used to indicate runtime lexical_cast failure
|
||||
class bad_lexical_cast : public std::bad_cast
|
||||
class bad_lexical_cast :
|
||||
// workaround MSVC bug with std::bad_cast when _HAS_EXCEPTIONS == 0
|
||||
#if defined(BOOST_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS
|
||||
public std::exception
|
||||
#else
|
||||
public std::bad_cast
|
||||
#endif
|
||||
|
||||
#if defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, < 0x560 )
|
||||
// under bcc32 5.5.1 bad_cast doesn't derive from exception
|
||||
@ -235,13 +247,42 @@ namespace boost
|
||||
static void check_coverage() {}
|
||||
};
|
||||
|
||||
// No specializations for:
|
||||
// lcast_src_length<char, signed char>
|
||||
// lcast_src_length<char, unsigned char>
|
||||
// lcast_src_length<char, signed char*>
|
||||
// lcast_src_length<char, unsigned char*>
|
||||
// lcast_src_length<char, signed char const*>
|
||||
// lcast_src_length<char, unsigned char const*>
|
||||
template<>
|
||||
struct lcast_src_length<char, signed char>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, unsigned char>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, signed char*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, unsigned char*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, signed char const*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
template<>
|
||||
struct lcast_src_length<char, unsigned char const*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = 1);
|
||||
static void check_coverage() {}
|
||||
};
|
||||
|
||||
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||
template<>
|
||||
@ -451,7 +492,7 @@ namespace boost
|
||||
#endif // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||
}
|
||||
|
||||
namespace detail // '0' and '-' constants
|
||||
namespace detail // '0', '+' and '-' constants
|
||||
{
|
||||
template<typename CharT> struct lcast_char_constants;
|
||||
|
||||
@ -460,6 +501,7 @@ namespace boost
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(char, zero = '0');
|
||||
BOOST_STATIC_CONSTANT(char, minus = '-');
|
||||
BOOST_STATIC_CONSTANT(char, plus = '+');
|
||||
};
|
||||
|
||||
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||
@ -468,6 +510,7 @@ namespace boost
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(wchar_t, zero = L'0');
|
||||
BOOST_STATIC_CONSTANT(wchar_t, minus = L'-');
|
||||
BOOST_STATIC_CONSTANT(wchar_t, plus = L'+');
|
||||
};
|
||||
#endif
|
||||
}
|
||||
@ -512,6 +555,10 @@ namespace boost
|
||||
BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed);
|
||||
#endif
|
||||
|
||||
typedef typename Traits::int_type int_type;
|
||||
CharT const czero = lcast_char_constants<CharT>::zero;
|
||||
int_type const zero = Traits::to_int_type(czero);
|
||||
|
||||
#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
|
||||
// TODO: use BOOST_NO_STD_LOCALE
|
||||
std::locale loc;
|
||||
@ -519,53 +566,159 @@ namespace boost
|
||||
numpunct const& np = BOOST_USE_FACET(numpunct, loc);
|
||||
std::string const& grouping = np.grouping();
|
||||
std::string::size_type const grouping_size = grouping.size();
|
||||
CharT thousands_sep = grouping_size ? np.thousands_sep() : 0;
|
||||
std::string::size_type group = 0; // current group number
|
||||
char last_grp_size = grouping[0] <= 0 ? CHAR_MAX : grouping[0];
|
||||
// a) Since grouping is const, grouping[grouping.size()] returns 0.
|
||||
// b) It's safe to assume here and below that CHAR_MAX
|
||||
// is equivalent to unlimited grouping:
|
||||
|
||||
if ( grouping_size && grouping[0] > 0 )
|
||||
{
|
||||
|
||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
// Check that ulimited group is unreachable:
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX);
|
||||
#endif
|
||||
CharT thousands_sep = np.thousands_sep();
|
||||
std::string::size_type group = 0; // current group number
|
||||
char last_grp_size = grouping[0];
|
||||
char left = last_grp_size;
|
||||
|
||||
char left = last_grp_size;
|
||||
#endif
|
||||
|
||||
typedef typename Traits::int_type int_type;
|
||||
CharT const czero = lcast_char_constants<CharT>::zero;
|
||||
int_type const zero = Traits::to_int_type(czero);
|
||||
|
||||
do
|
||||
{
|
||||
#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
|
||||
if(left == 0)
|
||||
do
|
||||
{
|
||||
++group;
|
||||
if(group < grouping_size)
|
||||
if(left == 0)
|
||||
{
|
||||
char const grp_size = grouping[group];
|
||||
last_grp_size = grp_size <= 0 ? CHAR_MAX : grp_size;
|
||||
++group;
|
||||
if(group < grouping_size)
|
||||
{
|
||||
char const grp_size = grouping[group];
|
||||
last_grp_size = grp_size <= 0 ? CHAR_MAX : grp_size;
|
||||
}
|
||||
|
||||
left = last_grp_size;
|
||||
--finish;
|
||||
Traits::assign(*finish, thousands_sep);
|
||||
}
|
||||
|
||||
left = last_grp_size;
|
||||
--left;
|
||||
|
||||
--finish;
|
||||
Traits::assign(*finish, thousands_sep);
|
||||
}
|
||||
int_type const digit = static_cast<int_type>(n % 10U);
|
||||
Traits::assign(*finish, Traits::to_char_type(zero + digit));
|
||||
n /= 10;
|
||||
} while(n);
|
||||
|
||||
--left;
|
||||
} else
|
||||
#endif
|
||||
|
||||
--finish;
|
||||
int_type const digit = static_cast<int_type>(n % 10U);
|
||||
Traits::assign(*finish, Traits::to_char_type(zero + digit));
|
||||
n /= 10;
|
||||
} while(n);
|
||||
{
|
||||
do
|
||||
{
|
||||
--finish;
|
||||
int_type const digit = static_cast<int_type>(n % 10U);
|
||||
Traits::assign(*finish, Traits::to_char_type(zero + digit));
|
||||
n /= 10;
|
||||
} while(n);
|
||||
}
|
||||
|
||||
return finish;
|
||||
}
|
||||
}
|
||||
|
||||
namespace detail // lcast_ret_unsigned
|
||||
{
|
||||
template<class Traits, class T, class CharT>
|
||||
inline bool lcast_ret_unsigned(T& value, const CharT* const begin, const CharT* end)
|
||||
{
|
||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed);
|
||||
#endif
|
||||
typedef typename Traits::int_type int_type;
|
||||
CharT const czero = lcast_char_constants<CharT>::zero;
|
||||
--end;
|
||||
value = 0;
|
||||
|
||||
if ( *end < czero || *end >= czero + 10 || begin > end)
|
||||
return false;
|
||||
value = *end - czero;
|
||||
--end;
|
||||
T multiplier = 1;
|
||||
|
||||
#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
|
||||
// TODO: use BOOST_NO_STD_LOCALE
|
||||
std::locale loc;
|
||||
typedef std::numpunct<CharT> numpunct;
|
||||
numpunct const& np = BOOST_USE_FACET(numpunct, loc);
|
||||
std::string const& grouping = np.grouping();
|
||||
std::string::size_type const grouping_size = grouping.size();
|
||||
|
||||
/* According to [22.2.2.1.2] of Programming languages - C++
|
||||
* we MUST check for correct grouping
|
||||
*/
|
||||
if (grouping_size && grouping[0] > 0)
|
||||
{
|
||||
unsigned char current_grouping = 0;
|
||||
CharT const thousands_sep = np.thousands_sep();
|
||||
char remained = grouping[current_grouping] - 1;
|
||||
bool shall_we_return = true;
|
||||
|
||||
for(;end>=begin; --end)
|
||||
{
|
||||
if (remained) {
|
||||
T const new_sub_value = multiplier * 10 * (*end - czero);
|
||||
|
||||
if (*end < czero || *end >= czero + 10
|
||||
/* detecting overflow */
|
||||
|| new_sub_value/10 != multiplier * (*end - czero)
|
||||
|| static_cast<T>((std::numeric_limits<T>::max)()-new_sub_value) < value
|
||||
)
|
||||
return false;
|
||||
|
||||
value += new_sub_value;
|
||||
multiplier *= 10;
|
||||
--remained;
|
||||
} else {
|
||||
if ( !Traits::eq(*end, thousands_sep) ) //|| begin == end ) return false;
|
||||
{
|
||||
/*
|
||||
* According to Programming languages - C++
|
||||
* Digit grouping is checked. That is, the positions of discarded
|
||||
* separators is examined for consistency with
|
||||
* use_facet<numpunct<charT> >(loc ).grouping()
|
||||
*
|
||||
* BUT what if there is no separators at all and grouping()
|
||||
* is not empty? Well, we have no extraced separators, so we
|
||||
* won`t check them for consistency. This will allow us to
|
||||
* work with "C" locale from other locales
|
||||
*/
|
||||
shall_we_return = false;
|
||||
break;
|
||||
} else {
|
||||
if ( begin == end ) return false;
|
||||
if (current_grouping < grouping_size-1 ) ++current_grouping;
|
||||
remained = grouping[current_grouping];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shall_we_return) return true;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
while ( begin <= end )
|
||||
{
|
||||
T const new_sub_value = multiplier * 10 * (*end - czero);
|
||||
|
||||
if (*end < czero || *end >= czero + 10
|
||||
/* detecting overflow */
|
||||
|| new_sub_value/10 != multiplier * (*end - czero)
|
||||
|| static_cast<T>((std::numeric_limits<T>::max)()-new_sub_value) < value
|
||||
)
|
||||
return false;
|
||||
|
||||
value += new_sub_value;
|
||||
multiplier *= 10;
|
||||
--end;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace detail // stream wrapper for handling lexical conversions
|
||||
{
|
||||
template<typename Target, typename Source, typename Traits>
|
||||
@ -728,9 +881,13 @@ namespace boost
|
||||
|
||||
bool operator<<(bool);
|
||||
bool operator<<(char);
|
||||
bool operator<<(unsigned char);
|
||||
bool operator<<(signed char);
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
bool operator<<(wchar_t);
|
||||
#endif
|
||||
bool operator<<(unsigned char const*);
|
||||
bool operator<<(signed char const*);
|
||||
bool operator<<(CharT const*);
|
||||
bool operator<<(short);
|
||||
bool operator<<(int);
|
||||
@ -751,8 +908,178 @@ namespace boost
|
||||
bool operator<<(double);
|
||||
bool operator<<(long double);
|
||||
|
||||
private:
|
||||
|
||||
template <typename Type>
|
||||
bool input_operator_helper_unsigned(Type& output)
|
||||
{
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
CharT const plus = lcast_char_constants<CharT>::plus;
|
||||
bool has_minus = false;
|
||||
|
||||
/* We won`t use `start' any more, so no need in decrementing it after */
|
||||
if ( Traits::eq(minus,*start) )
|
||||
{
|
||||
++start;
|
||||
has_minus = true;
|
||||
} else if ( Traits::eq( plus, *start ) )
|
||||
{
|
||||
++start;
|
||||
}
|
||||
|
||||
bool const succeed = lcast_ret_unsigned<Traits>(output, start, finish);
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( push )
|
||||
// C4146: unary minus operator applied to unsigned type, result still unsigned
|
||||
# pragma warning( disable : 4146 )
|
||||
#elif defined( __BORLANDC__ )
|
||||
# pragma option push -w-8041
|
||||
#endif
|
||||
if (has_minus) output = static_cast<Type>(-output);
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( pop )
|
||||
#elif defined( __BORLANDC__ )
|
||||
# pragma option pop
|
||||
#endif
|
||||
return succeed;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
bool input_operator_helper_signed(Type& output)
|
||||
{
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
CharT const plus = lcast_char_constants<CharT>::plus;
|
||||
typedef BOOST_DEDUCED_TYPENAME make_unsigned<Type>::type utype;
|
||||
utype out_tmp =0;
|
||||
bool has_minus = false;
|
||||
|
||||
/* We won`t use `start' any more, so no need in decrementing it after */
|
||||
if ( Traits::eq(minus,*start) )
|
||||
{
|
||||
++start;
|
||||
has_minus = true;
|
||||
} else if ( Traits::eq(plus, *start) )
|
||||
{
|
||||
++start;
|
||||
}
|
||||
|
||||
bool succeed = lcast_ret_unsigned<Traits>(out_tmp, start, finish);
|
||||
if (has_minus) {
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( push )
|
||||
// C4146: unary minus operator applied to unsigned type, result still unsigned
|
||||
# pragma warning( disable : 4146 )
|
||||
#elif defined( __BORLANDC__ )
|
||||
# pragma option push -w-8041
|
||||
#endif
|
||||
utype const comp_val = static_cast<utype>(-(std::numeric_limits<Type>::min)());
|
||||
succeed = succeed && out_tmp<=comp_val;
|
||||
output = -out_tmp;
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( pop )
|
||||
#elif defined( __BORLANDC__ )
|
||||
# pragma option pop
|
||||
#endif
|
||||
} else {
|
||||
utype const comp_val = static_cast<utype>((std::numeric_limits<Type>::max)());
|
||||
succeed = succeed && out_tmp<=comp_val;
|
||||
output = out_tmp;
|
||||
}
|
||||
return succeed;
|
||||
}
|
||||
|
||||
public: // input
|
||||
|
||||
bool operator>>(unsigned short& output)
|
||||
{
|
||||
return input_operator_helper_unsigned(output);
|
||||
}
|
||||
|
||||
bool operator>>(unsigned int& output)
|
||||
{
|
||||
return input_operator_helper_unsigned(output);
|
||||
}
|
||||
|
||||
bool operator>>(unsigned long int& output)
|
||||
{
|
||||
return input_operator_helper_unsigned(output);
|
||||
}
|
||||
|
||||
bool operator>>(short& output)
|
||||
{
|
||||
return input_operator_helper_signed(output);
|
||||
}
|
||||
|
||||
bool operator>>(int& output)
|
||||
{
|
||||
return input_operator_helper_signed(output);
|
||||
}
|
||||
|
||||
bool operator>>(long int& output)
|
||||
{
|
||||
return input_operator_helper_signed(output);
|
||||
}
|
||||
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
bool operator>>( boost::ulong_long_type& output)
|
||||
{
|
||||
return input_operator_helper_unsigned(output);
|
||||
}
|
||||
|
||||
bool operator>>(boost::long_long_type& output)
|
||||
{
|
||||
return input_operator_helper_signed(output);
|
||||
}
|
||||
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
bool operator>>(unsigned __int64& output)
|
||||
{
|
||||
return input_operator_helper_unsigned(output);
|
||||
}
|
||||
|
||||
bool operator>>(__int64& output)
|
||||
{
|
||||
return input_operator_helper_signed(output);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* case "-0" || "0" || "+0" : output = false; return true;
|
||||
* case "1" || "+1": output = true; return true;
|
||||
* default: return false;
|
||||
*/
|
||||
bool operator>>(bool& output)
|
||||
{
|
||||
CharT const zero = lcast_char_constants<CharT>::zero;
|
||||
CharT const plus = lcast_char_constants<CharT>::plus;
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
|
||||
switch(finish-start)
|
||||
{
|
||||
case 1:
|
||||
output = Traits::eq(start[0], zero+1);
|
||||
return output || Traits::eq(start[0], zero );
|
||||
case 2:
|
||||
if ( Traits::eq( plus, *start) )
|
||||
{
|
||||
++start;
|
||||
output = Traits::eq(start[0], zero +1);
|
||||
return output || Traits::eq(start[0], zero );
|
||||
} else
|
||||
{
|
||||
output = false;
|
||||
return Traits::eq( minus, *start)
|
||||
&& Traits::eq( zero, start[1]);
|
||||
}
|
||||
default:
|
||||
output = false; // Suppress warning about uninitalized variable
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Generic istream-based algorithm.
|
||||
// lcast_streambuf_for_target<InputStreamable>::value is true.
|
||||
template<typename InputStreamable>
|
||||
@ -787,6 +1114,8 @@ namespace boost
|
||||
}
|
||||
|
||||
bool operator>>(CharT&);
|
||||
bool operator>>(unsigned char&);
|
||||
bool operator>>(signed char&);
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
// This #if is in sync with lcast_streambuf_for_target
|
||||
@ -828,6 +1157,34 @@ namespace boost
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
unsigned char ch)
|
||||
{
|
||||
return ((*this) << static_cast<char>(ch));
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
signed char ch)
|
||||
{
|
||||
return ((*this) << static_cast<char>(ch));
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
unsigned char const* ch)
|
||||
{
|
||||
return ((*this) << reinterpret_cast<char const*>(ch));
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
signed char const* ch)
|
||||
{
|
||||
return ((*this) << reinterpret_cast<char const*>(ch));
|
||||
}
|
||||
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||
@ -993,6 +1350,34 @@ namespace boost
|
||||
return ok;
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
||||
unsigned char& output)
|
||||
{
|
||||
BOOST_STATIC_ASSERT( sizeof(CharT) == sizeof(unsigned char) );
|
||||
bool const ok = (finish - start == 1);
|
||||
if(ok) {
|
||||
CharT out;
|
||||
Traits::assign(out, *start);
|
||||
output = static_cast<signed char>(out);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
||||
signed char& output)
|
||||
{
|
||||
BOOST_STATIC_ASSERT( sizeof(CharT) == sizeof(signed char) );
|
||||
bool const ok = (finish - start == 1);
|
||||
if(ok) {
|
||||
CharT out;
|
||||
Traits::assign(out, *start);
|
||||
output = static_cast<signed char>(out);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template<typename CharT, class Base, class Traits>
|
||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
||||
@ -1048,23 +1433,13 @@ namespace boost
|
||||
template<class Target>
|
||||
struct lcast_streambuf_for_target
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(
|
||||
::boost::type_traits::ice_not< is_integral<Target>::value >::value
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct lcast_streambuf_for_target<char>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
template<>
|
||||
struct lcast_streambuf_for_target<wchar_t>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template<class Traits, class Alloc>
|
||||
struct lcast_streambuf_for_target<
|
||||
@ -1120,6 +1495,7 @@ namespace boost
|
||||
# pragma warning( push )
|
||||
# pragma warning( disable : 4701 ) // possible use of ... before initialization
|
||||
# pragma warning( disable : 4702 ) // unreachable code
|
||||
# pragma warning( disable : 4267 ) // conversion from 'size_t' to 'unsigned int'
|
||||
#endif
|
||||
|
||||
template< typename Target
|
||||
@ -1149,29 +1525,292 @@ namespace boost
|
||||
|
||||
Target result;
|
||||
if(!(interpreter << arg && interpreter >> result))
|
||||
BOOST_LCAST_THROW_BAD_CAST(Source, Target);
|
||||
BOOST_LCAST_THROW_BAD_CAST(Source, Target);
|
||||
return result;
|
||||
}
|
||||
#if (defined _MSC_VER)
|
||||
# pragma warning( pop )
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
struct is_stdstring
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false );
|
||||
};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_stdstring< std::basic_string<CharT, Traits, Alloc> >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true );
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_char_or_wchar
|
||||
{
|
||||
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(
|
||||
::boost::type_traits::ice_or<
|
||||
is_same< T, char >::value,
|
||||
is_same< T, wchar_t >::value,
|
||||
is_same< T, unsigned char >::value,
|
||||
is_same< T, signed char >::value
|
||||
>::value
|
||||
)
|
||||
);
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(
|
||||
::boost::type_traits::ice_or<
|
||||
is_same< T, char >::value,
|
||||
is_same< T, unsigned char >::value,
|
||||
is_same< T, signed char >::value
|
||||
>::value
|
||||
)
|
||||
);
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename Target, typename Source>
|
||||
struct is_arithmetic_and_not_xchars
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(
|
||||
::boost::type_traits::ice_and<
|
||||
is_arithmetic<Source>::value,
|
||||
is_arithmetic<Target>::value,
|
||||
::boost::type_traits::ice_not<
|
||||
detail::is_char_or_wchar<Target>::value
|
||||
>::value,
|
||||
::boost::type_traits::ice_not<
|
||||
detail::is_char_or_wchar<Source>::value
|
||||
>::value
|
||||
>::value
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
/*
|
||||
* is_xchar_to_xchar<Target, Source>::value is true, when
|
||||
* Target and Souce are the same char types, or when
|
||||
* Target and Souce are char types of the same size.
|
||||
*/
|
||||
template<typename Target, typename Source>
|
||||
struct is_xchar_to_xchar
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(
|
||||
::boost::type_traits::ice_or<
|
||||
::boost::type_traits::ice_and<
|
||||
is_same<Source,Target>::value,
|
||||
is_char_or_wchar<Target>::value
|
||||
>::value,
|
||||
::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_eq< sizeof(char),sizeof(Target)>::value,
|
||||
::boost::type_traits::ice_eq< sizeof(char),sizeof(Source)>::value,
|
||||
is_char_or_wchar<Target>::value,
|
||||
is_char_or_wchar<Source>::value
|
||||
>::value
|
||||
>::value
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
template<typename Target, typename Source>
|
||||
struct is_char_array_to_stdstring
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false );
|
||||
};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, CharT* >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true );
|
||||
};
|
||||
|
||||
template<typename CharT, typename Traits, typename Alloc>
|
||||
struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, const CharT* >
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true );
|
||||
};
|
||||
|
||||
template<typename Target, typename Source>
|
||||
struct lexical_cast_do_cast
|
||||
{
|
||||
static inline Target lexical_cast_impl(const Source &arg)
|
||||
{
|
||||
typedef typename detail::array_to_pointer_decay<Source>::type src;
|
||||
|
||||
typedef typename detail::widest_char<
|
||||
typename detail::stream_char<Target>::type
|
||||
, typename detail::stream_char<src>::type
|
||||
>::type char_type;
|
||||
|
||||
typedef detail::lcast_src_length<char_type, src> lcast_src_length;
|
||||
std::size_t const src_len = lcast_src_length::value;
|
||||
char_type buf[src_len + 1];
|
||||
lcast_src_length::check_coverage();
|
||||
return detail::lexical_cast<Target, src, !src_len>(arg, buf, src_len);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Source>
|
||||
struct lexical_cast_copy
|
||||
{
|
||||
static inline Source lexical_cast_impl(const Source &arg)
|
||||
{
|
||||
return arg;
|
||||
}
|
||||
};
|
||||
|
||||
class precision_loss_error : public boost::numeric::bad_numeric_cast
|
||||
{
|
||||
public:
|
||||
virtual const char * what() const throw()
|
||||
{ return "bad numeric conversion: precision loss error"; }
|
||||
};
|
||||
|
||||
template<class S >
|
||||
struct throw_on_precision_loss
|
||||
{
|
||||
typedef boost::numeric::Trunc<S> Rounder;
|
||||
typedef S source_type ;
|
||||
|
||||
typedef typename mpl::if_< is_arithmetic<S>,S,S const&>::type argument_type ;
|
||||
|
||||
static source_type nearbyint ( argument_type s )
|
||||
{
|
||||
source_type orig_div_round = s / Rounder::nearbyint(s);
|
||||
|
||||
if ( (orig_div_round > 1 ? orig_div_round - 1 : 1 - orig_div_round) > std::numeric_limits<source_type>::epsilon() )
|
||||
BOOST_THROW_EXCEPTION( precision_loss_error() );
|
||||
return s ;
|
||||
}
|
||||
|
||||
typedef typename Rounder::round_style round_style;
|
||||
} ;
|
||||
|
||||
template<typename Target, typename Source>
|
||||
struct lexical_cast_dynamic_num_not_ignoring_minus
|
||||
{
|
||||
static inline Target lexical_cast_impl(const Source &arg)
|
||||
{
|
||||
try{
|
||||
typedef boost::numeric::converter<
|
||||
Target,
|
||||
Source,
|
||||
boost::numeric::conversion_traits<Target,Source>,
|
||||
boost::numeric::def_overflow_handler,
|
||||
throw_on_precision_loss<Source>
|
||||
> Converter ;
|
||||
|
||||
return Converter::convert(arg);
|
||||
} catch( ::boost::numeric::bad_numeric_cast const& ) {
|
||||
BOOST_LCAST_THROW_BAD_CAST(Source, Target);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Target, typename Source>
|
||||
struct lexical_cast_dynamic_num_ignoring_minus
|
||||
{
|
||||
static inline Target lexical_cast_impl(const Source &arg)
|
||||
{
|
||||
try{
|
||||
typedef boost::numeric::converter<
|
||||
Target,
|
||||
Source,
|
||||
boost::numeric::conversion_traits<Target,Source>,
|
||||
boost::numeric::def_overflow_handler,
|
||||
throw_on_precision_loss<Source>
|
||||
> Converter ;
|
||||
|
||||
bool has_minus = ( arg < 0);
|
||||
if ( has_minus ) {
|
||||
return static_cast<Target>(-Converter::convert(-arg));
|
||||
} else {
|
||||
return Converter::convert(arg);
|
||||
}
|
||||
} catch( ::boost::numeric::bad_numeric_cast const& ) {
|
||||
BOOST_LCAST_THROW_BAD_CAST(Source, Target);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* lexical_cast_dynamic_num follows the rules:
|
||||
* 1) If Source can be converted to Target without precision loss and
|
||||
* without overflows, then assign Source to Target and return
|
||||
*
|
||||
* 2) If Source is less than 0 and Target is an unsigned integer,
|
||||
* then negate Source, check the requirements of rule 1) and if
|
||||
* successful, assign static_casted Source to Target and return
|
||||
*
|
||||
* 3) Otherwise throw a bad_lexical_cast exception
|
||||
*
|
||||
*
|
||||
* Rule 2) required because boost::lexical_cast has the behavior of
|
||||
* stringstream, which uses the rules of scanf for conversions. And
|
||||
* in the C99 standard for unsigned input value minus sign is
|
||||
* optional, so if a negative number is read, no errors will arise
|
||||
* and the result will be the two's complement.
|
||||
*/
|
||||
template<typename Target, typename Source>
|
||||
struct lexical_cast_dynamic_num
|
||||
{
|
||||
static inline Target lexical_cast_impl(const Source &arg)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c<
|
||||
::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_or<
|
||||
::boost::is_signed<Source>::value,
|
||||
::boost::is_float<Source>::value
|
||||
>::value,
|
||||
::boost::type_traits::ice_not<
|
||||
is_same<Source, bool>::value
|
||||
>::value,
|
||||
::boost::type_traits::ice_not<
|
||||
is_same<Target, bool>::value
|
||||
>::value,
|
||||
::boost::is_unsigned<Target>::value
|
||||
>::value,
|
||||
lexical_cast_dynamic_num_ignoring_minus<Target, Source>,
|
||||
lexical_cast_dynamic_num_not_ignoring_minus<Target, Source>
|
||||
>::type caster_type;
|
||||
|
||||
return caster_type::lexical_cast_impl(arg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template<typename Target, typename Source>
|
||||
inline Target lexical_cast(const Source &arg)
|
||||
{
|
||||
typedef typename detail::array_to_pointer_decay<Source>::type src;
|
||||
typedef BOOST_DEDUCED_TYPENAME detail::array_to_pointer_decay<Source>::type src;
|
||||
|
||||
typedef typename detail::widest_char<
|
||||
typename detail::stream_char<Target>::type
|
||||
, typename detail::stream_char<src>::type
|
||||
>::type char_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME ::boost::type_traits::ice_or<
|
||||
detail::is_xchar_to_xchar<Target, src>::value,
|
||||
detail::is_char_array_to_stdstring<Target,src>::value,
|
||||
::boost::type_traits::ice_and<
|
||||
is_same<Target, src>::value,
|
||||
detail::is_stdstring<Target>::value
|
||||
>::value
|
||||
> do_copy_type;
|
||||
|
||||
typedef detail::lcast_src_length<char_type, src> lcast_src_length;
|
||||
std::size_t const src_len = lcast_src_length::value;
|
||||
char_type buf[src_len + 1];
|
||||
lcast_src_length::check_coverage();
|
||||
return detail::lexical_cast<Target, src, !src_len>(arg, buf, src_len);
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
detail::is_arithmetic_and_not_xchars<Target, src> do_copy_with_dynamic_check_type;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c<
|
||||
do_copy_type::value,
|
||||
detail::lexical_cast_copy<src>,
|
||||
BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c<
|
||||
do_copy_with_dynamic_check_type::value,
|
||||
detail::lexical_cast_dynamic_num<Target, src>,
|
||||
detail::lexical_cast_do_cast<Target, src>
|
||||
>::type
|
||||
>::type caster_type;
|
||||
|
||||
return caster_type::lexical_cast_impl(arg);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -1191,11 +1830,7 @@ namespace boost
|
||||
Target result;
|
||||
|
||||
if(!(interpreter << arg && interpreter >> result))
|
||||
#ifndef BOOST_NO_TYPEID
|
||||
throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
|
||||
#else
|
||||
throw_exception(bad_lexical_cast());
|
||||
#endif
|
||||
BOOST_LCAST_THROW_BAD_CAST(Source, Target);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1203,7 +1838,8 @@ namespace boost
|
||||
}
|
||||
|
||||
// Copyright Kevlin Henney, 2000-2005.
|
||||
// Copyright Alexander Nasonov, 2006-2007.
|
||||
// Copyright Alexander Nasonov, 2006-2010.
|
||||
// Copyright Antony Polukhin, 2011.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
|
17
boost/boost/make_shared.hpp
Normal file
17
boost/boost/make_shared.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef BOOST_MAKE_SHARED_HPP_INCLUDED
|
||||
#define BOOST_MAKE_SHARED_HPP_INCLUDED
|
||||
|
||||
// make_shared.hpp
|
||||
//
|
||||
// Copyright (c) 2007, 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://www.boost.org/libs/smart_ptr/make_shared.html
|
||||
// for documentation.
|
||||
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
|
||||
#endif // #ifndef BOOST_MAKE_SHARED_HPP_INCLUDED
|
@ -20,7 +20,7 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
none_t const none = ((none_t)0) ;
|
||||
none_t const none = (static_cast<none_t>(0)) ;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
24
boost/boost/numeric/conversion/bounds.hpp
Normal file
24
boost/boost/numeric/conversion/bounds.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_BOUNDS_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_BOUNDS_12NOV2002_HPP
|
||||
|
||||
#include "boost/numeric/conversion/detail/bounds.hpp"
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
|
||||
template<class N>
|
||||
struct bounds : boundsdetail::get_impl<N>::type
|
||||
{} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
51
boost/boost/numeric/conversion/cast.hpp
Normal file
51
boost/boost/numeric/conversion/cast.hpp
Normal file
@ -0,0 +1,51 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
//
|
||||
// Revision History
|
||||
//
|
||||
// 19 Nov 2001 Syntatic changes as suggested by Darin Adler (Fernando Cacciola)
|
||||
// 08 Nov 2001 Fixes to accommodate MSVC (Fernando Cacciola)
|
||||
// 04 Nov 2001 Fixes to accommodate gcc2.92 (Fernando Cacciola)
|
||||
// 30 Oct 2001 Some fixes suggested by Daryle Walker (Fernando Cacciola)
|
||||
// 25 Oct 2001 Initial boostification (Fernando Cacciola)
|
||||
// 23 Jan 2004 Inital add to cvs (post review)s
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
|
||||
|
||||
# include<boost/numeric/conversion/detail/old_numeric_cast.hpp>
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type.hpp>
|
||||
#include <boost/numeric/conversion/converter.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<typename Target, typename Source>
|
||||
inline
|
||||
Target numeric_cast ( Source arg )
|
||||
{
|
||||
typedef boost::numeric::converter<Target,Source> Converter ;
|
||||
return Converter::convert(arg);
|
||||
}
|
||||
|
||||
using numeric::bad_numeric_cast;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
39
boost/boost/numeric/conversion/conversion_traits.hpp
Normal file
39
boost/boost/numeric/conversion/conversion_traits.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_CONVERSION_TRAITS_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_CONVERSION_TRAITS_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/numeric/conversion/detail/conversion_traits.hpp"
|
||||
#include "boost/detail/workaround.hpp"
|
||||
#include "boost/config.hpp"
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
|
||||
template<class T, class S>
|
||||
struct conversion_traits
|
||||
: convdetail::get_conversion_traits<T,S>::type
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
typedef typename convdetail::get_conversion_traits<T,S>::type base_;
|
||||
typedef typename base_::target_type target_type;
|
||||
typedef typename base_::source_type source_type;
|
||||
typedef typename base_::result_type result_type;
|
||||
typedef typename base_::argument_type argument_type;
|
||||
#endif
|
||||
} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
68
boost/boost/numeric/conversion/converter.hpp
Normal file
68
boost/boost/numeric/conversion/converter.hpp
Normal file
@ -0,0 +1,68 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_CONVERTER_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_CONVERTER_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/numeric/conversion/conversion_traits.hpp"
|
||||
#include "boost/numeric/conversion/converter_policies.hpp"
|
||||
|
||||
#include "boost/numeric/conversion/detail/converter.hpp"
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
|
||||
template<class T,
|
||||
class S,
|
||||
class Traits = conversion_traits<T,S>,
|
||||
class OverflowHandler = def_overflow_handler,
|
||||
class Float2IntRounder = Trunc< BOOST_DEDUCED_TYPENAME Traits::source_type> ,
|
||||
class RawConverter = raw_converter<Traits>,
|
||||
class UserRangeChecker = UseInternalRangeChecker
|
||||
>
|
||||
struct converter : convdetail::get_converter_impl<Traits,
|
||||
OverflowHandler,
|
||||
Float2IntRounder,
|
||||
RawConverter,
|
||||
UserRangeChecker
|
||||
>::type
|
||||
{
|
||||
typedef Traits traits ;
|
||||
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
typedef typename Traits::result_type result_type ;
|
||||
|
||||
result_type operator() ( argument_type s ) const { return this->convert(s) ; }
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
template<class S,
|
||||
class OverflowHandler = def_overflow_handler,
|
||||
class Float2IntRounder = Trunc<S> ,
|
||||
class UserRangeChecker = UseInternalRangeChecker
|
||||
>
|
||||
struct make_converter_from
|
||||
{
|
||||
template<class T,
|
||||
class Traits = conversion_traits<T,S>,
|
||||
class RawConverter = raw_converter<Traits>
|
||||
>
|
||||
struct to
|
||||
{
|
||||
typedef converter<T,S,Traits,OverflowHandler,Float2IntRounder,RawConverter,UserRangeChecker> type ;
|
||||
} ;
|
||||
|
||||
} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
|
||||
|
186
boost/boost/numeric/conversion/converter_policies.hpp
Normal file
186
boost/boost/numeric/conversion/converter_policies.hpp
Normal file
@ -0,0 +1,186 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_CONVERTER_POLICIES_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_CONVERTER_POLICIES_FLC_12NOV2002_HPP
|
||||
|
||||
#include <typeinfo> // for std::bad_cast
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp> // for std::floor and std::ceil
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "boost/type_traits/is_arithmetic.hpp"
|
||||
|
||||
#include "boost/mpl/if.hpp"
|
||||
#include "boost/mpl/integral_c.hpp"
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
|
||||
template<class S>
|
||||
struct Trunc
|
||||
{
|
||||
typedef S source_type ;
|
||||
|
||||
typedef typename mpl::if_< is_arithmetic<S>,S,S const&>::type argument_type ;
|
||||
|
||||
static source_type nearbyint ( argument_type s )
|
||||
{
|
||||
#if !defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using std::floor ;
|
||||
using std::ceil ;
|
||||
#endif
|
||||
|
||||
return s < static_cast<S>(0) ? ceil(s) : floor(s) ;
|
||||
}
|
||||
|
||||
typedef mpl::integral_c< std::float_round_style, std::round_toward_zero> round_style ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
template<class S>
|
||||
struct Floor
|
||||
{
|
||||
typedef S source_type ;
|
||||
|
||||
typedef typename mpl::if_< is_arithmetic<S>,S,S const&>::type argument_type ;
|
||||
|
||||
static source_type nearbyint ( argument_type s )
|
||||
{
|
||||
#if !defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using std::floor ;
|
||||
#endif
|
||||
|
||||
return floor(s) ;
|
||||
}
|
||||
|
||||
typedef mpl::integral_c< std::float_round_style, std::round_toward_neg_infinity> round_style ;
|
||||
} ;
|
||||
|
||||
template<class S>
|
||||
struct Ceil
|
||||
{
|
||||
typedef S source_type ;
|
||||
|
||||
typedef typename mpl::if_< is_arithmetic<S>,S,S const&>::type argument_type ;
|
||||
|
||||
static source_type nearbyint ( argument_type s )
|
||||
{
|
||||
#if !defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using std::ceil ;
|
||||
#endif
|
||||
|
||||
return ceil(s) ;
|
||||
}
|
||||
|
||||
typedef mpl::integral_c< std::float_round_style, std::round_toward_infinity> round_style ;
|
||||
} ;
|
||||
|
||||
template<class S>
|
||||
struct RoundEven
|
||||
{
|
||||
typedef S source_type ;
|
||||
|
||||
typedef typename mpl::if_< is_arithmetic<S>,S,S const&>::type argument_type ;
|
||||
|
||||
static source_type nearbyint ( argument_type s )
|
||||
{
|
||||
// Algorithm contributed by Guillaume Melquiond
|
||||
|
||||
#if !defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using std::floor ;
|
||||
using std::ceil ;
|
||||
#endif
|
||||
|
||||
// only works inside the range not at the boundaries
|
||||
S prev = floor(s);
|
||||
S next = ceil(s);
|
||||
|
||||
S rt = (s - prev) - (next - s); // remainder type
|
||||
|
||||
S const zero(0.0);
|
||||
S const two(2.0);
|
||||
|
||||
if ( rt < zero )
|
||||
return prev;
|
||||
else if ( rt > zero )
|
||||
return next;
|
||||
else
|
||||
{
|
||||
bool is_prev_even = two * floor(prev / two) == prev ;
|
||||
return ( is_prev_even ? prev : next ) ;
|
||||
}
|
||||
}
|
||||
|
||||
typedef mpl::integral_c< std::float_round_style, std::round_to_nearest> round_style ;
|
||||
} ;
|
||||
|
||||
|
||||
enum range_check_result
|
||||
{
|
||||
cInRange = 0 ,
|
||||
cNegOverflow = 1 ,
|
||||
cPosOverflow = 2
|
||||
} ;
|
||||
|
||||
class bad_numeric_cast : public std::bad_cast
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char * what() const throw()
|
||||
{ return "bad numeric conversion: overflow"; }
|
||||
};
|
||||
|
||||
class negative_overflow : public bad_numeric_cast
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char * what() const throw()
|
||||
{ return "bad numeric conversion: negative overflow"; }
|
||||
};
|
||||
class positive_overflow : public bad_numeric_cast
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char * what() const throw()
|
||||
{ return "bad numeric conversion: positive overflow"; }
|
||||
};
|
||||
|
||||
struct def_overflow_handler
|
||||
{
|
||||
void operator() ( range_check_result r ) // throw(negative_overflow,positive_overflow)
|
||||
{
|
||||
if ( r == cNegOverflow )
|
||||
throw negative_overflow() ;
|
||||
else if ( r == cPosOverflow )
|
||||
throw positive_overflow() ;
|
||||
}
|
||||
} ;
|
||||
|
||||
struct silent_overflow_handler
|
||||
{
|
||||
void operator() ( range_check_result ) {} // throw()
|
||||
} ;
|
||||
|
||||
template<class Traits>
|
||||
struct raw_converter
|
||||
{
|
||||
typedef typename Traits::result_type result_type ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static result_type low_level_convert ( argument_type s ) { return static_cast<result_type>(s) ; }
|
||||
} ;
|
||||
|
||||
struct UseInternalRangeChecker {} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
58
boost/boost/numeric/conversion/detail/bounds.hpp
Normal file
58
boost/boost/numeric/conversion/detail/bounds.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/limits.hpp"
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/mpl/if.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace boundsdetail
|
||||
{
|
||||
template<class N>
|
||||
class Integral
|
||||
{
|
||||
typedef std::numeric_limits<N> limits ;
|
||||
|
||||
public :
|
||||
|
||||
static N lowest () { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
|
||||
static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
|
||||
static N smallest() { return static_cast<N>(1); }
|
||||
} ;
|
||||
|
||||
template<class N>
|
||||
class Float
|
||||
{
|
||||
typedef std::numeric_limits<N> limits ;
|
||||
|
||||
public :
|
||||
|
||||
static N lowest () { return static_cast<N>(-limits::max BOOST_PREVENT_MACRO_SUBSTITUTION ()) ; }
|
||||
static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
|
||||
static N smallest() { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
|
||||
} ;
|
||||
|
||||
template<class N>
|
||||
struct get_impl
|
||||
{
|
||||
typedef mpl::bool_< ::std::numeric_limits<N>::is_integer > is_int ;
|
||||
|
||||
typedef Integral<N> impl_int ;
|
||||
typedef Float <N> impl_float ;
|
||||
|
||||
typedef typename mpl::if_<is_int,impl_int,impl_float>::type type ;
|
||||
} ;
|
||||
|
||||
} } } // namespace boost::numeric::boundsdetail.
|
||||
|
||||
#endif
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
97
boost/boost/numeric/conversion/detail/conversion_traits.hpp
Normal file
97
boost/boost/numeric/conversion/detail/conversion_traits.hpp
Normal file
@ -0,0 +1,97 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/type_traits/is_arithmetic.hpp"
|
||||
#include "boost/type_traits/is_same.hpp"
|
||||
#include "boost/type_traits/remove_cv.hpp"
|
||||
|
||||
#include "boost/numeric/conversion/detail/meta.hpp"
|
||||
#include "boost/numeric/conversion/detail/int_float_mixture.hpp"
|
||||
#include "boost/numeric/conversion/detail/sign_mixture.hpp"
|
||||
#include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp"
|
||||
#include "boost/numeric/conversion/detail/is_subranged.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Implementation of the Conversion Traits for T != S
|
||||
//
|
||||
// This is a VISIBLE base class of the user-level conversion_traits<> class.
|
||||
//-------------------------------------------------------------------
|
||||
template<class T,class S>
|
||||
struct non_trivial_traits_impl
|
||||
{
|
||||
typedef typename get_int_float_mixture <T,S>::type int_float_mixture ;
|
||||
typedef typename get_sign_mixture <T,S>::type sign_mixture ;
|
||||
typedef typename get_udt_builtin_mixture <T,S>::type udt_builtin_mixture ;
|
||||
|
||||
typedef typename get_is_subranged<T,S>::type subranged ;
|
||||
|
||||
typedef mpl::false_ trivial ;
|
||||
|
||||
typedef T target_type ;
|
||||
typedef S source_type ;
|
||||
typedef T result_type ;
|
||||
|
||||
typedef typename mpl::if_< is_arithmetic<S>, S, S const&>::type argument_type ;
|
||||
|
||||
typedef typename mpl::if_<subranged,S,T>::type supertype ;
|
||||
typedef typename mpl::if_<subranged,T,S>::type subtype ;
|
||||
} ;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Implementation of the Conversion Traits for T == S
|
||||
//
|
||||
// This is a VISIBLE base class of the user-level conversion_traits<> class.
|
||||
//-------------------------------------------------------------------
|
||||
template<class N>
|
||||
struct trivial_traits_impl
|
||||
{
|
||||
typedef typename get_int_float_mixture <N,N>::type int_float_mixture ;
|
||||
typedef typename get_sign_mixture <N,N>::type sign_mixture ;
|
||||
typedef typename get_udt_builtin_mixture<N,N>::type udt_builtin_mixture ;
|
||||
|
||||
typedef mpl::false_ subranged ;
|
||||
typedef mpl::true_ trivial ;
|
||||
|
||||
typedef N target_type ;
|
||||
typedef N source_type ;
|
||||
typedef N const& result_type ;
|
||||
typedef N const& argument_type ;
|
||||
|
||||
typedef N supertype ;
|
||||
typedef N subtype ;
|
||||
|
||||
} ;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Top level implementation selector.
|
||||
//-------------------------------------------------------------------
|
||||
template<class T, class S>
|
||||
struct get_conversion_traits
|
||||
{
|
||||
typedef typename remove_cv<T>::type target_type ;
|
||||
typedef typename remove_cv<S>::type source_type ;
|
||||
|
||||
typedef typename is_same<target_type,source_type>::type is_trivial ;
|
||||
|
||||
typedef trivial_traits_impl <target_type> trivial_imp ;
|
||||
typedef non_trivial_traits_impl<target_type,source_type> non_trivial_imp ;
|
||||
|
||||
typedef typename mpl::if_<is_trivial,trivial_imp,non_trivial_imp>::type type ;
|
||||
} ;
|
||||
|
||||
} } } // namespace boost::numeric::convdetail
|
||||
|
||||
#endif
|
||||
|
||||
|
602
boost/boost/numeric/conversion/detail/converter.hpp
Normal file
602
boost/boost/numeric/conversion/detail/converter.hpp
Normal file
@ -0,0 +1,602 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_CONVERTER_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERTER_FLC_12NOV2002_HPP
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "boost/numeric/conversion/detail/meta.hpp"
|
||||
#include "boost/numeric/conversion/detail/conversion_traits.hpp"
|
||||
#include "boost/numeric/conversion/bounds.hpp"
|
||||
|
||||
#include "boost/type_traits/is_same.hpp"
|
||||
|
||||
#include "boost/mpl/integral_c.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
// Integral Constants representing rounding modes
|
||||
typedef mpl::integral_c<std::float_round_style, std::round_toward_zero> round2zero_c ;
|
||||
typedef mpl::integral_c<std::float_round_style, std::round_to_nearest> round2nearest_c ;
|
||||
typedef mpl::integral_c<std::float_round_style, std::round_toward_infinity> round2inf_c ;
|
||||
typedef mpl::integral_c<std::float_round_style, std::round_toward_neg_infinity> round2neg_inf_c ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
// for_round_style<RoundStyle,RoundToZero,RoundToNearest,RoundToInf,RoundToNegInf>::type
|
||||
//
|
||||
// {RoundStyle} Integral Constant specifying a round style as declared above.
|
||||
// {RoundToZero,RoundToNearest,RoundToInf,RoundToNegInf} arbitrary types.
|
||||
//
|
||||
// Selects one of the 4 types according to the value of RoundStyle.
|
||||
//
|
||||
template<class RoundStyle,class RoundToZero,class RoundToNearest,class RoundToInf,class RoundToNegInf>
|
||||
struct for_round_style
|
||||
{
|
||||
typedef ct_switch4<RoundStyle
|
||||
, round2zero_c, round2nearest_c, round2inf_c // round2neg_inf_c
|
||||
, RoundToZero , RoundToNearest , RoundToInf , RoundToNegInf
|
||||
> selector ;
|
||||
|
||||
typedef typename selector::type type ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Range Checking Logic.
|
||||
//
|
||||
// The range checking logic is built up by combining 1 or 2 predicates.
|
||||
// Each predicate is encapsulated in a template class and exposes
|
||||
// the static member function 'apply'.
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Because a particular logic can combine either 1 or two predicates, the following
|
||||
// tags are used to allow the predicate applier to receive 2 preds, but optimize away
|
||||
// one of them if it is 'non-applicable'
|
||||
struct non_applicable { typedef mpl::false_ do_apply ; } ;
|
||||
struct applicable { typedef mpl::true_ do_apply ; } ;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Range Checking Logic implementations.
|
||||
//
|
||||
// The following classes, collectivelly named 'Predicates', are instantiated within
|
||||
// the corresponding range checkers.
|
||||
// Their static member function 'apply' is called to perform the actual range checking logic.
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// s < Lowest(T) ? cNegOverflow : cInRange
|
||||
//
|
||||
template<class Traits>
|
||||
struct LT_LoT : applicable
|
||||
{
|
||||
typedef typename Traits::target_type T ;
|
||||
typedef typename Traits::source_type S ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static range_check_result apply ( argument_type s )
|
||||
{
|
||||
return s < static_cast<S>(bounds<T>::lowest()) ? cNegOverflow : cInRange ;
|
||||
}
|
||||
} ;
|
||||
|
||||
// s < 0 ? cNegOverflow : cInRange
|
||||
//
|
||||
template<class Traits>
|
||||
struct LT_Zero : applicable
|
||||
{
|
||||
typedef typename Traits::source_type S ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static range_check_result apply ( argument_type s )
|
||||
{
|
||||
return s < static_cast<S>(0) ? cNegOverflow : cInRange ;
|
||||
}
|
||||
} ;
|
||||
|
||||
// s <= Lowest(T)-1 ? cNegOverflow : cInRange
|
||||
//
|
||||
template<class Traits>
|
||||
struct LE_PrevLoT : applicable
|
||||
{
|
||||
typedef typename Traits::target_type T ;
|
||||
typedef typename Traits::source_type S ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static range_check_result apply ( argument_type s )
|
||||
{
|
||||
return s <= static_cast<S>(bounds<T>::lowest()) - static_cast<S>(1.0)
|
||||
? cNegOverflow : cInRange ;
|
||||
}
|
||||
} ;
|
||||
|
||||
// s < Lowest(T)-0.5 ? cNegOverflow : cInRange
|
||||
//
|
||||
template<class Traits>
|
||||
struct LT_HalfPrevLoT : applicable
|
||||
{
|
||||
typedef typename Traits::target_type T ;
|
||||
typedef typename Traits::source_type S ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static range_check_result apply ( argument_type s )
|
||||
{
|
||||
return s < static_cast<S>(bounds<T>::lowest()) - static_cast<S>(0.5)
|
||||
? cNegOverflow : cInRange ;
|
||||
}
|
||||
} ;
|
||||
|
||||
// s > Highest(T) ? cPosOverflow : cInRange
|
||||
//
|
||||
template<class Traits>
|
||||
struct GT_HiT : applicable
|
||||
{
|
||||
typedef typename Traits::target_type T ;
|
||||
typedef typename Traits::source_type S ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static range_check_result apply ( argument_type s )
|
||||
{
|
||||
return s > static_cast<S>(bounds<T>::highest())
|
||||
? cPosOverflow : cInRange ;
|
||||
}
|
||||
} ;
|
||||
|
||||
// s >= Lowest(T) + 1 ? cPosOverflow : cInRange
|
||||
//
|
||||
template<class Traits>
|
||||
struct GE_SuccHiT : applicable
|
||||
{
|
||||
typedef typename Traits::target_type T ;
|
||||
typedef typename Traits::source_type S ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static range_check_result apply ( argument_type s )
|
||||
{
|
||||
return s >= static_cast<S>(bounds<T>::highest()) + static_cast<S>(1.0)
|
||||
? cPosOverflow : cInRange ;
|
||||
}
|
||||
} ;
|
||||
|
||||
// s >= Lowest(T) + 0.5 ? cPosgOverflow : cInRange
|
||||
//
|
||||
template<class Traits>
|
||||
struct GT_HalfSuccHiT : applicable
|
||||
{
|
||||
typedef typename Traits::target_type T ;
|
||||
typedef typename Traits::source_type S ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static range_check_result apply ( argument_type s )
|
||||
{
|
||||
return s >= static_cast<S>(bounds<T>::highest()) + static_cast<S>(0.5)
|
||||
? cPosOverflow : cInRange ;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Predicate Combiner.
|
||||
//
|
||||
// This helper classes are used to possibly combine the range checking logic
|
||||
// individually performed by the predicates
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Applies both predicates: first 'PredA', and if it equals 'cInRange', 'PredB'
|
||||
template<class PredA, class PredB>
|
||||
struct applyBoth
|
||||
{
|
||||
typedef typename PredA::argument_type argument_type ;
|
||||
|
||||
static range_check_result apply ( argument_type s )
|
||||
{
|
||||
range_check_result r = PredA::apply(s) ;
|
||||
if ( r == cInRange )
|
||||
r = PredB::apply(s);
|
||||
return r ;
|
||||
}
|
||||
} ;
|
||||
|
||||
template<class PredA, class PredB>
|
||||
struct combine
|
||||
{
|
||||
typedef applyBoth<PredA,PredB> Both ;
|
||||
typedef void NNone ; // 'None' is defined as a macro in (/usr/X11R6/include/X11/X.h)
|
||||
|
||||
typedef typename PredA::do_apply do_applyA ;
|
||||
typedef typename PredB::do_apply do_applyB ;
|
||||
|
||||
typedef typename for_both<do_applyA, do_applyB, Both, PredA, PredB, NNone>::type type ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Range Checker classes.
|
||||
//
|
||||
// The following classes are VISIBLE base classes of the user-level converter<> class.
|
||||
// They supply the optimized 'out_of_range()' and 'validate_range()' static member functions
|
||||
// visible in the user interface.
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Dummy range checker.
|
||||
template<class Traits>
|
||||
struct dummy_range_checker
|
||||
{
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static range_check_result out_of_range ( argument_type ) { return cInRange ; }
|
||||
static void validate_range ( argument_type ) {}
|
||||
} ;
|
||||
|
||||
// Generic range checker.
|
||||
//
|
||||
// All the range checking logic for all possible combinations of source and target
|
||||
// can be arranged in terms of one or two predicates, which test overflow on both neg/pos 'sides'
|
||||
// of the ranges.
|
||||
//
|
||||
// These predicates are given here as IsNegOverflow and IsPosOverflow.
|
||||
//
|
||||
template<class Traits, class IsNegOverflow, class IsPosOverflow, class OverflowHandler>
|
||||
struct generic_range_checker
|
||||
{
|
||||
typedef OverflowHandler overflow_handler ;
|
||||
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
|
||||
static range_check_result out_of_range ( argument_type s )
|
||||
{
|
||||
typedef typename combine<IsNegOverflow,IsPosOverflow>::type Predicate ;
|
||||
|
||||
return Predicate::apply(s);
|
||||
}
|
||||
|
||||
static void validate_range ( argument_type s )
|
||||
{ OverflowHandler()( out_of_range(s) ) ; }
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Selectors for the optimized Range Checker class.
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template<class Traits,class OverflowHandler>
|
||||
struct GetRC_Sig2Sig_or_Unsig2Unsig
|
||||
{
|
||||
typedef dummy_range_checker<Traits> Dummy ;
|
||||
|
||||
typedef LT_LoT<Traits> Pred1 ;
|
||||
typedef GT_HiT<Traits> Pred2 ;
|
||||
|
||||
typedef generic_range_checker<Traits,Pred1,Pred2,OverflowHandler> Normal ;
|
||||
|
||||
typedef typename Traits::subranged subranged ;
|
||||
|
||||
typedef typename mpl::if_<subranged,Normal,Dummy>::type type ;
|
||||
} ;
|
||||
|
||||
template<class Traits, class OverflowHandler>
|
||||
struct GetRC_Sig2Unsig
|
||||
{
|
||||
typedef LT_Zero<Traits> Pred1 ;
|
||||
typedef GT_HiT <Traits> Pred2 ;
|
||||
|
||||
typedef generic_range_checker<Traits,Pred1,Pred2,OverflowHandler> ChoiceA ;
|
||||
|
||||
typedef generic_range_checker<Traits,Pred1,non_applicable,OverflowHandler> ChoiceB ;
|
||||
|
||||
typedef typename Traits::target_type T ;
|
||||
typedef typename Traits::source_type S ;
|
||||
|
||||
typedef typename subranged_Unsig2Sig<S,T>::type oposite_subranged ;
|
||||
|
||||
typedef typename mpl::not_<oposite_subranged>::type positively_subranged ;
|
||||
|
||||
typedef typename mpl::if_<positively_subranged,ChoiceA,ChoiceB>::type type ;
|
||||
} ;
|
||||
|
||||
template<class Traits, class OverflowHandler>
|
||||
struct GetRC_Unsig2Sig
|
||||
{
|
||||
typedef GT_HiT<Traits> Pred1 ;
|
||||
|
||||
typedef generic_range_checker<Traits,non_applicable,Pred1,OverflowHandler> type ;
|
||||
} ;
|
||||
|
||||
template<class Traits,class OverflowHandler>
|
||||
struct GetRC_Int2Int
|
||||
{
|
||||
typedef GetRC_Sig2Sig_or_Unsig2Unsig<Traits,OverflowHandler> Sig2SigQ ;
|
||||
typedef GetRC_Sig2Unsig <Traits,OverflowHandler> Sig2UnsigQ ;
|
||||
typedef GetRC_Unsig2Sig <Traits,OverflowHandler> Unsig2SigQ ;
|
||||
typedef Sig2SigQ Unsig2UnsigQ ;
|
||||
|
||||
typedef typename Traits::sign_mixture sign_mixture ;
|
||||
|
||||
typedef typename
|
||||
for_sign_mixture<sign_mixture,Sig2SigQ,Sig2UnsigQ,Unsig2SigQ,Unsig2UnsigQ>::type
|
||||
selector ;
|
||||
|
||||
typedef typename selector::type type ;
|
||||
} ;
|
||||
|
||||
template<class Traits>
|
||||
struct GetRC_Int2Float
|
||||
{
|
||||
typedef dummy_range_checker<Traits> type ;
|
||||
} ;
|
||||
|
||||
template<class Traits, class OverflowHandler, class Float2IntRounder>
|
||||
struct GetRC_Float2Int
|
||||
{
|
||||
typedef LE_PrevLoT <Traits> Pred1 ;
|
||||
typedef GE_SuccHiT <Traits> Pred2 ;
|
||||
typedef LT_HalfPrevLoT<Traits> Pred3 ;
|
||||
typedef GT_HalfSuccHiT<Traits> Pred4 ;
|
||||
typedef GT_HiT <Traits> Pred5 ;
|
||||
typedef LT_LoT <Traits> Pred6 ;
|
||||
|
||||
typedef generic_range_checker<Traits,Pred1,Pred2,OverflowHandler> ToZero ;
|
||||
typedef generic_range_checker<Traits,Pred3,Pred4,OverflowHandler> ToNearest ;
|
||||
typedef generic_range_checker<Traits,Pred1,Pred5,OverflowHandler> ToInf ;
|
||||
typedef generic_range_checker<Traits,Pred6,Pred2,OverflowHandler> ToNegInf ;
|
||||
|
||||
typedef typename Float2IntRounder::round_style round_style ;
|
||||
|
||||
typedef typename for_round_style<round_style,ToZero,ToNearest,ToInf,ToNegInf>::type type ;
|
||||
} ;
|
||||
|
||||
template<class Traits, class OverflowHandler>
|
||||
struct GetRC_Float2Float
|
||||
{
|
||||
typedef dummy_range_checker<Traits> Dummy ;
|
||||
|
||||
typedef LT_LoT<Traits> Pred1 ;
|
||||
typedef GT_HiT<Traits> Pred2 ;
|
||||
|
||||
typedef generic_range_checker<Traits,Pred1,Pred2,OverflowHandler> Normal ;
|
||||
|
||||
typedef typename Traits::subranged subranged ;
|
||||
|
||||
typedef typename mpl::if_<subranged,Normal,Dummy>::type type ;
|
||||
} ;
|
||||
|
||||
template<class Traits, class OverflowHandler, class Float2IntRounder>
|
||||
struct GetRC_BuiltIn2BuiltIn
|
||||
{
|
||||
typedef GetRC_Int2Int<Traits,OverflowHandler> Int2IntQ ;
|
||||
typedef GetRC_Int2Float<Traits> Int2FloatQ ;
|
||||
typedef GetRC_Float2Int<Traits,OverflowHandler,Float2IntRounder> Float2IntQ ;
|
||||
typedef GetRC_Float2Float<Traits,OverflowHandler> Float2FloatQ ;
|
||||
|
||||
typedef typename Traits::int_float_mixture int_float_mixture ;
|
||||
|
||||
typedef typename for_int_float_mixture<int_float_mixture, Int2IntQ, Int2FloatQ, Float2IntQ, Float2FloatQ>::type selector ;
|
||||
|
||||
typedef typename selector::type type ;
|
||||
} ;
|
||||
|
||||
template<class Traits, class OverflowHandler, class Float2IntRounder>
|
||||
struct GetRC
|
||||
{
|
||||
typedef GetRC_BuiltIn2BuiltIn<Traits,OverflowHandler,Float2IntRounder> BuiltIn2BuiltInQ ;
|
||||
|
||||
typedef dummy_range_checker<Traits> Dummy ;
|
||||
|
||||
typedef mpl::identity<Dummy> DummyQ ;
|
||||
|
||||
typedef typename Traits::udt_builtin_mixture udt_builtin_mixture ;
|
||||
|
||||
typedef typename for_udt_builtin_mixture<udt_builtin_mixture,BuiltIn2BuiltInQ,DummyQ,DummyQ,DummyQ>::type selector ;
|
||||
|
||||
typedef typename selector::type type ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Converter classes.
|
||||
//
|
||||
// The following classes are VISIBLE base classes of the user-level converter<> class.
|
||||
// They supply the optimized 'nearbyint()' and 'convert()' static member functions
|
||||
// visible in the user interface.
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Trivial Converter : used when (cv-unqualified) T == (cv-unqualified) S
|
||||
//
|
||||
template<class Traits>
|
||||
struct trivial_converter_impl : public std::unary_function< BOOST_DEDUCED_TYPENAME Traits::argument_type
|
||||
,BOOST_DEDUCED_TYPENAME Traits::result_type
|
||||
>
|
||||
,public dummy_range_checker<Traits>
|
||||
{
|
||||
typedef Traits traits ;
|
||||
|
||||
typedef typename Traits::source_type source_type ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
typedef typename Traits::result_type result_type ;
|
||||
|
||||
static result_type low_level_convert ( argument_type s ) { return s ; }
|
||||
static source_type nearbyint ( argument_type s ) { return s ; }
|
||||
static result_type convert ( argument_type s ) { return s ; }
|
||||
} ;
|
||||
|
||||
|
||||
//
|
||||
// Rounding Converter : used for float to integral conversions.
|
||||
//
|
||||
template<class Traits,class RangeChecker,class RawConverter,class Float2IntRounder>
|
||||
struct rounding_converter : public std::unary_function< BOOST_DEDUCED_TYPENAME Traits::argument_type
|
||||
,BOOST_DEDUCED_TYPENAME Traits::result_type
|
||||
>
|
||||
,public RangeChecker
|
||||
,public Float2IntRounder
|
||||
,public RawConverter
|
||||
{
|
||||
typedef RangeChecker RangeCheckerBase ;
|
||||
typedef Float2IntRounder Float2IntRounderBase ;
|
||||
typedef RawConverter RawConverterBase ;
|
||||
|
||||
typedef Traits traits ;
|
||||
|
||||
typedef typename Traits::source_type source_type ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
typedef typename Traits::result_type result_type ;
|
||||
|
||||
static result_type convert ( argument_type s )
|
||||
{
|
||||
RangeCheckerBase::validate_range(s);
|
||||
source_type s1 = Float2IntRounderBase::nearbyint(s);
|
||||
return RawConverterBase::low_level_convert(s1);
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
//
|
||||
// Non-Rounding Converter : used for all other conversions.
|
||||
//
|
||||
template<class Traits,class RangeChecker,class RawConverter>
|
||||
struct non_rounding_converter : public std::unary_function< BOOST_DEDUCED_TYPENAME Traits::argument_type
|
||||
,BOOST_DEDUCED_TYPENAME Traits::result_type
|
||||
>
|
||||
,public RangeChecker
|
||||
,public RawConverter
|
||||
{
|
||||
typedef RangeChecker RangeCheckerBase ;
|
||||
typedef RawConverter RawConverterBase ;
|
||||
|
||||
typedef Traits traits ;
|
||||
|
||||
typedef typename Traits::source_type source_type ;
|
||||
typedef typename Traits::argument_type argument_type ;
|
||||
typedef typename Traits::result_type result_type ;
|
||||
|
||||
static source_type nearbyint ( argument_type s ) { return s ; }
|
||||
|
||||
static result_type convert ( argument_type s )
|
||||
{
|
||||
RangeCheckerBase::validate_range(s);
|
||||
return RawConverterBase::low_level_convert(s);
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Selectors for the optimized Converter class.
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template<class Traits,class OverflowHandler,class Float2IntRounder,class RawConverter, class UserRangeChecker>
|
||||
struct get_non_trivial_converter
|
||||
{
|
||||
typedef GetRC<Traits,OverflowHandler,Float2IntRounder> InternalRangeCheckerQ ;
|
||||
|
||||
typedef is_same<UserRangeChecker,UseInternalRangeChecker> use_internal_RC ;
|
||||
|
||||
typedef mpl::identity<UserRangeChecker> UserRangeCheckerQ ;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<use_internal_RC,InternalRangeCheckerQ,UserRangeCheckerQ>::type
|
||||
RangeChecker ;
|
||||
|
||||
typedef non_rounding_converter<Traits,RangeChecker,RawConverter> NonRounding ;
|
||||
typedef rounding_converter<Traits,RangeChecker,RawConverter,Float2IntRounder> Rounding ;
|
||||
|
||||
typedef mpl::identity<NonRounding> NonRoundingQ ;
|
||||
typedef mpl::identity<Rounding> RoundingQ ;
|
||||
|
||||
typedef typename Traits::int_float_mixture int_float_mixture ;
|
||||
|
||||
typedef typename
|
||||
for_int_float_mixture<int_float_mixture, NonRoundingQ, NonRoundingQ, RoundingQ, NonRoundingQ>::type
|
||||
selector ;
|
||||
|
||||
typedef typename selector::type type ;
|
||||
} ;
|
||||
|
||||
template< class Traits
|
||||
,class OverflowHandler
|
||||
,class Float2IntRounder
|
||||
,class RawConverter
|
||||
,class UserRangeChecker
|
||||
>
|
||||
struct get_converter_impl
|
||||
{
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT( 0x0561 ) )
|
||||
// bcc55 prefers sometimes template parameters to be explicit local types.
|
||||
// (notice that is is illegal to reuse the names like this)
|
||||
typedef Traits Traits ;
|
||||
typedef OverflowHandler OverflowHandler ;
|
||||
typedef Float2IntRounder Float2IntRounder ;
|
||||
typedef RawConverter RawConverter ;
|
||||
typedef UserRangeChecker UserRangeChecker ;
|
||||
#endif
|
||||
|
||||
typedef trivial_converter_impl<Traits> Trivial ;
|
||||
typedef mpl::identity <Trivial> TrivialQ ;
|
||||
|
||||
typedef get_non_trivial_converter< Traits
|
||||
,OverflowHandler
|
||||
,Float2IntRounder
|
||||
,RawConverter
|
||||
,UserRangeChecker
|
||||
> NonTrivialQ ;
|
||||
|
||||
typedef typename Traits::trivial trivial ;
|
||||
|
||||
typedef typename mpl::eval_if<trivial,TrivialQ,NonTrivialQ>::type type ;
|
||||
} ;
|
||||
|
||||
} } } // namespace boost::numeric::convdetail
|
||||
|
||||
#endif
|
||||
|
||||
|
72
boost/boost/numeric/conversion/detail/int_float_mixture.hpp
Normal file
72
boost/boost/numeric/conversion/detail/int_float_mixture.hpp
Normal file
@ -0,0 +1,72 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/limits.hpp"
|
||||
|
||||
#include "boost/numeric/conversion/int_float_mixture_enum.hpp"
|
||||
#include "boost/numeric/conversion/detail/meta.hpp"
|
||||
|
||||
#include "boost/mpl/integral_c.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
// Integral Constants for 'IntFloatMixture'
|
||||
typedef mpl::integral_c<int_float_mixture_enum, integral_to_integral> int2int_c ;
|
||||
typedef mpl::integral_c<int_float_mixture_enum, integral_to_float> int2float_c ;
|
||||
typedef mpl::integral_c<int_float_mixture_enum, float_to_integral> float2int_c ;
|
||||
typedef mpl::integral_c<int_float_mixture_enum, float_to_float> float2float_c ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
// get_int_float_mixture<T,S>::type
|
||||
//
|
||||
// Selects the appropriate Int-Float Mixture Integral Constant for the combination T,S.
|
||||
//
|
||||
template<class T,class S>
|
||||
struct get_int_float_mixture
|
||||
{
|
||||
typedef mpl::bool_< ::std::numeric_limits<S>::is_integer > S_int ;
|
||||
typedef mpl::bool_< ::std::numeric_limits<T>::is_integer > T_int ;
|
||||
|
||||
typedef typename
|
||||
for_both<S_int, T_int, int2int_c, int2float_c, float2int_c, float2float_c>::type
|
||||
type ;
|
||||
} ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
// for_int_float_mixture<Mixture,int_int,int_float,float_int,float_float>::type
|
||||
//
|
||||
// {Mixture} is one of the Integral Constants for Mixture, declared above.
|
||||
// {int_int,int_float,float_int,float_float} are aribtrary types. (not metafunctions)
|
||||
//
|
||||
// According to the value of 'IntFloatMixture', selects the corresponding type.
|
||||
//
|
||||
template<class IntFloatMixture, class Int2Int, class Int2Float, class Float2Int, class Float2Float>
|
||||
struct for_int_float_mixture
|
||||
{
|
||||
typedef typename
|
||||
ct_switch4<IntFloatMixture
|
||||
,int2int_c, int2float_c, float2int_c // default
|
||||
,Int2Int , Int2Float , Float2Int , Float2Float
|
||||
>::type
|
||||
type ;
|
||||
} ;
|
||||
|
||||
} } } // namespace boost::numeric::convdetail
|
||||
|
||||
#endif
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
234
boost/boost/numeric/conversion/detail/is_subranged.hpp
Normal file
234
boost/boost/numeric/conversion/detail/is_subranged.hpp
Normal file
@ -0,0 +1,234 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/limits.hpp"
|
||||
|
||||
#include "boost/mpl/int.hpp"
|
||||
#include "boost/mpl/multiplies.hpp"
|
||||
#include "boost/mpl/less.hpp"
|
||||
#include "boost/mpl/equal_to.hpp"
|
||||
|
||||
#include "boost/type_traits/is_same.hpp"
|
||||
|
||||
#include "boost/numeric/conversion/detail/meta.hpp"
|
||||
#include "boost/numeric/conversion/detail/int_float_mixture.hpp"
|
||||
#include "boost/numeric/conversion/detail/sign_mixture.hpp"
|
||||
#include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
// Implementations of the compile time predicate "T is subranged"
|
||||
//---------------------------------------------------------------
|
||||
|
||||
// for integral to integral conversions
|
||||
template<class T,class S>
|
||||
struct subranged_Sig2Unsig
|
||||
{
|
||||
// Signed to unsigned conversions are 'subranged' because of possible loose
|
||||
// of negative values.
|
||||
typedef mpl::true_ type ;
|
||||
} ;
|
||||
|
||||
// for unsigned integral to signed integral conversions
|
||||
template<class T,class S>
|
||||
struct subranged_Unsig2Sig
|
||||
{
|
||||
// IMPORTANT NOTE:
|
||||
//
|
||||
// This code assumes that signed/unsigned integral values are represented
|
||||
// such that:
|
||||
//
|
||||
// numeric_limits<signed T>::digits + 1 == numeric_limits<unsigned T>::digits
|
||||
//
|
||||
// The '+1' is required since numeric_limits<>::digits gives 1 bit less for signed integral types.
|
||||
//
|
||||
// This fact is used by the following logic:
|
||||
//
|
||||
// if ( (numeric_limits<T>::digits+1) < (2*numeric_limits<S>::digits) )
|
||||
// then the conversion is subranged.
|
||||
//
|
||||
|
||||
typedef mpl::int_< ::std::numeric_limits<S>::digits > S_digits ;
|
||||
typedef mpl::int_< ::std::numeric_limits<T>::digits > T_digits ;
|
||||
|
||||
// T is signed, so take digits+1
|
||||
typedef typename T_digits::next u_T_digits ;
|
||||
|
||||
typedef mpl::int_<2> Two ;
|
||||
|
||||
typedef typename mpl::multiplies<S_digits,Two>::type S_digits_times_2 ;
|
||||
|
||||
typedef typename mpl::less<u_T_digits,S_digits_times_2>::type type ;
|
||||
} ;
|
||||
|
||||
// for integral to integral conversions of the same sign.
|
||||
template<class T,class S>
|
||||
struct subranged_SameSign
|
||||
{
|
||||
// An integral conversion of the same sign is subranged if digits(T) < digits(S).
|
||||
|
||||
typedef mpl::int_< ::std::numeric_limits<S>::digits > S_digits ;
|
||||
typedef mpl::int_< ::std::numeric_limits<T>::digits > T_digits ;
|
||||
|
||||
typedef typename mpl::less<T_digits,S_digits>::type type ;
|
||||
} ;
|
||||
|
||||
// for integral to float conversions
|
||||
template<class T,class S>
|
||||
struct subranged_Int2Float
|
||||
{
|
||||
typedef mpl::false_ type ;
|
||||
} ;
|
||||
|
||||
// for float to integral conversions
|
||||
template<class T,class S>
|
||||
struct subranged_Float2Int
|
||||
{
|
||||
typedef mpl::true_ type ;
|
||||
} ;
|
||||
|
||||
// for float to float conversions
|
||||
template<class T,class S>
|
||||
struct subranged_Float2Float
|
||||
{
|
||||
// If both T and S are floats,
|
||||
// compare exponent bits and if they match, mantisa bits.
|
||||
|
||||
typedef mpl::int_< ::std::numeric_limits<S>::digits > S_mantisa ;
|
||||
typedef mpl::int_< ::std::numeric_limits<T>::digits > T_mantisa ;
|
||||
|
||||
typedef mpl::int_< ::std::numeric_limits<S>::max_exponent > S_exponent ;
|
||||
typedef mpl::int_< ::std::numeric_limits<T>::max_exponent > T_exponent ;
|
||||
|
||||
typedef typename mpl::less<T_exponent,S_exponent>::type T_smaller_exponent ;
|
||||
|
||||
typedef typename mpl::equal_to<T_exponent,S_exponent>::type equal_exponents ;
|
||||
|
||||
typedef mpl::less<T_mantisa,S_mantisa> T_smaller_mantisa ;
|
||||
|
||||
typedef mpl::eval_if<equal_exponents,T_smaller_mantisa,mpl::false_> not_bigger_exponent_case ;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<T_smaller_exponent,mpl::true_,not_bigger_exponent_case>::type
|
||||
type ;
|
||||
} ;
|
||||
|
||||
// for Udt to built-in conversions
|
||||
template<class T,class S>
|
||||
struct subranged_Udt2BuiltIn
|
||||
{
|
||||
typedef mpl::true_ type ;
|
||||
} ;
|
||||
|
||||
// for built-in to Udt conversions
|
||||
template<class T,class S>
|
||||
struct subranged_BuiltIn2Udt
|
||||
{
|
||||
typedef mpl::false_ type ;
|
||||
} ;
|
||||
|
||||
// for Udt to Udt conversions
|
||||
template<class T,class S>
|
||||
struct subranged_Udt2Udt
|
||||
{
|
||||
typedef mpl::false_ type ;
|
||||
} ;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Selectors for the implementations of the subranged predicate
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
template<class T,class S>
|
||||
struct get_subranged_Int2Int
|
||||
{
|
||||
typedef subranged_SameSign<T,S> Sig2Sig ;
|
||||
typedef subranged_Sig2Unsig<T,S> Sig2Unsig ;
|
||||
typedef subranged_Unsig2Sig<T,S> Unsig2Sig ;
|
||||
typedef Sig2Sig Unsig2Unsig ;
|
||||
|
||||
typedef typename get_sign_mixture<T,S>::type sign_mixture ;
|
||||
|
||||
typedef typename
|
||||
for_sign_mixture<sign_mixture, Sig2Sig, Sig2Unsig, Unsig2Sig, Unsig2Unsig>::type
|
||||
type ;
|
||||
} ;
|
||||
|
||||
template<class T,class S>
|
||||
struct get_subranged_BuiltIn2BuiltIn
|
||||
{
|
||||
typedef get_subranged_Int2Int<T,S> Int2IntQ ;
|
||||
|
||||
typedef subranged_Int2Float <T,S> Int2Float ;
|
||||
typedef subranged_Float2Int <T,S> Float2Int ;
|
||||
typedef subranged_Float2Float<T,S> Float2Float ;
|
||||
|
||||
typedef mpl::identity<Int2Float > Int2FloatQ ;
|
||||
typedef mpl::identity<Float2Int > Float2IntQ ;
|
||||
typedef mpl::identity<Float2Float> Float2FloatQ ;
|
||||
|
||||
typedef typename get_int_float_mixture<T,S>::type int_float_mixture ;
|
||||
|
||||
typedef for_int_float_mixture<int_float_mixture, Int2IntQ, Int2FloatQ, Float2IntQ, Float2FloatQ> for_ ;
|
||||
|
||||
typedef typename for_::type selected ;
|
||||
|
||||
typedef typename selected::type type ;
|
||||
} ;
|
||||
|
||||
template<class T,class S>
|
||||
struct get_subranged
|
||||
{
|
||||
typedef get_subranged_BuiltIn2BuiltIn<T,S> BuiltIn2BuiltInQ ;
|
||||
|
||||
typedef subranged_BuiltIn2Udt<T,S> BuiltIn2Udt ;
|
||||
typedef subranged_Udt2BuiltIn<T,S> Udt2BuiltIn ;
|
||||
typedef subranged_Udt2Udt<T,S> Udt2Udt ;
|
||||
|
||||
typedef mpl::identity<BuiltIn2Udt> BuiltIn2UdtQ ;
|
||||
typedef mpl::identity<Udt2BuiltIn> Udt2BuiltInQ ;
|
||||
typedef mpl::identity<Udt2Udt > Udt2UdtQ ;
|
||||
|
||||
typedef typename get_udt_builtin_mixture<T,S>::type udt_builtin_mixture ;
|
||||
|
||||
typedef typename
|
||||
for_udt_builtin_mixture<udt_builtin_mixture, BuiltIn2BuiltInQ, BuiltIn2UdtQ, Udt2BuiltInQ, Udt2UdtQ>::type
|
||||
selected ;
|
||||
|
||||
typedef typename selected::type selected2 ;
|
||||
|
||||
typedef typename selected2::type type ;
|
||||
} ;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Top level implementation selector.
|
||||
//-------------------------------------------------------------------
|
||||
template<class T, class S>
|
||||
struct get_is_subranged
|
||||
{
|
||||
typedef get_subranged<T,S> non_trivial_case ;
|
||||
typedef mpl::identity<mpl::false_> trivial_case ;
|
||||
|
||||
typedef is_same<T,S> is_trivial ;
|
||||
|
||||
typedef typename mpl::if_<is_trivial,trivial_case,non_trivial_case>::type selected ;
|
||||
|
||||
typedef typename selected::type type ;
|
||||
} ;
|
||||
|
||||
} } } // namespace boost::numeric::convdetail
|
||||
|
||||
#endif
|
||||
|
||||
|
120
boost/boost/numeric/conversion/detail/meta.hpp
Normal file
120
boost/boost/numeric/conversion/detail/meta.hpp
Normal file
@ -0,0 +1,120 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_META_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_DETAIL_META_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/type_traits/remove_cv.hpp"
|
||||
|
||||
#include "boost/mpl/if.hpp"
|
||||
#include "boost/mpl/eval_if.hpp"
|
||||
#include "boost/mpl/equal_to.hpp"
|
||||
#include "boost/mpl/not.hpp"
|
||||
#include "boost/mpl/and.hpp"
|
||||
#include "boost/mpl/bool.hpp"
|
||||
#include "boost/mpl/identity.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
template< class T1, class T2>
|
||||
struct equal_to
|
||||
{
|
||||
#if !defined(__BORLANDC__)
|
||||
|
||||
enum { x = ( BOOST_MPL_AUX_VALUE_WKND(T1)::value == BOOST_MPL_AUX_VALUE_WKND(T2)::value ) };
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = x);
|
||||
|
||||
typedef mpl::bool_<value> type;
|
||||
|
||||
#else
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = (
|
||||
BOOST_MPL_AUX_VALUE_WKND(T1)::value
|
||||
== BOOST_MPL_AUX_VALUE_WKND(T2)::value
|
||||
));
|
||||
|
||||
typedef mpl::bool_<(
|
||||
BOOST_MPL_AUX_VALUE_WKND(T1)::value
|
||||
== BOOST_MPL_AUX_VALUE_WKND(T2)::value
|
||||
)> type;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
// ct_switch4<Value,Case0Val,Case1Val,Case2Val,Case0Type,Case1Type,Case2Type,DefaultType>::type
|
||||
//
|
||||
// {Value,Case(X)Val} are Integral Constants (such as: mpl::int_<>)
|
||||
// {Case(X)Type,DefaultType} are arbitrary types. (not metafunctions)
|
||||
//
|
||||
// Returns Case(X)Type if Val==Case(X)Val; DefaultType otherwise.
|
||||
//
|
||||
template<class Value,
|
||||
class Case0Val,
|
||||
class Case1Val,
|
||||
class Case2Val,
|
||||
class Case0Type,
|
||||
class Case1Type,
|
||||
class Case2Type,
|
||||
class DefaultType
|
||||
>
|
||||
struct ct_switch4
|
||||
{
|
||||
typedef mpl::identity<Case0Type> Case0TypeQ ;
|
||||
typedef mpl::identity<Case1Type> Case1TypeQ ;
|
||||
|
||||
typedef equal_to<Value,Case0Val> is_case0 ;
|
||||
typedef equal_to<Value,Case1Val> is_case1 ;
|
||||
typedef equal_to<Value,Case2Val> is_case2 ;
|
||||
|
||||
typedef mpl::if_<is_case2,Case2Type,DefaultType> choose_2_3Q ;
|
||||
typedef mpl::eval_if<is_case1,Case1TypeQ,choose_2_3Q> choose_1_2_3Q ;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<is_case0,Case0TypeQ,choose_1_2_3Q>::type
|
||||
type ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
// for_both<expr0,expr1,TT,TF,FT,FF>::type
|
||||
//
|
||||
// {exp0,expr1} are Boolean Integral Constants
|
||||
// {TT,TF,FT,FF} are aribtrary types. (not metafunctions)
|
||||
//
|
||||
// According to the combined boolean value of 'expr0 && expr1', selects the corresponding type.
|
||||
//
|
||||
template<class expr0, class expr1, class TT, class TF, class FT, class FF>
|
||||
struct for_both
|
||||
{
|
||||
typedef mpl::identity<TF> TF_Q ;
|
||||
typedef mpl::identity<TT> TT_Q ;
|
||||
|
||||
typedef typename mpl::not_<expr0>::type not_expr0 ;
|
||||
typedef typename mpl::not_<expr1>::type not_expr1 ;
|
||||
|
||||
typedef typename mpl::and_<expr0,expr1>::type caseTT ;
|
||||
typedef typename mpl::and_<expr0,not_expr1>::type caseTF ;
|
||||
typedef typename mpl::and_<not_expr0,expr1>::type caseFT ;
|
||||
|
||||
typedef mpl::if_<caseFT,FT,FF> choose_FT_FF_Q ;
|
||||
typedef mpl::eval_if<caseTF,TF_Q,choose_FT_FF_Q> choose_TF_FT_FF_Q ;
|
||||
|
||||
typedef typename mpl::eval_if<caseTT,TT_Q,choose_TF_FT_FF_Q>::type type ;
|
||||
} ;
|
||||
|
||||
} } } // namespace boost::numeric::convdetail
|
||||
|
||||
#endif
|
||||
|
||||
|
339
boost/boost/numeric/conversion/detail/old_numeric_cast.hpp
Normal file
339
boost/boost/numeric/conversion/detail/old_numeric_cast.hpp
Normal file
@ -0,0 +1,339 @@
|
||||
// boost cast.hpp header file ----------------------------------------------//
|
||||
|
||||
// (C) Copyright Kevlin Henney and Dave Abrahams 1999.
|
||||
// Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/conversion for Documentation.
|
||||
|
||||
// Revision History
|
||||
// 23 JUN 05 Code extracted from /boost/cast.hpp into this new header.
|
||||
// Keeps this legacy version of numeric_cast<> for old compilers
|
||||
// wich can't compile the new version in /boost/numeric/conversion/cast.hpp
|
||||
// (Fernando Cacciola)
|
||||
// 02 Apr 01 Removed BOOST_NO_LIMITS workarounds and included
|
||||
// <boost/limits.hpp> instead (the workaround did not
|
||||
// actually compile when BOOST_NO_LIMITS was defined in
|
||||
// any case, so we loose nothing). (John Maddock)
|
||||
// 21 Jan 01 Undid a bug I introduced yesterday. numeric_cast<> never
|
||||
// worked with stock GCC; trying to get it to do that broke
|
||||
// vc-stlport.
|
||||
// 20 Jan 01 Moved BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS to config.hpp.
|
||||
// Removed unused BOOST_EXPLICIT_TARGET macro. Moved
|
||||
// boost::detail::type to boost/type.hpp. Made it compile with
|
||||
// stock gcc again (Dave Abrahams)
|
||||
// 29 Nov 00 Remove nested namespace cast, cleanup spacing before Formal
|
||||
// Review (Beman Dawes)
|
||||
// 19 Oct 00 Fix numeric_cast for floating-point types (Dave Abrahams)
|
||||
// 15 Jul 00 Suppress numeric_cast warnings for GCC, Borland and MSVC
|
||||
// (Dave Abrahams)
|
||||
// 30 Jun 00 More MSVC6 wordarounds. See comments below. (Dave Abrahams)
|
||||
// 28 Jun 00 Removed implicit_cast<>. See comment below. (Beman Dawes)
|
||||
// 27 Jun 00 More MSVC6 workarounds
|
||||
// 15 Jun 00 Add workarounds for MSVC6
|
||||
// 2 Feb 00 Remove bad_numeric_cast ";" syntax error (Doncho Angelov)
|
||||
// 26 Jan 00 Add missing throw() to bad_numeric_cast::what(0 (Adam Levar)
|
||||
// 29 Dec 99 Change using declarations so usages in other namespaces work
|
||||
// correctly (Dave Abrahams)
|
||||
// 23 Sep 99 Change polymorphic_downcast assert to also detect M.I. errors
|
||||
// as suggested Darin Adler and improved by Valentin Bonnard.
|
||||
// 2 Sep 99 Remove controversial asserts, simplify, rename.
|
||||
// 30 Aug 99 Move to cast.hpp, replace value_cast with numeric_cast,
|
||||
// place in nested namespace.
|
||||
// 3 Aug 99 Initial version
|
||||
|
||||
#ifndef BOOST_OLD_NUMERIC_CAST_HPP
|
||||
#define BOOST_OLD_NUMERIC_CAST_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <cassert>
|
||||
# include <typeinfo>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/limits.hpp>
|
||||
# include <boost/numeric/conversion/converter_policies.hpp>
|
||||
|
||||
// It has been demonstrated numerous times that MSVC 6.0 fails silently at link
|
||||
// time if you use a template function which has template parameters that don't
|
||||
// appear in the function's argument list.
|
||||
//
|
||||
// TODO: Add this to config.hpp?
|
||||
// FLC: This macro is repeated in boost/cast.hpp but only locally (is undefined at the bottom)
|
||||
// so is OK to reproduce it here.
|
||||
# if defined(BOOST_MSVC) && BOOST_MSVC < 1300
|
||||
# define BOOST_EXPLICIT_DEFAULT_TARGET , ::boost::type<Target>* = 0
|
||||
# else
|
||||
# define BOOST_EXPLICIT_DEFAULT_TARGET
|
||||
# endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
using numeric::bad_numeric_cast;
|
||||
|
||||
// LEGACY numeric_cast [only for some old broken compilers] --------------------------------------//
|
||||
|
||||
// Contributed by Kevlin Henney
|
||||
|
||||
// numeric_cast ------------------------------------------------------------//
|
||||
|
||||
#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_SGI_CPP_LIMITS)
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class T>
|
||||
struct signed_numeric_limits : std::numeric_limits<T>
|
||||
{
|
||||
static inline T min BOOST_PREVENT_MACRO_SUBSTITUTION ()
|
||||
{
|
||||
return (std::numeric_limits<T>::min)() >= 0
|
||||
// unary minus causes integral promotion, thus the static_cast<>
|
||||
? static_cast<T>(-(std::numeric_limits<T>::max)())
|
||||
: (std::numeric_limits<T>::min)();
|
||||
};
|
||||
};
|
||||
|
||||
// Move to namespace boost in utility.hpp?
|
||||
template <class T, bool specialized>
|
||||
struct fixed_numeric_limits_base
|
||||
: public if_true< std::numeric_limits<T>::is_signed >
|
||||
::BOOST_NESTED_TEMPLATE then< signed_numeric_limits<T>,
|
||||
std::numeric_limits<T>
|
||||
>::type
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct fixed_numeric_limits
|
||||
: fixed_numeric_limits_base<T,(std::numeric_limits<T>::is_specialized)>
|
||||
{};
|
||||
|
||||
# ifdef BOOST_HAS_LONG_LONG
|
||||
// cover implementations which supply no specialization for long
|
||||
// long / unsigned long long. Not intended to be full
|
||||
// numeric_limits replacements, but good enough for numeric_cast<>
|
||||
template <>
|
||||
struct fixed_numeric_limits_base< ::boost::long_long_type, false>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, is_specialized = true);
|
||||
BOOST_STATIC_CONSTANT(bool, is_signed = true);
|
||||
static ::boost::long_long_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
|
||||
{
|
||||
# ifdef LONGLONG_MAX
|
||||
return LONGLONG_MAX;
|
||||
# else
|
||||
return 9223372036854775807LL; // hope this is portable
|
||||
# endif
|
||||
}
|
||||
|
||||
static ::boost::long_long_type min BOOST_PREVENT_MACRO_SUBSTITUTION ()
|
||||
{
|
||||
# ifdef LONGLONG_MIN
|
||||
return LONGLONG_MIN;
|
||||
# else
|
||||
return -( 9223372036854775807LL )-1; // hope this is portable
|
||||
# endif
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fixed_numeric_limits_base< ::boost::ulong_long_type, false>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, is_specialized = true);
|
||||
BOOST_STATIC_CONSTANT(bool, is_signed = false);
|
||||
static ::boost::ulong_long_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
|
||||
{
|
||||
# ifdef ULONGLONG_MAX
|
||||
return ULONGLONG_MAX;
|
||||
# else
|
||||
return 0xffffffffffffffffULL; // hope this is portable
|
||||
# endif
|
||||
}
|
||||
|
||||
static ::boost::ulong_long_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }
|
||||
};
|
||||
# endif
|
||||
} // namespace detail
|
||||
|
||||
// less_than_type_min -
|
||||
// x_is_signed should be numeric_limits<X>::is_signed
|
||||
// y_is_signed should be numeric_limits<Y>::is_signed
|
||||
// y_min should be numeric_limits<Y>::min()
|
||||
//
|
||||
// check(x, y_min) returns true iff x < y_min without invoking comparisons
|
||||
// between signed and unsigned values.
|
||||
//
|
||||
// "poor man's partial specialization" is in use here.
|
||||
template <bool x_is_signed, bool y_is_signed>
|
||||
struct less_than_type_min
|
||||
{
|
||||
template <class X, class Y>
|
||||
static bool check(X x, Y y_min)
|
||||
{ return x < y_min; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct less_than_type_min<false, true>
|
||||
{
|
||||
template <class X, class Y>
|
||||
static bool check(X, Y)
|
||||
{ return false; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct less_than_type_min<true, false>
|
||||
{
|
||||
template <class X, class Y>
|
||||
static bool check(X x, Y)
|
||||
{ return x < 0; }
|
||||
};
|
||||
|
||||
// greater_than_type_max -
|
||||
// same_sign should be:
|
||||
// numeric_limits<X>::is_signed == numeric_limits<Y>::is_signed
|
||||
// y_max should be numeric_limits<Y>::max()
|
||||
//
|
||||
// check(x, y_max) returns true iff x > y_max without invoking comparisons
|
||||
// between signed and unsigned values.
|
||||
//
|
||||
// "poor man's partial specialization" is in use here.
|
||||
template <bool same_sign, bool x_is_signed>
|
||||
struct greater_than_type_max;
|
||||
|
||||
template<>
|
||||
struct greater_than_type_max<true, true>
|
||||
{
|
||||
template <class X, class Y>
|
||||
static inline bool check(X x, Y y_max)
|
||||
{ return x > y_max; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct greater_than_type_max<false, true>
|
||||
{
|
||||
// What does the standard say about this? I think it's right, and it
|
||||
// will work with every compiler I know of.
|
||||
template <class X, class Y>
|
||||
static inline bool check(X x, Y)
|
||||
{ return x >= 0 && static_cast<X>(static_cast<Y>(x)) != x; }
|
||||
|
||||
# if defined(BOOST_MSVC) && BOOST_MSVC < 1300
|
||||
// MSVC6 can't static_cast unsigned __int64 -> floating types
|
||||
# define BOOST_UINT64_CAST(src_type) \
|
||||
static inline bool check(src_type x, unsigned __int64) \
|
||||
{ \
|
||||
if (x < 0) return false; \
|
||||
unsigned __int64 y = static_cast<unsigned __int64>(x); \
|
||||
bool odd = y & 0x1; \
|
||||
__int64 div2 = static_cast<__int64>(y >> 1); \
|
||||
return ((static_cast<src_type>(div2) * 2.0) + odd) != x; \
|
||||
}
|
||||
|
||||
BOOST_UINT64_CAST(long double);
|
||||
BOOST_UINT64_CAST(double);
|
||||
BOOST_UINT64_CAST(float);
|
||||
# undef BOOST_UINT64_CAST
|
||||
# endif
|
||||
};
|
||||
|
||||
template<>
|
||||
struct greater_than_type_max<true, false>
|
||||
{
|
||||
template <class X, class Y>
|
||||
static inline bool check(X x, Y y_max)
|
||||
{ return x > y_max; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct greater_than_type_max<false, false>
|
||||
{
|
||||
// What does the standard say about this? I think it's right, and it
|
||||
// will work with every compiler I know of.
|
||||
template <class X, class Y>
|
||||
static inline bool check(X x, Y)
|
||||
{ return static_cast<X>(static_cast<Y>(x)) != x; }
|
||||
};
|
||||
|
||||
#else // use #pragma hacks if available
|
||||
|
||||
namespace detail
|
||||
{
|
||||
# if BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4018)
|
||||
# pragma warning(disable : 4146)
|
||||
#elif defined(__BORLANDC__)
|
||||
# pragma option push -w-8041
|
||||
# endif
|
||||
|
||||
// Move to namespace boost in utility.hpp?
|
||||
template <class T>
|
||||
struct fixed_numeric_limits : public std::numeric_limits<T>
|
||||
{
|
||||
static inline T min BOOST_PREVENT_MACRO_SUBSTITUTION ()
|
||||
{
|
||||
return std::numeric_limits<T>::is_signed && (std::numeric_limits<T>::min)() >= 0
|
||||
? T(-(std::numeric_limits<T>::max)()) : (std::numeric_limits<T>::min)();
|
||||
}
|
||||
};
|
||||
|
||||
# if BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#elif defined(__BORLANDC__)
|
||||
# pragma option pop
|
||||
# endif
|
||||
} // namespace detail
|
||||
|
||||
#endif
|
||||
|
||||
template<typename Target, typename Source>
|
||||
inline Target numeric_cast(Source arg BOOST_EXPLICIT_DEFAULT_TARGET)
|
||||
{
|
||||
// typedefs abbreviating respective trait classes
|
||||
typedef detail::fixed_numeric_limits<Source> arg_traits;
|
||||
typedef detail::fixed_numeric_limits<Target> result_traits;
|
||||
|
||||
#if defined(BOOST_STRICT_CONFIG) \
|
||||
|| (!defined(__HP_aCC) || __HP_aCC > 33900) \
|
||||
&& (!defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) \
|
||||
|| defined(BOOST_SGI_CPP_LIMITS))
|
||||
// typedefs that act as compile time assertions
|
||||
// (to be replaced by boost compile time assertions
|
||||
// as and when they become available and are stable)
|
||||
typedef bool argument_must_be_numeric[arg_traits::is_specialized];
|
||||
typedef bool result_must_be_numeric[result_traits::is_specialized];
|
||||
|
||||
const bool arg_is_signed = arg_traits::is_signed;
|
||||
const bool result_is_signed = result_traits::is_signed;
|
||||
const bool same_sign = arg_is_signed == result_is_signed;
|
||||
|
||||
if (less_than_type_min<arg_is_signed, result_is_signed>::check(arg, (result_traits::min)())
|
||||
|| greater_than_type_max<same_sign, arg_is_signed>::check(arg, (result_traits::max)())
|
||||
)
|
||||
|
||||
#else // We need to use #pragma hacks if available
|
||||
|
||||
# if BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4018)
|
||||
#elif defined(__BORLANDC__)
|
||||
#pragma option push -w-8012
|
||||
# endif
|
||||
if ((arg < 0 && !result_traits::is_signed) // loss of negative range
|
||||
|| (arg_traits::is_signed && arg < (result_traits::min)()) // underflow
|
||||
|| arg > (result_traits::max)()) // overflow
|
||||
# if BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#elif defined(__BORLANDC__)
|
||||
#pragma option pop
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
throw bad_numeric_cast();
|
||||
}
|
||||
return static_cast<Target>(arg);
|
||||
} // numeric_cast
|
||||
|
||||
# undef BOOST_EXPLICIT_DEFAULT_TARGET
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_OLD_NUMERIC_CAST_HPP
|
72
boost/boost/numeric/conversion/detail/sign_mixture.hpp
Normal file
72
boost/boost/numeric/conversion/detail/sign_mixture.hpp
Normal file
@ -0,0 +1,72 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/limits.hpp"
|
||||
|
||||
#include "boost/numeric/conversion/sign_mixture_enum.hpp"
|
||||
#include "boost/numeric/conversion/detail/meta.hpp"
|
||||
|
||||
#include "boost/mpl/integral_c.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
// Integral Constants for 'SignMixture'
|
||||
typedef mpl::integral_c<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
|
||||
typedef mpl::integral_c<sign_mixture_enum, signed_to_signed> sig2sig_c ;
|
||||
typedef mpl::integral_c<sign_mixture_enum, signed_to_unsigned> sig2unsig_c ;
|
||||
typedef mpl::integral_c<sign_mixture_enum, unsigned_to_signed> unsig2sig_c ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
// get_sign_mixture<T,S>::type
|
||||
//
|
||||
// Selects the appropriate SignMixture Integral Constant for the combination T,S.
|
||||
//
|
||||
template<class T,class S>
|
||||
struct get_sign_mixture
|
||||
{
|
||||
typedef mpl::bool_< ::std::numeric_limits<S>::is_signed > S_signed ;
|
||||
typedef mpl::bool_< ::std::numeric_limits<T>::is_signed > T_signed ;
|
||||
|
||||
typedef typename
|
||||
for_both<S_signed, T_signed, sig2sig_c, sig2unsig_c, unsig2sig_c, unsig2unsig_c>::type
|
||||
type ;
|
||||
} ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
// for_sign_mixture<SignMixture,Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig>::type
|
||||
//
|
||||
// {SignMixture} is one of the Integral Constants for SignMixture, declared above.
|
||||
// {Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig} are aribtrary types. (not metafunctions)
|
||||
//
|
||||
// According to the value of 'SignMixture', selects the corresponding type.
|
||||
//
|
||||
template<class SignMixture, class Sig2Sig, class Sig2Unsig, class Unsig2Sig, class Unsig2Unsig>
|
||||
struct for_sign_mixture
|
||||
{
|
||||
typedef typename
|
||||
ct_switch4<SignMixture
|
||||
, sig2sig_c, sig2unsig_c, unsig2sig_c // default
|
||||
, Sig2Sig , Sig2Unsig , Unsig2Sig , Unsig2Unsig
|
||||
>::type
|
||||
type ;
|
||||
} ;
|
||||
|
||||
} } } // namespace boost::numeric::convdetail
|
||||
|
||||
#endif
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -0,0 +1,69 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/type_traits/is_arithmetic.hpp"
|
||||
|
||||
#include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp"
|
||||
#include "boost/numeric/conversion/detail/meta.hpp"
|
||||
|
||||
#include "boost/mpl/integral_c.hpp"
|
||||
|
||||
namespace boost { namespace numeric { namespace convdetail
|
||||
{
|
||||
// Integral Constants for 'UdtMixture'
|
||||
typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
|
||||
typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_udt> builtin2udt_c ;
|
||||
typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_builtin> udt2builtin_c ;
|
||||
typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_udt> udt2udt_c ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
// for_udt_mixture<UdtMixture,BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt>::type
|
||||
//
|
||||
// {UdtMixture} is one of the Integral Constants for UdMixture, declared above.
|
||||
// {BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt} are aribtrary types. (not metafunctions)
|
||||
//
|
||||
// According to the value of 'UdtMixture', selects the corresponding type.
|
||||
//
|
||||
template<class UdtMixture, class BuiltIn2BuiltIn, class BuiltIn2Udt, class Udt2BuiltIn, class Udt2Udt>
|
||||
struct for_udt_builtin_mixture
|
||||
{
|
||||
typedef typename
|
||||
ct_switch4<UdtMixture
|
||||
, builtin2builtin_c, builtin2udt_c, udt2builtin_c // default
|
||||
, BuiltIn2BuiltIn , BuiltIn2Udt , Udt2BuiltIn , Udt2Udt
|
||||
>::type
|
||||
type ;
|
||||
} ;
|
||||
|
||||
// Metafunction:
|
||||
//
|
||||
// get_udt_mixture<T,S>::type
|
||||
//
|
||||
// Selects the appropriate UdtMixture Integral Constant for the combination T,S.
|
||||
//
|
||||
template<class T,class S>
|
||||
struct get_udt_builtin_mixture
|
||||
{
|
||||
typedef is_arithmetic<S> S_builtin ;
|
||||
typedef is_arithmetic<T> T_builtin ;
|
||||
|
||||
typedef typename
|
||||
for_both<S_builtin, T_builtin, builtin2builtin_c, builtin2udt_c, udt2builtin_c, udt2udt_c>::type
|
||||
type ;
|
||||
} ;
|
||||
|
||||
} } } // namespace boost::numeric::convdetail
|
||||
|
||||
#endif
|
||||
|
||||
|
30
boost/boost/numeric/conversion/int_float_mixture.hpp
Normal file
30
boost/boost/numeric/conversion/int_float_mixture.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/numeric/conversion/detail/int_float_mixture.hpp"
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
|
||||
template<class T, class S>
|
||||
struct int_float_mixture
|
||||
: convdetail::get_int_float_mixture< BOOST_DEDUCED_TYPENAME remove_cv<T>::type
|
||||
,BOOST_DEDUCED_TYPENAME remove_cv<S>::type
|
||||
>::type {} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
29
boost/boost/numeric/conversion/int_float_mixture_enum.hpp
Normal file
29
boost/boost/numeric/conversion/int_float_mixture_enum.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_ENUM_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_ENUM_FLC_12NOV2002_HPP
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
enum int_float_mixture_enum
|
||||
{
|
||||
integral_to_integral
|
||||
,integral_to_float
|
||||
,float_to_integral
|
||||
,float_to_float
|
||||
} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
27
boost/boost/numeric/conversion/is_subranged.hpp
Normal file
27
boost/boost/numeric/conversion/is_subranged.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_IS_SUBRANGED_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_IS_SUBRANGED_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/numeric/conversion/detail/is_subranged.hpp"
|
||||
|
||||
namespace boost { namespace numeric {
|
||||
|
||||
template<class T, class S>
|
||||
struct is_subranged
|
||||
: convdetail::get_is_subranged< BOOST_DEDUCED_TYPENAME remove_cv<T>::type
|
||||
,BOOST_DEDUCED_TYPENAME remove_cv<S>::type
|
||||
>::type {} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
|
||||
|
30
boost/boost/numeric/conversion/sign_mixture.hpp
Normal file
30
boost/boost/numeric/conversion/sign_mixture.hpp
Normal file
@ -0,0 +1,30 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_SIGN_MIXTURE_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_SIGN_MIXTURE_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/numeric/conversion/detail/sign_mixture.hpp"
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
|
||||
template<class T, class S>
|
||||
struct sign_mixture
|
||||
: convdetail::get_sign_mixture< BOOST_DEDUCED_TYPENAME remove_cv<T>::type
|
||||
,BOOST_DEDUCED_TYPENAME remove_cv<S>::type
|
||||
>::type {} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
29
boost/boost/numeric/conversion/sign_mixture_enum.hpp
Normal file
29
boost/boost/numeric/conversion/sign_mixture_enum.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_SIGN_MIXTURE_ENUM_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_SIGN_MIXTURE_ENUM_FLC_12NOV2002_HPP
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
enum sign_mixture_enum
|
||||
{
|
||||
unsigned_to_unsigned
|
||||
,signed_to_signed
|
||||
,signed_to_unsigned
|
||||
,unsigned_to_signed
|
||||
} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
28
boost/boost/numeric/conversion/udt_builtin_mixture.hpp
Normal file
28
boost/boost/numeric/conversion/udt_builtin_mixture.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
|
||||
|
||||
#include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp"
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
|
||||
template<class T, class S>
|
||||
struct udt_builtin_mixture
|
||||
: convdetail::get_udt_builtin_mixture< BOOST_DEDUCED_TYPENAME remove_cv<T>::type
|
||||
,BOOST_DEDUCED_TYPENAME remove_cv<S>::type
|
||||
>::type {} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
|
||||
|
26
boost/boost/numeric/conversion/udt_builtin_mixture_enum.hpp
Normal file
26
boost/boost/numeric/conversion/udt_builtin_mixture_enum.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See library home page at http://www.boost.org/libs/numeric/conversion
|
||||
//
|
||||
// Contact the author at: fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_UDT_BUILTIN_MIXTURE_ENUM_FLC_12NOV2002_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_UDT_BUILTIN_MIXTURE_ENUM_FLC_12NOV2002_HPP
|
||||
|
||||
namespace boost { namespace numeric
|
||||
{
|
||||
enum udt_builtin_mixture_enum
|
||||
{
|
||||
builtin_to_builtin
|
||||
,builtin_to_udt
|
||||
,udt_to_builtin
|
||||
,udt_to_udt
|
||||
} ;
|
||||
|
||||
} } // namespace boost::numeric
|
||||
|
||||
#endif
|
||||
|
@ -8,6 +8,8 @@
|
||||
// See http://www.boost.org/libs/utility/operators.htm for documentation.
|
||||
|
||||
// Revision History
|
||||
// 16 Dec 10 Limit warning suppression for 4284 to older versions of VC++
|
||||
// (Matthew Bradbury, fixes #4432)
|
||||
// 07 Aug 08 Added "euclidean" spelling. (Daniel Frey)
|
||||
// 03 Apr 08 Make sure "convertible to bool" is sufficient
|
||||
// for T::operator<, etc. (Daniel Frey)
|
||||
@ -88,7 +90,7 @@
|
||||
# pragma set woff 1234
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1600)
|
||||
# pragma warning( disable : 4284 ) // complaint about return type of
|
||||
#endif // operator-> not begin a UDT
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
|
||||
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
|
||||
//
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -9,6 +9,9 @@
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
//
|
||||
// Revisions:
|
||||
// 10 May 2008 (added swap related forward declaration) Niels Dekker
|
||||
//
|
||||
#ifndef BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP
|
||||
#define BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP
|
||||
|
||||
@ -16,6 +19,10 @@ namespace boost {
|
||||
|
||||
template<class T> class optional ;
|
||||
|
||||
template<class T> void swap ( optional<T>& , optional<T>& ) ;
|
||||
|
||||
template<class T> struct optional_swap_should_use_default_constructor ;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), \
|
||||
BOOST_PP_SEQ_CAT_I, \
|
||||
BOOST_PP_SEQ_HEAD(seq) BOOST_PP_TUPLE_EAT_1 \
|
||||
BOOST_PP_SEQ_HEAD \
|
||||
)(seq) \
|
||||
/**/
|
||||
# define BOOST_PP_SEQ_CAT_I(seq) BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq))
|
||||
@ -39,10 +39,11 @@
|
||||
# define BOOST_PP_SEQ_CAT_S(s, seq) \
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), \
|
||||
BOOST_PP_SEQ_CAT_S_I, \
|
||||
BOOST_PP_SEQ_HEAD(seq) BOOST_PP_TUPLE_EAT_2 \
|
||||
BOOST_PP_SEQ_CAT_S_I_A, \
|
||||
BOOST_PP_SEQ_CAT_S_I_B \
|
||||
)(s, seq) \
|
||||
/**/
|
||||
# define BOOST_PP_SEQ_CAT_S_I(s, seq) BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq))
|
||||
# define BOOST_PP_SEQ_CAT_S_I_A(s, seq) BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq))
|
||||
# define BOOST_PP_SEQ_CAT_S_I_B(s, seq) BOOST_PP_SEQ_HEAD(seq)
|
||||
#
|
||||
# endif
|
||||
|
@ -14,7 +14,6 @@
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/tuple/eat.hpp>
|
||||
#
|
||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
|
||||
# define BOOST_PP_SEQ_SIZE(seq) BOOST_PP_SEQ_SIZE_I((seq))
|
||||
|
@ -163,8 +163,10 @@
|
||||
* with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions
|
||||
* of the non-inline functions in the library, so that users can still link to the lib,
|
||||
* irrespective of whether their own code is built with /Zc:wchar_t.
|
||||
* Note that this does NOT WORK with VC10 when the C++ locale is in effect as
|
||||
* the locale's <unsigned short> facets simply do not compile in that case.
|
||||
*/
|
||||
#if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && !defined(BOOST_RWSTD_VER)
|
||||
#if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && !defined(BOOST_RWSTD_VER) && ((_MSC_VER < 1600) || !defined(BOOST_REGEX_USE_CPP_LOCALE))
|
||||
# define BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
|
@ -73,7 +73,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz
|
||||
// for now just throw, but we should never really get here...
|
||||
//
|
||||
::boost::throw_exception(std::runtime_error("Error in thread safety code: could not acquire a lock"));
|
||||
#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
|
||||
#if defined(BOOST_NO_UNREACHABLE_RETURN_DETECTION) || defined(BOOST_NO_EXCEPTIONS)
|
||||
return boost::shared_ptr<Object>();
|
||||
#endif
|
||||
#else
|
||||
|
@ -113,6 +113,10 @@ inline unsigned utf8_trailing_byte_count(boost::uint8_t c)
|
||||
return utf8_byte_count(c) - 1;
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100)
|
||||
#endif
|
||||
inline void invalid_utf32_code_point(::boost::uint32_t val)
|
||||
{
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
@ -124,6 +128,9 @@ inline void invalid_utf32_code_point(::boost::uint32_t val)
|
||||
#endif
|
||||
boost::throw_exception(e);
|
||||
}
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace detail
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2004
|
||||
* John Maddock
|
||||
* Copyright (c) 1998-2004 John Maddock
|
||||
* Copyright 2011 Garmin Ltd. or its subsidiaries
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -234,7 +234,7 @@ public:
|
||||
std::pair<const_iterator, const_iterator> BOOST_REGEX_CALL subexpression(std::size_t n)const
|
||||
{
|
||||
if(n == 0)
|
||||
throw std::out_of_range("0 is not a valid subexpression index.");
|
||||
boost::throw_exception(std::out_of_range("0 is not a valid subexpression index."));
|
||||
const std::pair<std::size_t, std::size_t>& pi = this->m_subs.at(n - 1);
|
||||
std::pair<const_iterator, const_iterator> p(expression() + pi.first, expression() + pi.second);
|
||||
return p;
|
||||
@ -487,7 +487,7 @@ public:
|
||||
std::pair<const_iterator, const_iterator> BOOST_REGEX_CALL subexpression(std::size_t n)const
|
||||
{
|
||||
if(!m_pimpl.get())
|
||||
throw std::logic_error("Can't access subexpressions in an invalid regex.");
|
||||
boost::throw_exception(std::logic_error("Can't access subexpressions in an invalid regex."));
|
||||
return m_pimpl->subexpression(n);
|
||||
}
|
||||
const_iterator BOOST_REGEX_CALL begin()const
|
||||
|
@ -2711,6 +2711,8 @@ regex_constants::syntax_option_type basic_regex_parser<charT, traits>::parse_opt
|
||||
}
|
||||
}
|
||||
while(!breakout);
|
||||
|
||||
breakout = false;
|
||||
|
||||
if(*m_position == static_cast<charT>('-'))
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* John Maddock
|
||||
* Copyright (c) 2004 John Maddock
|
||||
* Copyright 2011 Garmin Ltd. or its subsidiaries
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
@ -511,7 +511,9 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
// however at least one std lib will always throw
|
||||
// std::bad_alloc for certain arguments...
|
||||
//
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try{
|
||||
#endif
|
||||
//
|
||||
// What we do here depends upon the format of the sort key returned by
|
||||
// sort key returned by this->transform:
|
||||
@ -546,7 +548,9 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
result.erase(i);
|
||||
break;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}catch(...){}
|
||||
#endif
|
||||
while(result.size() && (charT(0) == *result.rbegin()))
|
||||
result.erase(result.size() - 1);
|
||||
if(result.empty())
|
||||
@ -576,7 +580,9 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
// std::bad_alloc for certain arguments...
|
||||
//
|
||||
string_type result;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try{
|
||||
#endif
|
||||
result = this->m_pcollate->transform(p1, p2);
|
||||
//
|
||||
// Borland's STLPort version returns a NULL-terminated
|
||||
@ -593,10 +599,12 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
result.erase(result.size() - 1);
|
||||
#endif
|
||||
BOOST_ASSERT(std::find(result.begin(), result.end(), charT(0)) == result.end());
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -317,14 +317,14 @@ inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(cons
|
||||
template <std::size_t N>
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, m);
|
||||
return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
template <class charT, class Traits, class Alloc, std::size_t N>
|
||||
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, const int (&submatch)[N], 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);
|
||||
}
|
||||
template <std::size_t N>
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
@ -354,7 +354,7 @@ template <class charT, class Traits, class Alloc>
|
||||
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, const std::vector<int>& submatch, 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, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifndef BOOST_SMART_PTR_HPP_INCLUDED
|
||||
#define BOOST_SMART_PTR_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// smart_ptr.hpp
|
||||
//
|
||||
@ -22,4 +25,7 @@
|
||||
# include <boost/weak_ptr.hpp>
|
||||
# include <boost/intrusive_ptr.hpp>
|
||||
# include <boost/enable_shared_from_this.hpp>
|
||||
# include <boost/make_shared.hpp>
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_HPP_INCLUDED
|
||||
|
@ -52,6 +52,10 @@ int const weak_count_id = 0x298C38A4;
|
||||
|
||||
struct sp_nothrow_tag {};
|
||||
|
||||
template< class D > struct sp_inplace_tag
|
||||
{
|
||||
};
|
||||
|
||||
class weak_count;
|
||||
|
||||
class shared_count
|
||||
@ -142,6 +146,40 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING )
|
||||
|
||||
template< class P, class D > shared_count( P p, sp_inplace_tag<D> ): pi_( 0 )
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
||||
try
|
||||
{
|
||||
pi_ = new sp_counted_impl_pd< P, D >( p );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
D()( p ); // delete p
|
||||
throw;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
pi_ = new sp_counted_impl_pd< P, D >( p );
|
||||
|
||||
if( pi_ == 0 )
|
||||
{
|
||||
D()( p ); // delete p
|
||||
boost::throw_exception( std::bad_alloc() );
|
||||
}
|
||||
|
||||
#endif // #ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING )
|
||||
|
||||
template<class P, class D, class A> shared_count( P p, D d, A a ): pi_( 0 )
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
@ -188,6 +226,56 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING )
|
||||
|
||||
template< class P, class D, class A > shared_count( P p, sp_inplace_tag< D >, A a ): pi_( 0 )
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
typedef sp_counted_impl_pda< P, D, A > impl_type;
|
||||
typedef typename A::template rebind< impl_type >::other A2;
|
||||
|
||||
A2 a2( a );
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
||||
try
|
||||
{
|
||||
pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
|
||||
new( static_cast< void* >( pi_ ) ) impl_type( p, a );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
D()( p );
|
||||
|
||||
if( pi_ != 0 )
|
||||
{
|
||||
a2.deallocate( static_cast< impl_type* >( pi_ ), 1 );
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
|
||||
|
||||
if( pi_ != 0 )
|
||||
{
|
||||
new( static_cast< void* >( pi_ ) ) impl_type( p, a );
|
||||
}
|
||||
else
|
||||
{
|
||||
D()( p );
|
||||
boost::throw_exception( std::bad_alloc() );
|
||||
}
|
||||
|
||||
#endif // #ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING )
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
|
||||
// auto_ptr<Y> is special cased to provide the strong guarantee
|
||||
|
@ -135,7 +135,11 @@ public:
|
||||
|
||||
// pre: d(p) must not throw
|
||||
|
||||
sp_counted_impl_pd( P p, D d ): ptr(p), del(d)
|
||||
sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d )
|
||||
{
|
||||
}
|
||||
|
||||
sp_counted_impl_pd( P p ): ptr( p ), del()
|
||||
{
|
||||
}
|
||||
|
||||
@ -195,7 +199,11 @@ public:
|
||||
|
||||
// pre: d( p ) must not throw
|
||||
|
||||
sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a )
|
||||
sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a )
|
||||
{
|
||||
}
|
||||
|
||||
sp_counted_impl_pda( P p, A a ): p_( p ), d_(), a_( a )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
// are available.
|
||||
//
|
||||
|
||||
#if defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 )
|
||||
#if defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( BOOST_SP_NO_SYNC )
|
||||
|
||||
#define BOOST_SP_HAS_SYNC
|
||||
|
||||
|
@ -31,7 +31,10 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/smart_ptr/detail/sp_has_sync.hpp>
|
||||
|
||||
#if defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )
|
||||
#if defined( BOOST_SP_USE_PTHREADS )
|
||||
# include <boost/smart_ptr/detail/spinlock_pt.hpp>
|
||||
|
||||
#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )
|
||||
# include <boost/smart_ptr/detail/spinlock_gcc_arm.hpp>
|
||||
|
||||
#elif defined( BOOST_SP_HAS_SYNC )
|
||||
|
@ -41,7 +41,11 @@ public:
|
||||
|
||||
static spinlock & spinlock_for( void const * pv )
|
||||
{
|
||||
#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
|
||||
std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41;
|
||||
#else
|
||||
std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41;
|
||||
#endif
|
||||
return pool_[ i ];
|
||||
}
|
||||
|
||||
|
@ -15,11 +15,6 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4284) // odd return type for operator->
|
||||
#endif
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/smart_ptr/detail/sp_convertible.hpp>
|
||||
@ -292,8 +287,4 @@ template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED
|
||||
|
@ -49,7 +49,18 @@ private:
|
||||
{
|
||||
if( initialized_ )
|
||||
{
|
||||
#if defined( __GNUC__ )
|
||||
|
||||
// fixes incorrect aliasing warning
|
||||
T * p = reinterpret_cast< T* >( storage_.data_ );
|
||||
p->~T();
|
||||
|
||||
#else
|
||||
|
||||
reinterpret_cast< T* >( storage_.data_ )->~T();
|
||||
|
||||
#endif
|
||||
|
||||
initialized_ = false;
|
||||
}
|
||||
}
|
||||
@ -97,13 +108,19 @@ template< class T > T&& sp_forward( T & t )
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING )
|
||||
# define BOOST_SP_MSD( T ) boost::detail::sp_inplace_tag< boost::detail::sp_ms_deleter< T > >()
|
||||
#else
|
||||
# define BOOST_SP_MSD( T ) boost::detail::sp_ms_deleter< T >()
|
||||
#endif
|
||||
|
||||
// Zero-argument versions
|
||||
//
|
||||
// Used even when variadic templates are available because of the new T() vs new T issue
|
||||
|
||||
template< class T > boost::shared_ptr< T > make_shared()
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -120,7 +137,7 @@ template< class T > boost::shared_ptr< T > make_shared()
|
||||
|
||||
template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -141,7 +158,7 @@ template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a
|
||||
|
||||
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 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -158,7 +175,7 @@ template< class T, class Arg1, class... Args > boost::shared_ptr< T > make_share
|
||||
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -173,6 +190,460 @@ template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > a
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
#elif defined( BOOST_HAS_RVALUE_REFS )
|
||||
|
||||
// For example MSVC 10.0
|
||||
|
||||
template< class T, class A1 >
|
||||
boost::shared_ptr< T > make_shared( A1 && a1 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A, class A1 >
|
||||
boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A1, class A2 >
|
||||
boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A, class A1, class A2 >
|
||||
boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A1, class A2, class A3 >
|
||||
boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A, class A1, class A2, class A3 >
|
||||
boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A1, class A2, class A3, class A4 >
|
||||
boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A, class A1, class A2, class A3, class A4 >
|
||||
boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A1, class A2, class A3, class A4, class A5 >
|
||||
boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
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 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A1, class A2, class A3, class A4, class A5, class A6 >
|
||||
boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 ),
|
||||
boost::detail::sp_forward<A6>( a6 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
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 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 ),
|
||||
boost::detail::sp_forward<A6>( a6 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 >
|
||||
boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 ),
|
||||
boost::detail::sp_forward<A6>( a6 ),
|
||||
boost::detail::sp_forward<A7>( a7 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
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 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 ),
|
||||
boost::detail::sp_forward<A6>( a6 ),
|
||||
boost::detail::sp_forward<A7>( a7 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
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 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 ),
|
||||
boost::detail::sp_forward<A6>( a6 ),
|
||||
boost::detail::sp_forward<A7>( a7 ),
|
||||
boost::detail::sp_forward<A8>( a8 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
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 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 ),
|
||||
boost::detail::sp_forward<A6>( a6 ),
|
||||
boost::detail::sp_forward<A7>( a7 ),
|
||||
boost::detail::sp_forward<A8>( a8 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
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 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 ),
|
||||
boost::detail::sp_forward<A6>( a6 ),
|
||||
boost::detail::sp_forward<A7>( a7 ),
|
||||
boost::detail::sp_forward<A8>( a8 ),
|
||||
boost::detail::sp_forward<A9>( a9 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
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 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
void * pv = pd->address();
|
||||
|
||||
::new( pv ) T(
|
||||
boost::detail::sp_forward<A1>( a1 ),
|
||||
boost::detail::sp_forward<A2>( a2 ),
|
||||
boost::detail::sp_forward<A3>( a3 ),
|
||||
boost::detail::sp_forward<A4>( a4 ),
|
||||
boost::detail::sp_forward<A5>( a5 ),
|
||||
boost::detail::sp_forward<A6>( a6 ),
|
||||
boost::detail::sp_forward<A7>( a7 ),
|
||||
boost::detail::sp_forward<A8>( a8 ),
|
||||
boost::detail::sp_forward<A9>( a9 )
|
||||
);
|
||||
|
||||
pd->set_initialized();
|
||||
|
||||
T * pt2 = static_cast< T* >( pv );
|
||||
|
||||
boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
|
||||
return boost::shared_ptr< T >( pt, pt2 );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// C++03 version
|
||||
@ -180,7 +651,7 @@ template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > a
|
||||
template< class T, class A1 >
|
||||
boost::shared_ptr< T > make_shared( A1 const & a1 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -198,7 +669,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1 )
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -216,7 +687,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1 )
|
||||
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 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -234,7 +705,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2 )
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -252,7 +723,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a
|
||||
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 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -270,7 +741,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -288,7 +759,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a
|
||||
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 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -306,7 +777,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3,
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -324,7 +795,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a
|
||||
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 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -342,7 +813,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3,
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -360,7 +831,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a
|
||||
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 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -378,7 +849,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3,
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -396,7 +867,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a
|
||||
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 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -414,7 +885,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3,
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -432,7 +903,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a
|
||||
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 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -450,7 +921,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3,
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -468,7 +939,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a
|
||||
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 ), boost::detail::sp_ms_deleter< T >() );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -486,7 +957,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3,
|
||||
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 ), boost::detail::sp_ms_deleter< T >(), a );
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a );
|
||||
|
||||
boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
|
||||
|
||||
@ -503,6 +974,8 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a
|
||||
|
||||
#endif
|
||||
|
||||
#undef BOOST_SP_MSD
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <algorithm> // for std::swap
|
||||
#include <functional> // for std::less
|
||||
#include <typeinfo> // for std::bad_cast
|
||||
#include <cstddef> // for std::size_t
|
||||
|
||||
#if !defined(BOOST_NO_IOSTREAM)
|
||||
#if !defined(BOOST_NO_IOSFWD)
|
||||
@ -50,11 +51,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4284) // odd return type for operator->
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@ -688,14 +684,19 @@ template<class T> inline bool atomic_compare_exchange_explicit( shared_ptr<T> *
|
||||
return atomic_compare_exchange( p, v, w ); // std::move( w )
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // !defined(BOOST_SP_NO_ATOMIC_ACCESS)
|
||||
|
||||
// hash_value
|
||||
|
||||
template< class T > struct hash;
|
||||
|
||||
template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p )
|
||||
{
|
||||
return boost::hash< T* >()( p.get() );
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
|
||||
|
@ -209,6 +209,36 @@ namespace boost{
|
||||
// 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.
|
||||
|
||||
#if !defined(BOOST_NO_CWCTYPE)
|
||||
template<typename traits, int N>
|
||||
struct traits_extension_details : public traits {
|
||||
typedef typename traits::char_type char_type;
|
||||
static bool isspace(char_type c)
|
||||
{
|
||||
return std::iswspace(c) != 0;
|
||||
}
|
||||
static bool ispunct(char_type c)
|
||||
{
|
||||
return std::iswpunct(c) != 0;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename traits>
|
||||
struct traits_extension_details<traits, 1> : public traits {
|
||||
typedef typename traits::char_type char_type;
|
||||
static bool isspace(char_type c)
|
||||
{
|
||||
return std::isspace(c) != 0;
|
||||
}
|
||||
static bool ispunct(char_type c)
|
||||
{
|
||||
return std::ispunct(c) != 0;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// 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>
|
||||
@ -217,10 +247,7 @@ namespace boost{
|
||||
static bool isspace(char_type c)
|
||||
{
|
||||
#if !defined(BOOST_NO_CWCTYPE)
|
||||
if (sizeof(char_type) == 1)
|
||||
return std::isspace(static_cast<int>(c)) != 0;
|
||||
else
|
||||
return std::iswspace(static_cast<std::wint_t>(c)) != 0;
|
||||
return traits_extension_details<traits, sizeof(char_type)>::isspace(c);
|
||||
#else
|
||||
return static_cast< unsigned >(c) <= 255 && std::isspace(c) != 0;
|
||||
#endif
|
||||
@ -229,10 +256,7 @@ namespace boost{
|
||||
static bool ispunct(char_type c)
|
||||
{
|
||||
#if !defined(BOOST_NO_CWCTYPE)
|
||||
if (sizeof(char_type) == 1)
|
||||
return std::ispunct(static_cast<int>(c)) != 0;
|
||||
else
|
||||
return std::iswpunct(static_cast<std::wint_t>(c)) != 0;
|
||||
return traits_extension_details<traits, sizeof(char_type)>::ispunct(c);
|
||||
#else
|
||||
return static_cast< unsigned >(c) <= 255 && std::ispunct(c) != 0;
|
||||
#endif
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <ostream>
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "boost/tuple/tuple.hpp"
|
||||
|
||||
// This is ugly: one should be using twoargument isspace since whitspace can
|
||||
@ -244,6 +246,22 @@ print(std::ostream& o, const cons<T1, T2>& t) {
|
||||
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool handle_width(std::ostream& o, const T& t) {
|
||||
std::streamsize width = o.width();
|
||||
if(width == 0) return false;
|
||||
|
||||
std::ostringstream ss;
|
||||
|
||||
ss.copyfmt(o);
|
||||
ss.tie(0);
|
||||
ss.width(0);
|
||||
|
||||
ss << t;
|
||||
o << ss.str();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
@ -280,6 +298,23 @@ print(std::basic_ostream<CharType, CharTrait>& o, const cons<T1, T2>& t) {
|
||||
return print(o, t.tail);
|
||||
}
|
||||
|
||||
template<class CharT, class Traits, class T>
|
||||
inline bool handle_width(std::basic_ostream<CharT, Traits>& o, const T& t) {
|
||||
std::streamsize width = o.width();
|
||||
if(width == 0) return false;
|
||||
|
||||
std::basic_ostringstream<CharT, Traits> ss;
|
||||
|
||||
ss.copyfmt(o);
|
||||
ss.tie(0);
|
||||
ss.width(0);
|
||||
|
||||
ss << t;
|
||||
o << ss.str();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_TEMPLATED_STREAMS
|
||||
|
||||
} // namespace detail
|
||||
@ -288,6 +323,7 @@ print(std::basic_ostream<CharType, CharTrait>& o, const cons<T1, T2>& t) {
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& o, const null_type& t) {
|
||||
if (!o.good() ) return o;
|
||||
if (detail::handle_width(o, t)) return o;
|
||||
|
||||
const char l =
|
||||
detail::format_info::get_manipulator(o, detail::format_info::open);
|
||||
@ -303,6 +339,7 @@ inline std::ostream& operator<<(std::ostream& o, const null_type& t) {
|
||||
template<class T1, class T2>
|
||||
inline std::ostream& operator<<(std::ostream& o, const cons<T1, T2>& t) {
|
||||
if (!o.good() ) return o;
|
||||
if (detail::handle_width(o, t)) return o;
|
||||
|
||||
const char l =
|
||||
detail::format_info::get_manipulator(o, detail::format_info::open);
|
||||
@ -325,6 +362,7 @@ inline std::basic_ostream<CharType, CharTrait>&
|
||||
operator<<(std::basic_ostream<CharType, CharTrait>& o,
|
||||
const null_type& t) {
|
||||
if (!o.good() ) return o;
|
||||
if (detail::handle_width(o, t)) return o;
|
||||
|
||||
const CharType l =
|
||||
detail::format_info::get_manipulator(o, detail::format_info::open);
|
||||
@ -342,6 +380,7 @@ inline std::basic_ostream<CharType, CharTrait>&
|
||||
operator<<(std::basic_ostream<CharType, CharTrait>& o,
|
||||
const cons<T1, T2>& t) {
|
||||
if (!o.good() ) return o;
|
||||
if (detail::handle_width(o, t)) return o;
|
||||
|
||||
const CharType l =
|
||||
detail::format_info::get_manipulator(o, detail::format_info::open);
|
||||
|
@ -28,7 +28,7 @@
|
||||
// shall name T&&; otherwise, type shall name T. [ Note: This rule reflects
|
||||
// the semantics of reference collapsing. For example, when a type T names
|
||||
// a type T1&, the type add_rvalue_reference<T>::type is not an rvalue
|
||||
// reference. —end note ]
|
||||
// reference. -end note ]
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
namespace boost {
|
||||
@ -65,3 +65,4 @@ BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename boost::type_traits_
|
||||
#include <boost/type_traits/detail/type_trait_undef.hpp>
|
||||
|
||||
#endif // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
|
||||
|
||||
|
@ -93,7 +93,7 @@ BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(alignment_of,T,::boost::detail::alignment_of_impl
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <typename T>
|
||||
struct alignment_of<T&>
|
||||
: alignment_of<T*>
|
||||
: public alignment_of<T*>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
@ -11,20 +11,20 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef __SUNPRO_CC
|
||||
#if defined(__SUNPRO_CC) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF)
|
||||
# define BOOST_COMMON_TYPE_DONT_USE_TYPEOF
|
||||
#endif
|
||||
#ifdef __IBMCPP__
|
||||
#if defined(__IBMCPP__) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF)
|
||||
# define BOOST_COMMON_TYPE_DONT_USE_TYPEOF
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
#if defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
#if defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_COMMON_TYPE_ARITY)
|
||||
#define BOOST_COMMON_TYPE_ARITY 3
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
#if defined(BOOST_NO_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF)
|
||||
#if defined(BOOST_NO_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) && !defined(BOOST_TYPEOF_SILENT)
|
||||
#define BOOST_TYPEOF_SILENT
|
||||
#include <boost/typeof/typeof.hpp> // boost wonders never cease!
|
||||
#endif
|
||||
@ -141,7 +141,7 @@ namespace type_traits_detail {
|
||||
template <class T, class U>
|
||||
struct common_type<T, U, void>
|
||||
#endif
|
||||
: type_traits_detail::common_type_2<T,U>
|
||||
: public type_traits_detail::common_type_2<T,U>
|
||||
{ };
|
||||
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// $Source$
|
||||
// $Date: 2006-07-12 07:10:22 -0400 (Wed, 12 Jul 2006) $
|
||||
// $Revision: 34511 $
|
||||
// $Date: 2011-04-25 08:26:48 -0400 (Mon, 25 Apr 2011) $
|
||||
// $Revision: 71481 $
|
||||
|
||||
#include <boost/type_traits/detail/template_arity_spec.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
@ -60,7 +60,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_TT_AUX_BOOL_C_BASE
|
||||
# define BOOST_TT_AUX_BOOL_C_BASE(C) : ::boost::integral_constant<bool,C>
|
||||
# define BOOST_TT_AUX_BOOL_C_BASE(C) : public ::boost::integral_constant<bool,C>
|
||||
#endif
|
||||
|
||||
|
||||
@ -68,6 +68,7 @@
|
||||
template< typename T > struct trait \
|
||||
BOOST_TT_AUX_BOOL_C_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \
|
||||
}; \
|
||||
@ -80,6 +81,7 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \
|
||||
template< typename T1, typename T2 > struct trait \
|
||||
BOOST_TT_AUX_BOOL_C_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2,trait,(T1,T2)) \
|
||||
}; \
|
||||
@ -91,6 +93,7 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,trait) \
|
||||
template<> struct trait< sp > \
|
||||
BOOST_TT_AUX_BOOL_C_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(sp)) \
|
||||
}; \
|
||||
@ -100,6 +103,7 @@ template<> struct trait< sp > \
|
||||
template<> struct trait< sp1,sp2 > \
|
||||
BOOST_TT_AUX_BOOL_C_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \
|
||||
}; \
|
||||
@ -108,6 +112,7 @@ template<> struct trait< sp1,sp2 > \
|
||||
#define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(trait,sp,C) \
|
||||
template<> struct trait##_impl< sp > \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_STATIC_CONSTANT(bool, value = (C)); \
|
||||
}; \
|
||||
/**/
|
||||
@ -115,6 +120,7 @@ template<> struct trait##_impl< sp > \
|
||||
#define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,sp1,sp2,C) \
|
||||
template<> struct trait##_impl< sp1,sp2 > \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_STATIC_CONSTANT(bool, value = (C)); \
|
||||
}; \
|
||||
/**/
|
||||
@ -123,6 +129,7 @@ template<> struct trait##_impl< sp1,sp2 > \
|
||||
template< param > struct trait< sp > \
|
||||
BOOST_TT_AUX_BOOL_C_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
|
||||
}; \
|
||||
/**/
|
||||
@ -131,6 +138,7 @@ template< param > struct trait< sp > \
|
||||
template< param1, param2 > struct trait< sp > \
|
||||
BOOST_TT_AUX_BOOL_C_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
|
||||
}; \
|
||||
/**/
|
||||
@ -139,6 +147,7 @@ template< param1, param2 > struct trait< sp > \
|
||||
template< param > struct trait< sp1,sp2 > \
|
||||
BOOST_TT_AUX_BOOL_C_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \
|
||||
}; \
|
||||
@ -148,6 +157,7 @@ template< param > struct trait< sp1,sp2 > \
|
||||
template< param1, param2 > struct trait< sp1,sp2 > \
|
||||
BOOST_TT_AUX_BOOL_C_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
|
||||
}; \
|
||||
/**/
|
||||
@ -155,6 +165,7 @@ template< param1, param2 > struct trait< sp1,sp2 > \
|
||||
#define BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \
|
||||
template< param > struct trait##_impl< sp1,sp2 > \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_STATIC_CONSTANT(bool, value = (C)); \
|
||||
}; \
|
||||
/**/
|
||||
|
@ -77,7 +77,7 @@ namespace detail {
|
||||
// Use the implementation above for non function pointers
|
||||
template <typename T, unsigned Select
|
||||
= (unsigned)sizeof(::boost::type_traits::gcc8503::mini_funcptr_tester((T)0)) >
|
||||
struct cv_traits_imp : ::boost::type_traits::gcc8503::cv_traits_imp<T> { };
|
||||
struct cv_traits_imp : public ::boost::type_traits::gcc8503::cv_traits_imp<T> { };
|
||||
|
||||
// Functions are never cv-qualified
|
||||
template <typename T> struct cv_traits_imp<T*,1>
|
||||
|
@ -8,8 +8,8 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// $Source$
|
||||
// $Date: 2005-08-25 12:27:28 -0400 (Thu, 25 Aug 2005) $
|
||||
// $Revision: 30670 $
|
||||
// $Date: 2011-04-25 08:26:48 -0400 (Mon, 25 Apr 2011) $
|
||||
// $Revision: 71481 $
|
||||
|
||||
#include <boost/type_traits/detail/template_arity_spec.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
@ -19,10 +19,10 @@
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300
|
||||
# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::integral_constant<std::size_t,C>
|
||||
# define BOOST_TT_AUX_SIZE_T_BASE(C) public ::boost::integral_constant<std::size_t,C>
|
||||
# define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) /**/
|
||||
#else
|
||||
# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::mpl::size_t<C>
|
||||
# define BOOST_TT_AUX_SIZE_T_BASE(C) public ::boost::mpl::size_t<C>
|
||||
# define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \
|
||||
typedef ::boost::mpl::size_t<C> base_; \
|
||||
using base_::value; \
|
||||
@ -34,6 +34,7 @@
|
||||
template< typename T > struct trait \
|
||||
: BOOST_TT_AUX_SIZE_T_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \
|
||||
}; \
|
||||
@ -45,6 +46,7 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \
|
||||
template<> struct trait<spec> \
|
||||
: BOOST_TT_AUX_SIZE_T_BASE(C) \
|
||||
{ \
|
||||
public:\
|
||||
BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \
|
||||
}; \
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user