diff --git a/boost/ChangeLog b/boost/ChangeLog index dd4ec3d7df..05400b33ac 100644 --- a/boost/ChangeLog +++ b/boost/ChangeLog @@ -1,3 +1,10 @@ +2002-07-29 Lars Gullik Bjønnes + + * update boost + [Remember that all changes to boost code _must_ go through me, + then I can sync up with my boost tree, and also request changes on + the boost developers list.] + 2002-06-18 Angus Leeming Reapplied: diff --git a/boost/boost/array_traits.hpp b/boost/boost/array_traits.hpp index 0ea66d405e..b8ae77ab5b 100644 --- a/boost/boost/array_traits.hpp +++ b/boost/boost/array_traits.hpp @@ -13,7 +13,7 @@ // Author: Dietmar Kuehl dietmar.kuehl@claas-solutions.de // Title: STL container support, including support for built-in arrays -// Version: $Id: array_traits.hpp,v 1.3 2002/06/18 15:39:24 larsbj Exp $ +// Version: $Id: array_traits.hpp,v 1.4 2002/07/28 23:38:36 larsbj Exp $ // Dec 4, 2000 Added some more typedefs to array_traits including // an iterator type to supersede iter_type. -J.Siek diff --git a/boost/boost/bind.hpp b/boost/boost/bind.hpp index 5a3ffbfd43..5480d1f2f8 100644 --- a/boost/boost/bind.hpp +++ b/boost/boost/bind.hpp @@ -1343,6 +1343,18 @@ template + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST + +#endif + #ifdef BOOST_BIND_ENABLE_PASCAL #define BOOST_BIND_ST pascal @@ -1377,6 +1389,18 @@ template + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC + +#endif + // data member pointers template diff --git a/boost/boost/bind/placeholders.hpp b/boost/boost/bind/placeholders.hpp index c76f7f5c7e..3e3d8336a6 100644 --- a/boost/boost/bind/placeholders.hpp +++ b/boost/boost/bind/placeholders.hpp @@ -36,7 +36,7 @@ static inline boost::arg<7> _7() { return boost::arg<7>(); } static inline boost::arg<8> _8() { return boost::arg<8>(); } static inline boost::arg<9> _9() { return boost::arg<9>(); } -#elif defined(BOOST_MSVC) +#elif defined(BOOST_MSVC) && BOOST_MSVC <= 1300 static boost::arg<1> _1; static boost::arg<2> _2; diff --git a/boost/boost/cast.hpp b/boost/boost/cast.hpp index fcbad0d98e..bf5c77c3a1 100644 --- a/boost/boost/cast.hpp +++ b/boost/boost/cast.hpp @@ -48,6 +48,7 @@ # include # include # include +# include // 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 @@ -125,54 +126,77 @@ namespace boost namespace detail { - template struct numeric_min_select; - - template<> - struct numeric_min_select - { - template - struct limits : std::numeric_limits + template + struct signed_numeric_limits : std::numeric_limits + { + static inline T min() { - static inline T min() -# ifndef __GNUC__ // bug workaround courtesy Jens Maurer - { - return std::numeric_limits::min() >= 0 + return std::numeric_limits::min() >= 0 // unary minus causes integral promotion, thus the static_cast<> ? static_cast(-std::numeric_limits::max()) : std::numeric_limits::min(); - } -# else - ; -# endif }; - }; - -# ifdef __GNUC__ // bug workaround courtesy Jens Maurer - template<> template - inline T numeric_min_select::limits::min() - { - return std::numeric_limits::min() >= 0 - // unary minus causes integral promotion, thus the static_cast<> - ? static_cast(-std::numeric_limits::max()) - : std::numeric_limits::min(); - } -# endif - - template<> - struct numeric_min_select - { - template - struct limits : std::numeric_limits {}; }; - + // Move to namespace boost in utility.hpp? + template + struct fixed_numeric_limits_base + : public if_true< std::numeric_limits::is_signed > + ::template then< signed_numeric_limits, + std::numeric_limits + >::type + {}; + template struct fixed_numeric_limits - : public numeric_min_select< - std::numeric_limits::is_signed - >::template limits + : fixed_numeric_limits_base::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_STATIC_CONSTANT(bool, is_specialized = true); + BOOST_STATIC_CONSTANT(bool, is_signed = true); + static long long max() + { +# ifdef LONGLONG_MAX + return LONGLONG_MAX; +# else + return 9223372036854775807LL; // hope this is portable +# endif + } + + static long long min() + { +# ifdef LONGLONG_MIN + return LONGLONG_MIN; +# else + return -9223372036854775808LL; // hope this is portable +# endif + } }; + + template <> + struct fixed_numeric_limits_base + { + BOOST_STATIC_CONSTANT(bool, is_specialized = true); + BOOST_STATIC_CONSTANT(bool, is_signed = false); + static unsigned long long max() + { +# ifdef ULONGLONG_MAX + return ULONGLONG_MAX; +# else + return 0xffffffffffffffffULL; // hope this is portable +# endif + } + + static unsigned long long min() { return 0; } + }; +# endif } // namespace detail // less_than_type_min - @@ -236,6 +260,24 @@ namespace boost template static inline bool check(X x, Y) { return x >= 0 && static_cast(static_cast(x)) != x; } + +# if defined(BOOST_MSVC) && BOOST_MSVC <= 1200 + // 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(x); \ + bool odd = y & 0x1; \ + __int64 div2 = static_cast<__int64>(y >> 1); \ + return ((static_cast(div2) * 2.0) + odd) != x; \ + } + + BOOST_UINT64_CAST(long double); + BOOST_UINT64_CAST(double); + BOOST_UINT64_CAST(float); +# undef BOOST_UINT64_CAST +# endif }; template<> @@ -292,7 +334,7 @@ namespace boost inline Target numeric_cast(Source arg BOOST_EXPLICIT_DEFAULT_TARGET) { // typedefs abbreviating respective trait classes - typedef std::numeric_limits arg_traits; + typedef detail::fixed_numeric_limits arg_traits; typedef detail::fixed_numeric_limits result_traits; #if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_SGI_CPP_LIMITS) diff --git a/boost/boost/concept_check.hpp b/boost/boost/concept_check.hpp index 882bd1dbb9..decd413166 100644 --- a/boost/boost/concept_check.hpp +++ b/boost/boost/concept_check.hpp @@ -22,7 +22,7 @@ #include -#if defined(BOOST_MSVC) || defined(__BORLANDC__) +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__) #define BOOST_FPTR #else #define BOOST_FPTR & diff --git a/boost/boost/config/compiler/common_edg.hpp b/boost/boost/config/compiler/common_edg.hpp index c8522dd167..93a5ee3a62 100644 --- a/boost/boost/config/compiler/common_edg.hpp +++ b/boost/boost/config/compiler/common_edg.hpp @@ -26,9 +26,18 @@ # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP #endif +# if !defined(__EXCEPTIONS) +# define BOOST_NO_EXCEPTIONS +# endif + +# if !defined(__NO_LONG_LONG) +# define BOOST_HAS_LONG_LONG +# endif + #ifdef c_plusplus // EDG has "long long" in non-strict mode // However, some libraries have insufficient "long long" support // #define BOOST_HAS_LONG_LONG #endif + diff --git a/boost/boost/config/compiler/metrowerks.hpp b/boost/boost/config/compiler/metrowerks.hpp index a190025270..43f35008bc 100644 --- a/boost/boost/config/compiler/metrowerks.hpp +++ b/boost/boost/config/compiler/metrowerks.hpp @@ -23,7 +23,7 @@ //# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING # endif -# if(__MWERKS__ <= 0x2406) || !defined(BOOST_STRICT_CONFIG) // 7.0 & 7.1 +# if(__MWERKS__ <= 0x2407) // 7.x # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif @@ -32,8 +32,15 @@ # define BOOST_NO_INTRINSIC_WCHAR_T #endif +# if __MWERKS__ == 0x3000 +# define BOOST_COMPILER_VERSION 8.0 +# elif __MWERKS__ == 0x3001 +# define BOOST_COMPILER_VERSION 8.1 +# else +# define BOOST_COMPILER_VERSION __MWERKS__ +# endif -#define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(__MWERKS__) +#define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // // versions check: @@ -42,8 +49,8 @@ # error "Compiler not supported or configured - please reconfigure" #endif // -// last known and checked version is 0x2406: -#if (__MWERKS__ > 0x2406) +// last known and checked version is 0x3001: +#if (__MWERKS__ > 0x3001) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif diff --git a/boost/boost/config/compiler/sunpro_cc.hpp b/boost/boost/config/compiler/sunpro_cc.hpp index bc3915cdd4..dab038ff4a 100644 --- a/boost/boost/config/compiler/sunpro_cc.hpp +++ b/boost/boost/config/compiler/sunpro_cc.hpp @@ -43,6 +43,7 @@ // integral constant expressions with 64 bit numbers fail # define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_TEMPLATE_TEMPLATES # endif #define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC) @@ -64,3 +65,4 @@ + diff --git a/boost/boost/config/compiler/visualc.hpp b/boost/boost/config/compiler/visualc.hpp index fe604f5ff1..8aeb1e187b 100644 --- a/boost/boost/config/compiler/visualc.hpp +++ b/boost/boost/config/compiler/visualc.hpp @@ -19,9 +19,6 @@ # define BOOST_NO_VOID_RETURNS // disable min/max macro defines on vc6: // -# ifndef NOMINMAX -# define NOMINMAX -# endif #endif #if (_MSC_VER <= 1300) // || !defined(BOOST_STRICT_CONFIG) // VC7 Beta 2 or later @@ -50,15 +47,6 @@ # define BOOST_NO_TEMPLATE_TEMPLATES # if (_MSC_VER > 1200) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS -# endif - // - // disable min/max macros if defined: - // -# ifdef min -# undef min -# endif -# ifdef max -# undef max # endif #endif @@ -91,9 +79,15 @@ # define BOOST_DISABLE_WIN32 #endif +# if _MSC_VER == 1200 +# define BOOST_COMPILER_VERSION 6.0 +# elif _MSC_VER == 1300 +# define BOOST_COMPILER_VERSION 7.0 +# else +# define BOOST_COMPILER_VERSION _MSC_VER +# endif - -#define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(_MSC_VER) +#define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // // versions check: @@ -102,8 +96,8 @@ #error "Compiler not supported or configured - please reconfigure" #endif // -// last known and checked version is 1301: -#if (_MSC_VER > 1301) +// last known and checked version is 1310: +#if (_MSC_VER > 1310) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else diff --git a/boost/boost/config/platform/win32.hpp b/boost/boost/config/platform/win32.hpp index 491b8c3d95..cd9ea0d37b 100644 --- a/boost/boost/config/platform/win32.hpp +++ b/boost/boost/config/platform/win32.hpp @@ -37,3 +37,42 @@ #define BOOST_HAS_FTIME #endif + +// +// disable min/max macros: +// +#ifdef min +# undef min +#endif +#ifdef max +# undef max +#endif +#ifndef NOMINMAX +# define NOMINMAX +#endif + +#ifdef BOOST_MSVC +namespace std{ + // Apparently, something in the Microsoft libraries requires the "long" + // overload, because it calls the min/max functions with arguments of + // slightly different type. (If this proves to be incorrect, this + // whole "BOOST_MSVC" section can be removed.) + inline long min(long __a, long __b) { + return __b < __a ? __b : __a; + } + inline long max(long __a, long __b) { + return __a < __b ? __b : __a; + } + // The "long double" overload is required, otherwise user code calling + // min/max for floating-point numbers will use the "long" overload. + // (SourceForge bug #495495) + inline long double min(long double __a, long double __b) { + return __b < __a ? __b : __a; + } + inline long double max(long double __a, long double __b) { + return __a < __b ? __b : __a; + } +} +using std::min; +using std::max; +# endif diff --git a/boost/boost/config/select_stdlib_config.hpp b/boost/boost/config/select_stdlib_config.hpp index a3fa2ca5d0..dd24b77780 100644 --- a/boost/boost/config/select_stdlib_config.hpp +++ b/boost/boost/config/select_stdlib_config.hpp @@ -23,6 +23,10 @@ // can end up detecting that first rather than STLport: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp" +#elif defined(__LIBCOMO__) +// Commeau STL: +#define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp" + #elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) // Rogue Wave library: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/roguewave.hpp" diff --git a/boost/boost/config/stdlib/dinkumware.hpp b/boost/boost/config/stdlib/dinkumware.hpp index 5b13f7eafa..95689396c5 100644 --- a/boost/boost/config/stdlib/dinkumware.hpp +++ b/boost/boost/config/stdlib/dinkumware.hpp @@ -46,18 +46,13 @@ // Updated Dinkum library defines this, and provides // its own min and max definitions. # define BOOST_NO_STD_MIN_MAX -# undef min -# undef max -# endif -# ifndef NOMINMAX - // avoid spurious NOMINMAX redefinition warning -# define NOMINMAX +# define BOOST_NO_MS_INT64_NUMERIC_LIMITS # endif #endif -#if defined(_MSC_VER) && (_MSC_VER <= 1200) || !defined(_CPPLIB_VER) || _CPPLIB_VER < 306 +#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || !defined(_CPPLIB_VER) || _CPPLIB_VER < 306 // if we're using a dinkum lib that's - // been configured for VC6 then there is + // been configured for VC6/7 then there is // no iterator traits (true even for icl) # define BOOST_NO_STD_ITERATOR_TRAITS #endif diff --git a/boost/boost/config/stdlib/libstdcpp3.hpp b/boost/boost/config/stdlib/libstdcpp3.hpp index 7493677c07..e4ddcdf0e5 100644 --- a/boost/boost/config/stdlib/libstdcpp3.hpp +++ b/boost/boost/config/stdlib/libstdcpp3.hpp @@ -14,6 +14,7 @@ # define BOOST_NO_CWCHAR # define BOOST_NO_CWCTYPE # define BOOST_NO_STD_WSTRING +# define BOOST_NO_STD_WSTREAMBUF #endif #ifndef _GLIBCPP_USE_LONG_LONG diff --git a/boost/boost/config/stdlib/roguewave.hpp b/boost/boost/config/stdlib/roguewave.hpp index 07e3729280..7edea216ad 100644 --- a/boost/boost/config/stdlib/roguewave.hpp +++ b/boost/boost/config/stdlib/roguewave.hpp @@ -39,6 +39,13 @@ # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS #endif +// +// Borland version of numeric_limits lacks __int64 specialisation: +// +#ifdef __BORLANDC__ +# define BOOST_NO_MS_INT64_NUMERIC_LIMITS +#endif + // // No std::iterator if it can't figure out default template args: // diff --git a/boost/boost/config/stdlib/stlport.hpp b/boost/boost/config/stdlib/stlport.hpp index d97f316097..acea6c1f1d 100644 --- a/boost/boost/config/stdlib/stlport.hpp +++ b/boost/boost/config/stdlib/stlport.hpp @@ -83,13 +83,38 @@ // // Harold Howe says: // Borland switched to STLport in BCB6. Defining BOOST_NO_STDC_NAMESPACE with -// BCB6 does cause problems. If we detect BCB6, then don't define +// BCB6 does cause problems. If we detect C++ Builder, then don't define // BOOST_NO_STDC_NAMESPACE // -#if !defined(__BORLANDC__) || (__BORLANDC__ < 0x560) -# if defined(__STL_IMPORT_VENDOR_CSTD) || defined(__STL_USE_OWN_NAMESPACE) || defined(_STLP_IMPORT_VENDOR_CSTD) || defined(_STLP_USE_OWN_NAMESPACE) +#if !defined(__BORLANDC__) +// +// If STLport is using it's own namespace, and the real names are in +// the global namespace, then we duplicate STLport's using declarations +// (by defining BOOST_NO_STDC_NAMESPACE), we do this because STLport doesn't +// necessarily import all the names we need into namespace std:: +// +# if (defined(__STL_IMPORT_VENDOR_CSTD) \ + || defined(__STL_USE_OWN_NAMESPACE) \ + || defined(_STLP_IMPORT_VENDOR_CSTD) \ + || defined(_STLP_USE_OWN_NAMESPACE)) \ + && (defined(__STL_VENDOR_GLOBAL_CSTD) || defined (_STLP_VENDOR_GLOBAL_CSTD)) # define BOOST_NO_STDC_NAMESPACE # endif +#elif __BORLANDC__ < 0x560 +// STLport doesn't import std::abs correctly: +#include +namespace std { using ::abs; } +// and strcmp/strcpy don't get imported either ('cos they are macros) +#include +#ifdef strcpy +# undef strcpy +#endif +#ifdef strcmp +# undef strcmp +#endif +#ifdef _STLP_VENDOR_CSTD +namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; } +#endif #endif // @@ -126,3 +151,4 @@ + diff --git a/boost/boost/config/suffix.hpp b/boost/boost/config/suffix.hpp index 7175f80b6a..abffd3b06b 100644 --- a/boost/boost/config/suffix.hpp +++ b/boost/boost/config/suffix.hpp @@ -28,7 +28,8 @@ // no namespace issues from this. // #include -# if !defined(BOOST_MSVC) && !defined(__BORLANDC__) \ +# if !defined(BOOST_HAS_LONG_LONG) \ + && !(defined(BOOST_MSVC) && BOOST_MSVC <=1300) && !defined(__BORLANDC__) \ && (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) # define BOOST_HAS_LONG_LONG #endif @@ -66,8 +67,26 @@ # if defined(BOOST_NO_LIMITS) \ && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# define BOOST_NO_MS_INT64_NUMERIC_LIMITS +# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS # endif +// +// if there is no long long then there is no specialisation +// for numeric_limits either: +// +#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS) +# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS +#endif + +// +// if there is no __int64 then there is no specialisation +// for numeric_limits<__int64> either: +// +#if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS) +# define BOOST_NO_MS_INT64_NUMERIC_LIMITS +#endif + // // if member templates are supported then so is the // VC6 subset of member templates: @@ -127,6 +146,13 @@ # define BOOST_NO_STD_MESSAGES # endif +// +// We can't have a working std::wstreambuf if there is no std::locale: +// +# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF) +# define BOOST_NO_STD_WSTREAMBUF +# endif + // // We can't have a if there is no : // @@ -225,27 +251,6 @@ namespace std { inline const _Tp& max(const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; } -# ifdef BOOST_MSVC - // Apparently, something in the Microsoft libraries requires the "long" - // overload, because it calls the min/max functions with arguments of - // slightly different type. (If this proves to be incorrect, this - // whole "BOOST_MSVC" section can be removed.) - inline long min(long __a, long __b) { - return __b < __a ? __b : __a; - } - inline long max(long __a, long __b) { - return __a < __b ? __b : __a; - } - // The "long double" overload is required, otherwise user code calling - // min/max for floating-point numbers will use the "long" overload. - // (SourceForge bug #495495) - inline long double min(long double __a, long double __b) { - return __b < __a ? __b : __a; - } - inline long double max(long double __a, long double __b) { - return __a < __b ? __b : __a; - } -# endif } # endif @@ -344,3 +349,4 @@ namespace std { #endif + diff --git a/boost/boost/detail/algorithm.hpp b/boost/boost/detail/algorithm.hpp index a26ed3eabc..4cc52c1e76 100644 --- a/boost/boost/detail/algorithm.hpp +++ b/boost/boost/detail/algorithm.hpp @@ -210,7 +210,7 @@ namespace boost { ForwardIterator next = first; for (++next; next != last; first = next, ++next) { if (*next < *first) - return false; + return false; } return true; @@ -218,7 +218,7 @@ namespace boost { template bool is_sorted(ForwardIterator first, ForwardIterator last, - StrictWeakOrdering comp) + StrictWeakOrdering comp) { if (first == last) return true; @@ -226,7 +226,7 @@ namespace boost { ForwardIterator next = first; for (++next; next != last; first = next, ++next) { if (comp(*next, *first)) - return false; + return false; } return true; diff --git a/boost/boost/detail/lightweight_mutex.hpp b/boost/boost/detail/lightweight_mutex.hpp index b92b576c92..da9e5754fe 100644 --- a/boost/boost/detail/lightweight_mutex.hpp +++ b/boost/boost/detail/lightweight_mutex.hpp @@ -15,10 +15,10 @@ // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // -// typedef boost::detail::lightweight_mutex; +// typedef boost::detail::lightweight_mutex; // -// boost::detail::lightweight_mutex meets the Mutex concept requirements -// See http://www.boost.org/libs/thread/doc/mutex_concept.html#Mutex +// boost::detail::lightweight_mutex meets a subset of the Mutex concept +// requirements: http://www.boost.org/libs/thread/doc/mutex_concept.html#Mutex // // * Used by the smart pointer library // * Performance oriented @@ -30,6 +30,23 @@ // lightweight_mutex does not guarantee fairness. // * Never keep a lightweight_mutex locked for long periods. // +// The current implementation can use a pthread_mutex, a CRITICAL_SECTION, +// or a platform-specific spinlock. +// +// You can force a particular implementation by defining BOOST_LWM_USE_PTHREADS, +// BOOST_LWM_USE_CRITICAL_SECTION, or BOOST_LWM_USE_SPINLOCK. +// +// If neither macro has been defined, the default is to use a spinlock on Win32, +// and a pthread_mutex otherwise. +// +// Note that a spinlock is not a general synchronization primitive. In particular, +// it is not guaranteed to be a memory barrier, and it is possible to "livelock" +// if a lower-priority thread has acquired the spinlock but a higher-priority +// thread is spinning trying to acquire the same lock. +// +// For these reasons, spinlocks have been disabled by default except on Windows, +// where a spinlock can be several orders of magnitude faster than a CRITICAL_SECTION. + // Note: lwm_linux.hpp has been disabled by default; see the comments // inside for more info. @@ -37,8 +54,7 @@ #include -// -// Note to implementors: if you write a platform-specific lightweight_mutex +// Note to implementors: if you write a platform-specific spinlock // for a platform that supports pthreads, be sure to test its performance // against the pthreads-based version using shared_ptr_timing_test.cpp and // shared_ptr_mt_test.cpp. Custom versions are usually not worth the trouble @@ -47,11 +63,10 @@ // Be sure to compare against a "real" pthreads library; // shared_ptr_timing_test.cpp will compile succesfully with a stub do-nothing // pthreads library, since it doesn't create any threads. -// #ifndef BOOST_HAS_THREADS # include -#elif defined(BOOST_USE_ASM_ATOMIC_H) +#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(BOOST_USE_ASM_ATOMIC_H) # include #elif defined(BOOST_LWM_USE_CRITICAL_SECTION) # include @@ -59,9 +74,9 @@ # include #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) # include -#elif defined(__sgi) +#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(__sgi) # include -#elif defined(__GLIBCPP__) +#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(__GLIBCPP__) # include #elif defined(BOOST_HAS_PTHREADS) # define BOOST_LWM_USE_PTHREADS diff --git a/boost/boost/detail/limits.hpp b/boost/boost/detail/limits.hpp index df9298683a..2dd2ad914b 100644 --- a/boost/boost/detail/limits.hpp +++ b/boost/boost/detail/limits.hpp @@ -133,8 +133,8 @@ public: BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, false); BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style, - has_denorm, - denorm_absent); + has_denorm, + denorm_absent); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); static __number infinity() throw() { return __number(); } @@ -149,17 +149,17 @@ public: BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false); BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, - round_style, - round_toward_zero); + round_style, + round_toward_zero); }; // Base class for integers. template -class _Integer_limits : public _Numeric_limits_base<_Int> + _Int __imin, + _Int __imax, + int __idigits = -1> +class _Integer_limits : public _Numeric_limits_base<_Int> { public: BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true); @@ -168,12 +168,12 @@ public: static _Int max() throw() { return __imax; } BOOST_STL_DECLARE_LIMITS_MEMBER(int, - digits, - (__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT) - - (__imin == 0 ? 0 : 1) - : __idigits); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000); - // log 2 = 0.301029995664... + digits, + (__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT) + - (__imin == 0 ? 0 : 1) + : __idigits); + BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000); + // log 2 = 0.301029995664... BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, __imin != 0); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, true); @@ -192,7 +192,7 @@ public: // sizeof(long double) == 16 const unsigned int _S_word[4] = { Word, 0, 0, 0 }; return *reinterpret_cast(&_S_word); - } + } }; #else @@ -203,22 +203,22 @@ public: // sizeof(long double) == 12, but only 10 bytes significant const unsigned int _S_word[4] = { 0, 0, 0, Word }; return *reinterpret_cast( - reinterpret_cast(&_S_word)+16- - (sizeof(Number) == 12 ? 10 : sizeof(Number))); - } + reinterpret_cast(&_S_word)+16- + (sizeof(Number) == 12 ? 10 : sizeof(Number))); + } }; #endif // Base class for floating-point numbers. template + int __Digits, int __Digits10, + int __MinExp, int __MaxExp, + int __MinExp10, int __MaxExp10, + unsigned int __InfinityWord, + unsigned int __QNaNWord, unsigned int __SNaNWord, + bool __IsIEC559, + float_round_style __RoundStyle> class _Floating_limits : public _Numeric_limits_base<__number> { public: @@ -240,11 +240,11 @@ public: BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, true); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, true); BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style, - has_denorm, - denorm_indeterminate); + has_denorm, + denorm_indeterminate); BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); - + static __number infinity() throw() { return float_helper<__number, __InfinityWord>::get_word(); } @@ -267,7 +267,7 @@ public: // The unspecialized class. -template +template class numeric_limits : public _Numeric_limits_base {}; // Specializations for all built-in integral types. @@ -356,41 +356,36 @@ class numeric_limits #if !defined(LONGLONG_MIN) # define LONGLONG_MIN (-LONGLONG_MAX - 1) -#endif +#endif -template<> -class numeric_limits - : public _Integer_limits -{}; -template<> -class numeric_limits - : public _Integer_limits -{}; +#if !defined(ULONGLONG_MIN) +# define ULONGLONG_MIN 0 +#endif #endif /* __GNUC__ */ // Specializations for all built-in floating-point type. template<> class numeric_limits - : public _Floating_limits + true, // conforms to iec559 + round_to_nearest> { public: static float min() throw() { return FLT_MIN; } @@ -401,24 +396,24 @@ public: }; template<> class numeric_limits - : public _Floating_limits + true, // conforms to iec559 + round_to_nearest> { public: static double min() throw() { return DBL_MIN; } @@ -429,24 +424,24 @@ public: }; template<> class numeric_limits - : public _Floating_limits + false, // Doesn't conform to iec559 + round_to_nearest> { public: static long double min() throw() { return LDBL_MIN; } @@ -463,3 +458,6 @@ public: // Local Variables: // mode:C++ // End: + + + diff --git a/boost/boost/detail/lwm_win32.hpp b/boost/boost/detail/lwm_win32.hpp index a54aefcb01..abd18697e7 100644 --- a/boost/boost/detail/lwm_win32.hpp +++ b/boost/boost/detail/lwm_win32.hpp @@ -18,6 +18,10 @@ #include +#ifdef __BORLANDC__ +# pragma warn -8027 // Functions containing while are not expanded inline +#endif + namespace boost { @@ -57,7 +61,12 @@ public: { while( winapi::InterlockedExchange(&m_.l_, 1) ) { - winapi::Sleep(0); + // Note: changed to Sleep(1) from Sleep(0). + // According to MSDN, Sleep(0) will never yield + // to a lower-priority thread, whereas Sleep(1) + // will. Performance seems not to be affected. + + winapi::Sleep(1); } } @@ -65,8 +74,8 @@ public: { winapi::InterlockedExchange(&m_.l_, 0); - // Note: adding a Sleep(0) here will make - // the mutex more fair and will increase the overall + // Note: adding a yield here will make + // the spinlock more fair and will increase the overall // performance of some applications substantially in // high contention situations, but will penalize the // low contention / single thread case up to 5x @@ -78,4 +87,8 @@ public: } // namespace boost +#ifdef __BORLANDC__ +# pragma warn .8027 // Functions containing while are not expanded inline +#endif + #endif // #ifndef BOOST_DETAIL_LWM_WIN32_HPP_INCLUDED diff --git a/boost/boost/detail/numeric_traits.hpp b/boost/boost/detail/numeric_traits.hpp index f44ba2de5d..f8cbf36d43 100644 --- a/boost/boost/detail/numeric_traits.hpp +++ b/boost/boost/detail/numeric_traits.hpp @@ -81,7 +81,7 @@ namespace boost { namespace detail { template struct is_signed { -#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) +#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300 BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0))); #else BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits::is_signed); @@ -135,7 +135,7 @@ namespace boost { namespace detail { private: typedef Integer integer_type; typedef std::numeric_limits x; -# ifdef BOOST_MSVC +# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // for some reason, MSVC asserts when it shouldn't unless we make these // local definitions BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer); diff --git a/boost/boost/detail/ob_compressed_pair.hpp b/boost/boost/detail/ob_compressed_pair.hpp index f8efbb131b..a9e7b3ef6f 100644 --- a/boost/boost/detail/ob_compressed_pair.hpp +++ b/boost/boost/detail/ob_compressed_pair.hpp @@ -168,7 +168,7 @@ public: compressed_pair_1(const ::boost::compressed_pair& x) : T2(x.second()), _first(x.first()) {} -#ifdef BOOST_MSVC +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // Total weirdness. If the assignment to _first is moved after // the call to the inherited operator=, then this breaks graph/test/graph.cpp // by way of iterator_adaptor. diff --git a/boost/boost/detail/shared_count.hpp b/boost/boost/detail/shared_count.hpp index 918d647451..a3707a1af8 100644 --- a/boost/boost/detail/shared_count.hpp +++ b/boost/boost/detail/shared_count.hpp @@ -28,6 +28,11 @@ #include // for std::less #include // for std::exception +#ifdef __BORLANDC__ +# pragma warn -8026 // Functions with excep. spec. are not expanded inline +# pragma warn -8027 // Functions containing try are not expanded inline +#endif + namespace boost { @@ -37,7 +42,7 @@ public: virtual char const * what() const throw() { - return "use_count_is_zero"; + return "use_count_is_zero"; } }; @@ -50,14 +55,14 @@ private: public: counted_base(): - use_count_(0), weak_count_(0), self_deleter_(&self_delete) + use_count_(0), weak_count_(0) { } // pre: initial_use_count <= initial_weak_count explicit counted_base(long initial_use_count, long initial_weak_count): - use_count_(initial_use_count), weak_count_(initial_weak_count), self_deleter_(&self_delete) + use_count_(initial_use_count), weak_count_(initial_weak_count) { } @@ -78,76 +83,81 @@ public: { } + // destruct() is called when weak_count_ drops to zero. + + virtual void destruct() // nothrow + { + delete this; + } + void add_ref() { #ifdef BOOST_HAS_THREADS - mutex_type::scoped_lock lock(mtx_); + mutex_type::scoped_lock lock(mtx_); #endif #ifndef BOOST_NO_EXCEPTIONS - if(use_count_ == 0 && weak_count_ != 0) throw use_count_is_zero(); + if(use_count_ == 0 && weak_count_ != 0) throw use_count_is_zero(); #endif - BOOST_NOEH_ASSERT(!(use_count_ == 0 && weak_count_ != 0)); - ++use_count_; - ++weak_count_; + BOOST_NOEH_ASSERT(!(use_count_ == 0 && weak_count_ != 0)); + ++use_count_; + ++weak_count_; } void release() // nothrow { - long new_use_count; - long new_weak_count; + long new_use_count; + long new_weak_count; - { + { #ifdef BOOST_HAS_THREADS - mutex_type::scoped_lock lock(mtx_); + mutex_type::scoped_lock lock(mtx_); #endif - new_use_count = --use_count_; - new_weak_count = --weak_count_; - } + new_use_count = --use_count_; + new_weak_count = --weak_count_; + } - if(new_use_count == 0) - { - dispose(); - } + if(new_use_count == 0) + { + dispose(); + } - if(new_weak_count == 0) - { - // not a direct 'delete this', because the inlined - // release() may use a different heap manager - self_deleter_(this); - } + if(new_weak_count == 0) + { + destruct(); + } } void weak_add_ref() // nothrow { #ifdef BOOST_HAS_THREADS - mutex_type::scoped_lock lock(mtx_); + mutex_type::scoped_lock lock(mtx_); #endif - ++weak_count_; + ++weak_count_; } void weak_release() // nothrow { - long new_weak_count; + long new_weak_count; - { + { #ifdef BOOST_HAS_THREADS - mutex_type::scoped_lock lock(mtx_); + mutex_type::scoped_lock lock(mtx_); #endif - new_weak_count = --weak_count_; - } + new_weak_count = --weak_count_; + } - if(new_weak_count == 0) - { - self_deleter_(this); - } + if(new_weak_count == 0) + { + destruct(); + } } long use_count() const // nothrow { #ifdef BOOST_HAS_THREADS - mutex_type::scoped_lock lock(mtx_); + mutex_type::scoped_lock lock(mtx_); #endif - return use_count_; + return use_count_; } private: @@ -155,19 +165,14 @@ private: counted_base(counted_base const &); counted_base & operator= (counted_base const &); - static void self_delete(counted_base * p) - { - delete p; - } - // inv: use_count_ <= weak_count_ long use_count_; long weak_count_; + #ifdef BOOST_HAS_THREADS mutable mutex_type mtx_; #endif - void (*self_deleter_) (counted_base *); }; inline void intrusive_ptr_add_ref(counted_base * p) @@ -198,13 +203,13 @@ public: // pre: initial_use_count <= initial_weak_count, d(p) must not throw counted_base_impl(P p, D d, long initial_use_count, long initial_weak_count): - counted_base(initial_use_count, initial_weak_count), ptr(p), del(d) + counted_base(initial_use_count, initial_weak_count), ptr(p), del(d) { } virtual void dispose() // nothrow { - del(ptr); + del(ptr); } }; @@ -228,33 +233,30 @@ public: explicit shared_count(counted_base * pi): pi_(pi) // never throws { - pi_->add_ref(); + pi_->add_ref(); } template shared_count(P p, D d, void const * = 0): pi_(0) { #ifndef BOOST_NO_EXCEPTIONS - try - { + try + { + pi_ = new counted_base_impl(p, d, 1, 1); + } + catch(...) + { + d(p); // delete p + throw; + } +#else + pi_ = new counted_base_impl(p, d, 1, 1); + BOOST_NOEH_ASSERT(pi_); #endif - pi_ = new counted_base_impl(p, d, 1, 1); -#ifndef BOOST_NO_EXCEPTIONS - } -#endif -#ifndef BOOST_NO_EXCEPTIONS - catch(...) - - { - d(p); // delete p - throw; - } -#endif - BOOST_NOEH_ASSERT(pi_); } template shared_count(P, D, counted_base * pi): pi_(pi) { - pi_->add_ref(); + pi_->add_ref(); } #ifndef BOOST_NO_AUTO_PTR @@ -264,58 +266,58 @@ public: template explicit shared_count(std::auto_ptr & r): pi_(new counted_base_impl< Y *, checked_deleter >(r.get(), checked_deleter(), 1, 1)) { - r.release(); + r.release(); } #endif ~shared_count() // nothrow { - pi_->release(); + pi_->release(); } shared_count(shared_count const & r): pi_(r.pi_) // nothrow { - pi_->add_ref(); + pi_->add_ref(); } explicit shared_count(weak_count const & r); // throws use_count_is_zero when r.use_count() == 0 shared_count & operator= (shared_count const & r) // nothrow { - counted_base * tmp = r.pi_; - tmp->add_ref(); - pi_->release(); - pi_ = tmp; + counted_base * tmp = r.pi_; + tmp->add_ref(); + pi_->release(); + pi_ = tmp; - return *this; + return *this; } void swap(shared_count & r) // nothrow { - counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; + counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; } long use_count() const // nothrow { - return pi_->use_count(); + return pi_->use_count(); } bool unique() const // nothrow { - return pi_->use_count() == 1; + return pi_->use_count() == 1; } friend inline bool operator==(shared_count const & a, shared_count const & b) { - return a.pi_ == b.pi_; + return a.pi_ == b.pi_; } friend inline bool operator<(shared_count const & a, shared_count const & b) { - return std::less()(a.pi_, b.pi_); + return std::less()(a.pi_, b.pi_); } }; @@ -335,59 +337,59 @@ public: weak_count(shared_count const & r): pi_(r.pi_) // nothrow { - pi_->weak_add_ref(); + pi_->weak_add_ref(); } weak_count(weak_count const & r): pi_(r.pi_) // nothrow { - pi_->weak_add_ref(); + pi_->weak_add_ref(); } ~weak_count() // nothrow { - pi_->weak_release(); + pi_->weak_release(); } weak_count & operator= (shared_count const & r) // nothrow { - counted_base * tmp = r.pi_; - tmp->weak_add_ref(); - pi_->weak_release(); - pi_ = tmp; + counted_base * tmp = r.pi_; + tmp->weak_add_ref(); + pi_->weak_release(); + pi_ = tmp; - return *this; + return *this; } weak_count & operator= (weak_count const & r) // nothrow { - counted_base * tmp = r.pi_; - tmp->weak_add_ref(); - pi_->weak_release(); - pi_ = tmp; + counted_base * tmp = r.pi_; + tmp->weak_add_ref(); + pi_->weak_release(); + pi_ = tmp; - return *this; + return *this; } void swap(weak_count & r) // nothrow { - counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; + counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; } long use_count() const // nothrow { - return pi_->use_count(); + return pi_->use_count(); } friend inline bool operator==(weak_count const & a, weak_count const & b) { - return a.pi_ == b.pi_; + return a.pi_ == b.pi_; } friend inline bool operator<(weak_count const & a, weak_count const & b) { - return std::less()(a.pi_, b.pi_); + return std::less()(a.pi_, b.pi_); } }; @@ -400,4 +402,9 @@ inline shared_count::shared_count(weak_count const & r): pi_(r.pi_) } // namespace boost +#ifdef __BORLANDC__ +# pragma warn .8027 // Functions containing try are not expanded inline +# pragma warn .8026 // Functions with excep. spec. are not expanded inline +#endif + #endif // #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/boost/boost/detail/winapi.hpp b/boost/boost/detail/winapi.hpp index 0e9bb72711..340036a0ca 100644 --- a/boost/boost/detail/winapi.hpp +++ b/boost/boost/detail/winapi.hpp @@ -55,10 +55,41 @@ struct critical_section ulong_ptr_type SpinCount; }; +#if defined(_WIN64) + +// Intel 6.0 on Win64 version, posted by Tim Fenders to [boost-users] + +extern "C" long_type __cdecl _InterlockedIncrement(long_type volatile *); +extern "C" long_type __cdecl _InterlockedDecrement(long_type volatile *); +extern "C" long_type __cdecl _InterlockedExchange(long_type volatile *, long_type); + +#pragma intrinsic(_InterlockedIncrement) +#pragma intrinsic(_InterlockedDecrement) +#pragma intrinsic(_InterlockedExchange) + +inline long_type InterlockedIncrement(long_type volatile * lp) +{ + return _InterlockedIncrement(lp); +} + +inline long_type InterlockedDecrement(long_type volatile* lp) +{ + return _InterlockedDecrement(lp); +} + +inline long_type InterlockedExchange(long_type volatile* lp, long_type l) +{ + return _InterlockedExchange(lp, l); +} + +#else + extern "C" __declspec(dllimport) long_type __stdcall InterlockedIncrement(long_type volatile *); extern "C" __declspec(dllimport) long_type __stdcall InterlockedDecrement(long_type volatile *); extern "C" __declspec(dllimport) long_type __stdcall InterlockedExchange(long_type volatile *, long_type); +#endif + extern "C" __declspec(dllimport) void __stdcall Sleep(dword_type); extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(critical_section *); diff --git a/boost/boost/function.hpp b/boost/boost/function.hpp index 01e3fb3a9d..2cf9f0f741 100644 --- a/boost/boost/function.hpp +++ b/boost/boost/function.hpp @@ -20,6 +20,10 @@ #define BOOST_FUNCTION_HPP #include +#include +#include +#include +#include #include #include #include @@ -35,6 +39,207 @@ namespace boost { namespace detail { namespace function { +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template + struct function_traits + { + typedef void result_type; + typedef void arg1_type; + typedef void arg2_type; + typedef void arg3_type; + typedef void arg4_type; + typedef void arg5_type; + typedef void arg6_type; + typedef void arg7_type; + typedef void arg8_type; + typedef void arg9_type; + typedef void arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef unusable arg1_type; + typedef unusable arg2_type; + typedef unusable arg3_type; + typedef unusable arg4_type; + typedef unusable arg5_type; + typedef unusable arg6_type; + typedef unusable arg7_type; + typedef unusable arg8_type; + typedef unusable arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef unusable arg2_type; + typedef unusable arg3_type; + typedef unusable arg4_type; + typedef unusable arg5_type; + typedef unusable arg6_type; + typedef unusable arg7_type; + typedef unusable arg8_type; + typedef unusable arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef unusable arg3_type; + typedef unusable arg4_type; + typedef unusable arg5_type; + typedef unusable arg6_type; + typedef unusable arg7_type; + typedef unusable arg8_type; + typedef unusable arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef unusable arg4_type; + typedef unusable arg5_type; + typedef unusable arg6_type; + typedef unusable arg7_type; + typedef unusable arg8_type; + typedef unusable arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef unusable arg5_type; + typedef unusable arg6_type; + typedef unusable arg7_type; + typedef unusable arg8_type; + typedef unusable arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef unusable arg6_type; + typedef unusable arg7_type; + typedef unusable arg8_type; + typedef unusable arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef unusable arg7_type; + typedef unusable arg8_type; + typedef unusable arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef unusable arg8_type; + typedef unusable arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef T8 arg8_type; + typedef unusable arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef T8 arg8_type; + typedef T9 arg9_type; + typedef unusable arg10_type; + }; + + template + struct function_traits + { + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef T8 arg8_type; + typedef T9 arg9_type; + typedef T10 arg10_type; + }; +#endif + // Choose the appropriate underlying implementation template struct real_get_function_impl {}; @@ -319,24 +524,107 @@ namespace boost { }; }; - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy = empty_function_policy, - typename Mixin = empty_function_mixin, - typename Allocator = std::allocator - > - struct get_function_impl + template + struct is_not_same { + BOOST_STATIC_CONSTANT(bool, value = !(is_same::value)); + }; + + template< + typename InR, + typename InT1, + typename InT2, + typename InT3, + typename InT4, + typename InT5, + typename InT6, + typename InT7, + typename InT8, + typename InT9, + typename InT10, + typename InPolicy = empty_function_policy, + typename InMixin = empty_function_mixin, + typename InAllocator = std::allocator + > + class get_function_impl + { +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + typedef function_traits::type> traits; + public: + + typedef typename ct_if<(is_function::value), + typename traits::result_type, + InR>::type R; + typedef typename ct_if<(is_function::value), + typename traits::arg1_type, + InT1>::type T1; + typedef typename ct_if<(is_function::value), + typename traits::arg2_type, + InT2>::type T2; + typedef typename ct_if<(is_function::value), + typename traits::arg3_type, + InT3>::type T3; + typedef typename ct_if<(is_function::value), + typename traits::arg4_type, + InT4>::type T4; + typedef typename ct_if<(is_function::value), + typename traits::arg5_type, + InT5>::type T5; + typedef typename ct_if<(is_function::value), + typename traits::arg6_type, + InT6>::type T6; + typedef typename ct_if<(is_function::value), + typename traits::arg7_type, + InT7>::type T7; + typedef typename ct_if<(is_function::value), + typename traits::arg8_type, + InT8>::type T8; + typedef typename ct_if<(is_function::value), + typename traits::arg9_type, + InT9>::type T9; + typedef typename ct_if<(is_function::value), + typename traits::arg10_type, + InT10>::type T10; + typedef typename ct_if< + (type_traits::ice_and< + (is_function::value), + (is_not_same::value) + >::value), + InT1, + InPolicy>::type Policy; + + typedef typename ct_if< + (type_traits::ice_and< + (is_function::value), + (is_not_same::value) + >::value), + InT2, + InMixin>::type Mixin; + + typedef typename ct_if< + (type_traits::ice_and< + (is_function::value), + (is_not_same::value) + >::value), + InT3, + InAllocator>::type Allocator; +#else + public: + typedef InR R; + typedef InT1 T1; + typedef InT2 T2; + typedef InT3 T3; + typedef InT4 T4; + typedef InT5 T5; + typedef InT6 T6; + typedef InT7 T7; + typedef InT8 T8; + typedef InT9 T9; + typedef InT10 T10; + typedef InPolicy Policy; + typedef InMixin Mixin; + typedef InAllocator Allocator; +#endif typedef typename real_get_function_impl< (count_used_args::value) >::template params + typename InR, + typename InT1, + typename InT2, + typename InT3, + typename InT4, + typename InT5, + typename InT6, + typename InT7, + typename InT8, + typename InT9, + typename InT10, + typename InMyPolicy = empty_function_policy, + typename InMyMixin = empty_function_mixin, + typename InMyAllocator = std::allocator > - struct function_traits_builder + class function_traits_builder { - typedef typename get_function_impl::type - type; + typedef get_function_impl + impl; + typedef typename impl::R MyR; + typedef typename impl::T1 MyT1; + typedef typename impl::T2 MyT2; + typedef typename impl::T3 MyT3; + typedef typename impl::T4 MyT4; + typedef typename impl::T5 MyT5; + typedef typename impl::T6 MyT6; + typedef typename impl::T7 MyT7; + typedef typename impl::T8 MyT8; + typedef typename impl::T9 MyT9; + typedef typename impl::T10 MyT10; + typedef typename impl::Policy MyPolicy; + typedef typename impl::Mixin MyMixin; + typedef typename impl::Allocator MyAllocator; + + public: + typedef typename impl::type type; typedef MyPolicy policy_type; typedef MyMixin mixin_type; typedef MyAllocator allocator_type; @@ -374,28 +679,28 @@ namespace boost { #ifndef BOOST_NO_DEPENDENT_NESTED_DERIVATIONS template struct policy : - public function_traits_builder {}; + public function_traits_builder {}; template struct mixin : - public function_traits_builder {}; + public function_traits_builder {}; template struct allocator : - public function_traits_builder {}; + public function_traits_builder {}; #else template struct policy { - typedef typename function_traits_builder::type type; }; @@ -403,8 +708,9 @@ namespace boost { template struct mixin { - typedef typename function_traits_builder::type type; }; @@ -412,9 +718,10 @@ namespace boost { template struct allocator { - typedef typename function_traits_builder::type + typedef typename function_traits_builder::type type; }; #endif @@ -482,16 +789,19 @@ namespace boost { template void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { + int deprecated; self_type(f).swap(*this); } void set(const base_type& f) { + int deprecated; self_type(f).swap(*this); } void set(const self_type& f) { + int deprecated; self_type(f).swap(*this); } }; @@ -512,6 +822,6 @@ namespace boost { { f1.swap(f2); } -} +} // end namespace boost #endif diff --git a/boost/boost/function/function_template.hpp b/boost/boost/function/function_template.hpp index 0613cb4ed5..7c724fea61 100644 --- a/boost/boost/function/function_template.hpp +++ b/boost/boost/function/function_template.hpp @@ -14,7 +14,7 @@ // For more information, see http://www.boost.org // Note: this header is a header template and must NOT have multiple-inclusion -// protection. +// protection. #ifndef BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP #define BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP @@ -34,7 +34,7 @@ // Comma if nonzero number of arguments #if BOOST_FUNCTION_NUM_ARGS == 0 -# define BOOST_FUNCTION_COMMA +# define BOOST_FUNCTION_COMMA #else # define BOOST_FUNCTION_COMMA , #endif // BOOST_FUNCTION_NUM_ARGS > 0 @@ -44,7 +44,7 @@ #define BOOST_FUNCTION_FUNCTION_INVOKER \ BOOST_JOIN(function_invoker,BOOST_FUNCTION_NUM_ARGS) #define BOOST_FUNCTION_VOID_FUNCTION_INVOKER \ - BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) + BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) #define BOOST_FUNCTION_FUNCTION_OBJ_INVOKER \ BOOST_JOIN(function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) #define BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER \ @@ -64,163 +64,163 @@ namespace boost { namespace detail { namespace function { template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > + typename FunctionPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > struct BOOST_FUNCTION_FUNCTION_INVOKER { - static R invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - { - FunctionPtr f = reinterpret_cast(function_ptr.func_ptr); - return f(BOOST_FUNCTION_ARGS); - } + static R invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + { + FunctionPtr f = reinterpret_cast(function_ptr.func_ptr); + return f(BOOST_FUNCTION_ARGS); + } }; template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > + typename FunctionPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER { - static unusable invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static unusable invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) - { - FunctionPtr f = reinterpret_cast(function_ptr.func_ptr); - f(BOOST_FUNCTION_ARGS); - return unusable(); - } + { + FunctionPtr f = reinterpret_cast(function_ptr.func_ptr); + f(BOOST_FUNCTION_ARGS); + return unusable(); + } }; template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS > struct BOOST_FUNCTION_FUNCTION_OBJ_INVOKER { - static R invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static R invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) - { - FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr); - return (*f)(BOOST_FUNCTION_ARGS); - } + { + FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr); + return (*f)(BOOST_FUNCTION_ARGS); + } }; template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS > struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER { - static unusable invoke(any_pointer function_obj_ptr - BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static unusable invoke(any_pointer function_obj_ptr + BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) - { - FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr); - (*f)(BOOST_FUNCTION_ARGS); - return unusable(); - } + { + FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr); + (*f)(BOOST_FUNCTION_ARGS); + return unusable(); + } }; template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS > struct BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER { - static R invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) - { - FunctionObj f = FunctionObj(); - return f(BOOST_FUNCTION_ARGS); - } + static R invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) + { + FunctionObj f = FunctionObj(); + return f(BOOST_FUNCTION_ARGS); + } }; template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS > struct BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER { - static unusable invoke(any_pointer BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) + static unusable invoke(any_pointer BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) - { - FunctionObj f = FunctionObj(); - f(BOOST_FUNCTION_ARGS); - return unusable(); - } + { + FunctionObj f = FunctionObj(); + f(BOOST_FUNCTION_ARGS); + return unusable(); + } }; template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename FunctionPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS > struct BOOST_FUNCTION_GET_FUNCTION_INVOKER { - typedef typename ct_if<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; + typedef typename ct_if<(is_void::value), + BOOST_FUNCTION_VOID_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; }; template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS > struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER { - typedef typename ct_if<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; + typedef typename ct_if<(is_void::value), + BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; }; template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS > struct BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER { - typedef typename ct_if<(is_void::value), - BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; + typedef typename ct_if<(is_void::value), + BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; }; } // end namespace function @@ -235,12 +235,12 @@ namespace boost { > class BOOST_FUNCTION_FUNCTION : public function_base, public Mixin { - typedef typename detail::function::function_return_type::type + typedef typename detail::function::function_return_type::type internal_result_type; public: BOOST_STATIC_CONSTANT(int, args = BOOST_FUNCTION_NUM_ARGS); - + #if BOOST_FUNCTION_NUM_ARGS == 1 typedef T0 argument_type; #elif BOOST_FUNCTION_NUM_ARGS == 2 @@ -260,8 +260,8 @@ namespace boost { BOOST_FUNCTION_FUNCTION() : function_base(), Mixin(), invoker(0) {} - explicit BOOST_FUNCTION_FUNCTION(const Mixin& m) : - function_base(), Mixin(m), invoker(0) + explicit BOOST_FUNCTION_FUNCTION(const Mixin& m) : + function_base(), Mixin(m), invoker(0) { } @@ -296,9 +296,9 @@ namespace boost { policy_type policy; policy.precall(this); - internal_result_type result = invoker(function_base::functor - BOOST_FUNCTION_COMMA - BOOST_FUNCTION_ARGS); + internal_result_type result = invoker(function_base::functor + BOOST_FUNCTION_COMMA + BOOST_FUNCTION_ARGS); policy.postcall(this); #ifndef BOOST_NO_VOID_RETURNS @@ -311,10 +311,10 @@ namespace boost { // The distinction between when to use BOOST_FUNCTION_FUNCTION and // when to use self_type is obnoxious. MSVC cannot handle self_type as // the return type of these assignment operators, but Borland C++ cannot - // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to + // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to // construct. template - BOOST_FUNCTION_FUNCTION& + BOOST_FUNCTION_FUNCTION& operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { self_type(f, static_cast(*this)).swap(*this); @@ -324,6 +324,7 @@ namespace boost { template void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { + int deprecated; self_type(f, static_cast(*this)).swap(*this); } @@ -331,7 +332,7 @@ namespace boost { BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) { if (&f == this) - return *this; + return *this; self_type(f).swap(*this); return *this; @@ -340,8 +341,9 @@ namespace boost { // Assignment from another BOOST_FUNCTION_FUNCTION void set(const BOOST_FUNCTION_FUNCTION& f) { + //int deprecated; if (&f == this) - return; + return; self_type(f).swap(*this); } @@ -349,7 +351,7 @@ namespace boost { void swap(BOOST_FUNCTION_FUNCTION& other) { if (&other == this) - return; + return; std::swap(function_base::manager, other.manager); std::swap(function_base::functor, other.functor); @@ -361,9 +363,9 @@ namespace boost { void clear() { if (function_base::manager) { - function_base::functor = - function_base::manager(function_base::functor, - detail::function::destroy_functor_tag); + function_base::functor = + function_base::manager(function_base::functor, + detail::function::destroy_functor_tag); } function_base::manager = 0; @@ -374,11 +376,11 @@ namespace boost { void assign_to_own(const BOOST_FUNCTION_FUNCTION& f) { if (!f.empty()) { - invoker = f.invoker; - function_base::manager = f.manager; - function_base::functor = - f.manager(f.functor, detail::function::clone_functor_tag); - } + invoker = f.invoker; + function_base::manager = f.manager; + function_base::functor = + f.manager(f.functor, detail::function::clone_functor_tag); + } } template @@ -392,27 +394,27 @@ namespace boost { void assign_to(FunctionPtr f, detail::function::function_ptr_tag) { clear(); - + if (f) { - typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - invoker = &invoker_type::invoke; - function_base::manager = - &detail::function::functor_manager::manage; - function_base::functor = - function_base::manager(detail::function::any_pointer( - // should be a reinterpret cast, but some compilers - // insist on giving cv-qualifiers to free functions - (void (*)())(f) - ), - detail::function::clone_functor_tag); + typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + invoker = &invoker_type::invoke; + function_base::manager = + &detail::function::functor_manager::manage; + function_base::functor = + function_base::manager(detail::function::any_pointer( + // should be a reinterpret cast, but some compilers + // insist on giving cv-qualifiers to free functions + (void (*)())(f) + ), + detail::function::clone_functor_tag); } - } + } #if BOOST_FUNCTION_NUM_ARGS > 0 template @@ -421,102 +423,102 @@ namespace boost { this->assign_to(mem_fn(f)); } #endif // BOOST_FUNCTION_NUM_ARGS > 0 - + template void assign_to(FunctionObj f, detail::function::function_obj_tag) { if (!detail::function::has_empty_target(addressof(f))) { - typedef - typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - invoker = &invoker_type::invoke; - function_base::manager = &detail::function::functor_manager< - FunctionObj, Allocator>::manage; -#ifndef BOOST_NO_STD_ALLOCATOR - typedef typename Allocator::template rebind::other - allocator_type; - typedef typename allocator_type::pointer pointer_type; - allocator_type allocator; - pointer_type copy = allocator.allocate(1); - allocator.construct(copy, f); + typedef + typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; - // Get back to the original pointer type - FunctionObj* new_f = static_cast(copy); + invoker = &invoker_type::invoke; + function_base::manager = &detail::function::functor_manager< + FunctionObj, Allocator>::manage; +#ifndef BOOST_NO_STD_ALLOCATOR + typedef typename Allocator::template rebind::other + allocator_type; + typedef typename allocator_type::pointer pointer_type; + allocator_type allocator; + pointer_type copy = allocator.allocate(1); + allocator.construct(copy, f); + + // Get back to the original pointer type + FunctionObj* new_f = static_cast(copy); #else - FunctionObj* new_f = new FunctionObj(f); + FunctionObj* new_f = new FunctionObj(f); #endif // BOOST_NO_STD_ALLOCATOR - function_base::functor = - detail::function::any_pointer(static_cast(new_f)); + function_base::functor = + detail::function::any_pointer(static_cast(new_f)); } } - + template - void assign_to(const reference_wrapper& f, - detail::function::function_obj_ref_tag) + void assign_to(const reference_wrapper& f, + detail::function::function_obj_ref_tag) { if (!detail::function::has_empty_target(f.get_pointer())) { - typedef - typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - invoker = &invoker_type::invoke; - function_base::manager = &detail::function::trivial_manager; - function_base::functor = - function_base::manager( - detail::function::any_pointer( - const_cast(f.get_pointer())), - detail::function::clone_functor_tag); + typedef + typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + invoker = &invoker_type::invoke; + function_base::manager = &detail::function::trivial_manager; + function_base::functor = + function_base::manager( + detail::function::any_pointer( + const_cast(f.get_pointer())), + detail::function::clone_functor_tag); } } - + template void assign_to(FunctionObj, detail::function::stateless_function_obj_tag) { - typedef - typename detail::function:: - BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; + typedef + typename detail::function:: + BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; invoker = &invoker_type::invoke; function_base::manager = &detail::function::trivial_manager; function_base::functor = detail::function::any_pointer(this); } typedef internal_result_type (*invoker_type)(detail::function::any_pointer - BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS); - + BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS); + invoker_type invoker; }; template + typename Policy, typename Mixin, typename Allocator> inline void swap(BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Policy, - Mixin, - Allocator - >& f1, - BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS, - Policy, - Mixin, - Allocator - >& f2) + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS , + Policy, + Mixin, + Allocator + >& f1, + BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS, + Policy, + Mixin, + Allocator + >& f2) { f1.swap(f2); } diff --git a/boost/boost/functional.hpp b/boost/boost/functional.hpp index b433924479..6e7efbea78 100644 --- a/boost/boost/functional.hpp +++ b/boost/boost/functional.hpp @@ -14,7 +14,7 @@ // purpose. It is provided "as is" without express or implied // warranty. // ------------------------------------------------------------------------------ -// $Id: functional.hpp,v 1.3 2002/06/16 13:12:16 lyx Exp $ +// $Id: functional.hpp,v 1.3 2000/11/22 09:04:28 mark_rodgers Exp $ // ------------------------------------------------------------------------------ #ifndef BOOST_FUNCTIONAL_HPP diff --git a/boost/boost/integer/static_log2.hpp b/boost/boost/integer/static_log2.hpp index 436250e090..fed9d6cf14 100644 --- a/boost/boost/integer/static_log2.hpp +++ b/boost/boost/integer/static_log2.hpp @@ -12,9 +12,13 @@ #include // self include -#include // for BOOST_STATIC_CONSTANT +#include // for BOOST_STATIC_CONSTANT, etc. #include // for std::numeric_limits +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include // for boost::ct_if<> +#endif + namespace boost { @@ -30,9 +34,22 @@ template < unsigned long Val, int Place = 0, int Index = std::numeric_limits::digits > struct static_log2_helper_t; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template < unsigned long Val, int Place > struct static_log2_helper_t< Val, Place, 1 >; +#else + +template < int Place > + struct static_log2_helper_final_step; + +template < unsigned long Val, int Place = 0, int Index + = std::numeric_limits::digits > + struct static_log2_helper_nopts_t; + +#endif + // Recursively build the logarithm by examining the upper bits template < unsigned long Val, int Place, int Index > struct static_log2_helper_t @@ -50,7 +67,11 @@ private: : Place ); BOOST_STATIC_CONSTANT( int, new_index = Index - half_place ); +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION typedef static_log2_helper_t next_step_type; +#else + typedef static_log2_helper_nopts_t next_step_type; +#endif public: BOOST_STATIC_CONSTANT( int, value = next_step_type::value ); @@ -58,6 +79,8 @@ public: }; // boost::detail::static_log2_helper_t // Non-recursive case +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template < unsigned long Val, int Place > struct static_log2_helper_t< Val, Place, 1 > { @@ -66,6 +89,33 @@ public: }; // boost::detail::static_log2_helper_t +#else + +template < int Place > +struct static_log2_helper_final_step +{ +public: + BOOST_STATIC_CONSTANT( int, value = Place ); + +}; // boost::detail::static_log2_helper_final_step + +template < unsigned long Val, int Place, int Index > +struct static_log2_helper_nopts_t +{ +private: + typedef static_log2_helper_t recursive_step_type; + typedef static_log2_helper_final_step final_step_type; + + typedef typename ct_if<( Index != 1 ), recursive_step_type, + final_step_type>::type next_step_type; + +public: + BOOST_STATIC_CONSTANT( int, value = next_step_type::value ); + +}; // boost::detail::static_log2_helper_nopts_t + +#endif + } // namespace detail diff --git a/boost/boost/integer_traits.hpp b/boost/boost/integer_traits.hpp index 8c77a780aa..6d97c9bde2 100644 --- a/boost/boost/integer_traits.hpp +++ b/boost/boost/integer_traits.hpp @@ -10,7 +10,7 @@ * software for any purpose. It is provided "as is" without express or * implied warranty. * - * $Id: integer_traits.hpp,v 1.3 2002/06/16 13:12:16 lyx Exp $ + * $Id: integer_traits.hpp,v 1.19 2002/07/13 12:26:19 david_abrahams Exp $ * * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers */ diff --git a/boost/boost/intrusive_ptr.hpp b/boost/boost/intrusive_ptr.hpp index 780fe78eaa..4ada734b09 100644 --- a/boost/boost/intrusive_ptr.hpp +++ b/boost/boost/intrusive_ptr.hpp @@ -61,7 +61,7 @@ public: if(p_ != 0) intrusive_ptr_release(p_); } -#ifdef BOOST_MSVC6_MEMBER_TEMPLATES +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) template intrusive_ptr(intrusive_ptr const & rhs): p_(rhs.get()) { @@ -75,7 +75,7 @@ public: if(p_ != 0) intrusive_ptr_add_ref(p_); } -#ifdef BOOST_MSVC6_MEMBER_TEMPLATES +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) template intrusive_ptr & operator=(intrusive_ptr const & rhs) { diff --git a/boost/boost/iterator_adaptors.hpp b/boost/boost/iterator_adaptors.hpp index 7da273888a..f0ef01068b 100644 --- a/boost/boost/iterator_adaptors.hpp +++ b/boost/boost/iterator_adaptors.hpp @@ -147,7 +147,7 @@ namespace boost { template struct TrivialIteratorPoliciesConcept { - typedef typename Traits::reference Reference; + typedef typename Traits::reference reference; void constraints() { function_requires< AssignableConcept >(); function_requires< DefaultConstructibleConcept >(); @@ -157,7 +157,7 @@ struct TrivialIteratorPoliciesConcept const_constraints(); } void const_constraints() const { - Reference r = p.dereference(x); + reference r = p.dereference(x); b = p.equal(x, x); ignore_unused_variable_warning(r); } @@ -766,7 +766,7 @@ namespace detail { // This macro definition is only temporary in this file -# if !defined(BOOST_MSVC) +# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 # define BOOST_ARG_DEPENDENT_TYPENAME typename # else # define BOOST_ARG_DEPENDENT_TYPENAME @@ -855,9 +855,9 @@ struct iterator_adaptor : policies().initialize(base()); } -#if defined(BOOST_MSVC) || defined(__BORLANDC__) +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__) // This is required to prevent a bug in how VC++ generates - // the assignment operator for compressed_pairv + // the assignment operator for compressed_pair iterator_adaptor& operator= (const iterator_adaptor& x) { m_iter_p = x.m_iter_p; return *this; @@ -1097,7 +1097,7 @@ struct indirect_iterator_policies : public default_iterator_policies }; namespace detail { -# if !defined(BOOST_MSVC) // stragely instantiated even when unused! Maybe try a recursive template someday ;-) +# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // strangely instantiated even when unused! Maybe try a recursive template someday ;-) template struct traits_of_value_type { typedef typename boost::detail::iterator_traits::value_type outer_value; @@ -1110,12 +1110,12 @@ namespace detail { template 1300 = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< OuterIterator>::value_type #endif , class Reference -#if !defined(BOOST_MSVC) +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< OuterIterator>::reference #else @@ -1124,7 +1124,7 @@ template ::iterator_category , class Pointer -#if !defined(BOOST_MSVC) +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< OuterIterator>::pointer #else @@ -1139,12 +1139,12 @@ struct indirect_iterator_generator template 1300 = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< OuterIterator>::value_type #endif , class Reference -#if !defined(BOOST_MSVC) +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< OuterIterator>::reference #else @@ -1154,7 +1154,7 @@ template ::iterator_category , class Pointer -#if !defined(BOOST_MSVC) +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 = BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type< OuterIterator>::pointer #else @@ -1170,7 +1170,7 @@ struct indirect_iterator_pair_generator Value, ConstReference,Category,ConstPointer>::type const_iterator; }; -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template inline typename indirect_iterator_generator::type make_indirect_iterator(OuterIterator base) @@ -1392,7 +1392,7 @@ template ::value)); -#ifndef BOOST_MSVC // I don't have any idea why this occurs, but it doesn't seem to hurt too badly. +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // I don't have any idea why this occurs, but it doesn't seem to hurt too badly. BOOST_STATIC_ASSERT(!is_bidirectional); #endif typedef filter_iterator_policies policies_type; diff --git a/boost/boost/limits.hpp b/boost/boost/limits.hpp index 1d2ca13895..9151acc80b 100644 --- a/boost/boost/limits.hpp +++ b/boost/boost/limits.hpp @@ -12,9 +12,128 @@ #include #ifdef BOOST_NO_LIMITS -#include +# include #else -#include +# include #endif +#if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \ + || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS)) +// Add missing specializations for numeric_limits: +#ifdef BOOST_HAS_MS_INT64 +# define BOOST_LLT __int64 +#else +# define BOOST_LLT long long +#endif + +namespace std +{ + template<> + class numeric_limits + { + public: + + BOOST_STATIC_CONSTANT(bool, is_specialized = true); +#ifdef BOOST_HAS_MS_INT64 + static BOOST_LLT min(){ return 0x8000000000000000i64; } + static BOOST_LLT max(){ return 0x7FFFFFFFFFFFFFFFi64; } +#elif defined(LLONG_MAX) + static BOOST_LLT min(){ return LLONG_MIN; } + static BOOST_LLT max(){ return LLONG_MAX; } +#elif defined(LONGLONG_MAX) + static BOOST_LLT min(){ return LONGLONG_MIN; } + static BOOST_LLT max(){ return LONGLONG_MAX; } +#else + static BOOST_LLT min(){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); } + static BOOST_LLT max(){ return ~min(); } +#endif + BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1); + BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000); + BOOST_STATIC_CONSTANT(bool, is_signed = true); + BOOST_STATIC_CONSTANT(bool, is_integer = true); + BOOST_STATIC_CONSTANT(bool, is_exact = true); + BOOST_STATIC_CONSTANT(int, radix = 2); + static BOOST_LLT epsilon() throw() { return 0; }; + static BOOST_LLT round_error() throw() { return 0; }; + + BOOST_STATIC_CONSTANT(int, min_exponent = 0); + BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); + BOOST_STATIC_CONSTANT(int, max_exponent = 0); + BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); + + BOOST_STATIC_CONSTANT(bool, has_infinity = false); + BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); + BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); + BOOST_STATIC_CONSTANT(bool, has_denorm = false); + BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); + static BOOST_LLT infinity() throw() { return 0; }; + static BOOST_LLT quiet_NaN() throw() { return 0; }; + static BOOST_LLT signaling_NaN() throw() { return 0; }; + static BOOST_LLT denorm_min() throw() { return 0; }; + + BOOST_STATIC_CONSTANT(bool, is_iec559 = false); + BOOST_STATIC_CONSTANT(bool, is_bounded = false); + BOOST_STATIC_CONSTANT(bool, is_modulo = false); + + BOOST_STATIC_CONSTANT(bool, traps = false); + BOOST_STATIC_CONSTANT(bool, tinyness_before = false); + BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); + + }; + + template<> + class numeric_limits + { + public: + + BOOST_STATIC_CONSTANT(bool, is_specialized = true); +#ifdef BOOST_HAS_MS_INT64 + static unsigned BOOST_LLT min(){ return 0ui64; } + static unsigned BOOST_LLT max(){ return 0xFFFFFFFFFFFFFFFFui64; } +#elif defined(ULLONG_MAX) + static unsigned BOOST_LLT min(){ return ULLONG_MIN; } + static unsigned BOOST_LLT max(){ return ULLONG_MAX; } +#elif defined(ULONGLONG_MAX) + static unsigned BOOST_LLT min(){ return ULONGLONG_MIN; } + static unsigned BOOST_LLT max(){ return ULONGLONG_MAX; } +#else + static unsigned BOOST_LLT min(){ return 0uLL; } + static unsigned BOOST_LLT max(){ return ~0uLL; } +#endif + BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1); + BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000); + BOOST_STATIC_CONSTANT(bool, is_signed = false); + BOOST_STATIC_CONSTANT(bool, is_integer = true); + BOOST_STATIC_CONSTANT(bool, is_exact = true); + BOOST_STATIC_CONSTANT(int, radix = 2); + static unsigned BOOST_LLT epsilon() throw() { return 0; }; + static unsigned BOOST_LLT round_error() throw() { return 0; }; + + BOOST_STATIC_CONSTANT(int, min_exponent = 0); + BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); + BOOST_STATIC_CONSTANT(int, max_exponent = 0); + BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); + + BOOST_STATIC_CONSTANT(bool, has_infinity = false); + BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); + BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); + BOOST_STATIC_CONSTANT(bool, has_denorm = false); + BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); + static unsigned BOOST_LLT infinity() throw() { return 0; }; + static unsigned BOOST_LLT quiet_NaN() throw() { return 0; }; + static unsigned BOOST_LLT signaling_NaN() throw() { return 0; }; + static unsigned BOOST_LLT denorm_min() throw() { return 0; }; + + BOOST_STATIC_CONSTANT(bool, is_iec559 = false); + BOOST_STATIC_CONSTANT(bool, is_bounded = false); + BOOST_STATIC_CONSTANT(bool, is_modulo = false); + + BOOST_STATIC_CONSTANT(bool, traps = false); + BOOST_STATIC_CONSTANT(bool, tinyness_before = false); + BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); + + }; +} +#endif + #endif diff --git a/boost/boost/mem_fn.hpp b/boost/boost/mem_fn.hpp index f59fff41e1..af93168469 100644 --- a/boost/boost/mem_fn.hpp +++ b/boost/boost/mem_fn.hpp @@ -66,6 +66,18 @@ template struct mf #endif +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + #undef BOOST_MEM_FN_RETURN }; // struct mf @@ -95,6 +107,18 @@ template<> struct mf #endif +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + #undef BOOST_MEM_FN_RETURN }; // struct mf @@ -126,6 +150,20 @@ template<> struct mf #endif +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) X##_fastcall +#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_NAME2 +#undef BOOST_MEM_FN_CC + +#endif + } // namespace _mfi #else // #ifdef BOOST_NO_VOID_RETURNS @@ -158,6 +196,18 @@ namespace _mfi #endif +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + #undef BOOST_MEM_FN_RETURN } // namespace _mfi @@ -187,6 +237,18 @@ namespace _mfi #endif +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC + +#endif + // data member support namespace _mfi diff --git a/boost/boost/multi_array.hpp b/boost/boost/multi_array.hpp index a9481b9bc3..69a1896351 100644 --- a/boost/boost/multi_array.hpp +++ b/boost/boost/multi_array.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_MULTI_ARRAY_RG071801_HPP #define BOOST_MULTI_ARRAY_RG071801_HPP @@ -66,7 +78,7 @@ public: template explicit multi_array(ExtentList const& extents, - const general_storage_order& so) : + const general_storage_order& so) : super_type((T*)initial_base_,extents,so) { boost::function_requires< detail::multi_array::CollectionConcept >(); @@ -75,8 +87,8 @@ public: template explicit multi_array(ExtentList const& extents, - const general_storage_order& so, - Allocator const& alloc) : + const general_storage_order& so, + Allocator const& alloc) : super_type((T*)initial_base_,extents,so), allocator_(alloc) { boost::function_requires< detail::multi_array::CollectionConcept >(); @@ -85,7 +97,7 @@ public: explicit multi_array(const detail::multi_array - ::extent_gen& ranges) : + ::extent_gen& ranges) : super_type((T*)initial_base_,ranges) { allocate_space(); @@ -93,8 +105,8 @@ public: explicit multi_array(const detail::multi_array - ::extent_gen& ranges, - const general_storage_order& so) : + ::extent_gen& ranges, + const general_storage_order& so) : super_type((T*)initial_base_,ranges,so) { allocate_space(); @@ -102,9 +114,9 @@ public: explicit multi_array(const detail::multi_array - ::extent_gen& ranges, - const general_storage_order& so, - Allocator const& alloc) : + ::extent_gen& ranges, + const general_storage_order& so, + Allocator const& alloc) : super_type((T*)initial_base_,ranges,so), allocator_(alloc) { allocate_space(); @@ -118,7 +130,7 @@ public: template multi_array(const detail::multi_array:: - const_sub_array& rhs) : + const_sub_array& rhs) : super_type(rhs) { allocate_space(); std::copy(rhs.begin(),rhs.end(),begin()); @@ -128,7 +140,7 @@ public: // member function when passed a subarray, so i was forced to // duplicate the functionality here... multi_array(const detail::multi_array:: - sub_array& rhs) : + sub_array& rhs) : super_type(rhs) { allocate_space(); std::copy(rhs.begin(),rhs.end(),begin()); @@ -166,7 +178,7 @@ private: void deallocate_space() { if(base_) { for(T* i = base_; i != base_+allocated_elements_; ++i) - allocator_.destroy(i); + allocator_.destroy(i); allocator_.deallocate(base_,allocated_elements_); } } diff --git a/boost/boost/multi_array/algorithm.hpp b/boost/boost/multi_array/algorithm.hpp index 71e07e7e06..0d1d423f34 100644 --- a/boost/boost/multi_array/algorithm.hpp +++ b/boost/boost/multi_array/algorithm.hpp @@ -26,6 +26,18 @@ // representations about the suitability of this software for any // purpose. It is provided "as is" without express or implied warranty. // +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #include "boost/iterator.hpp" @@ -37,7 +49,7 @@ namespace boost { template OutputIter copy_n(InputIter first, Size count, - OutputIter result) { + OutputIter result) { for ( ; count > 0; --count) { *result = *first; ++first; @@ -71,7 +83,7 @@ copy_n__(RAIter first, Size count, template inline OutputIter copy_n__(InputIter first, Size count, OutputIter result) { - typedef std::iterator_traits::iterator_category cat; + typedef typename std::iterator_traits::iterator_category cat; return copy_n__(first, count, result, cat()); } diff --git a/boost/boost/multi_array/base.hpp b/boost/boost/multi_array/base.hpp index 67807d2db5..7d6746e2c6 100644 --- a/boost/boost/multi_array/base.hpp +++ b/boost/boost/multi_array/base.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BASE_RG071801_HPP #define BASE_RG071801_HPP @@ -130,9 +142,9 @@ protected: // used by array operator[] and iterators to get reference types. template Reference access(boost::type,index idx,TPtr base, - const size_type* extents, - const index* strides, - const index* index_base) const { + const size_type* extents, + const index* strides, + const index* index_base) const { // return a sub_array proxy object TPtr newbase = base + idx * strides[0]; @@ -168,9 +180,9 @@ protected: // used by array operator[] and iterators to get reference types. template Reference access(boost::type,index idx,TPtr base, - const size_type*, - const index* strides, - const index*) const { + const size_type*, + const index* strides, + const index*) const { return *(base + idx * strides[0]); } @@ -304,8 +316,8 @@ protected: // Used by operator() in our array classes template Reference access_element(boost::type, TPtr base, - const IndexList& indices, - const index* strides) const { + const IndexList& indices, + const index* strides) const { index offset = 0; for (size_type n = 0; n != NumDims; ++n) offset += indices[n] * strides[n]; @@ -315,7 +327,7 @@ protected: template void compute_strides(StrideList& stride_list, ExtentList& extent_list, - const general_storage_order& storage) + const general_storage_order& storage) { // invariant: stride = the stride for dimension n index stride = 1; @@ -323,7 +335,7 @@ protected: index stride_sign = +1; if (!storage.ascending(storage.ordering(n))) - stride_sign = -1; + stride_sign = -1; // The stride for this dimension is the product of the // lengths of the ranks minor to it. @@ -339,13 +351,13 @@ protected: template index calculate_origin_offset(const StrideList& stride_list, - const ExtentList& extent_list, - const general_storage_order& storage, - const BaseList& index_base_list) + const ExtentList& extent_list, + const general_storage_order& storage, + const BaseList& index_base_list) { return calculate_descending_dimension_offset(stride_list,extent_list, - storage) + + storage) + calculate_indexing_offset(stride_list,index_base_list); } @@ -354,14 +366,14 @@ protected: template index calculate_descending_dimension_offset(const StrideList& stride_list, - const ExtentList& extent_list, - const general_storage_order& storage) + const ExtentList& extent_list, + const general_storage_order& storage) { index offset = 0; if (!storage.all_dims_ascending()) for (size_type n = 0; n != NumDims; ++n) - if (!storage.ascending(n)) - offset -= (extent_list[n] - 1) * stride_list[n]; + if (!storage.ascending(n)) + offset -= (extent_list[n] - 1) * stride_list[n]; return offset; } @@ -373,11 +385,11 @@ protected: template index calculate_indexing_offset(const StrideList& stride_list, - const BaseList& index_base_list) + const BaseList& index_base_list) { index offset = 0; for (size_type n = 0; n != NumDims; ++n) - offset -= stride_list[n] * index_base_list[n]; + offset -= stride_list[n] * index_base_list[n]; return offset; } @@ -393,12 +405,12 @@ protected: template ArrayRef generate_array_view(boost::type, - const boost::detail::multi_array:: - index_gen& indices, - const size_type* extents, - const index* strides, - const index* index_bases, - TPtr base) const { + const boost::detail::multi_array:: + index_gen& indices, + const size_type* extents, + const index* strides, + const index* index_bases, + TPtr base) const { boost::array new_strides; boost::array new_extents; @@ -420,23 +432,23 @@ protected: if (!current_range.is_degenerate()) { - // The index_factor for each dimension is included into the - // strides for the array_view (see [Garcia] for the math involved). - new_strides[dim] = index_factor * strides[n]; - - // calculate new extents - new_extents[dim] = len; - ++dim; + // The index_factor for each dimension is included into the + // strides for the array_view (see [Garcia] for the math involved). + new_strides[dim] = index_factor * strides[n]; + + // calculate new extents + new_extents[dim] = len; + ++dim; } } assert (dim == NDims); return ArrayRef(base+offset, - new_extents, - new_strides); + new_extents, + new_strides); } - + }; diff --git a/boost/boost/multi_array/collection_concept.hpp b/boost/boost/multi_array/collection_concept.hpp index 36195f5cf0..766352e98a 100644 --- a/boost/boost/multi_array/collection_concept.hpp +++ b/boost/boost/multi_array/collection_concept.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef COLLECTION_CONCEPT_RG103101_HPP #define COLLECTION_CONCEPT_RG103101_HPP diff --git a/boost/boost/multi_array/concept_checks.hpp b/boost/boost/multi_array/concept_checks.hpp index 2e470ad64d..a866231951 100644 --- a/boost/boost/multi_array/concept_checks.hpp +++ b/boost/boost/multi_array/concept_checks.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_MULTI_ARRAY_CONCEPT_CHECKS_RG110101_HPP #define BOOST_MULTI_ARRAY_CONCEPT_CHECKS_RG110101_HPP diff --git a/boost/boost/multi_array/copy_array.hpp b/boost/boost/multi_array/copy_array.hpp index 5e47d8a8ac..f515212d81 100644 --- a/boost/boost/multi_array/copy_array.hpp +++ b/boost/boost/multi_array/copy_array.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef COPY_ARRAY_RG092101_HPP #define COPY_ARRAY_RG092101_HPP @@ -18,7 +30,7 @@ class copy_dispatch { public: template static void copy_array (SourceIterator first, SourceIterator last, - DestIterator result) { + DestIterator result) { while (first != last) { copy_array(*first++,*result++); } @@ -41,7 +53,7 @@ private: template void copy_array (Array1& source, Array2& dest) { assert(std::equal(source.shape(),source.shape()+source.num_dimensions(), - dest.shape())); + dest.shape())); // Dispatch to the proper function typedef typename Array1::element element_type; copy_dispatch:: diff --git a/boost/boost/multi_array/extent_gen.hpp b/boost/boost/multi_array/extent_gen.hpp index 46429a4384..016fd33b4b 100644 --- a/boost/boost/multi_array/extent_gen.hpp +++ b/boost/boost/multi_array/extent_gen.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_EXTENT_GEN_RG071801_HPP #define BOOST_EXTENT_GEN_RG071801_HPP @@ -32,7 +44,7 @@ public: // Used by operator[] to expand extent_gens extent_gen(const extent_gen& rhs, - const range& a_range) + const range& a_range) { std::copy(rhs.ranges_.begin(),rhs.ranges_.end(),ranges_.begin()); *ranges_.rbegin() = a_range; diff --git a/boost/boost/multi_array/extent_range.hpp b/boost/boost/multi_array/extent_range.hpp index ddd9f68973..18ec3e99b7 100644 --- a/boost/boost/multi_array/extent_range.hpp +++ b/boost/boost/multi_array/extent_range.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_EXTENT_RANGE_RG071801_HPP #define BOOST_EXTENT_RANGE_RG071801_HPP diff --git a/boost/boost/multi_array/index_gen.hpp b/boost/boost/multi_array/index_gen.hpp index d5c714e56c..0b734292f1 100644 --- a/boost/boost/multi_array/index_gen.hpp +++ b/boost/boost/multi_array/index_gen.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_INDEX_GEN_RG071801_HPP #define BOOST_INDEX_GEN_RG071801_HPP @@ -32,7 +44,7 @@ public: template explicit index_gen(const index_gen& rhs, - const index_range& range) + const index_range& range) { std::copy(rhs.ranges_.begin(),rhs.ranges_.end(),ranges_.begin()); *ranges_.rbegin() = range; diff --git a/boost/boost/multi_array/index_range.hpp b/boost/boost/multi_array/index_range.hpp index 7dfcbe3d86..55b7d3fc37 100644 --- a/boost/boost/multi_array/index_range.hpp +++ b/boost/boost/multi_array/index_range.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_INDEX_RANGE_RG071801_HPP #define BOOST_INDEX_RANGE_RG071801_HPP @@ -41,7 +53,7 @@ namespace multi_array { explicit index_range(index start, index finish, index stride=1) : start_(start), finish_(finish), stride_(stride), - degenerate_(start_ == finish_) + degenerate_(start_ == finish_) { } @@ -68,7 +80,7 @@ namespace multi_array { index get_start(index low_index_range = 0) const { if (start_ == from_start()) - return low_index_range; + return low_index_range; return start_; } @@ -80,16 +92,16 @@ namespace multi_array { index get_finish(index high_index_range = 0) const { if (finish_ == to_end()) - return high_index_range; + return high_index_range; return finish_; } size_type size(index recommended_length = 0) const { if ((start_ == from_start()) || (finish_ == to_end())) - return recommended_length; + return recommended_length; else - return (finish_ - start_) / stride_; + return (finish_ - start_) / stride_; } index stride() const { return stride_; } diff --git a/boost/boost/multi_array/iterator.hpp b/boost/boost/multi_array/iterator.hpp index 356fb56cbc..529d19e3e5 100644 --- a/boost/boost/multi_array/iterator.hpp +++ b/boost/boost/multi_array/iterator.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef ITERATOR_RG071801_HPP #define ITERATOR_RG071801_HPP @@ -33,8 +45,8 @@ struct iterator_base : private multi_array_base { const index* index_base_; iterator_base(int idx, TPtr base, const size_type* extents, - const index* strides, - const index* index_base) : + const index* strides, + const index* index_base) : idx_(idx), base_(base), extents_(extents), strides_(strides), index_base_(index_base) { } @@ -61,11 +73,11 @@ public: dereference(const IteratorAdaptor& iter) const { typedef typename IteratorAdaptor::reference reference; return super_type::access(boost::type(), - iter.base().idx_, - iter.base().base_, - iter.base().extents_, - iter.base().strides_, - iter.base().index_base_); + iter.base().idx_, + iter.base().base_, + iter.base().extents_, + iter.base().strides_, + iter.base().index_base_); } template diff --git a/boost/boost/multi_array/iterator_adaptors.hpp b/boost/boost/multi_array/iterator_adaptors.hpp index 2359c5abd9..612e36c523 100644 --- a/boost/boost/multi_array/iterator_adaptors.hpp +++ b/boost/boost/multi_array/iterator_adaptors.hpp @@ -10,6 +10,10 @@ // "as is" without express or implied warranty, and with no claim as // to its suitability for any purpose. // + +// Thes code is modified from its original form to meet the needs of +// Boost.MultiArray. + // Revision History: // 27 Mar 2002 Ronald Garcia @@ -686,7 +690,7 @@ namespace detail { // This macro definition is only temporary in this file -# if !defined(BOOST_MSVC) +# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 # define BOOST_ARG_DEPENDENT_TYPENAME typename # else # define BOOST_ARG_DEPENDENT_TYPENAME @@ -775,7 +779,7 @@ struct iterator_adaptor : policies().initialize(base()); } -#if defined(BOOST_MSVC) || defined(__BORLANDC__) +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__) // This is required to prevent a bug in how VC++ generates // the assignment operator for compressed_pairv iterator_adaptor& operator= (const iterator_adaptor& x) { diff --git a/boost/boost/multi_array/multi_array_ref.hpp b/boost/boost/multi_array/multi_array_ref.hpp index 43418df232..cdefb6c04e 100644 --- a/boost/boost/multi_array/multi_array_ref.hpp +++ b/boost/boost/multi_array/multi_array_ref.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_MULTI_ARRAY_REF_RG071801_HPP #define BOOST_MULTI_ARRAY_REF_RG071801_HPP @@ -64,7 +76,7 @@ public: template const_multi_array_ref(const const_multi_array_ref& other) + OPtr>& other) : base_(other.base_), storage_(other.storage_), extent_list_(other.extent_list_), stride_list_(other.stride_list_), @@ -85,7 +97,7 @@ public: template explicit const_multi_array_ref(TPtr base, const ExtentList& extents, - const general_storage_order& so) : + const general_storage_order& so) : base_(base), storage_(so) { boost::function_requires< detail::multi_array::CollectionConcept >(); @@ -95,17 +107,17 @@ public: } explicit const_multi_array_ref(TPtr base, - const detail::multi_array:: - extent_gen& ranges) : + const detail::multi_array:: + extent_gen& ranges) : base_(base), storage_(c_storage_order()) { init_from_extent_gen(ranges); } explicit const_multi_array_ref(TPtr base, - const detail::multi_array:: - extent_gen& ranges, - const general_storage_order& so) : + const detail::multi_array:: + extent_gen& ranges, + const general_storage_order& so) : base_(base), storage_(so) { init_from_extent_gen(ranges); @@ -131,14 +143,14 @@ public: boost::copy_n(values.begin(),num_dimensions(),index_base_list_.begin()); origin_offset_ = calculate_origin_offset(stride_list_,extent_list_, - storage_,index_base_list_); + storage_,index_base_list_); } void reindex(index value) { index_base_list_.assign(value); origin_offset_ = calculate_origin_offset(stride_list_,extent_list_, - storage_,index_base_list_); + storage_,index_base_list_); } template @@ -146,15 +158,15 @@ public: boost::function_requires< detail::multi_array::CollectionConcept >(); assert(num_elements_ == - std::accumulate(extents.begin(),extents.end(), - size_type(1),std::multiplies())); + std::accumulate(extents.begin(),extents.end(), + size_type(1),std::multiplies())); std::copy(extents.begin(),extents.end(),extent_list_.begin()); compute_strides(stride_list_,extent_list_,storage_); origin_offset_ = calculate_origin_offset(stride_list_,extent_list_, - storage_,index_base_list_); + storage_,index_base_list_); } size_type num_dimensions() const { return NumDims; } @@ -188,45 +200,45 @@ public: boost::function_requires< detail::multi_array::CollectionConcept >(); return super_type::access_element(boost::type(), - origin(), - indices,strides()); + origin(), + indices,strides()); } // Only allow const element access const_reference operator[](index idx) const { return super_type::access(boost::type(), - idx,origin(), - shape(),strides(),index_bases()); + idx,origin(), + shape(),strides(),index_bases()); } // see generate_array_view in base.hpp -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template #else template // else ICE #endif // BOOST_MSVC typename const_array_view::type operator[](const detail::multi_array:: - index_gen& indices) + index_gen& indices) const { - typedef const_array_view::type return_type; + typedef typename const_array_view::type return_type; return super_type::generate_array_view(boost::type(), - indices, - shape(), - strides(), - index_bases(), - origin()); + indices, + shape(), + strides(), + index_bases(), + origin()); } const_iterator begin() const { return const_iterator(const_iter_base(*index_bases(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } const_iterator end() const { return const_iterator(const_iter_base(*index_bases()+*shape(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } const_reverse_iterator rbegin() const { @@ -240,46 +252,46 @@ public: template bool operator==(const - const_multi_array_ref& rhs) + const_multi_array_ref& rhs) const { if(std::equal(extent_list_.begin(), - extent_list_.end(), - rhs.extent_list_.begin())) + extent_list_.end(), + rhs.extent_list_.begin())) return std::equal(begin(),end(),rhs.begin()); else return false; } template bool operator<(const - const_multi_array_ref& rhs) + const_multi_array_ref& rhs) const { return std::lexicographical_compare(begin(),end(),rhs.begin(),rhs.end()); } template bool operator!=(const - const_multi_array_ref& rhs) + const_multi_array_ref& rhs) const { return !(*this == rhs); } template bool operator>(const - const_multi_array_ref& rhs) + const_multi_array_ref& rhs) const { return rhs < *this; } template bool operator<=(const - const_multi_array_ref& rhs) + const_multi_array_ref& rhs) const { return !(*this > rhs); } template bool operator>=(const - const_multi_array_ref& rhs) + const_multi_array_ref& rhs) const { return !(*this < rhs); } @@ -296,7 +308,7 @@ public: template const_multi_array_ref(const detail::multi_array:: - const_sub_array& rhs) + const_sub_array& rhs) : base_(rhs.origin()), storage_(c_storage_order()), origin_offset_(0), directional_offset_(0), @@ -325,21 +337,21 @@ private: const_multi_array_ref& operator=(const const_multi_array_ref& other); void init_from_extent_gen(const - detail::multi_array:: - extent_gen& ranges) { + detail::multi_array:: + extent_gen& ranges) { typedef boost::array extent_list; // get the index_base values std::transform(ranges.ranges_.begin(),ranges.ranges_.end(), - index_base_list_.begin(), - boost::mem_fun_ref(&extent_range::start)); + index_base_list_.begin(), + boost::mem_fun_ref(&extent_range::start)); // calculate the extents extent_list extents; std::transform(ranges.ranges_.begin(),ranges.ranges_.end(), - extents.begin(), - boost::mem_fun_ref(&extent_range::size)); + extents.begin(), + boost::mem_fun_ref(&extent_range::size)); init_multi_array_ref(extents.begin()); } @@ -353,17 +365,17 @@ private: // Calculate the array size num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(), - 1,std::multiplies()); + 1,std::multiplies()); assert(num_elements_ != 0); compute_strides(stride_list_,extent_list_,storage_); origin_offset_ = calculate_origin_offset(stride_list_,extent_list_, - storage_,index_base_list_); + storage_,index_base_list_); directional_offset_ = calculate_descending_dimension_offset(stride_list_,extent_list_, - storage_); + storage_); } }; @@ -410,7 +422,7 @@ public: template explicit multi_array_ref(T* base, const ExtentList& extents, - const general_storage_order& so) : + const general_storage_order& so) : super_type(base,extents,so) { boost::function_requires< detail::multi_array::CollectionConcept >(); @@ -418,21 +430,21 @@ public: explicit multi_array_ref(T* base, - const detail::multi_array:: - extent_gen& ranges) : + const detail::multi_array:: + extent_gen& ranges) : super_type(base,ranges) { } explicit multi_array_ref(T* base, - const detail::multi_array:: - extent_gen& - ranges, - const general_storage_order& so) : + const detail::multi_array:: + extent_gen& + ranges, + const general_storage_order& so) : super_type(base,ranges,so) { } template multi_array_ref(const detail::multi_array:: - const_sub_array& rhs) + const_sub_array& rhs) : super_type(rhs) {} // Assignment from other ConstMultiArray types. @@ -445,7 +457,7 @@ public: // make sure the dimensions agree assert(other.num_dimensions() == num_dimensions()); assert(std::equal(other.shape(),other.shape()+num_dimensions(), - shape())); + shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); return *this; @@ -457,7 +469,7 @@ public: assert(other.num_dimensions() == num_dimensions()); assert(std::equal(other.shape(),other.shape()+num_dimensions(), - shape())); + shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); } @@ -473,47 +485,47 @@ public: boost::function_requires< detail::multi_array::CollectionConcept >(); return super_type::access_element(boost::type(), - origin(), - indices,strides()); + origin(), + indices,strides()); } reference operator[](index idx) { return super_type::access(boost::type(), - idx,origin(), - shape(),strides(), - index_bases()); + idx,origin(), + shape(),strides(), + index_bases()); } // See note attached to generate_array_view in base.hpp -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template #else template // else ICE #endif // BOOST_MSVC typename array_view::type operator[](const detail::multi_array:: - index_gen& indices) { - typedef array_view::type return_type; + index_gen& indices) { + typedef typename array_view::type return_type; return super_type::generate_array_view(boost::type(), - indices, - shape(), - strides(), - index_bases(), - origin()); + indices, + shape(), + strides(), + index_bases(), + origin()); } iterator begin() { return iterator(iter_base(*index_bases(),origin(),shape(), - strides(),index_bases())); + strides(),index_bases())); } iterator end() { return iterator(iter_base(*index_bases()+*shape(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } // RG - rbegin() and rend() written naively to thwart MSVC ICE. @@ -542,19 +554,19 @@ public: const_reference operator[](index idx) const { return super_type::access(boost::type(), - idx,origin(), - shape(),strides(),index_bases()); + idx,origin(), + shape(),strides(),index_bases()); } // See note attached to generate_array_view in base.hpp -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template #else template // else ICE #endif // BOOST_MSVC typename const_array_view::type operator[](const detail::multi_array:: - index_gen& indices) + index_gen& indices) const { return super_type::operator[](indices); } diff --git a/boost/boost/multi_array/range_list.hpp b/boost/boost/multi_array/range_list.hpp index 9d0aaec37c..143da091be 100644 --- a/boost/boost/multi_array/range_list.hpp +++ b/boost/boost/multi_array/range_list.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef RANGE_LIST_RG072501_HPP #define RANGE_LIST_RG072501_HPP // diff --git a/boost/boost/multi_array/storage_order.hpp b/boost/boost/multi_array/storage_order.hpp index e8e571c2bb..9a84e958d5 100644 --- a/boost/boost/multi_array/storage_order.hpp +++ b/boost/boost/multi_array/storage_order.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_STORAGE_ORDER_RG071801_HPP #define BOOST_STORAGE_ORDER_RG071801_HPP @@ -23,7 +35,7 @@ namespace boost { typedef detail::multi_array::size_type size_type; template general_storage_order(OrderingIter ordering, - AscendingIter ascending) { + AscendingIter ascending) { boost::copy_n(ordering,NumDims,ordering_.begin()); boost::copy_n(ascending,NumDims,ascending_.begin()); } @@ -34,14 +46,14 @@ namespace boost { // storage_order objects, I sacrifice that feature for compiler support. general_storage_order(const c_storage_order&) { for (size_type i=0; i != NumDims; ++i) { - ordering_[i] = NumDims - 1 - i; + ordering_[i] = NumDims - 1 - i; } ascending_.assign(true); } general_storage_order(const fortran_storage_order&) { for (size_type i=0; i != NumDims; ++i) { - ordering_[i] = i; + ordering_[i] = i; } ascending_.assign(true); } @@ -51,12 +63,12 @@ namespace boost { bool all_dims_ascending() const { return std::accumulate(ascending_.begin(),ascending_.end(),true, - std::logical_and()); + std::logical_and()); } bool operator==(general_storage_order const& rhs) const { return (ordering_ == rhs.ordering_) && - (ascending_ == rhs.ascending_); + (ascending_ == rhs.ascending_); } protected: @@ -77,11 +89,11 @@ namespace boost { boost::array ascending; for (size_type i=0; i != NumDims; ++i) { - ordering[i] = NumDims - 1 - i; - ascending[i] = true; + ordering[i] = NumDims - 1 - i; + ascending[i] = true; } return general_storage_order(ordering.begin(), - ascending.begin()); + ascending.begin()); } #endif }; @@ -99,11 +111,11 @@ namespace boost { boost::array ascending; for (size_type i=0; i != NumDims; ++i) { - ordering[i] = i; - ascending[i] = true; + ordering[i] = i; + ascending[i] = true; } return general_storage_order(ordering.begin(), - ascending.begin()); + ascending.begin()); } #endif }; diff --git a/boost/boost/multi_array/subarray.hpp b/boost/boost/multi_array/subarray.hpp index 5b1ab067c9..2aa1070918 100644 --- a/boost/boost/multi_array/subarray.hpp +++ b/boost/boost/multi_array/subarray.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef SUBARRAY_RG071801_HPP #define SUBARRAY_RG071801_HPP @@ -63,34 +75,34 @@ public: // constness. const_reference operator[](index idx) const { return super_type::access(boost::type(), - idx,base_,shape(),strides(),index_bases()); + idx,base_,shape(),strides(),index_bases()); } template const element& operator()(const IndexList& indices) const { return super_type::access_element(boost::type(), - origin(), - indices,strides()); + origin(), + indices,strides()); } // see generate_array_view in base.hpp -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template #else template // else ICE #endif // BOOST_MSVC typename const_array_view::type operator[](const boost::detail::multi_array:: - index_gen& indices) + index_gen& indices) const { - typedef const_array_view::type return_type; + typedef typename const_array_view::type return_type; return super_type::generate_array_view(boost::type(), - indices, - shape(), - strides(), - index_bases(), - base_); + indices, + shape(), + strides(), + index_bases(), + base_); } template @@ -127,12 +139,12 @@ public: const_iterator begin() const { return const_iterator(const_iter_base(*index_bases(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } const_iterator end() const { return const_iterator(const_iter_base(*index_bases()+*shape(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } const_reverse_iterator rbegin() const { @@ -154,7 +166,7 @@ public: size_type num_elements() const { return std::accumulate(shape(),shape() + num_dimensions(), - size_type(1), std::multiplies()); + size_type(1), std::multiplies()); } @@ -167,9 +179,9 @@ public: // Should be protected #endif const_sub_array (TPtr base, - const size_type* extents, - const index* strides, - const index* index_base) : + const size_type* extents, + const index* strides, + const index* index_base) : base_(base), extents_(extents), strides_(strides), index_base_(index_base) { } @@ -225,7 +237,7 @@ public: // make sure the dimensions agree assert(other.num_dimensions() == num_dimensions()); assert(std::equal(other.shape(),other.shape()+num_dimensions(), - shape())); + shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); return *this; @@ -237,7 +249,7 @@ public: // make sure the dimensions agree assert(other.num_dimensions() == num_dimensions()); assert(std::equal(other.shape(),other.shape()+num_dimensions(), - shape())); + shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); } @@ -249,43 +261,43 @@ public: reference operator[](index idx) { return super_type::access(boost::type(), - idx,base_,shape(),strides(),index_bases()); + idx,base_,shape(),strides(),index_bases()); } // see generate_array_view in base.hpp -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template #else template // else ICE #endif // BOOST_MSVC typename array_view::type operator[](const boost::detail::multi_array:: - index_gen& indices) { - typedef array_view::type return_type; + index_gen& indices) { + typedef typename array_view::type return_type; return super_type::generate_array_view(boost::type(), - indices, - shape(), - strides(), - index_bases(), - origin()); + indices, + shape(), + strides(), + index_bases(), + origin()); } template element& operator()(const IndexList& indices) { return super_type::access_element(boost::type(), - origin(), - indices,strides()); + origin(), + indices,strides()); } iterator begin() { return iterator(iter_base(*index_bases(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } iterator end() { return iterator(iter_base(*index_bases()+*shape(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } // RG - rbegin() and rend() written naively to thwart MSVC ICE. @@ -313,14 +325,14 @@ public: } // see generate_array_view in base.hpp -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template #else template // else ICE #endif // BOOST_MSVC typename const_array_view::type operator[](const boost::detail::multi_array:: - index_gen& indices) + index_gen& indices) const { return super_type::operator[](indices); } @@ -349,9 +361,9 @@ public: // should be private #endif sub_array (T* base, - const size_type* extents, - const index* strides, - const index* index_base) : + const size_type* extents, + const index* strides, + const index* index_base) : super_type(base,extents,strides,index_base) { } diff --git a/boost/boost/multi_array/types.hpp b/boost/boost/multi_array/types.hpp index 2f1cb1e208..159bf00407 100644 --- a/boost/boost/multi_array/types.hpp +++ b/boost/boost/multi_array/types.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_MULTI_ARRAY_TYPES_RG071801_HPP #define BOOST_MULTI_ARRAY_TYPES_RG071801_HPP diff --git a/boost/boost/multi_array/view.hpp b/boost/boost/multi_array/view.hpp index fe69ba614c..5484c9d794 100644 --- a/boost/boost/multi_array/view.hpp +++ b/boost/boost/multi_array/view.hpp @@ -1,3 +1,15 @@ +// Copyright (C) 2002 Ronald Garcia +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. +// + #ifndef BOOST_MULTI_ARRAY_VIEW_RG071301_HPP #define BOOST_MULTI_ARRAY_VIEW_RG071301_HPP @@ -53,7 +65,7 @@ public: template const_multi_array_view(const - const_multi_array_view& other) : + const_multi_array_view& other) : base_(other.base_), origin_offset_(other.origin_offset_), num_elements_(other.num_elements_), extent_list_(other.extent_list_), stride_list_(other.stride_list_), index_base_list_(other.index_base_list_) @@ -98,45 +110,45 @@ public: template const element& operator()(IndexList indices) const { return super_type::access_element(boost::type(), - origin(), - indices,strides()); + origin(), + indices,strides()); } // Only allow const element access const_reference operator[](index idx) const { return super_type::access(boost::type(), - idx,origin(), - shape(),strides(), - index_bases()); + idx,origin(), + shape(),strides(), + index_bases()); } // see generate_array_view in base.hpp -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template #else template // else ICE #endif // BOOST_MSVC typename const_array_view::type operator[](const boost::detail::multi_array:: - index_gen& indices) + index_gen& indices) const { - typedef const_array_view::type return_type; + typedef typename const_array_view::type return_type; return super_type::generate_array_view(boost::type(), - indices, - shape(), - strides(), - index_bases(), - origin()); + indices, + shape(), + strides(), + index_bases(), + origin()); } const_iterator begin() const { return const_iterator(const_iter_base(*index_bases(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } const_iterator end() const { return const_iterator(const_iter_base(*index_bases()+*shape(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } const_reverse_iterator rbegin() const { @@ -150,46 +162,46 @@ public: template bool operator==(const - const_multi_array_view& rhs) + const_multi_array_view& rhs) const { if(std::equal(extent_list_.begin(), - extent_list_.end(), - rhs.extent_list_.begin())) + extent_list_.end(), + rhs.extent_list_.begin())) return std::equal(begin(),end(),rhs.begin()); else return false; } template bool operator<(const - const_multi_array_view& rhs) + const_multi_array_view& rhs) const { return std::lexicographical_compare(begin(),end(),rhs.begin(),rhs.end()); } template bool operator!=(const - const_multi_array_view& rhs) + const_multi_array_view& rhs) const { return !(*this == rhs); } template bool operator>(const - const_multi_array_view& rhs) + const_multi_array_view& rhs) const { return rhs < *this; } template bool operator<=(const - const_multi_array_view& rhs) + const_multi_array_view& rhs) const { return !(*this > rhs); } template bool operator>=(const - const_multi_array_view& rhs) + const_multi_array_view& rhs) const { return !(*this < rhs); } @@ -207,8 +219,8 @@ public: // should be protected // to create strides template explicit const_multi_array_view(TPtr base, - const ExtentList& extents, - const boost::array& strides): + const ExtentList& extents, + const boost::array& strides): base_(base), origin_offset_(0) { index_base_list_.assign(0); @@ -219,7 +231,7 @@ public: // should be protected // Calculate the array size num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(), - size_type(1),std::multiplies()); + size_type(1),std::multiplies()); assert(num_elements_ != 0); } @@ -281,7 +293,7 @@ public: // make sure the dimensions agree assert(other.num_dimensions() == num_dimensions()); assert(std::equal(other.shape(),other.shape()+num_dimensions(), - shape())); + shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); return *this; @@ -293,7 +305,7 @@ public: // make sure the dimensions agree assert(other.num_dimensions() == num_dimensions()); assert(std::equal(other.shape(),other.shape()+num_dimensions(), - shape())); + shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); } @@ -305,47 +317,47 @@ public: template element& operator()(const IndexList& indices) { return super_type::access_element(boost::type(), - origin(), - indices,strides()); + origin(), + indices,strides()); } reference operator[](index idx) { return super_type::access(boost::type(), - idx,origin(), - shape(),strides(), - index_bases()); + idx,origin(), + shape(),strides(), + index_bases()); } // see generate_array_view in base.hpp -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template #else template // else ICE #endif // BOOST_MSVC typename array_view::type operator[](const boost::detail::multi_array:: - index_gen& indices) { - typedef array_view::type return_type; + index_gen& indices) { + typedef typename array_view::type return_type; return super_type::generate_array_view(boost::type(), - indices, - shape(), - strides(), - index_bases(), - origin()); + indices, + shape(), + strides(), + index_bases(), + origin()); } iterator begin() { return iterator(iter_base(*index_bases(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } iterator end() { return iterator(iter_base(*index_bases()+*shape(),origin(), - shape(),strides(),index_bases())); + shape(),strides(),index_bases())); } reverse_iterator rbegin() { @@ -371,14 +383,14 @@ public: } // see generate_array_view in base.hpp -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template #else template // else ICE #endif // BOOST_MSVC typename const_array_view::type operator[](const boost::detail::multi_array:: - index_gen& indices) + index_gen& indices) const { return super_type::operator[](indices); } @@ -410,8 +422,8 @@ public: // should be private // generate array views template explicit multi_array_view(T* base, - const ExtentList& extents, - const boost::array& strides) : + const ExtentList& extents, + const boost::array& strides) : super_type(base,extents,strides) { } }; diff --git a/boost/boost/preprocessor/detail/cat.hpp b/boost/boost/preprocessor/detail/cat.hpp index 8ccad4ebea..78a3b65be4 100644 --- a/boost/boost/preprocessor/detail/cat.hpp +++ b/boost/boost/preprocessor/detail/cat.hpp @@ -2,24 +2,29 @@ #define BOOST_PREPROCESSOR_DETAIL_CAT_HPP /* Copyright (C) 2002 Vesa Karvonen - * - * Permission to copy, use, modify, sell and distribute this software is - * granted provided this copyright notice appears in all copies. This - * software is provided "as is" without express or implied warranty, and - * with no claim as to its suitability for any purpose. - * - * See http://www.boost.org for most recent version. - */ +* +* Permission to copy, use, modify, sell and distribute this software is +* granted provided this copyright notice appears in all copies. This +* software is provided "as is" without express or implied warranty, and +* with no claim as to its suitability for any purpose. +* +* See http://www.boost.org for most recent version. +*/ -#define BOOST_PP_DETAIL_CAT2(A,B) BOOST_PP_DETAIL_DO_CAT2(A,B) +#define BOOST_PP_DETAIL_CAT2(A,B) BOOST_PP_DETAIL_CAT2_DELAY(A,B) +#define BOOST_PP_DETAIL_CAT2_DELAY(A, B) BOOST_PP_DETAIL_DO_CAT2(A, B) #define BOOST_PP_DETAIL_DO_CAT2(A,B) A##B -#define BOOST_PP_DETAIL_CAT3(A,B,C) BOOST_PP_DETAIL_DO_CAT3(A,B,C) +#define BOOST_PP_DETAIL_CAT3(A,B,C) BOOST_PP_DETAIL_CAT3_DELAY(A,B,C) +#define BOOST_PP_DETAIL_CAT3_DELAY(A,B,C) BOOST_PP_DETAIL_DO_CAT3(A,B,C) #define BOOST_PP_DETAIL_DO_CAT3(A,B,C) A##B##C -#define BOOST_PP_DETAIL_CAT4(A,B,C,D) BOOST_PP_DETAIL_DO_CAT4(A,B,C,D) +#define BOOST_PP_DETAIL_CAT4(A,B,C,D) BOOST_PP_DETAIL_CAT4_DELAY(A,B,C,D) +#define BOOST_PP_DETAIL_CAT4_DELAY(A,B,C,D) BOOST_PP_DETAIL_DO_CAT4(A,B,C,D) #define BOOST_PP_DETAIL_DO_CAT4(A,B,C,D) A##B##C##D -#define BOOST_PP_DETAIL_CAT5(A,B,C,D,E) BOOST_PP_DETAIL_DO_CAT5(A,B,C,D,E) +#define BOOST_PP_DETAIL_CAT5(A,B,C,D,E) BOOST_PP_DETAIL_CAT5_DELAY(A,B,C,D,E) +#define BOOST_PP_DETAIL_CAT5_DELAY(A,B,C,D,E) BOOST_PP_DETAIL_DO_CAT5(A,B,C,D,E) #define BOOST_PP_DETAIL_DO_CAT5(A,B,C,D,E) A##B##C##D##E + #endif diff --git a/boost/boost/preprocessor/detail/expand.hpp b/boost/boost/preprocessor/detail/expand.hpp index dde4af0529..08b793906e 100644 --- a/boost/boost/preprocessor/detail/expand.hpp +++ b/boost/boost/preprocessor/detail/expand.hpp @@ -1,5 +1,5 @@ #ifndef BOOST_PREPROCESSOR_DETAIL_EXPAND_HPP -#define BOOST_PREPROCESSOR_DETAIL_EXPAND_HPP +# define BOOST_PREPROCESSOR_DETAIL_EXPAND_HPP /* Copyright (C) 2002 Vesa Karvonen * @@ -11,5 +11,11 @@ * See http://www.boost.org for most recent version. */ -#define BOOST_PP_DETAIL_EXPAND(X) X +# define BOOST_PP_DETAIL_EXPAND(X) X +# if !defined(__MWERKS__) || __MWERKS__ > 0x3001 +# define BOOST_PP_DETAIL_EXPAND2(X,Y) BOOST_PP_DETAIL_EXPAND(X Y) +# else +# define BOOST_PP_DETAIL_EXPAND2(X, Y) BOOST_PP_DETAIL_EXPAND2_DELAY(X, Y) +# define BOOST_PP_DETAIL_EXPAND2_DELAY(X, Y) X ## Y +# endif #endif diff --git a/boost/boost/preprocessor/expr_if.hpp b/boost/boost/preprocessor/expr_if.hpp index b748264060..4bf77cb17b 100644 --- a/boost/boost/preprocessor/expr_if.hpp +++ b/boost/boost/preprocessor/expr_if.hpp @@ -13,7 +13,6 @@ * See http://www.boost.org for most recent version. */ -#include #include /**

Expands to EXPR if COND != 0 and to nothing if COND == 0.

@@ -27,7 +26,10 @@
  • BOOST_PP_IF()
  • */ -#define BOOST_PP_EXPR_IF(COND,EXPR) BOOST_PP_DETAIL_CAT2(BOOST_PP_EXPR_IF,BOOST_PP_BOOL(COND))(EXPR) +#define BOOST_PP_EXPR_IF(COND,EXPR) BOOST_PP_EXPR_IF_BOOL(BOOST_PP_BOOL(COND),EXPR) /* original: BOOST_PP_DETAIL_CAT2(BOOST_PP_EXPR_IF,BOOST_PP_BOOL(COND))(EXPR) */ + +#define BOOST_PP_EXPR_IF_BOOL(COND,EXPR) BOOST_PP_EXPR_IF_BOOL_DELAY(COND,EXPR) +#define BOOST_PP_EXPR_IF_BOOL_DELAY(COND,EXPR) BOOST_PP_EXPR_IF##COND(EXPR) #define BOOST_PP_EXPR_IF0(E) #define BOOST_PP_EXPR_IF1(E) E diff --git a/boost/boost/preprocessor/if.hpp b/boost/boost/preprocessor/if.hpp index 1a6266acae..0ade0993f1 100644 --- a/boost/boost/preprocessor/if.hpp +++ b/boost/boost/preprocessor/if.hpp @@ -13,7 +13,6 @@ * See http://www.boost.org for most recent version. */ -#include #include /**

    Expands to THEN if COND != 0 and ELSE if @@ -33,7 +32,11 @@

  • preprocessor_test.cpp
  • */ -#define BOOST_PP_IF(COND,THEN,ELSE) BOOST_PP_DETAIL_CAT2(BOOST_PP_IF,BOOST_PP_BOOL(COND))(ELSE,THEN) +#define BOOST_PP_IF(COND,THEN,ELSE) BOOST_PP_IF_BOOL(BOOST_PP_BOOL(COND),ELSE,THEN) + +#define BOOST_PP_IF_BOOL(C,E,T) BOOST_PP_IF_BOOL_DELAY(C,E,T) +#define BOOST_PP_IF_BOOL_DELAY(C,E,T) BOOST_PP_IF##C(E,T) + #define BOOST_PP_IF0(E,T) E #define BOOST_PP_IF1(E,T) T #endif diff --git a/boost/boost/preprocessor/limits.hpp b/boost/boost/preprocessor/limits.hpp index 107bb81296..ee880e9533 100644 --- a/boost/boost/preprocessor/limits.hpp +++ b/boost/boost/preprocessor/limits.hpp @@ -40,5 +40,5 @@ BOOST_PP_REPEAT() and BOOST_PP_REPEAT_FROM_TO()).

    #define BOOST_PP_LIMIT_MAG 128 /**

    Expands to the maximum tuple size supported by the library.

    */ -#define BOOST_PP_LIMIT_TUPLE 16 +#define BOOST_PP_LIMIT_TUPLE 32 #endif diff --git a/boost/boost/preprocessor/list/for_each_product.hpp b/boost/boost/preprocessor/list/for_each_product.hpp index 0e7f692d53..592581d0cc 100644 --- a/boost/boost/preprocessor/list/for_each_product.hpp +++ b/boost/boost/preprocessor/list/for_each_product.hpp @@ -100,4 +100,36 @@ BOOST_PP_LIST_FOR_EACH_PRODUCT #define BOOST_PP_LIST_FOR_EACH_PRODUCT_I14(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,14)(R,P) #define BOOST_PP_LIST_FOR_EACH_PRODUCT_I15_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I16) #define BOOST_PP_LIST_FOR_EACH_PRODUCT_I15(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,15)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I16_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I17) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I16(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,16)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I17_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I18) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I17(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,17)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I18_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I19) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I18(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,18)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I19_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I20) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I19(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,19)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I20_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I21) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I20(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,20)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I21_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I22) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I21(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,21)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I22_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I23) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I22(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,22)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I23_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I24) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I23(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,23)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I24_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I25) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I24(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,24)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I25_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I26) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I25(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,25)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I26_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I27) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I26(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,26)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I27_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I28) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I27(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,27)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I28_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I29) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I28(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,28)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I29_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I30) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I29(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,29)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I30_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I31) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I30(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,30)(R,P) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I31_C(R,P) BOOST_PP_FOR##R(BOOST_PP_LIST_FOR_EACH_PRODUCT_I_H(P),BOOST_PP_LIST_FOR_EACH_PRODUCT_C,BOOST_PP_LIST_FOR_EACH_PRODUCT_F,BOOST_PP_LIST_FOR_EACH_PRODUCT_I32) +#define BOOST_PP_LIST_FOR_EACH_PRODUCT_I31(R,P) BOOST_PP_LIST_FOR_EACH_PRODUCT_I_C(P,31)(R,P) #endif diff --git a/boost/boost/preprocessor/logical/bool.hpp b/boost/boost/preprocessor/logical/bool.hpp index 5f41ee883f..ddde33a05c 100644 --- a/boost/boost/preprocessor/logical/bool.hpp +++ b/boost/boost/preprocessor/logical/bool.hpp @@ -13,7 +13,8 @@ * See http://www.boost.org for most recent version. */ -#include +// pm: not necessary if using manual delay +// #include /**

    Expands to 0 if X == 0 and 1 if X != 0.

    @@ -21,7 +22,8 @@

    For example, BOOST_PP_BOOL(3) expands to 1.

    */ -#define BOOST_PP_BOOL(X) BOOST_PP_DETAIL_CAT2(BOOST_PP_BOOL,X) +#define BOOST_PP_BOOL(X) BOOST_PP_BOOL_DELAY(X) /* original: BOOST_PP_DETAIL_CAT2(BOOST_PP_BOOL,X) */ +#define BOOST_PP_BOOL_DELAY(X) BOOST_PP_BOOL##X /* BOOL can be implemented in O(1) tokens using saturated ADD & SUB. * Unfortunately, it would result in significantly slower preprocessing. diff --git a/boost/boost/preprocessor/repeat.hpp b/boost/boost/preprocessor/repeat.hpp index bbc5c367ec..dd286e045e 100644 --- a/boost/boost/preprocessor/repeat.hpp +++ b/boost/boost/preprocessor/repeat.hpp @@ -92,6 +92,13 @@ are directly supported.

    #define BOOST_PP_REPEAT_AUTO_REC3(M,P) BOOST_PP_EXPAND(M P) #define BOOST_PP_REPEAT_1(C,M,D) BOOST_PP_REPEAT_AUTO_REC1(BOOST_PP_DETAIL_CAT2(BOOST_PP_R1_,C),(M,D)) +#define BOOST_PP_REPEAT_2(C,M,D) BOOST_PP_REPEAT_AUTO_REC2(BOOST_PP_DETAIL_CAT2(BOOST_PP_R2_,C),(M,D)) +#define BOOST_PP_REPEAT_3(C,M,D) BOOST_PP_REPEAT_AUTO_REC3(BOOST_PP_DETAIL_CAT2(BOOST_PP_R3_,C),(M,D)) + +#if defined(__EDG_VERSION__) && (__EDG_VERSION__ <= 245) /* unrolled repeats for EDG front end */ +#include +#else + #define BOOST_PP_R1_0(M,D) #define BOOST_PP_R1_1(M,D) M(0,D) #define BOOST_PP_R1_2(M,D) M(0,D) M(1,D) @@ -222,7 +229,6 @@ are directly supported.

    #define BOOST_PP_R1_127(M,D) BOOST_PP_R1_126(M,D) M(126,D) #define BOOST_PP_R1_128(M,D) BOOST_PP_R1_127(M,D) M(127,D) -#define BOOST_PP_REPEAT_2(C,M,D) BOOST_PP_REPEAT_AUTO_REC2(BOOST_PP_DETAIL_CAT2(BOOST_PP_R2_,C),(M,D)) #define BOOST_PP_R2_0(M,D) #define BOOST_PP_R2_1(M,D) M(0,D) #define BOOST_PP_R2_2(M,D) M(0,D) M(1,D) @@ -353,7 +359,6 @@ are directly supported.

    #define BOOST_PP_R2_127(M,D) BOOST_PP_R2_126(M,D) M(126,D) #define BOOST_PP_R2_128(M,D) BOOST_PP_R2_127(M,D) M(127,D) -#define BOOST_PP_REPEAT_3(C,M,D) BOOST_PP_REPEAT_AUTO_REC3(BOOST_PP_DETAIL_CAT2(BOOST_PP_R3_,C),(M,D)) #define BOOST_PP_R3_0(M,D) #define BOOST_PP_R3_1(M,D) M(0,D) #define BOOST_PP_R3_2(M,D) M(0,D) M(1,D) @@ -484,6 +489,8 @@ are directly supported.

    #define BOOST_PP_R3_127(M,D) BOOST_PP_R3_126(M,D) M(126,D) #define BOOST_PP_R3_128(M,D) BOOST_PP_R3_127(M,D) M(127,D) +#endif // !(defined(__EDG_VERSION__) && (__EDG_VERSION__ <= 245)) + /**

    Obsolete, just use BOOST_PP_REPEAT().

    */ #define BOOST_PP_REPEAT_2ND BOOST_PP_REPEAT /**

    Obsolete, just use BOOST_PP_REPEAT().

    */ diff --git a/boost/boost/preprocessor/tuple.hpp b/boost/boost/preprocessor/tuple.hpp index 0866bb482e..54f6f54c1e 100644 --- a/boost/boost/preprocessor/tuple.hpp +++ b/boost/boost/preprocessor/tuple.hpp @@ -24,9 +24,9 @@ constitutes a single macro parameter.

    Examples of tuples:

    -(const, volatile)    // 2-tuple
    -(*, /, %)            // 3-tuple
    -(1, "2", '3', (4,5)) // 4-tuple
    +(const, volatile)       a 2-tuple
    +(*, /, %)               a 3-tuple
    +(1, "2", '3', (4,5))    a 4-tuple
     

    Tuples can be used for representing structured data.

    diff --git a/boost/boost/preprocessor/tuple/eat.hpp b/boost/boost/preprocessor/tuple/eat.hpp index 4c01fc260d..1b00a1ad48 100644 --- a/boost/boost/preprocessor/tuple/eat.hpp +++ b/boost/boost/preprocessor/tuple/eat.hpp @@ -47,4 +47,20 @@ BOOST_PP_IF(0,BOOST_PP_ENUM_PARAMS,BOOST_PP_TUPLE_EAT(2))(10,P) #define BOOST_PP_TUPLE14_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N) #define BOOST_PP_TUPLE15_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) #define BOOST_PP_TUPLE16_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) +#define BOOST_PP_TUPLE17_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q) +#define BOOST_PP_TUPLE18_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R) +#define BOOST_PP_TUPLE19_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S) +#define BOOST_PP_TUPLE20_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T) +#define BOOST_PP_TUPLE21_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U) +#define BOOST_PP_TUPLE22_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V) +#define BOOST_PP_TUPLE23_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W) +#define BOOST_PP_TUPLE24_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X) +#define BOOST_PP_TUPLE25_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y) +#define BOOST_PP_TUPLE26_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z) +#define BOOST_PP_TUPLE27_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a) +#define BOOST_PP_TUPLE28_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b) +#define BOOST_PP_TUPLE29_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c) +#define BOOST_PP_TUPLE30_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d) +#define BOOST_PP_TUPLE31_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e) +#define BOOST_PP_TUPLE32_EAT(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f) #endif diff --git a/boost/boost/preprocessor/tuple/elem.hpp b/boost/boost/preprocessor/tuple/elem.hpp index bcc665f5a4..b38e78fa5f 100644 --- a/boost/boost/preprocessor/tuple/elem.hpp +++ b/boost/boost/preprocessor/tuple/elem.hpp @@ -31,7 +31,25 @@ BOOST_PP_TUPLE_ELEM(2,1,(A,B))
  • BOOST_PP_LIMIT_TUPLE
  • */ -#define BOOST_PP_TUPLE_ELEM(SIZE_OF_TUPLE,INDEX,TUPLE) BOOST_PP_DETAIL_EXPAND(BOOST_PP_DETAIL_CAT2(BOOST_PP_TUPLE16_ELEM,INDEX) BOOST_PP_DETAIL_CAT2(BOOST_PP_TUPLE_ELEM_EX,SIZE_OF_TUPLE) TUPLE) + +#if !defined(__MWERKS__) || __MWERKS__ > 0x3001 +# define BOOST_PP_TUPLE_ELEM(SIZE_OF_TUPLE,INDEX,TUPLE)\ + BOOST_PP_DETAIL_EXPAND2(\ + BOOST_PP_DETAIL_CAT2(BOOST_PP_TUPLE16_ELEM,INDEX)\ + ,BOOST_PP_DETAIL_CAT2(BOOST_PP_TUPLE_ELEM_EX,SIZE_OF_TUPLE) TUPLE\ + )\ +/**/ +#else +# define BOOST_PP_TUPLE_ELEM(SIZE_OF_TUPLE,INDEX,TUPLE)\ + BOOST_PP_TUPLE_ELEM_DELAY(SIZE_OF_TUPLE,INDEX,TUPLE)\ +/**/ +# define BOOST_PP_TUPLE_ELEM_DELAY(SIZE_OF_TUPLE,INDEX,TUPLE)\ + BOOST_PP_DETAIL_CAT2(\ + BOOST_PP_TUPLE16_ELEM##INDEX\ + ,BOOST_PP_DETAIL_CAT2(BOOST_PP_TUPLE_ELEM_EX##SIZE_OF_TUPLE,TUPLE)\ + )\ +/**/ +#endif #define BOOST_PP_TUPLE_ELEM_EX1(A) (A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) #define BOOST_PP_TUPLE_ELEM_EX2(A,B) (A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) diff --git a/boost/boost/preprocessor/tuple/reverse.hpp b/boost/boost/preprocessor/tuple/reverse.hpp index 5a90c8dc66..496c9a3c98 100644 --- a/boost/boost/preprocessor/tuple/reverse.hpp +++ b/boost/boost/preprocessor/tuple/reverse.hpp @@ -50,4 +50,20 @@ BOOST_PP_TUPLE_REVERSE(3,(A,B,C)) #define BOOST_PP_TUPLE14_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N) (N,M,L,K,J,I,H,G,F,E,D,C,B,A) #define BOOST_PP_TUPLE15_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) (O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) #define BOOST_PP_TUPLE16_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) (P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE17_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q) (Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE18_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R) (R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE19_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S) (S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE20_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T) (T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE21_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U) (U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE22_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V) (V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE23_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W) (W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE24_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X) (X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE25_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y) (Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE26_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z) (Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE27_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a) (a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE28_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b) (b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE29_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c) (c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE30_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d) (d,c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE31_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e) (e,d,c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) +#define BOOST_PP_TUPLE32_REVERSE(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f) (f,e,d,c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A) #endif diff --git a/boost/boost/preprocessor/tuple/to_list.hpp b/boost/boost/preprocessor/tuple/to_list.hpp index 27664f1a73..2d5eaf117b 100644 --- a/boost/boost/preprocessor/tuple/to_list.hpp +++ b/boost/boost/preprocessor/tuple/to_list.hpp @@ -64,4 +64,20 @@ BOOST_PP_LIST_NIL))) #define BOOST_PP_TUPLE14_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1) #define BOOST_PP_TUPLE15_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) #define BOOST_PP_TUPLE16_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE17_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE18_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE19_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE20_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE21_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE22_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE23_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE24_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(X,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE25_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(X,(Y,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE26_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(X,(Y,(Z,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE27_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(X,(Y,(Z,(a,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE28_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(X,(Y,(Z,(a,(b,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE29_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(X,(Y,(Z,(a,(b,(c,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE30_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(X,(Y,(Z,(a,(b,(c,(d,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE31_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(X,(Y,(Z,(a,(b,(c,(d,(e,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) +#define BOOST_PP_TUPLE32_TO_LIST(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f) (A,(B,(C,(D,(E,(F,(G,(H,(I,(J,(K,(L,(M,(N,(O,(P,(Q,(R,(S,(T,(U,(V,(W,(X,(Y,(Z,(a,(b,(c,(d,(e,(f,(_,_,0),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1),1) #endif diff --git a/boost/boost/property_map.hpp b/boost/boost/property_map.hpp index bafe9001f6..371f1a41c0 100644 --- a/boost/boost/property_map.hpp +++ b/boost/boost/property_map.hpp @@ -118,7 +118,7 @@ namespace boost { }; #endif -#ifndef BOOST_MSVC +#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) // MSVC doesn't have Koenig lookup, so the user has to // do boost::get() anyways, and the using clause // doesn't really work for MSVC. @@ -135,7 +135,7 @@ namespace boost { template inline const T& get(const T* pa, std::ptrdiff_t k) { return pa[k]; } -#ifndef BOOST_MSVC +#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) namespace boost { using ::put; using ::get; diff --git a/boost/boost/regex.hpp b/boost/boost/regex.hpp index 276962c4a1..9cddec1111 100644 --- a/boost/boost/regex.hpp +++ b/boost/boost/regex.hpp @@ -437,7 +437,7 @@ struct def_alloc_param_traits } template ::type) > #else BOOST_DEFAULT_ALLOCATOR(re_detail::def_alloc_param_traits::type) > diff --git a/boost/boost/regex/config.hpp b/boost/boost/regex/config.hpp index 581327e3eb..84eb058d03 100644 --- a/boost/boost/regex/config.hpp +++ b/boost/boost/regex/config.hpp @@ -152,7 +152,7 @@ // We don't make our templates external if the compiler // can't handle it: -#if defined(BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS) || defined(__ICL) || defined(__ICC)\ +#if (defined(BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS) || defined(__MWERKS__) || defined(__COMO__) || defined(__ICL) || defined(__ICC))\ && !defined(BOOST_MSVC) && !defined(__BORLANDC__) # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES #endif @@ -628,3 +628,4 @@ inline void pointer_construct(T* p, const T& t) + diff --git a/boost/boost/regex/detail/regex_match.hpp b/boost/boost/regex/detail/regex_match.hpp index da97ecce62..6f2f25fa1d 100644 --- a/boost/boost/regex/detail/regex_match.hpp +++ b/boost/boost/regex/detail/regex_match.hpp @@ -500,7 +500,11 @@ bool query_match_aux(iterator first, case syntax_element_word_boundary: { // prev and this character must be opposites: +#if defined(BOOST_REGEX_USE_C_LOCALE) && defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) + bool b = traits::is_class(*first, traits::char_class_word); +#else bool b = traits_inst.is_class(*first, traits::char_class_word); +#endif if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0)) { if(flags & match_not_bow) diff --git a/boost/boost/regex/regex_traits.hpp b/boost/boost/regex/regex_traits.hpp index caae5887b5..6edb4b8cb7 100644 --- a/boost/boost/regex/regex_traits.hpp +++ b/boost/boost/regex/regex_traits.hpp @@ -536,7 +536,7 @@ private: #endif // Wide strings #endif // Win32 -#ifndef BOOST_NO_STD_LOCALE +#if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF) } // namspace boost diff --git a/boost/boost/scoped_array.hpp b/boost/boost/scoped_array.hpp index 070925ce7a..8c7fdcc982 100644 --- a/boost/boost/scoped_array.hpp +++ b/boost/boost/scoped_array.hpp @@ -33,6 +33,8 @@ private: scoped_array(scoped_array const &); scoped_array & operator=(scoped_array const &); + typedef scoped_array this_type; + public: typedef T element_type; @@ -67,6 +69,20 @@ public: return ptr; } + // implicit conversion to "bool" + + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return ptr == 0? 0: &this_type::get; + } + + bool operator! () const // never throws + { + return ptr == 0; + } + void swap(scoped_array & b) // never throws { T * tmp = b.ptr; diff --git a/boost/boost/scoped_ptr.hpp b/boost/boost/scoped_ptr.hpp index f452f7a8a9..738ad1be3e 100644 --- a/boost/boost/scoped_ptr.hpp +++ b/boost/boost/scoped_ptr.hpp @@ -15,6 +15,10 @@ #include #include +#ifndef BOOST_NO_AUTO_PTR +# include // for std::auto_ptr +#endif + namespace boost { @@ -27,11 +31,13 @@ template class scoped_ptr // noncopyable { private: - T* ptr; + T * ptr; scoped_ptr(scoped_ptr const &); scoped_ptr & operator=(scoped_ptr const &); + typedef scoped_ptr this_type; + public: typedef T element_type; @@ -40,6 +46,14 @@ public: { } +#ifndef BOOST_NO_AUTO_PTR + + explicit scoped_ptr(std::auto_ptr p): ptr(p.release()) // never throws + { + } + +#endif + ~scoped_ptr() // never throws { checked_delete(ptr); @@ -71,6 +85,20 @@ public: return ptr; } + // implicit conversion to "bool" + + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return ptr == 0? 0: &this_type::get; + } + + bool operator! () const // never throws + { + return ptr == 0; + } + void swap(scoped_ptr & b) // never throws { T * tmp = b.ptr; @@ -84,6 +112,13 @@ template inline void swap(scoped_ptr & a, scoped_ptr & b) // n a.swap(b); } +// get_pointer(p) is a generic way to say p.get() + +template inline T * get_pointer(scoped_ptr const & p) +{ + return p.get(); +} + } // namespace boost #endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED diff --git a/boost/boost/shared_array.hpp b/boost/boost/shared_array.hpp index a820abc58d..c60a85a089 100644 --- a/boost/boost/shared_array.hpp +++ b/boost/boost/shared_array.hpp @@ -17,7 +17,7 @@ #include // for broken compiler workarounds -#ifndef BOOST_MSVC6_MEMBER_TEMPLATES +#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) #include #else @@ -92,6 +92,20 @@ public: return px; } + // implicit conversion to "bool" + + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: &this_type::get; + } + + bool operator! () const // never throws + { + return px == 0; + } + bool unique() const // never throws { return pn.unique(); @@ -137,6 +151,6 @@ template void swap(shared_array & a, shared_array & b) // neve } // namespace boost -#endif // #ifndef BOOST_MSVC6_MEMBER_TEMPLATES +#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) #endif // #ifndef BOOST_SHARED_ARRAY_HPP_INCLUDED diff --git a/boost/boost/shared_ptr.hpp b/boost/boost/shared_ptr.hpp index 39df95f020..78698a7885 100644 --- a/boost/boost/shared_ptr.hpp +++ b/boost/boost/shared_ptr.hpp @@ -17,7 +17,7 @@ #include // for broken compiler workarounds -#ifndef BOOST_MSVC6_MEMBER_TEMPLATES +#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) #include #else @@ -56,6 +56,15 @@ template<> struct shared_ptr_traits typedef void reference; }; +#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) + +template<> struct shared_ptr_traits +{ + typedef void reference; +}; + +#endif + } // namespace detail @@ -126,19 +135,19 @@ public: template shared_ptr(shared_ptr const & r, detail::dynamic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) { - if (px == 0) // need to allocate new counter -- the cast failed - { - pn = detail::shared_count(); - } + if (px == 0) // need to allocate new counter -- the cast failed + { + pn = detail::shared_count(); + } } template shared_ptr(shared_ptr const & r, detail::polymorphic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) { - if (px == 0) - { - throw std::bad_cast(); - } + if (px == 0) + { + throw std::bad_cast(); + } } #ifndef BOOST_NO_AUTO_PTR @@ -155,9 +164,9 @@ public: template shared_ptr & operator=(shared_ptr const & r) // never throws { - px = r.px; - pn = r.pn; // shared_count::op= doesn't throw - return *this; + px = r.px; + pn = r.pn; // shared_count::op= doesn't throw + return *this; } #endif @@ -167,73 +176,73 @@ public: template shared_ptr & operator=(std::auto_ptr & r) { - this_type(r).swap(*this); - return *this; + this_type(r).swap(*this); + return *this; } #endif void reset() { - this_type().swap(*this); + this_type().swap(*this); } template void reset(Y * p) // Y must be complete { - BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors - this_type(p).swap(*this); + BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors + this_type(p).swap(*this); } template void reset(Y * p, D d) { - this_type(p, d).swap(*this); + this_type(p, d).swap(*this); } typename detail::shared_ptr_traits::reference operator* () const // never throws { - BOOST_ASSERT(px != 0); - return *px; + BOOST_ASSERT(px != 0); + return *px; } T * operator-> () const // never throws { - BOOST_ASSERT(px != 0); - return px; + BOOST_ASSERT(px != 0); + return px; } - + T * get() const // never throws { - return px; - } - - bool unique() const // never throws - { - return pn.unique(); - } - - long use_count() const // never throws - { - return pn.use_count(); + return px; } // implicit conversion to "bool" - typedef long (this_type::*bool_type)() const; + typedef T * (this_type::*unspecified_bool_type)() const; - operator bool_type() const // never throws + operator unspecified_bool_type() const // never throws { - return px == 0? 0: &this_type::use_count; + return px == 0? 0: &this_type::get; } bool operator! () const // never throws { - return px == 0; + return px == 0; + } + + bool unique() const // never throws + { + return pn.unique(); + } + + long use_count() const // never throws + { + return pn.use_count(); } void swap(shared_ptr & other) // never throws { - std::swap(px, other.px); - pn.swap(other.pn); + std::swap(px, other.px); + pn.swap(other.pn); } // Tasteless as this may seem, making all members public allows member templates @@ -313,12 +322,34 @@ template inline T * get_pointer(shared_ptr const & p) return p.get(); } +// shared_from_this() creates a shared_ptr from a raw pointer (usually 'this') + +namespace detail +{ + +inline void sp_assert_counted_base(boost::counted_base const *) +{ +} + +template inline T * sp_remove_const(T const * p) +{ + return const_cast(p); +} + +} // namespace detail + +template shared_ptr shared_from_this(T * p) +{ + detail::sp_assert_counted_base(p); + return shared_ptr(detail::sp_remove_const(p)); +} + } // namespace boost #ifdef BOOST_MSVC # pragma warning(pop) -#endif +#endif -#endif // #ifndef BOOST_MSVC6_MEMBER_TEMPLATES +#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) #endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED diff --git a/boost/boost/signal.hpp b/boost/boost/signal.hpp index 60cd515dce..ac1ead9559 100644 --- a/boost/boost/signal.hpp +++ b/boost/boost/signal.hpp @@ -374,14 +374,14 @@ namespace boost { > class signal : public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl >::type + T8, T9, T10, boost::last_value >::type { public: template struct combiner { private: typedef BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl t1; + T6, T7, T8, T9, T10, Combiner> t1; public: typedef typename t1::type type; }; diff --git a/boost/boost/signals/connection.hpp b/boost/boost/signals/connection.hpp index 3381c99ad7..e032ab8b85 100644 --- a/boost/boost/signals/connection.hpp +++ b/boost/boost/signals/connection.hpp @@ -151,7 +151,7 @@ namespace boost { inline void connection::add_bound_object(const BOOST_SIGNALS_NAMESPACE::detail::bound_object& b) { - assert(con.get() != 0); + assert(con.get()); con->bound_objects.push_back(b); } diff --git a/boost/boost/signals/detail/signal_base.hpp b/boost/boost/signals/detail/signal_base.hpp index 7094b9c887..453e8a336c 100644 --- a/boost/boost/signals/detail/signal_base.hpp +++ b/boost/boost/signals/detail/signal_base.hpp @@ -69,17 +69,17 @@ namespace boost { // manages call depth class call_notification { public: - call_notification(const shared_ptr&); - ~call_notification(); - - shared_ptr impl; + call_notification(const shared_ptr&); + ~call_notification(); + + shared_ptr impl; }; // Implementation of base class for all signals. It handles the // management of the underlying slot lists. class signal_base_impl { public: - friend class call_notification; + friend class call_notification; typedef function2 compare_type; @@ -101,7 +101,7 @@ namespace boost { signal_base_impl* base; }; - friend class temporarily_set_clearing; + friend class temporarily_set_clearing; signal_base_impl(const compare_type&); ~signal_base_impl(); @@ -127,19 +127,19 @@ namespace boost { void remove_disconnected_slots() const; public: - // Our call depth when invoking slots (> 1 when we have a loop) - mutable int call_depth; - - struct { - // True if some slots have disconnected, but we were not able to - // remove them from the list of slots because there are valid - // iterators into the slot list - mutable bool delayed_disconnect:1; - - // True if we are disconnecting all disconnected slots - bool clearing:1; - } flags; - + // Our call depth when invoking slots (> 1 when we have a loop) + mutable int call_depth; + + struct { + // True if some slots have disconnected, but we were not able to + // remove them from the list of slots because there are valid + // iterators into the slot list + mutable bool delayed_disconnect:1; + + // True if we are disconnecting all disconnected slots + bool clearing:1; + } flags; + // Slots typedef std::multimap slot_container_type; @@ -155,9 +155,9 @@ namespace boost { friend class call_notification; signal_base(const compare_type& comp) : impl() - { + { impl.reset(new signal_base_impl(comp)); - } + } ~signal_base(); @@ -179,7 +179,7 @@ namespace boost { typedef signal_base_impl::slot_iterator slot_iterator; typedef signal_base_impl::stored_slot_type stored_slot_type; - shared_ptr impl; + shared_ptr impl; }; } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE diff --git a/boost/boost/signals/detail/signals_common.hpp b/boost/boost/signals/detail/signals_common.hpp index cb2db28835..e0b9b50877 100644 --- a/boost/boost/signals/detail/signals_common.hpp +++ b/boost/boost/signals/detail/signals_common.hpp @@ -37,12 +37,12 @@ namespace boost { // Determine the result type of a slot call template struct slot_result_type { - typedef R type; + typedef R type; }; template<> struct slot_result_type { - typedef unusable type; + typedef unusable type; }; // Determine if the given type T is a signal @@ -50,8 +50,8 @@ namespace boost { template struct is_signal { - BOOST_STATIC_CONSTANT(bool, - value = (is_convertible::value)); + BOOST_STATIC_CONSTANT(bool, + value = (is_convertible::value)); }; /* @@ -102,13 +102,13 @@ namespace boost { template struct is_ref { - BOOST_STATIC_CONSTANT(bool, value = false); + BOOST_STATIC_CONSTANT(bool, value = false); }; template struct is_ref > { - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true); }; #else // no partial specialization typedef char yes_type; @@ -122,9 +122,9 @@ namespace boost { template struct is_ref { - static T* t; - BOOST_STATIC_CONSTANT(bool, - value = (sizeof(is_ref_tester(t)) == sizeof(yes_type))); + static T* t; + BOOST_STATIC_CONSTANT(bool, + value = (sizeof(is_ref_tester(t)) == sizeof(yes_type))); }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -138,14 +138,14 @@ namespace boost { // standard slot template class get_slot_tag { - typedef typename IF<(is_signal::value), - signal_tag, - value_tag>::type signal_or_value; + typedef typename IF<(is_signal::value), + signal_tag, + value_tag>::type signal_or_value; - public: - typedef typename IF<(is_ref::value), - reference_tag, - signal_or_value>::type type; + public: + typedef typename IF<(is_ref::value), + reference_tag, + signal_or_value>::type type; }; // Forward declaration needed in lots of places diff --git a/boost/boost/signals/detail/slot_call_iterator.hpp b/boost/boost/signals/detail/slot_call_iterator.hpp index 354adee4b9..cabe0703ed 100644 --- a/boost/boost/signals/detail/slot_call_iterator.hpp +++ b/boost/boost/signals/detail/slot_call_iterator.hpp @@ -43,75 +43,75 @@ namespace boost { slot_call_policies() {} - slot_call_policies(const Iterator& x, Function fi) : - end(x), f(fi), cache() - { - } - - void initialize(Iterator& x) - { - x = std::find_if(x, end, std::not1(is_disconnected())); - cache.reset(); - } - - template - typename IteratorAdaptor::reference - dereference(const IteratorAdaptor& x) const - { - if (!cache.get()) { - cache.reset(new cached_return_value(f(*x.base()))); - } - - return cache->value; - } - - template - void increment(IteratorAdaptor& x) - { - ++x.base(); - x.base() = std::find_if(x.base(), x.policies().end, - std::not1(is_disconnected())); + slot_call_policies(const Iterator& x, Function fi) : + end(x), f(fi), cache() + { + } + + void initialize(Iterator& x) + { + x = std::find_if(x, end, std::not1(is_disconnected())); cache.reset(); - } - - template - bool equal(const IteratorAdaptor1& x, const IteratorAdaptor2& y) const - { - Iterator xb = std::find_if(x.base(), x.policies().end, - std::not1(is_disconnected())); - Iterator yb = std::find_if(y.base(), y.policies().end, - std::not1(is_disconnected())); + } + + template + typename IteratorAdaptor::reference + dereference(const IteratorAdaptor& x) const + { + if (!cache.get()) { + cache.reset(new cached_return_value(f(*x.base()))); + } + + return cache->value; + } + + template + void increment(IteratorAdaptor& x) + { + ++x.base(); + x.base() = std::find_if(x.base(), x.policies().end, + std::not1(is_disconnected())); + cache.reset(); + } + + template + bool equal(const IteratorAdaptor1& x, const IteratorAdaptor2& y) const + { + Iterator xb = std::find_if(x.base(), x.policies().end, + std::not1(is_disconnected())); + Iterator yb = std::find_if(y.base(), y.policies().end, + std::not1(is_disconnected())); const_cast(x).base() = xb; const_cast(y).base() = yb; - return xb == yb; - } - + return xb == yb; + } + private: - Iterator end; - Function f; + Iterator end; + Function f; mutable shared_ptr< cached_return_value > cache; }; template class slot_call_iterator_generator { private: - typedef typename Function::result_type value_type; + typedef typename Function::result_type value_type; public: - typedef slot_call_policies policy_type; - typedef iterator_adaptor type; + typedef slot_call_policies policy_type; + typedef iterator_adaptor type; }; template inline typename slot_call_iterator_generator::type make_slot_call_iterator(Iterator first, Iterator last, Function f) { - typedef slot_call_iterator_generator gen; - typedef typename gen::type sc_iterator; - typedef typename gen::policy_type sc_policy; + typedef slot_call_iterator_generator gen; + typedef typename gen::type sc_iterator; + typedef typename gen::policy_type sc_policy; - return sc_iterator(first, sc_policy(last, f)); + return sc_iterator(first, sc_policy(last, f)); } } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE diff --git a/boost/boost/signals/signal_template.hpp b/boost/boost/signals/signal_template.hpp index 615ee0bd63..4cb1f877a8 100644 --- a/boost/boost/signals/signal_template.hpp +++ b/boost/boost/signals/signal_template.hpp @@ -62,10 +62,10 @@ namespace boost { BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS typename Dummy = int> struct BOOST_SIGNALS_ARGS_STRUCT { - BOOST_SIGNALS_ARGS_STRUCT(BOOST_SIGNALS_COPY_PARMS) - BOOST_SIGNALS_INIT_ARGS - { - } + BOOST_SIGNALS_ARGS_STRUCT(BOOST_SIGNALS_COPY_PARMS) + BOOST_SIGNALS_INIT_ARGS + { + } BOOST_SIGNALS_ARGS_AS_MEMBERS }; @@ -74,19 +74,19 @@ namespace boost { // the bound arguments along to that underlying function object template struct BOOST_SIGNALS_CALL_BOUND { - template - struct caller { - typedef BOOST_SIGNALS_ARGS_STRUCT* - args_type; + struct caller { + typedef BOOST_SIGNALS_ARGS_STRUCT* + args_type; args_type args; typedef R result_type; caller() {} - caller(args_type a) : args(a) {} + caller(args_type a) : args(a) {} template R operator()(const Pair& slot) const @@ -94,32 +94,32 @@ namespace boost { F* target = const_cast(any_cast(&slot.second.second)); return (*target)(BOOST_SIGNALS_BOUND_ARGS); } - }; + }; }; template<> struct BOOST_SIGNALS_CALL_BOUND { - template - struct caller { - typedef BOOST_SIGNALS_ARGS_STRUCT* - args_type; + struct caller { + typedef BOOST_SIGNALS_ARGS_STRUCT* + args_type; args_type args; typedef unusable result_type; - caller(args_type a) : args(a) {} + caller(args_type a) : args(a) {} template unusable operator()(const Pair& slot) const { F* target = const_cast(any_cast(&slot.second.second)); (*target)(BOOST_SIGNALS_BOUND_ARGS); - return unusable(); + return unusable(); } - }; + }; }; } // namespace detail } // namespace BOOST_SIGNALS_NAMESPACE @@ -299,9 +299,9 @@ namespace boost { // Let the combiner call the slots via a pair of input iterators return combiner(BOOST_SIGNALS_NAMESPACE::detail::make_slot_call_iterator( - notification.impl->slots_.begin(), impl->slots_.end(), f), - BOOST_SIGNALS_NAMESPACE::detail::make_slot_call_iterator( - notification.impl->slots_.end(), impl->slots_.end(), f)); + notification.impl->slots_.begin(), impl->slots_.end(), f), + BOOST_SIGNALS_NAMESPACE::detail::make_slot_call_iterator( + notification.impl->slots_.end(), impl->slots_.end(), f)); } template< @@ -338,9 +338,9 @@ namespace boost { // Let the combiner call the slots via a pair of input iterators return combiner(BOOST_SIGNALS_NAMESPACE::detail::make_slot_call_iterator( - notification.impl->slots_.begin(), impl->slots_.end(), f), - BOOST_SIGNALS_NAMESPACE::detail::make_slot_call_iterator( - notification.impl->slots_.end(), impl->slots_.end(), f)); + notification.impl->slots_.begin(), impl->slots_.end(), f), + BOOST_SIGNALS_NAMESPACE::detail::make_slot_call_iterator( + notification.impl->slots_.end(), impl->slots_.end(), f)); } } // namespace boost diff --git a/boost/boost/token_functions.hpp b/boost/boost/token_functions.hpp index 938d88e872..858d2b587e 100644 --- a/boost/boost/token_functions.hpp +++ b/boost/boost/token_functions.hpp @@ -70,7 +70,7 @@ namespace boost{ // The out of the box GCC 2.95 on cygwin does not have a char_traits class. // MSVC does not like the following typename -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template ::traits_type > #else @@ -259,7 +259,7 @@ namespace boost{ enum empty_token_policy { drop_empty_tokens, keep_empty_tokens }; // The out of the box GCC 2.95 on cygwin does not have a char_traits class. -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template ::traits_type > #else @@ -390,7 +390,7 @@ namespace boost{ // cannot be returned as tokens. These are often whitespace // The out of the box GCC 2.95 on cygwin does not have a char_traits class. -#ifndef BOOST_MSVC +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template ::traits_type > #else diff --git a/boost/boost/tuple/detail/tuple_basic_no_partial_spec.hpp b/boost/boost/tuple/detail/tuple_basic_no_partial_spec.hpp index ec45df1481..f5dbdb62a7 100644 --- a/boost/boost/tuple/detail/tuple_basic_no_partial_spec.hpp +++ b/boost/boost/tuple/detail/tuple_basic_no_partial_spec.hpp @@ -648,8 +648,8 @@ namespace tuples { detail::assign_to_pointee(&t2), detail::assign_to_pointee(&t3), detail::assign_to_pointee(&t4), - detail::assign_to_pointee(&t5), - detail::assign_to_pointee(&t6)); + detail::assign_to_pointee(&t5), + detail::assign_to_pointee(&t6)); } // Tie variables into a tuple diff --git a/boost/boost/type_traits.hpp b/boost/boost/type_traits.hpp index d84f05b946..02d76e0e2b 100644 --- a/boost/boost/type_traits.hpp +++ b/boost/boost/type_traits.hpp @@ -4,8 +4,6 @@ // warranty, and with no claim as to its suitability for any purpose. // See http://www.boost.org for most recent version including documentation. -// See boost/detail/type_traits.hpp and boost/detail/ob_type_traits.hpp -// for full copyright notices. #ifndef BOOST_TYPE_TRAITS_HPP #define BOOST_TYPE_TRAITS_HPP @@ -41,3 +39,4 @@ + diff --git a/boost/boost/type_traits/conversion_traits.hpp b/boost/boost/type_traits/conversion_traits.hpp index d8c0198756..f5642cdb9d 100644 --- a/boost/boost/type_traits/conversion_traits.hpp +++ b/boost/boost/type_traits/conversion_traits.hpp @@ -38,7 +38,7 @@ namespace boost{ -#ifdef BOOST_MSVC +#if defined(BOOST_MSVC) // // MS specific version: diff --git a/boost/boost/type_traits/cv_traits.hpp b/boost/boost/type_traits/cv_traits.hpp index b10eac689b..514e0c1931 100644 --- a/boost/boost/type_traits/cv_traits.hpp +++ b/boost/boost/type_traits/cv_traits.hpp @@ -191,7 +191,7 @@ namespace detail{ namespace detail { - template + template struct is_const_impl : ::boost::type_traits::false_unary_metafunction {}; @@ -257,7 +257,7 @@ struct is_const namespace detail { - template + template struct is_volatile_impl : ::boost::type_traits::false_unary_metafunction {}; @@ -397,3 +397,4 @@ struct add_cv{ typedef T& type; }; + diff --git a/boost/boost/type_traits/same_traits.hpp b/boost/boost/type_traits/same_traits.hpp index fc3c555b39..e05579cf3c 100644 --- a/boost/boost/type_traits/same_traits.hpp +++ b/boost/boost/type_traits/same_traits.hpp @@ -52,7 +52,7 @@ const bool is_same::value; #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -#ifdef BOOST_MSVC +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // // the following VC6 specific implementation is *NOT* legal // C++, but has the advantage that it works for incomplete diff --git a/boost/libs/regex/src/cpp_regex_traits.cpp b/boost/libs/regex/src/cpp_regex_traits.cpp index eff1999c51..f9ecf07477 100644 --- a/boost/libs/regex/src/cpp_regex_traits.cpp +++ b/boost/libs/regex/src/cpp_regex_traits.cpp @@ -8,11 +8,11 @@ * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Dr John Maddock makes no representations - * about the suitability of this software for any purpose. + * about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * */ - + /* * LOCATION: see http://www.boost.org for most recent version. * FILE: c_regex_traits.cpp @@ -25,7 +25,7 @@ #include -#ifndef BOOST_NO_STD_LOCALE +#if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF) # ifdef BOOST_MSVC # pragma warning(disable:4786 4702 4127 4244) @@ -86,7 +86,7 @@ const char* re_char_class_names[] = { }; template > + class traits = ::std::char_traits > class parser_buf : public ::std::basic_streambuf { typedef ::std::basic_streambuf base_type; @@ -129,22 +129,23 @@ parser_buf::seekoff(off_type off, ::std::ios_base::seekdir way, : { case ::std::ios_base::beg: if((off < 0) || (off > size)) - return pos_type(off_type(-1)); + return pos_type(off_type(-1)); else - this->setg(g, g + off, g + size); + this->setg(g, g + off, g + size); case ::std::ios_base::end: if((off < 0) || (off > size)) - return pos_type(off_type(-1)); + return pos_type(off_type(-1)); else - this->setg(g, g + size - off, g + size); + this->setg(g, g + size - off, g + size); case ::std::ios_base::cur: { std::ptrdiff_t newpos = pos + off; if((newpos < 0) || (newpos > size)) - return pos_type(off_type(-1)); + return pos_type(off_type(-1)); else - this->setg(g, g + newpos, g + size); + this->setg(g, g + newpos, g + size); } + default: ; } return static_cast(this->gptr() - this->eback()); } @@ -204,13 +205,13 @@ message_data::message_data(const std::locale& l, const std::string& regex_ #ifndef BOOST_NO_EXCEPTIONS if(cat < 0) { - std::string m("Unable to open message catalog: "); - throw std::runtime_error(m + regex_message_catalogue); + std::string m("Unable to open message catalog: "); + throw std::runtime_error(m + regex_message_catalogue); } #else BOOST_REGEX_NOEH_ASSERT(cat >= 0); #endif - } + } #endif std::memset(syntax_map, cpp_regex_traits::syntax_char, 256); unsigned i; @@ -222,18 +223,18 @@ message_data::message_data(const std::locale& l, const std::string& regex_ new_size = re_get_default_message(0, 0, i+100); if(new_size > array_size) { - a.reset(new char[new_size]); - array_size = new_size; + a.reset(new char[new_size]); + array_size = new_size; } re_get_default_message(a.get(), array_size, i+100); std::string s = a.get(); #ifndef BOOST_NO_STD_MESSAGES if((int)cat >= 0) - s = pm->get(cat, 0, i+100, s); + s = pm->get(cat, 0, i+100, s); #endif for(std::size_t j = 0; j < s.size(); ++j) { - syntax_map[s[j]] = (unsigned char)(i); + syntax_map[s[j]] = (unsigned char)(i); } } @@ -260,19 +261,19 @@ message_data::message_data(const std::locale& l, const std::string& regex_ c2 = pm->get(cat, 0, i, c1); while(c2.size()) { - const char* p1, *p2, *p3, *p4;; - p1 = c2.c_str(); - while(*p1 && BOOST_REGEX_STD isspace((char)*p1, l))++p1; - p2 = p1; - while(*p2 && !BOOST_REGEX_STD isspace((char)*p2, l))++p2; - p3 = p2; - while(*p3 && BOOST_REGEX_STD isspace((char)*p3, l))++p3; - p4 = p3; - while(*p4 && !BOOST_REGEX_STD isspace((char)*p4, l))++p4; - collating_elements[std::string(p1, p2)] = std::string(p3, p4); + const char* p1, *p2, *p3, *p4;; + p1 = c2.c_str(); + while(*p1 && BOOST_REGEX_STD isspace((char)*p1, l))++p1; + p2 = p1; + while(*p2 && !BOOST_REGEX_STD isspace((char)*p2, l))++p2; + p3 = p2; + while(*p3 && BOOST_REGEX_STD isspace((char)*p3, l))++p3; + p4 = p3; + while(*p4 && !BOOST_REGEX_STD isspace((char)*p4, l))++p4; + collating_elements[std::string(p1, p2)] = std::string(p3, p4); - ++i; - c2 = pm->get(cat, 0, i, c1); + ++i; + c2 = pm->get(cat, 0, i, c1); } } #endif @@ -283,14 +284,14 @@ message_data::message_data(const std::locale& l, const std::string& regex_ { for(i = 0; i < re_classes_max; ++i) { - s = pm->get(cat, 0, i+300, m); - if(s.size()) - classes[s] = i; + s = pm->get(cat, 0, i+300, m); + if(s.size()) + classes[s] = i; } for(i = 0; i <= boost::REG_E_UNKNOWN ; ++i) { - s = pm->get(cat, 0, i+200, m); - error_strings[i] = s; + s = pm->get(cat, 0, i+200, m); + error_strings[i] = s; } } @@ -389,7 +390,7 @@ boost::uint_fast32_t BOOST_REGEX_CALL cpp_regex_traits::lookup_classname(c for(i = 0; i < re_classes_max; ++i) { if(s == re_char_class_names[i]) - return re_char_class_id[i]; + return re_char_class_id[i]; } return 0; } @@ -417,16 +418,16 @@ void BOOST_REGEX_CALL cpp_regex_traits::transform_primary(std::string& out break; case re_detail::sort_fixed: if((unsigned)sort_delim < out.size()) - out.erase((int)sort_delim); + out.erase((int)sort_delim); break; case re_detail::sort_delim: for(unsigned int i = 0; i < out.size(); ++i) { - if((out[i] == sort_delim) && (i+1 < out.size())) - { - out.erase(i+1); - break; - } + if((out[i] == sort_delim) && (i+1 < out.size())) + { + out.erase(i+1); + break; + } } } } @@ -481,20 +482,20 @@ std::string BOOST_REGEX_CALL to_narrow(const std::basic_string& is, con switch(cvt.out(state, is.c_str(), is.c_str() + is.size(), next_in, t.get(), t.get() + bufsize, next_out)) { case std::codecvt_base::ok: - return std::string(t.get(), next_out); + return std::string(t.get(), next_out); case std::codecvt_base::partial: - bufsize *= 2; - t.reset(new char[bufsize]); - continue; + bufsize *= 2; + t.reset(new char[bufsize]); + continue; case std::codecvt_base::error: - // not much we can do here but guess: + // not much we can do here but guess: case std::codecvt_base::noconv: - std::string out; - for(unsigned i = 0; i < is.size(); ++i) - { - out.append(1, (char)is[i]); - } - return out; + std::string out; + for(unsigned i = 0; i < is.size(); ++i) + { + out.append(1, (char)is[i]); + } + return out; } } } @@ -522,25 +523,25 @@ std::wstring BOOST_REGEX_CALL to_wide(const std::string& is, const std::codecvt< switch(cvt.in(state, is.c_str(), is.c_str() + is.size(), next_in, t.get(), t.get() + bufsize, next_out)) { case std::codecvt_base::ok: - return std::wstring(t.get(), next_out); + return std::wstring(t.get(), next_out); case std::codecvt_base::partial: - bufsize *= 2; - if(bufsize < maxsize) - { - t.reset(new wchar_t[bufsize]); - continue; - } - // - // error fall through: + bufsize *= 2; + if(bufsize < maxsize) + { + t.reset(new wchar_t[bufsize]); + continue; + } + // + // error fall through: case std::codecvt_base::error: - // not much we can do here but guess: + // not much we can do here but guess: case std::codecvt_base::noconv: - std::wstring out; - for(unsigned i = 0; i < is.size(); ++i) - { - out.append(1, is[i]); - } - return out; + std::wstring out; + for(unsigned i = 0; i < is.size(); ++i) + { + out.append(1, is[i]); + } + return out; } } } @@ -595,8 +596,8 @@ message_data::message_data(const std::locale& l, const std::string& reg #ifndef BOOST_NO_EXCEPTIONS if(cat < 0) { - std::string m("Unable to open message catalog: "); - throw std::runtime_error(m + regex_message_catalogue); + std::string m("Unable to open message catalog: "); + throw std::runtime_error(m + regex_message_catalogue); } #else BOOST_REGEX_NOEH_ASSERT(cat >= 0); @@ -613,26 +614,26 @@ message_data::message_data(const std::locale& l, const std::string& reg new_size = re_get_default_message(0, 0, i+100); if(new_size > array_size) { - a.reset(new char[new_size]); - array_size = new_size; + a.reset(new char[new_size]); + array_size = new_size; } re_get_default_message(a.get(), array_size, i+100); std::string ns = a.get(); string_type s = to_wide(ns, cvt); #ifndef BOOST_NO_STD_MESSAGES if((int)cat >= 0) - s = BOOST_USE_FACET(std::messages, l).get(cat, 0, (int)i+100, s); + s = BOOST_USE_FACET(std::messages, l).get(cat, 0, (int)i+100, s); #endif for(unsigned int j = 0; j < s.size(); ++j) { - if((s[j] <= UCHAR_MAX) && (s[j] >= 0)) - syntax_[s[j]] = static_cast(i); - else - { - m.c = s[j]; - m.type = static_cast(i); - syntax.push_back(m); - } + if((s[j] <= UCHAR_MAX) && (s[j] >= 0)) + syntax_[s[j]] = static_cast(i); + else + { + m.c = s[j]; + m.type = static_cast(i); + syntax.push_back(m); + } } } @@ -645,19 +646,19 @@ message_data::message_data(const std::locale& l, const std::string& reg c2 = msgs.get(cat, 0, (int)i, c1); while(c2.size()) { - const wchar_t* p1, *p2, *p3, *p4;; - p1 = c2.c_str(); - while(*p1 && BOOST_REGEX_STD isspace((wchar_t)*p1, l))++p1; - p2 = p1; - while(*p2 && !BOOST_REGEX_STD isspace((wchar_t)*p2, l))++p2; - p3 = p2; - while(*p3 && BOOST_REGEX_STD isspace((wchar_t)*p3, l))++p3; - p4 = p3; - while(*p4 && !BOOST_REGEX_STD isspace((wchar_t)*p4, l))++p4; - collating_elements[std::basic_string(p1, p2)] = std::basic_string(p3, p4); + const wchar_t* p1, *p2, *p3, *p4;; + p1 = c2.c_str(); + while(*p1 && BOOST_REGEX_STD isspace((wchar_t)*p1, l))++p1; + p2 = p1; + while(*p2 && !BOOST_REGEX_STD isspace((wchar_t)*p2, l))++p2; + p3 = p2; + while(*p3 && BOOST_REGEX_STD isspace((wchar_t)*p3, l))++p3; + p4 = p3; + while(*p4 && !BOOST_REGEX_STD isspace((wchar_t)*p4, l))++p4; + collating_elements[std::basic_string(p1, p2)] = std::basic_string(p3, p4); - ++i; - c2 = msgs.get(cat, 0, (int)i, c1); + ++i; + c2 = msgs.get(cat, 0, (int)i, c1); } } @@ -666,20 +667,20 @@ message_data::message_data(const std::locale& l, const std::string& reg c2.erase(); for(i = 0; i < re_classes_max; ++i) { - c1 = msgs.get(cat, 0, static_cast(i+300), c2); - if(c1.size()) - classes[c1] = i; + c1 = msgs.get(cat, 0, static_cast(i+300), c2); + if(c1.size()) + classes[c1] = i; } for(i = 0; i <= boost::REG_E_UNKNOWN ; ++i) { - c1 = msgs.get(cat, 0, static_cast(i+200), c2); - error_strings[i] = to_narrow(c1, cvt); + c1 = msgs.get(cat, 0, static_cast(i+200), c2); + error_strings[i] = to_narrow(c1, cvt); } } if((int)cat >= 0) msgs.close(cat); -#endif +#endif } } // namespace re_detail @@ -692,7 +693,7 @@ unsigned int BOOST_REGEX_CALL cpp_regex_traits::do_syntax_type(size_typ while(i != j) { if(((uchar_type)(*i).c) == c) - return (*i).type; + return (*i).type; ++i; } return 0; @@ -708,16 +709,16 @@ void BOOST_REGEX_CALL cpp_regex_traits::transform_primary(std::basic_st break; case re_detail::sort_fixed: if((unsigned)sort_delim < out.size()) - out.erase((int)sort_delim); + out.erase((int)sort_delim); break; case re_detail::sort_delim: for(unsigned int i = 0; i < out.size(); ++i) { - if((out[i] == sort_delim) && (i+1 < out.size())) - { - out.erase(i+1); - break; - } + if((out[i] == sort_delim) && (i+1 < out.size())) + { + out.erase(i+1); + break; + } } } } @@ -768,7 +769,7 @@ boost::uint_fast32_t BOOST_REGEX_CALL cpp_regex_traits::lookup_classnam for(i = 0; i < re_classes_max; ++i) { if(ns == re_char_class_names[i]) - return re_char_class_id[i]; + return re_char_class_id[i]; } return 0; } @@ -864,4 +865,3 @@ std::size_t BOOST_REGEX_CALL cpp_regex_traits::strwiden(wchar_t *s1, st } // namespace boost #endif - diff --git a/boost/libs/signals/src/connection.cpp b/boost/libs/signals/src/connection.cpp index 3f7020a054..d30d69cc6b 100644 --- a/boost/libs/signals/src/connection.cpp +++ b/boost/libs/signals/src/connection.cpp @@ -39,7 +39,7 @@ namespace boost { typedef std::list::iterator iterator; for (iterator i = local_con->bound_objects.begin(); i != local_con->bound_objects.end(); ++i) { - assert(i->disconnect != 0); + assert(i->disconnect); i->disconnect(i->obj, i->data); } } diff --git a/boost/libs/signals/src/signal_base.cpp b/boost/libs/signals/src/signal_base.cpp index ccdd0cf2a6..d3ae937919 100644 --- a/boost/libs/signals/src/signal_base.cpp +++ b/boost/libs/signals/src/signal_base.cpp @@ -10,7 +10,7 @@ // // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. - + // For more information, see http://www.boost.org #include @@ -19,205 +19,205 @@ namespace boost { namespace BOOST_SIGNALS_NAMESPACE { namespace detail { - signal_base_impl::signal_base_impl(const compare_type& comp) : + signal_base_impl::signal_base_impl(const compare_type& comp) : call_depth(0), slots_(comp) { - flags.delayed_disconnect = false; - flags.clearing = false; + flags.delayed_disconnect = false; + flags.clearing = false; } signal_base_impl::~signal_base_impl() { - // Set the "clearing" flag to ignore extraneous disconnect requests, - // because all slots will be disconnected on destruction anyway. - flags.clearing = true; + // Set the "clearing" flag to ignore extraneous disconnect requests, + // because all slots will be disconnected on destruction anyway. + flags.clearing = true; } void signal_base_impl::disconnect_all_slots() { - // Do nothing if we're already clearing the slot list - if (flags.clearing) - return; + // Do nothing if we're already clearing the slot list + if (flags.clearing) + return; if (call_depth == 0) { - // Clearing the slot list will disconnect all slots automatically + // Clearing the slot list will disconnect all slots automatically temporarily_set_clearing set_clearing(this); slots_.clear(); } else { - // We can't actually remove elements from the slot list because there - // are still iterators into the slot list that must not be - // invalidated by this operation. So just disconnect each slot - // without removing it from the slot list. When the call depth does - // reach zero, the call list will be cleared. - flags.delayed_disconnect = true; - temporarily_set_clearing set_clearing(this); + // We can't actually remove elements from the slot list because there + // are still iterators into the slot list that must not be + // invalidated by this operation. So just disconnect each slot + // without removing it from the slot list. When the call depth does + // reach zero, the call list will be cleared. + flags.delayed_disconnect = true; + temporarily_set_clearing set_clearing(this); for (slot_iterator i = slots_.begin(); i != slots_.end(); ++i) { i->second.first.disconnect(); } } } - connection + connection signal_base_impl:: - connect_slot(const any& slot, - const any& name, - const std::vector& bound_objects) + connect_slot(const any& slot, + const any& name, + const std::vector& bound_objects) { - // Allocate storage for a new basic_connection object to represent the - // connection - basic_connection* con = new basic_connection(); + // Allocate storage for a new basic_connection object to represent the + // connection + basic_connection* con = new basic_connection(); - // Create a new connection handle object and place the basic_connection - // object we just created under its control. Note that the "reset" - // routine will delete con if allocation throws. - connection slot_connection; - slot_connection.reset(con); + // Create a new connection handle object and place the basic_connection + // object we just created under its control. Note that the "reset" + // routine will delete con if allocation throws. + connection slot_connection; + slot_connection.reset(con); - // Allocate storage for an iterator that will hold the point of - // insertion of the slot into the list. This is used to later remove - // the slot when it is disconnected. - std::auto_ptr saved_iter(new slot_iterator()); + // Allocate storage for an iterator that will hold the point of + // insertion of the slot into the list. This is used to later remove + // the slot when it is disconnected. + std::auto_ptr saved_iter(new slot_iterator()); - // Add the slot to the list. + // Add the slot to the list. - slot_iterator pos = - slots_.insert(stored_slot_type(name, - connection_slot_pair(slot_connection, - slot))); + slot_iterator pos = + slots_.insert(stored_slot_type(name, + connection_slot_pair(slot_connection, + slot))); - // Make the copy of the connection in the list disconnect when it is - // destroyed - pos->second.first.set_controlling(); + // Make the copy of the connection in the list disconnect when it is + // destroyed + pos->second.first.set_controlling(); - // The assignment operation here absolutely must not throw, which - // intuitively makes sense (because any container's insert method - // becomes impossible to use in an exception-safe manner without this - // assumption), but doesn't appear to be mentioned in the standard. - *saved_iter = pos; - - // Fill out the connection object appropriately. None of these - // operations can throw - con->signal = this; - con->signal_data = saved_iter.release(); - con->signal_disconnect = &signal_base_impl::slot_disconnected; - - // If an exception is thrown the connection will automatically be - // disconnected. - scoped_connection safe_connection = slot_connection; - - // Connect each of the bound objects - for(std::vector::const_iterator i = - bound_objects.begin(); - i != bound_objects.end(); - ++i) { - // Notify the object that the signal is connecting to it by passing - // it a copy of the connection. If the connection - // should throw, the scoped connection safe_connection will - // disconnect the connection completely. - bound_object binding; - (*i)->signal_connected(slot_connection, binding); + // The assignment operation here absolutely must not throw, which + // intuitively makes sense (because any container's insert method + // becomes impossible to use in an exception-safe manner without this + // assumption), but doesn't appear to be mentioned in the standard. + *saved_iter = pos; - // This will notify the bound object that the connection just made - // should be disconnected if an exception is thrown before the - // end of this iteration - auto_disconnect_bound_object disconnector(binding); + // Fill out the connection object appropriately. None of these + // operations can throw + con->signal = this; + con->signal_data = saved_iter.release(); + con->signal_disconnect = &signal_base_impl::slot_disconnected; - // Add the binding to the list of bindings for the connection. - con->bound_objects.push_back(binding); + // If an exception is thrown the connection will automatically be + // disconnected. + scoped_connection safe_connection = slot_connection; - // The connection object now knows about the bound object, so if an - // exception is thrown later the connection object will notify the - // bound object of the disconnection automatically - disconnector.release(); - } + // Connect each of the bound objects + for(std::vector::const_iterator i = + bound_objects.begin(); + i != bound_objects.end(); + ++i) { + // Notify the object that the signal is connecting to it by passing + // it a copy of the connection. If the connection + // should throw, the scoped connection safe_connection will + // disconnect the connection completely. + bound_object binding; + (*i)->signal_connected(slot_connection, binding); - // No exceptions will be thrown past this point, and we must not - // disconnect the connection now - safe_connection.release(); + // This will notify the bound object that the connection just made + // should be disconnected if an exception is thrown before the + // end of this iteration + auto_disconnect_bound_object disconnector(binding); - return slot_connection; + // Add the binding to the list of bindings for the connection. + con->bound_objects.push_back(binding); + + // The connection object now knows about the bound object, so if an + // exception is thrown later the connection object will notify the + // bound object of the disconnection automatically + disconnector.release(); + } + + // No exceptions will be thrown past this point, and we must not + // disconnect the connection now + safe_connection.release(); + + return slot_connection; } bool signal_base_impl::empty() const { - // Disconnected slots may still be in the list of slots if - // a) this is called while slots are being invoked (call_depth > 0) - // b) an exception was thrown in remove_disconnected_slots - for (slot_iterator i = slots_.begin(); i != slots_.end(); ++i) { - if (i->second.first.connected()) - return false; - } + // Disconnected slots may still be in the list of slots if + // a) this is called while slots are being invoked (call_depth > 0) + // b) an exception was thrown in remove_disconnected_slots + for (slot_iterator i = slots_.begin(); i != slots_.end(); ++i) { + if (i->second.first.connected()) + return false; + } - return true; + return true; } void signal_base_impl::disconnect(const any& group) { - std::pair group_slots = - slots_.equal_range(group); - while (group_slots.first != group_slots.second) { - slot_iterator next = group_slots.first; - ++next; + std::pair group_slots = + slots_.equal_range(group); + while (group_slots.first != group_slots.second) { + slot_iterator next = group_slots.first; + ++next; - group_slots.first->second.first.disconnect(); - group_slots.first = next; - } + group_slots.first->second.first.disconnect(); + group_slots.first = next; + } } void signal_base_impl::slot_disconnected(void* obj, void* data) { - signal_base_impl* self = reinterpret_cast(obj); + signal_base_impl* self = reinterpret_cast(obj); - // We won't need the slot iterator after this - std::auto_ptr slot( - reinterpret_cast(data)); - - // If we're flags.clearing, we don't bother updating the list of slots - if (!self->flags.clearing) { - // If we're in a call, note the fact that a slot has been deleted so - // we can come back later to remove the iterator - if (self->call_depth > 0) { - self->flags.delayed_disconnect = true; - } - else { - // Just remove the slot now, it's safe - self->slots_.erase(*slot); - } - } + // We won't need the slot iterator after this + std::auto_ptr slot( + reinterpret_cast(data)); + + // If we're flags.clearing, we don't bother updating the list of slots + if (!self->flags.clearing) { + // If we're in a call, note the fact that a slot has been deleted so + // we can come back later to remove the iterator + if (self->call_depth > 0) { + self->flags.delayed_disconnect = true; + } + else { + // Just remove the slot now, it's safe + self->slots_.erase(*slot); + } + } } void signal_base_impl::remove_disconnected_slots() const { - // Remove any disconnected slots - for (slot_iterator i = slots_.begin(); i != slots_.end(); /* none */) { - if (!i->second.first.connected()) - slots_.erase(i++); - else - ++i; - } + // Remove any disconnected slots + for (slot_iterator i = slots_.begin(); i != slots_.end(); /* none */) { + if (!i->second.first.connected()) + slots_.erase(i++); + else + ++i; + } } call_notification:: - call_notification(const shared_ptr& b) : + call_notification(const shared_ptr& b) : impl(b) { - // A call will be made, so increment the call depth as a notification - impl->call_depth++; + // A call will be made, so increment the call depth as a notification + impl->call_depth++; } call_notification::~call_notification() { - impl->call_depth--; + impl->call_depth--; - // If the call depth is zero and we have some slots that have been - // disconnected during the calls, remove those slots from the list - if (impl->call_depth == 0 && + // If the call depth is zero and we have some slots that have been + // disconnected during the calls, remove those slots from the list + if (impl->call_depth == 0 && impl->flags.delayed_disconnect) { - impl->remove_disconnected_slots(); - impl->flags.delayed_disconnect = false; - } + impl->remove_disconnected_slots(); + impl->flags.delayed_disconnect = false; + } } signal_base::~signal_base() @@ -230,7 +230,7 @@ namespace boost { #ifndef BOOST_MSVC // Explicit instantiations to keep in the library template class boost::function2; -template class std::multimap >; +template class std::multimap >; #endif diff --git a/src/support/ChangeLog b/src/support/ChangeLog index f16bdcd5e8..99c99fa0eb 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -4,7 +4,7 @@ also add a trim function that is the equiv of strip(frontStrip(...)), also reimplement the functions (improvements still possible.) - + * filetools.C: strip,frontStrip -> trim,ltrim,rtrim * forkedcall.C (generateChild): ditto * lstrings.C: ditto