mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
update boost
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4802 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
043298544c
commit
69862d12f4
@ -1,3 +1,10 @@
|
||||
2002-07-29 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* 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 <leeming@lyx.org>
|
||||
|
||||
Reapplied:
|
||||
|
@ -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
|
||||
|
@ -1343,6 +1343,18 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_BIND_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_BIND_CC __fastcall
|
||||
#define BOOST_BIND_ST
|
||||
|
||||
#include <boost/bind/bind_cc.hpp>
|
||||
|
||||
#undef BOOST_BIND_CC
|
||||
#undef BOOST_BIND_ST
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_BIND_ENABLE_PASCAL
|
||||
|
||||
#define BOOST_BIND_ST pascal
|
||||
@ -1377,6 +1389,18 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_BIND_MF_NAME(X) X##_fastcall
|
||||
#define BOOST_BIND_MF_CC __fastcall
|
||||
|
||||
#include <boost/bind/bind_mf_cc.hpp>
|
||||
|
||||
#undef BOOST_BIND_MF_NAME
|
||||
#undef BOOST_BIND_MF_CC
|
||||
|
||||
#endif
|
||||
|
||||
// data member pointers
|
||||
|
||||
template<class R, class T, class A1>
|
||||
|
@ -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;
|
||||
|
@ -48,6 +48,7 @@
|
||||
# include <typeinfo>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/limits.hpp>
|
||||
# include <boost/detail/select_type.hpp>
|
||||
|
||||
// It has been demonstrated numerous times that MSVC 6.0 fails silently at link
|
||||
// time if you use a template function which has template parameters that don't
|
||||
@ -125,54 +126,77 @@ namespace boost
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <bool is_signed> struct numeric_min_select;
|
||||
|
||||
template<>
|
||||
struct numeric_min_select<true>
|
||||
{
|
||||
template <class T>
|
||||
struct limits : std::numeric_limits<T>
|
||||
template <class T>
|
||||
struct signed_numeric_limits : std::numeric_limits<T>
|
||||
{
|
||||
static inline T min()
|
||||
{
|
||||
static inline T min()
|
||||
# ifndef __GNUC__ // bug workaround courtesy Jens Maurer
|
||||
{
|
||||
return std::numeric_limits<T>::min() >= 0
|
||||
return std::numeric_limits<T>::min() >= 0
|
||||
// unary minus causes integral promotion, thus the static_cast<>
|
||||
? static_cast<T>(-std::numeric_limits<T>::max())
|
||||
: std::numeric_limits<T>::min();
|
||||
}
|
||||
# else
|
||||
;
|
||||
# endif
|
||||
};
|
||||
};
|
||||
|
||||
# ifdef __GNUC__ // bug workaround courtesy Jens Maurer
|
||||
template<> template<class T>
|
||||
inline T numeric_min_select<true>::limits<T>::min()
|
||||
{
|
||||
return std::numeric_limits<T>::min() >= 0
|
||||
// unary minus causes integral promotion, thus the static_cast<>
|
||||
? static_cast<T>(-std::numeric_limits<T>::max())
|
||||
: std::numeric_limits<T>::min();
|
||||
}
|
||||
# endif
|
||||
|
||||
template<>
|
||||
struct numeric_min_select<false>
|
||||
{
|
||||
template <class T>
|
||||
struct limits : std::numeric_limits<T> {};
|
||||
};
|
||||
|
||||
|
||||
// Move to namespace boost in utility.hpp?
|
||||
template <class T, bool specialized>
|
||||
struct fixed_numeric_limits_base
|
||||
: public if_true< std::numeric_limits<T>::is_signed >
|
||||
::template then< signed_numeric_limits<T>,
|
||||
std::numeric_limits<T>
|
||||
>::type
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct fixed_numeric_limits
|
||||
: public numeric_min_select<
|
||||
std::numeric_limits<T>::is_signed
|
||||
>::template limits<T>
|
||||
: fixed_numeric_limits_base<T,(std::numeric_limits<T>::is_specialized)>
|
||||
{};
|
||||
|
||||
# ifdef BOOST_HAS_LONG_LONG
|
||||
// cover implementations which supply no specialization for long
|
||||
// long / unsigned long long. Not intended to be full
|
||||
// numeric_limits replacements, but good enough for numeric_cast<>
|
||||
template <>
|
||||
struct fixed_numeric_limits_base<long long, false>
|
||||
{
|
||||
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<unsigned long long, false>
|
||||
{
|
||||
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 <class X, class Y>
|
||||
static inline bool check(X x, Y)
|
||||
{ return x >= 0 && static_cast<X>(static_cast<Y>(x)) != x; }
|
||||
|
||||
# if defined(BOOST_MSVC) && BOOST_MSVC <= 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<unsigned __int64>(x); \
|
||||
bool odd = y & 0x1; \
|
||||
__int64 div2 = static_cast<__int64>(y >> 1); \
|
||||
return ((static_cast<src_type>(div2) * 2.0) + odd) != x; \
|
||||
}
|
||||
|
||||
BOOST_UINT64_CAST(long double);
|
||||
BOOST_UINT64_CAST(double);
|
||||
BOOST_UINT64_CAST(float);
|
||||
# undef BOOST_UINT64_CAST
|
||||
# endif
|
||||
};
|
||||
|
||||
template<>
|
||||
@ -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<Source> arg_traits;
|
||||
typedef detail::fixed_numeric_limits<Source> arg_traits;
|
||||
typedef detail::fixed_numeric_limits<Target> result_traits;
|
||||
|
||||
#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_SGI_CPP_LIMITS)
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <boost/type.hpp>
|
||||
|
||||
|
||||
#if defined(BOOST_MSVC) || defined(__BORLANDC__)
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__)
|
||||
#define BOOST_FPTR
|
||||
#else
|
||||
#define BOOST_FPTR &
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
//
|
||||
|
@ -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 <stdlib.h>
|
||||
namespace std { using ::abs; }
|
||||
// and strcmp/strcpy don't get imported either ('cos they are macros)
|
||||
#include <string.h>
|
||||
#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 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -28,7 +28,8 @@
|
||||
// no namespace issues from this.
|
||||
//
|
||||
#include <limits.h>
|
||||
# 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<long long> 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 <cwctype> if there is no <cwchar>:
|
||||
//
|
||||
@ -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
|
||||
|
||||
|
||||
|
@ -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 <typename ForwardIterator, typename StrictWeakOrdering>
|
||||
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;
|
||||
|
@ -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 <implementation-defined> boost::detail::lightweight_mutex;
|
||||
// typedef <unspecified> 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 <boost/config.hpp>
|
||||
|
||||
//
|
||||
// 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 <boost/detail/lwm_nop.hpp>
|
||||
#elif defined(BOOST_USE_ASM_ATOMIC_H)
|
||||
#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(BOOST_USE_ASM_ATOMIC_H)
|
||||
# include <boost/detail/lwm_linux.hpp>
|
||||
#elif defined(BOOST_LWM_USE_CRITICAL_SECTION)
|
||||
# include <boost/detail/lwm_win32_cs.hpp>
|
||||
@ -59,9 +74,9 @@
|
||||
# include <boost/detail/lwm_pthreads.hpp>
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
# include <boost/detail/lwm_win32.hpp>
|
||||
#elif defined(__sgi)
|
||||
#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(__sgi)
|
||||
# include <boost/detail/lwm_irix.hpp>
|
||||
#elif defined(__GLIBCPP__)
|
||||
#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(__GLIBCPP__)
|
||||
# include <boost/detail/lwm_gcc.hpp>
|
||||
#elif defined(BOOST_HAS_PTHREADS)
|
||||
# define BOOST_LWM_USE_PTHREADS
|
||||
|
@ -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 _Int,
|
||||
_Int __imin,
|
||||
_Int __imax,
|
||||
int __idigits = -1>
|
||||
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<const Number*>(&_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<const Number*>(
|
||||
reinterpret_cast<const char *>(&_S_word)+16-
|
||||
(sizeof(Number) == 12 ? 10 : sizeof(Number)));
|
||||
}
|
||||
reinterpret_cast<const char *>(&_S_word)+16-
|
||||
(sizeof(Number) == 12 ? 10 : sizeof(Number)));
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Base class for floating-point numbers.
|
||||
template <class __number,
|
||||
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>
|
||||
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<class T>
|
||||
template<class T>
|
||||
class numeric_limits : public _Numeric_limits_base<T> {};
|
||||
|
||||
// Specializations for all built-in integral types.
|
||||
@ -356,41 +356,36 @@ class numeric_limits<unsigned long>
|
||||
|
||||
#if !defined(LONGLONG_MIN)
|
||||
# define LONGLONG_MIN (-LONGLONG_MAX - 1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template<>
|
||||
class numeric_limits<long long>
|
||||
: public _Integer_limits<long long, LONGLONG_MIN, LONGLONG_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned long long>
|
||||
: public _Integer_limits<unsigned long long, 0, ULONGLONG_MAX>
|
||||
{};
|
||||
#if !defined(ULONGLONG_MIN)
|
||||
# define ULONGLONG_MIN 0
|
||||
#endif
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
// Specializations for all built-in floating-point type.
|
||||
|
||||
template<> class numeric_limits<float>
|
||||
: public _Floating_limits<float,
|
||||
FLT_MANT_DIG, // Binary digits of precision
|
||||
FLT_DIG, // Decimal digits of precision
|
||||
FLT_MIN_EXP, // Minimum exponent
|
||||
FLT_MAX_EXP, // Maximum exponent
|
||||
FLT_MIN_10_EXP, // Minimum base 10 exponent
|
||||
FLT_MAX_10_EXP, // Maximum base 10 exponent
|
||||
: public _Floating_limits<float,
|
||||
FLT_MANT_DIG, // Binary digits of precision
|
||||
FLT_DIG, // Decimal digits of precision
|
||||
FLT_MIN_EXP, // Minimum exponent
|
||||
FLT_MAX_EXP, // Maximum exponent
|
||||
FLT_MIN_10_EXP, // Minimum base 10 exponent
|
||||
FLT_MAX_10_EXP, // Maximum base 10 exponent
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
0x7f80 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7f81 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7fc1 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
0x7f80 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7f81 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7fc1 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
#else
|
||||
0x7f800000u, // Last word of +infinity
|
||||
0x7f810000u, // Last word of quiet NaN
|
||||
0x7fc10000u, // Last word of signaling NaN
|
||||
0x7f800000u, // Last word of +infinity
|
||||
0x7f810000u, // Last word of quiet NaN
|
||||
0x7fc10000u, // Last word of signaling NaN
|
||||
#endif
|
||||
true, // conforms to iec559
|
||||
round_to_nearest>
|
||||
true, // conforms to iec559
|
||||
round_to_nearest>
|
||||
{
|
||||
public:
|
||||
static float min() throw() { return FLT_MIN; }
|
||||
@ -401,24 +396,24 @@ public:
|
||||
};
|
||||
|
||||
template<> class numeric_limits<double>
|
||||
: public _Floating_limits<double,
|
||||
DBL_MANT_DIG, // Binary digits of precision
|
||||
DBL_DIG, // Decimal digits of precision
|
||||
DBL_MIN_EXP, // Minimum exponent
|
||||
DBL_MAX_EXP, // Maximum exponent
|
||||
DBL_MIN_10_EXP, // Minimum base 10 exponent
|
||||
DBL_MAX_10_EXP, // Maximum base 10 exponent
|
||||
: public _Floating_limits<double,
|
||||
DBL_MANT_DIG, // Binary digits of precision
|
||||
DBL_DIG, // Decimal digits of precision
|
||||
DBL_MIN_EXP, // Minimum exponent
|
||||
DBL_MAX_EXP, // Maximum exponent
|
||||
DBL_MIN_10_EXP, // Minimum base 10 exponent
|
||||
DBL_MAX_10_EXP, // Maximum base 10 exponent
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
#else
|
||||
0x7ff00000u, // Last word of +infinity
|
||||
0x7ff10000u, // Last word of quiet NaN
|
||||
0x7ff90000u, // Last word of signaling NaN
|
||||
0x7ff00000u, // Last word of +infinity
|
||||
0x7ff10000u, // Last word of quiet NaN
|
||||
0x7ff90000u, // Last word of signaling NaN
|
||||
#endif
|
||||
true, // conforms to iec559
|
||||
round_to_nearest>
|
||||
true, // conforms to iec559
|
||||
round_to_nearest>
|
||||
{
|
||||
public:
|
||||
static double min() throw() { return DBL_MIN; }
|
||||
@ -429,24 +424,24 @@ public:
|
||||
};
|
||||
|
||||
template<> class numeric_limits<long double>
|
||||
: public _Floating_limits<long double,
|
||||
LDBL_MANT_DIG, // Binary digits of precision
|
||||
LDBL_DIG, // Decimal digits of precision
|
||||
LDBL_MIN_EXP, // Minimum exponent
|
||||
LDBL_MAX_EXP, // Maximum exponent
|
||||
LDBL_MIN_10_EXP,// Minimum base 10 exponent
|
||||
LDBL_MAX_10_EXP,// Maximum base 10 exponent
|
||||
: public _Floating_limits<long double,
|
||||
LDBL_MANT_DIG, // Binary digits of precision
|
||||
LDBL_DIG, // Decimal digits of precision
|
||||
LDBL_MIN_EXP, // Minimum exponent
|
||||
LDBL_MAX_EXP, // Maximum exponent
|
||||
LDBL_MIN_10_EXP,// Minimum base 10 exponent
|
||||
LDBL_MAX_10_EXP,// Maximum base 10 exponent
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
#else
|
||||
0x7fff8000u, // Last word of +infinity
|
||||
0x7fffc000u, // Last word of quiet NaN
|
||||
0x7fff9000u, // Last word of signaling NaN
|
||||
0x7fff8000u, // Last word of +infinity
|
||||
0x7fffc000u, // Last word of quiet NaN
|
||||
0x7fff9000u, // Last word of signaling NaN
|
||||
#endif
|
||||
false, // Doesn't conform to iec559
|
||||
round_to_nearest>
|
||||
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:
|
||||
|
||||
|
||||
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
#include <boost/detail/winapi.hpp>
|
||||
|
||||
#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
|
||||
|
@ -81,7 +81,7 @@ namespace boost { namespace detail {
|
||||
template <class Number>
|
||||
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<Number>::is_signed);
|
||||
@ -135,7 +135,7 @@ namespace boost { namespace detail {
|
||||
private:
|
||||
typedef Integer integer_type;
|
||||
typedef std::numeric_limits<integer_type> 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);
|
||||
|
@ -168,7 +168,7 @@ public:
|
||||
compressed_pair_1(const ::boost::compressed_pair<T1,T2>& 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.
|
||||
|
@ -28,6 +28,11 @@
|
||||
#include <functional> // for std::less
|
||||
#include <exception> // 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<class P, class D> shared_count(P p, D d, void const * = 0): pi_(0)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
pi_ = new counted_base_impl<P, D>(p, d, 1, 1);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
d(p); // delete p
|
||||
throw;
|
||||
}
|
||||
#else
|
||||
pi_ = new counted_base_impl<P, D>(p, d, 1, 1);
|
||||
BOOST_NOEH_ASSERT(pi_);
|
||||
#endif
|
||||
pi_ = new counted_base_impl<P, D>(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<class P, class D> 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<typename Y>
|
||||
explicit shared_count(std::auto_ptr<Y> & r): pi_(new counted_base_impl< Y *, checked_deleter<Y> >(r.get(), checked_deleter<Y>(), 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<counted_base *>()(a.pi_, b.pi_);
|
||||
return std::less<counted_base *>()(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<counted_base *>()(a.pi_, b.pi_);
|
||||
return std::less<counted_base *>()(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
|
||||
|
@ -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 *);
|
||||
|
@ -20,6 +20,10 @@
|
||||
#define BOOST_FUNCTION_HPP
|
||||
|
||||
#include <boost/function/function_base.hpp>
|
||||
#include <boost/type_traits/function_traits.hpp>
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <boost/type_traits/transform_traits.hpp>
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#include <boost/function/function0.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
@ -35,6 +39,207 @@
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace function {
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template<typename Signature>
|
||||
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<typename R>
|
||||
struct function_traits<R (*)(void)>
|
||||
{
|
||||
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<typename R, typename T1>
|
||||
struct function_traits<R (*)(T1)>
|
||||
{
|
||||
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<typename R, typename T1, typename T2>
|
||||
struct function_traits<R (*)(T1, T2)>
|
||||
{
|
||||
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<typename R, typename T1, typename T2, typename T3>
|
||||
struct function_traits<R (*)(T1, T2, T3)>
|
||||
{
|
||||
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<typename R, typename T1, typename T2, typename T3, typename T4>
|
||||
struct function_traits<R (*)(T1, T2, T3, T4)>
|
||||
{
|
||||
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<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5>
|
||||
struct function_traits<R (*)(T1, T2, T3, T4, T5)>
|
||||
{
|
||||
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<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6>
|
||||
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6)>
|
||||
{
|
||||
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<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7>
|
||||
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6, T7)>
|
||||
{
|
||||
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<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8>
|
||||
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6, T7, T8)>
|
||||
{
|
||||
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<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9)>
|
||||
{
|
||||
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<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8, typename T9,
|
||||
typename T10>
|
||||
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>
|
||||
{
|
||||
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<int Args> 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<function_base>
|
||||
>
|
||||
struct get_function_impl
|
||||
template<typename T1, typename T2>
|
||||
struct is_not_same
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = !(is_same<T1, T2>::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<function_base>
|
||||
>
|
||||
class get_function_impl
|
||||
{
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
typedef function_traits<typename add_pointer<InR>::type> traits;
|
||||
public:
|
||||
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::result_type,
|
||||
InR>::type R;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg1_type,
|
||||
InT1>::type T1;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg2_type,
|
||||
InT2>::type T2;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg3_type,
|
||||
InT3>::type T3;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg4_type,
|
||||
InT4>::type T4;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg5_type,
|
||||
InT5>::type T5;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg6_type,
|
||||
InT6>::type T6;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg7_type,
|
||||
InT7>::type T7;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg8_type,
|
||||
InT8>::type T8;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg9_type,
|
||||
InT9>::type T9;
|
||||
typedef typename ct_if<(is_function<InR>::value),
|
||||
typename traits::arg10_type,
|
||||
InT10>::type T10;
|
||||
typedef typename ct_if<
|
||||
(type_traits::ice_and<
|
||||
(is_function<InR>::value),
|
||||
(is_not_same<InT1, unusable>::value)
|
||||
>::value),
|
||||
InT1,
|
||||
InPolicy>::type Policy;
|
||||
|
||||
typedef typename ct_if<
|
||||
(type_traits::ice_and<
|
||||
(is_function<InR>::value),
|
||||
(is_not_same<InT2, unusable>::value)
|
||||
>::value),
|
||||
InT2,
|
||||
InMixin>::type Mixin;
|
||||
|
||||
typedef typename ct_if<
|
||||
(type_traits::ice_and<
|
||||
(is_function<InR>::value),
|
||||
(is_not_same<InT3, unusable>::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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value)
|
||||
>::template params<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
|
||||
@ -345,28 +633,45 @@ 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 MyPolicy = empty_function_policy,
|
||||
typename MyMixin = empty_function_mixin,
|
||||
typename MyAllocator = std::allocator<function_base>
|
||||
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<function_base>
|
||||
>
|
||||
struct function_traits_builder
|
||||
class function_traits_builder
|
||||
{
|
||||
typedef typename get_function_impl<R, T1, T2, T3, T4, T5, T6, T7,
|
||||
T8, T9, T10, MyPolicy, MyMixin,
|
||||
MyAllocator>::type
|
||||
type;
|
||||
typedef get_function_impl<InR, InT1, InT2, InT3, InT4, InT5, InT6, InT7,
|
||||
InT8, InT9, InT10, InMyPolicy, InMyMixin,
|
||||
InMyAllocator>
|
||||
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<typename Policy>
|
||||
struct policy :
|
||||
public function_traits_builder<R, T1, T2, T3, T4, T5, T6, T7, T8, T9,
|
||||
T10, Policy, mixin_type,
|
||||
allocator_type> {};
|
||||
public function_traits_builder<MyR, MyT1, MyT2, MyT3, MyT4, MyT5, MyT6,
|
||||
MyT7, MyT8, MyT9, MyT10, Policy,
|
||||
mixin_type, allocator_type> {};
|
||||
|
||||
template<typename Mixin>
|
||||
struct mixin :
|
||||
public function_traits_builder<R, T1, T2, T3, T4, T5, T6, T7, T8, T9,
|
||||
T10, policy_type, Mixin,
|
||||
allocator_type> {};
|
||||
public function_traits_builder<MyR, MyT1, MyT2, MyT3, MyT4, MyT5, MyT6,
|
||||
MyT7, MyT8, MyT9, MyT10, policy_type,
|
||||
Mixin, allocator_type> {};
|
||||
|
||||
template<typename Allocator>
|
||||
struct allocator :
|
||||
public function_traits_builder<R, T1, T2, T3, T4, T5, T6, T7, T8, T9,
|
||||
T10, policy_type, mixin_type,
|
||||
Allocator> {};
|
||||
public function_traits_builder<MyR, MyT1, MyT2, MyT3, MyT4, MyT5, MyT6,
|
||||
MyT7, MyT8, MyT9, MyT10, policy_type,
|
||||
mixin_type, Allocator> {};
|
||||
#else
|
||||
template<typename Policy>
|
||||
struct policy
|
||||
{
|
||||
typedef typename function_traits_builder<R, T1, T2, T3, T4, T5, T6, T7,
|
||||
T8, T9, T10, Policy,
|
||||
mixin_type,
|
||||
typedef typename function_traits_builder<MyR, MyT1, MyT2, MyT3, MyT4,
|
||||
MyT5, MyT6, MyT7, MyT8, MyT9,
|
||||
MyT10, Policy, mixin_type,
|
||||
allocator_type>::type
|
||||
type;
|
||||
};
|
||||
@ -403,8 +708,9 @@ namespace boost {
|
||||
template<typename Mixin>
|
||||
struct mixin
|
||||
{
|
||||
typedef typename function_traits_builder<R, T1, T2, T3, T4, T5, T6, T7,
|
||||
T8, T9, T10, policy_type, Mixin,
|
||||
typedef typename function_traits_builder<MyR, MyT1, MyT2, MyT3, MyT4,
|
||||
MyT5, MyT6, MyT7, MyT8, MyT9,
|
||||
MyT10, policy_type, Mixin,
|
||||
allocator_type>::type
|
||||
type;
|
||||
};
|
||||
@ -412,9 +718,10 @@ namespace boost {
|
||||
template<typename Allocator>
|
||||
struct allocator
|
||||
{
|
||||
typedef typename function_traits_builder<R, T1, T2, T3, T4, T5, T6, T7,
|
||||
T8, T9, T10, policy_type,
|
||||
mixin_type, Allocator>::type
|
||||
typedef typename function_traits_builder<MyR, MyT1, MyT2, MyT3, MyT4,
|
||||
MyT5, MyT6, MyT7, MyT8, MyT9,
|
||||
MyT10, policy_type, mixin_type,
|
||||
Allocator>::type
|
||||
type;
|
||||
};
|
||||
#endif
|
||||
@ -482,16 +789,19 @@ namespace boost {
|
||||
template<typename Functor>
|
||||
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
|
||||
|
@ -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<FunctionPtr>(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<FunctionPtr>(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<FunctionPtr>(function_ptr.func_ptr);
|
||||
f(BOOST_FUNCTION_ARGS);
|
||||
return unusable();
|
||||
}
|
||||
{
|
||||
FunctionPtr f = reinterpret_cast<FunctionPtr>(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<R>::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<R>::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<R>::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<R>::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<R>::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<R>::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<R>::type
|
||||
typedef typename detail::function::function_return_type<R>::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<typename Functor>
|
||||
BOOST_FUNCTION_FUNCTION&
|
||||
BOOST_FUNCTION_FUNCTION&
|
||||
operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
|
||||
{
|
||||
self_type(f, static_cast<const Mixin&>(*this)).swap(*this);
|
||||
@ -324,6 +324,7 @@ namespace boost {
|
||||
template<typename Functor>
|
||||
void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
|
||||
{
|
||||
int deprecated;
|
||||
self_type(f, static_cast<const Mixin&>(*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<typename Functor>
|
||||
@ -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<FunctionPtr, Allocator>::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<FunctionPtr, Allocator>::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<typename MemberPtr>
|
||||
@ -421,102 +423,102 @@ namespace boost {
|
||||
this->assign_to(mem_fn(f));
|
||||
}
|
||||
#endif // BOOST_FUNCTION_NUM_ARGS > 0
|
||||
|
||||
|
||||
template<typename FunctionObj>
|
||||
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<FunctionObj>::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<FunctionObj*>(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<FunctionObj>::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<FunctionObj*>(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<void*>(new_f));
|
||||
function_base::functor =
|
||||
detail::function::any_pointer(static_cast<void*>(new_f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename FunctionObj>
|
||||
void assign_to(const reference_wrapper<FunctionObj>& f,
|
||||
detail::function::function_obj_ref_tag)
|
||||
void assign_to(const reference_wrapper<FunctionObj>& 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<FunctionObj*>(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<FunctionObj*>(f.get_pointer())),
|
||||
detail::function::clone_functor_tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename FunctionObj>
|
||||
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 R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS ,
|
||||
typename Policy, typename Mixin, typename Allocator>
|
||||
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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -12,9 +12,13 @@
|
||||
|
||||
#include <boost/integer_fwd.hpp> // self include
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
|
||||
#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT, etc.
|
||||
#include <boost/limits.hpp> // for std::numeric_limits
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
#include <boost/pending/ct_if.hpp> // for boost::ct_if<>
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -30,9 +34,22 @@ template < unsigned long Val, int Place = 0, int Index
|
||||
= std::numeric_limits<unsigned long>::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<unsigned long>::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<new_val, new_place, new_index> next_step_type;
|
||||
#else
|
||||
typedef static_log2_helper_nopts_t<new_val, new_place, new_index> 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<Val, Place, Index> recursive_step_type;
|
||||
typedef static_log2_helper_final_step<Place> 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
|
||||
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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<class U> intrusive_ptr(intrusive_ptr<U> 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<class U> intrusive_ptr & operator=(intrusive_ptr<U> const & rhs)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ namespace boost {
|
||||
template <class Policies, class Adapted, class Traits>
|
||||
struct TrivialIteratorPoliciesConcept
|
||||
{
|
||||
typedef typename Traits::reference Reference;
|
||||
typedef typename Traits::reference reference;
|
||||
void constraints() {
|
||||
function_requires< AssignableConcept<Policies> >();
|
||||
function_requires< DefaultConstructibleConcept<Policies> >();
|
||||
@ -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 <class T>
|
||||
struct traits_of_value_type {
|
||||
typedef typename boost::detail::iterator_traits<T>::value_type outer_value;
|
||||
@ -1110,12 +1110,12 @@ namespace detail {
|
||||
|
||||
template <class OuterIterator, // Mutable or Immutable, does not matter
|
||||
class Value
|
||||
#if !defined(BOOST_MSVC)
|
||||
#if !defined(BOOST_MSVC) || BOOST_MSVC > 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 <class OuterIterator, // Mutable or Immutable, does not matter
|
||||
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<
|
||||
OuterIterator>::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 <class OuterIterator, // Mutable or Immutable, does not matter
|
||||
class Value
|
||||
#if !defined(BOOST_MSVC)
|
||||
#if !defined(BOOST_MSVC) || BOOST_MSVC > 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 <class OuterIterator, // Mutable or Immutable, does not matter
|
||||
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<
|
||||
OuterIterator>::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 <class OuterIterator>
|
||||
inline typename indirect_iterator_generator<OuterIterator>::type
|
||||
make_indirect_iterator(OuterIterator base)
|
||||
@ -1392,7 +1392,7 @@ template <class Predicate, class Iterator,
|
||||
class filter_iterator_generator {
|
||||
BOOST_STATIC_CONSTANT(bool, is_bidirectional
|
||||
= (boost::is_convertible<Category*, std::bidirectional_iterator_tag*>::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<Predicate,Iterator> policies_type;
|
||||
|
@ -12,9 +12,128 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_LIMITS
|
||||
#include <boost/detail/limits.hpp>
|
||||
# include <boost/detail/limits.hpp>
|
||||
#else
|
||||
#include <limits>
|
||||
# include <limits>
|
||||
#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<BOOST_LLT>
|
||||
{
|
||||
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<unsigned BOOST_LLT>
|
||||
{
|
||||
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
|
||||
|
@ -66,6 +66,18 @@ template<class V> 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 <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#undef BOOST_MEM_FN_RETURN
|
||||
|
||||
}; // struct mf<V>
|
||||
@ -95,6 +107,18 @@ template<> struct mf<void>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#include <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_CC
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
|
||||
#endif
|
||||
|
||||
#undef BOOST_MEM_FN_RETURN
|
||||
|
||||
}; // struct mf<void>
|
||||
@ -126,6 +150,20 @@ template<> struct mf<void>
|
||||
|
||||
#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 <boost/bind/mem_fn_vw.hpp>
|
||||
|
||||
#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 <boost/bind/mem_fn_template.hpp>
|
||||
|
||||
#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 <boost/bind/mem_fn_cc.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#endif
|
||||
|
||||
// data member support
|
||||
|
||||
namespace _mfi
|
||||
|
@ -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 <class ExtentList>
|
||||
explicit multi_array(ExtentList const& extents,
|
||||
const general_storage_order<NumDims>& so) :
|
||||
const general_storage_order<NumDims>& so) :
|
||||
super_type((T*)initial_base_,extents,so) {
|
||||
boost::function_requires<
|
||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||
@ -75,8 +87,8 @@ public:
|
||||
|
||||
template <class ExtentList>
|
||||
explicit multi_array(ExtentList const& extents,
|
||||
const general_storage_order<NumDims>& so,
|
||||
Allocator const& alloc) :
|
||||
const general_storage_order<NumDims>& so,
|
||||
Allocator const& alloc) :
|
||||
super_type((T*)initial_base_,extents,so), allocator_(alloc) {
|
||||
boost::function_requires<
|
||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||
@ -85,7 +97,7 @@ public:
|
||||
|
||||
|
||||
explicit multi_array(const detail::multi_array
|
||||
::extent_gen<NumDims>& ranges) :
|
||||
::extent_gen<NumDims>& ranges) :
|
||||
super_type((T*)initial_base_,ranges) {
|
||||
|
||||
allocate_space();
|
||||
@ -93,8 +105,8 @@ public:
|
||||
|
||||
|
||||
explicit multi_array(const detail::multi_array
|
||||
::extent_gen<NumDims>& ranges,
|
||||
const general_storage_order<NumDims>& so) :
|
||||
::extent_gen<NumDims>& ranges,
|
||||
const general_storage_order<NumDims>& so) :
|
||||
super_type((T*)initial_base_,ranges,so) {
|
||||
|
||||
allocate_space();
|
||||
@ -102,9 +114,9 @@ public:
|
||||
|
||||
|
||||
explicit multi_array(const detail::multi_array
|
||||
::extent_gen<NumDims>& ranges,
|
||||
const general_storage_order<NumDims>& so,
|
||||
Allocator const& alloc) :
|
||||
::extent_gen<NumDims>& ranges,
|
||||
const general_storage_order<NumDims>& so,
|
||||
Allocator const& alloc) :
|
||||
super_type((T*)initial_base_,ranges,so), allocator_(alloc) {
|
||||
|
||||
allocate_space();
|
||||
@ -118,7 +130,7 @@ public:
|
||||
|
||||
template <typename OPtr>
|
||||
multi_array(const detail::multi_array::
|
||||
const_sub_array<T,NumDims,OPtr>& rhs) :
|
||||
const_sub_array<T,NumDims,OPtr>& 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<T,NumDims>& rhs) :
|
||||
sub_array<T,NumDims>& 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_);
|
||||
}
|
||||
}
|
||||
|
@ -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 <class InputIter, class Size, class OutputIter>
|
||||
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 <class InputIter, class Size, class OutputIter>
|
||||
inline OutputIter
|
||||
copy_n__(InputIter first, Size count, OutputIter result) {
|
||||
typedef std::iterator_traits<InputIter>::iterator_category cat;
|
||||
typedef typename std::iterator_traits<InputIter>::iterator_category cat;
|
||||
return copy_n__(first, count, result, cat());
|
||||
}
|
||||
|
||||
|
@ -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 <typename Reference, typename TPtr>
|
||||
Reference access(boost::type<Reference>,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<T,NDims-1> proxy object
|
||||
TPtr newbase = base + idx * strides[0];
|
||||
@ -168,9 +180,9 @@ protected:
|
||||
// used by array operator[] and iterators to get reference types.
|
||||
template <typename Reference, typename TPtr>
|
||||
Reference access(boost::type<Reference>,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 <typename Reference, typename IndexList, typename TPtr>
|
||||
Reference access_element(boost::type<Reference>, 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 <typename StrideList, typename ExtentList>
|
||||
void compute_strides(StrideList& stride_list, ExtentList& extent_list,
|
||||
const general_storage_order<NumDims>& storage)
|
||||
const general_storage_order<NumDims>& 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 <typename StrideList, typename ExtentList, typename BaseList>
|
||||
index
|
||||
calculate_origin_offset(const StrideList& stride_list,
|
||||
const ExtentList& extent_list,
|
||||
const general_storage_order<NumDims>& storage,
|
||||
const BaseList& index_base_list)
|
||||
const ExtentList& extent_list,
|
||||
const general_storage_order<NumDims>& 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 <typename StrideList, typename ExtentList>
|
||||
index
|
||||
calculate_descending_dimension_offset(const StrideList& stride_list,
|
||||
const ExtentList& extent_list,
|
||||
const general_storage_order<NumDims>& storage)
|
||||
const ExtentList& extent_list,
|
||||
const general_storage_order<NumDims>& 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 <typename StrideList, typename BaseList>
|
||||
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 <typename ArrayRef, int NDims, typename TPtr>
|
||||
ArrayRef
|
||||
generate_array_view(boost::type<ArrayRef>,
|
||||
const boost::detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices,
|
||||
const size_type* extents,
|
||||
const index* strides,
|
||||
const index* index_bases,
|
||||
TPtr base) const {
|
||||
const boost::detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices,
|
||||
const size_type* extents,
|
||||
const index* strides,
|
||||
const index* index_bases,
|
||||
TPtr base) const {
|
||||
|
||||
boost::array<index,NDims> new_strides;
|
||||
boost::array<index,NDims> 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 <typename SourceIterator, typename DestIterator>
|
||||
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 <typename Array1, typename Array2>
|
||||
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<element_type>::
|
||||
|
@ -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<NumRanges-1>& rhs,
|
||||
const range& a_range)
|
||||
const range& a_range)
|
||||
{
|
||||
std::copy(rhs.ranges_.begin(),rhs.ranges_.end(),ranges_.begin());
|
||||
*ranges_.rbegin() = a_range;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 <int ND>
|
||||
explicit index_gen(const index_gen<NumRanges-1,ND>& rhs,
|
||||
const index_range<Index,SizeType>& range)
|
||||
const index_range<Index,SizeType>& range)
|
||||
{
|
||||
std::copy(rhs.ranges_.begin(),rhs.ranges_.end(),ranges_.begin());
|
||||
*ranges_.rbegin() = range;
|
||||
|
@ -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_; }
|
||||
|
@ -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<reference>(),
|
||||
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 <class IteratorAdaptor>
|
||||
|
@ -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) {
|
||||
|
@ -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 <typename OPtr>
|
||||
const_multi_array_ref(const const_multi_array_ref<T,NumDims,
|
||||
OPtr>& 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 <typename ExtentList>
|
||||
explicit const_multi_array_ref(TPtr base, const ExtentList& extents,
|
||||
const general_storage_order<NumDims>& so) :
|
||||
const general_storage_order<NumDims>& so) :
|
||||
base_(base), storage_(so) {
|
||||
boost::function_requires<
|
||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||
@ -95,17 +107,17 @@ public:
|
||||
}
|
||||
|
||||
explicit const_multi_array_ref(TPtr base,
|
||||
const detail::multi_array::
|
||||
extent_gen<NumDims>& ranges) :
|
||||
const detail::multi_array::
|
||||
extent_gen<NumDims>& 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<NumDims>& ranges,
|
||||
const general_storage_order<NumDims>& so) :
|
||||
const detail::multi_array::
|
||||
extent_gen<NumDims>& ranges,
|
||||
const general_storage_order<NumDims>& 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 <typename SizeList>
|
||||
@ -146,15 +158,15 @@ public:
|
||||
boost::function_requires<
|
||||
detail::multi_array::CollectionConcept<SizeList> >();
|
||||
assert(num_elements_ ==
|
||||
std::accumulate(extents.begin(),extents.end(),
|
||||
size_type(1),std::multiplies<size_type>()));
|
||||
std::accumulate(extents.begin(),extents.end(),
|
||||
size_type(1),std::multiplies<size_type>()));
|
||||
|
||||
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<IndexList> >();
|
||||
return super_type::access_element(boost::type<const element&>(),
|
||||
origin(),
|
||||
indices,strides());
|
||||
origin(),
|
||||
indices,strides());
|
||||
}
|
||||
|
||||
// Only allow const element access
|
||||
const_reference operator[](index idx) const {
|
||||
return super_type::access(boost::type<const_reference>(),
|
||||
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 <int NDims>
|
||||
#else
|
||||
template <int NumDims, int NDims> // else ICE
|
||||
#endif // BOOST_MSVC
|
||||
typename const_array_view<NDims>::type
|
||||
operator[](const detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
const {
|
||||
typedef const_array_view<NDims>::type return_type;
|
||||
typedef typename const_array_view<NDims>::type return_type;
|
||||
return
|
||||
super_type::generate_array_view(boost::type<return_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 <typename OPtr>
|
||||
bool operator==(const
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_ref<T,NumDims,OPtr>& 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 <typename OPtr>
|
||||
bool operator<(const
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return std::lexicographical_compare(begin(),end(),rhs.begin(),rhs.end());
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
bool operator!=(const
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
bool operator>(const
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return rhs < *this;
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
bool operator<=(const
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return !(*this > rhs);
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
bool operator>=(const
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_ref<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return !(*this < rhs);
|
||||
}
|
||||
@ -296,7 +308,7 @@ public:
|
||||
|
||||
template <typename OPtr>
|
||||
const_multi_array_ref(const detail::multi_array::
|
||||
const_sub_array<T,NumDims,OPtr>& rhs)
|
||||
const_sub_array<T,NumDims,OPtr>& 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<NumDims>& ranges) {
|
||||
detail::multi_array::
|
||||
extent_gen<NumDims>& ranges) {
|
||||
|
||||
typedef boost::array<index,NumDims> 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<index>());
|
||||
1,std::multiplies<index>());
|
||||
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 <class ExtentList>
|
||||
explicit multi_array_ref(T* base, const ExtentList& extents,
|
||||
const general_storage_order<NumDims>& so) :
|
||||
const general_storage_order<NumDims>& so) :
|
||||
super_type(base,extents,so) {
|
||||
boost::function_requires<
|
||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||
@ -418,21 +430,21 @@ public:
|
||||
|
||||
|
||||
explicit multi_array_ref(T* base,
|
||||
const detail::multi_array::
|
||||
extent_gen<NumDims>& ranges) :
|
||||
const detail::multi_array::
|
||||
extent_gen<NumDims>& ranges) :
|
||||
super_type(base,ranges) { }
|
||||
|
||||
|
||||
explicit multi_array_ref(T* base,
|
||||
const detail::multi_array::
|
||||
extent_gen<NumDims>&
|
||||
ranges,
|
||||
const general_storage_order<NumDims>& so) :
|
||||
const detail::multi_array::
|
||||
extent_gen<NumDims>&
|
||||
ranges,
|
||||
const general_storage_order<NumDims>& so) :
|
||||
super_type(base,ranges,so) { }
|
||||
|
||||
template <typename OPtr>
|
||||
multi_array_ref(const detail::multi_array::
|
||||
const_sub_array<T,NumDims,OPtr>& rhs)
|
||||
const_sub_array<T,NumDims,OPtr>& 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<IndexList> >();
|
||||
return super_type::access_element(boost::type<element&>(),
|
||||
origin(),
|
||||
indices,strides());
|
||||
origin(),
|
||||
indices,strides());
|
||||
}
|
||||
|
||||
|
||||
reference operator[](index idx) {
|
||||
return super_type::access(boost::type<reference>(),
|
||||
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 <int NDims>
|
||||
#else
|
||||
template <int NumDims, int NDims> // else ICE
|
||||
#endif // BOOST_MSVC
|
||||
typename array_view<NDims>::type
|
||||
operator[](const detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices) {
|
||||
typedef array_view<NDims>::type return_type;
|
||||
index_gen<NumDims,NDims>& indices) {
|
||||
typedef typename array_view<NDims>::type return_type;
|
||||
return
|
||||
super_type::generate_array_view(boost::type<return_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<const_reference>(),
|
||||
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 <int NDims>
|
||||
#else
|
||||
template <int NumDims, int NDims> // else ICE
|
||||
#endif // BOOST_MSVC
|
||||
typename const_array_view<NDims>::type
|
||||
operator[](const detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
const {
|
||||
return super_type::operator[](indices);
|
||||
}
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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 <typename OrderingIter, typename AscendingIter>
|
||||
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<bool>());
|
||||
std::logical_and<bool>());
|
||||
}
|
||||
|
||||
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<bool,NumDims> 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<NumDims>(ordering.begin(),
|
||||
ascending.begin());
|
||||
ascending.begin());
|
||||
}
|
||||
#endif
|
||||
};
|
||||
@ -99,11 +111,11 @@ namespace boost {
|
||||
boost::array<bool,NumDims> 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<NumDims>(ordering.begin(),
|
||||
ascending.begin());
|
||||
ascending.begin());
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
@ -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<const_reference>(),
|
||||
idx,base_,shape(),strides(),index_bases());
|
||||
idx,base_,shape(),strides(),index_bases());
|
||||
}
|
||||
|
||||
template <typename IndexList>
|
||||
const element& operator()(const IndexList& indices) const {
|
||||
return super_type::access_element(boost::type<const element&>(),
|
||||
origin(),
|
||||
indices,strides());
|
||||
origin(),
|
||||
indices,strides());
|
||||
}
|
||||
|
||||
// see generate_array_view in base.hpp
|
||||
#ifndef BOOST_MSVC
|
||||
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
|
||||
template <int NDims>
|
||||
#else
|
||||
template <int NumDims, int NDims> // else ICE
|
||||
#endif // BOOST_MSVC
|
||||
typename const_array_view<NDims>::type
|
||||
operator[](const boost::detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
const {
|
||||
typedef const_array_view<NDims>::type return_type;
|
||||
typedef typename const_array_view<NDims>::type return_type;
|
||||
return
|
||||
super_type::generate_array_view(boost::type<return_type>(),
|
||||
indices,
|
||||
shape(),
|
||||
strides(),
|
||||
index_bases(),
|
||||
base_);
|
||||
indices,
|
||||
shape(),
|
||||
strides(),
|
||||
index_bases(),
|
||||
base_);
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
@ -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>());
|
||||
size_type(1), std::multiplies<size_type>());
|
||||
}
|
||||
|
||||
|
||||
@ -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<reference>(),
|
||||
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 <int NDims>
|
||||
#else
|
||||
template <int NumDims, int NDims> // else ICE
|
||||
#endif // BOOST_MSVC
|
||||
typename array_view<NDims>::type
|
||||
operator[](const boost::detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices) {
|
||||
typedef array_view<NDims>::type return_type;
|
||||
index_gen<NumDims,NDims>& indices) {
|
||||
typedef typename array_view<NDims>::type return_type;
|
||||
return
|
||||
super_type::generate_array_view(boost::type<return_type>(),
|
||||
indices,
|
||||
shape(),
|
||||
strides(),
|
||||
index_bases(),
|
||||
origin());
|
||||
indices,
|
||||
shape(),
|
||||
strides(),
|
||||
index_bases(),
|
||||
origin());
|
||||
}
|
||||
|
||||
template <class IndexList>
|
||||
element& operator()(const IndexList& indices) {
|
||||
return super_type::access_element(boost::type<element&>(),
|
||||
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 <int NDims>
|
||||
#else
|
||||
template <int NumDims, int NDims> // else ICE
|
||||
#endif // BOOST_MSVC
|
||||
typename const_array_view<NDims>::type
|
||||
operator[](const boost::detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
index_gen<NumDims,NDims>& 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) {
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 <typename OPtr>
|
||||
const_multi_array_view(const
|
||||
const_multi_array_view<T,NumDims,OPtr>& other) :
|
||||
const_multi_array_view<T,NumDims,OPtr>& 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 <typename IndexList>
|
||||
const element& operator()(IndexList indices) const {
|
||||
return super_type::access_element(boost::type<const element&>(),
|
||||
origin(),
|
||||
indices,strides());
|
||||
origin(),
|
||||
indices,strides());
|
||||
}
|
||||
|
||||
// Only allow const element access
|
||||
const_reference operator[](index idx) const {
|
||||
return super_type::access(boost::type<const_reference>(),
|
||||
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 <int NDims>
|
||||
#else
|
||||
template <int NumDims, int NDims> // else ICE
|
||||
#endif // BOOST_MSVC
|
||||
typename const_array_view<NDims>::type
|
||||
operator[](const boost::detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
const {
|
||||
typedef const_array_view<NDims>::type return_type;
|
||||
typedef typename const_array_view<NDims>::type return_type;
|
||||
return
|
||||
super_type::generate_array_view(boost::type<return_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 <typename OPtr>
|
||||
bool operator==(const
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_view<T,NumDims,OPtr>& 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 <typename OPtr>
|
||||
bool operator<(const
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return std::lexicographical_compare(begin(),end(),rhs.begin(),rhs.end());
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
bool operator!=(const
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
bool operator>(const
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return rhs < *this;
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
bool operator<=(const
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return !(*this > rhs);
|
||||
}
|
||||
|
||||
template <typename OPtr>
|
||||
bool operator>=(const
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const_multi_array_view<T,NumDims,OPtr>& rhs)
|
||||
const {
|
||||
return !(*this < rhs);
|
||||
}
|
||||
@ -207,8 +219,8 @@ public: // should be protected
|
||||
// to create strides
|
||||
template <typename ExtentList, typename Index>
|
||||
explicit const_multi_array_view(TPtr base,
|
||||
const ExtentList& extents,
|
||||
const boost::array<Index,NumDims>& strides):
|
||||
const ExtentList& extents,
|
||||
const boost::array<Index,NumDims>& 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>());
|
||||
size_type(1),std::multiplies<size_type>());
|
||||
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 <class IndexList>
|
||||
element& operator()(const IndexList& indices) {
|
||||
return super_type::access_element(boost::type<element&>(),
|
||||
origin(),
|
||||
indices,strides());
|
||||
origin(),
|
||||
indices,strides());
|
||||
}
|
||||
|
||||
|
||||
reference operator[](index idx) {
|
||||
return super_type::access(boost::type<reference>(),
|
||||
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 <int NDims>
|
||||
#else
|
||||
template <int NumDims, int NDims> // else ICE
|
||||
#endif // BOOST_MSVC
|
||||
typename array_view<NDims>::type
|
||||
operator[](const boost::detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices) {
|
||||
typedef array_view<NDims>::type return_type;
|
||||
index_gen<NumDims,NDims>& indices) {
|
||||
typedef typename array_view<NDims>::type return_type;
|
||||
return
|
||||
super_type::generate_array_view(boost::type<return_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 <int NDims>
|
||||
#else
|
||||
template <int NumDims, int NDims> // else ICE
|
||||
#endif // BOOST_MSVC
|
||||
typename const_array_view<NDims>::type
|
||||
operator[](const boost::detail::multi_array::
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
index_gen<NumDims,NDims>& indices)
|
||||
const {
|
||||
return super_type::operator[](indices);
|
||||
}
|
||||
@ -410,8 +422,8 @@ public: // should be private
|
||||
// generate array views
|
||||
template <typename ExtentList, typename Index>
|
||||
explicit multi_array_view(T* base,
|
||||
const ExtentList& extents,
|
||||
const boost::array<Index,NumDims>& strides) :
|
||||
const ExtentList& extents,
|
||||
const boost::array<Index,NumDims>& strides) :
|
||||
super_type(base,extents,strides) { }
|
||||
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -13,7 +13,6 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
#include <boost/preprocessor/detail/cat.hpp>
|
||||
#include <boost/preprocessor/logical/bool.hpp>
|
||||
|
||||
/** <p>Expands to <code>EXPR</code> if <code>COND != 0</code> and to nothing if <code>COND == 0</code>.</p>
|
||||
@ -27,7 +26,10 @@
|
||||
<li>BOOST_PP_IF()</li>
|
||||
</ul>
|
||||
*/
|
||||
#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
|
||||
|
@ -13,7 +13,6 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
#include <boost/preprocessor/detail/cat.hpp>
|
||||
#include <boost/preprocessor/logical/bool.hpp>
|
||||
|
||||
/** <p>Expands to <code>THEN</code> if <code>COND != 0</code> and <code>ELSE</code> if
|
||||
@ -33,7 +32,11 @@
|
||||
<li><a href="../../test/preprocessor_test.cpp">preprocessor_test.cpp</a></li>
|
||||
</ul>
|
||||
*/
|
||||
#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
|
||||
|
@ -40,5 +40,5 @@ BOOST_PP_REPEAT() and BOOST_PP_REPEAT_FROM_TO()).</p>
|
||||
#define BOOST_PP_LIMIT_MAG 128
|
||||
|
||||
/** <p>Expands to the maximum tuple size supported by the library.</p> */
|
||||
#define BOOST_PP_LIMIT_TUPLE 16
|
||||
#define BOOST_PP_LIMIT_TUPLE 32
|
||||
#endif
|
||||
|
@ -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
|
||||
|
@ -13,7 +13,8 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
#include <boost/preprocessor/detail/cat.hpp>
|
||||
// pm: not necessary if using manual delay
|
||||
// #include <boost/preprocessor/detail/cat.hpp>
|
||||
|
||||
/** <p>Expands to <code>0</code> if <code>X == 0</code> and <code>1</code> if <code>X != 0</code>.</p>
|
||||
|
||||
@ -21,7 +22,8 @@
|
||||
|
||||
<p>For example, <code>BOOST_PP_BOOL(3)</code> expands to <code>1</code>.</p>
|
||||
*/
|
||||
#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.
|
||||
|
@ -92,6 +92,13 @@ are directly supported.</p>
|
||||
#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 <boost/preprocessor/detail/repeat_edg.hpp>
|
||||
#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.</p>
|
||||
#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.</p>
|
||||
#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.</p>
|
||||
#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))
|
||||
|
||||
/** <p>Obsolete, just use BOOST_PP_REPEAT().</p> */
|
||||
#define BOOST_PP_REPEAT_2ND BOOST_PP_REPEAT
|
||||
/** <p>Obsolete, just use BOOST_PP_REPEAT().</p> */
|
||||
|
@ -24,9 +24,9 @@ constitutes a single macro parameter.</p>
|
||||
<p>Examples of tuples:</p>
|
||||
|
||||
<pre>
|
||||
(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
|
||||
</pre>
|
||||
|
||||
<p>Tuples can be used for representing structured data.</p>
|
||||
|
@ -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
|
||||
|
@ -31,7 +31,25 @@ BOOST_PP_TUPLE_ELEM(2,1,(A,B))
|
||||
<li>BOOST_PP_LIMIT_TUPLE</li>
|
||||
</ul>
|
||||
*/
|
||||
#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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 <class T>
|
||||
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;
|
||||
|
@ -437,7 +437,7 @@ struct def_alloc_param_traits<const wchar_t*>
|
||||
}
|
||||
|
||||
template <class iterator, class Allocator =
|
||||
#ifndef BOOST_MSVC
|
||||
#if !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1300))
|
||||
BOOST_DEFAULT_ALLOCATOR(typename re_detail::def_alloc_param_traits<iterator>::type) >
|
||||
#else
|
||||
BOOST_DEFAULT_ALLOCATOR(re_detail::def_alloc_param_traits<iterator>::type) >
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -33,6 +33,8 @@ private:
|
||||
scoped_array(scoped_array const &);
|
||||
scoped_array & operator=(scoped_array const &);
|
||||
|
||||
typedef scoped_array<T> 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;
|
||||
|
@ -15,6 +15,10 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/checked_delete.hpp>
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
# include <memory> // for std::auto_ptr
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@ -27,11 +31,13 @@ template<typename T> class scoped_ptr // noncopyable
|
||||
{
|
||||
private:
|
||||
|
||||
T* ptr;
|
||||
T * ptr;
|
||||
|
||||
scoped_ptr(scoped_ptr const &);
|
||||
scoped_ptr & operator=(scoped_ptr const &);
|
||||
|
||||
typedef scoped_ptr<T> this_type;
|
||||
|
||||
public:
|
||||
|
||||
typedef T element_type;
|
||||
@ -40,6 +46,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
|
||||
explicit scoped_ptr(std::auto_ptr<T> 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<typename T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) // n
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
// get_pointer(p) is a generic way to say p.get()
|
||||
|
||||
template<typename T> inline T * get_pointer(scoped_ptr<T> const & p)
|
||||
{
|
||||
return p.get();
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include <boost/config.hpp> // for broken compiler workarounds
|
||||
|
||||
#ifndef BOOST_MSVC6_MEMBER_TEMPLATES
|
||||
#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
|
||||
#include <boost/detail/shared_array_nmt.hpp>
|
||||
#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<typename T> void swap(shared_array<T> & a, shared_array<T> & 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
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include <boost/config.hpp> // for broken compiler workarounds
|
||||
|
||||
#ifndef BOOST_MSVC6_MEMBER_TEMPLATES
|
||||
#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
|
||||
#include <boost/detail/shared_ptr_nmt.hpp>
|
||||
#else
|
||||
|
||||
@ -56,6 +56,15 @@ template<> struct shared_ptr_traits<void>
|
||||
typedef void reference;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
|
||||
|
||||
template<> struct shared_ptr_traits<void const>
|
||||
{
|
||||
typedef void reference;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
@ -126,19 +135,19 @@ public:
|
||||
template<typename Y>
|
||||
shared_ptr(shared_ptr<Y> const & r, detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(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<typename Y>
|
||||
shared_ptr(shared_ptr<Y> const & r, detail::polymorphic_cast_tag): px(dynamic_cast<element_type *>(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<typename Y>
|
||||
shared_ptr & operator=(shared_ptr<Y> 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<typename Y>
|
||||
shared_ptr & operator=(std::auto_ptr<Y> & 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<typename Y> 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<typename Y, typename D> void reset(Y * p, D d)
|
||||
{
|
||||
this_type(p, d).swap(*this);
|
||||
this_type(p, d).swap(*this);
|
||||
}
|
||||
|
||||
typename detail::shared_ptr_traits<T>::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<T> & 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<typename T> inline T * get_pointer(shared_ptr<T> 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<class T> inline T * sp_remove_const(T const * p)
|
||||
{
|
||||
return const_cast<T *>(p);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T> shared_ptr<T> shared_from_this(T * p)
|
||||
{
|
||||
detail::sp_assert_counted_base(p);
|
||||
return shared_ptr<T>(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
|
||||
|
@ -374,14 +374,14 @@ namespace boost {
|
||||
>
|
||||
class signal :
|
||||
public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<R, T1, T2, T3, T4, T5, T6, T7,
|
||||
T8, T9, T10, boost::last_value<R> >::type
|
||||
T8, T9, T10, boost::last_value<R> >::type
|
||||
{
|
||||
public:
|
||||
template<typename Combiner>
|
||||
struct combiner {
|
||||
private:
|
||||
typedef BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<R, T1, T2, T3, T4, T5,
|
||||
T6, T7, T8, T9, T10, Combiner> t1;
|
||||
T6, T7, T8, T9, T10, Combiner> t1;
|
||||
public:
|
||||
typedef typename t1::type type;
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -69,17 +69,17 @@ namespace boost {
|
||||
// manages call depth
|
||||
class call_notification {
|
||||
public:
|
||||
call_notification(const shared_ptr<signal_base_impl>&);
|
||||
~call_notification();
|
||||
|
||||
shared_ptr<signal_base_impl> impl;
|
||||
call_notification(const shared_ptr<signal_base_impl>&);
|
||||
~call_notification();
|
||||
|
||||
shared_ptr<signal_base_impl> 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<bool, any, any> 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<any, connection_slot_pair, compare_type>
|
||||
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<signal_base_impl> impl;
|
||||
shared_ptr<signal_base_impl> impl;
|
||||
};
|
||||
} // end namespace detail
|
||||
} // end namespace BOOST_SIGNALS_NAMESPACE
|
||||
|
@ -37,12 +37,12 @@ namespace boost {
|
||||
// Determine the result type of a slot call
|
||||
template<typename R>
|
||||
struct slot_result_type {
|
||||
typedef R type;
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct slot_result_type<void> {
|
||||
typedef unusable type;
|
||||
typedef unusable type;
|
||||
};
|
||||
|
||||
// Determine if the given type T is a signal
|
||||
@ -50,8 +50,8 @@ namespace boost {
|
||||
|
||||
template<typename T>
|
||||
struct is_signal {
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value = (is_convertible<T*, signal_base*>::value));
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value = (is_convertible<T*, signal_base*>::value));
|
||||
};
|
||||
|
||||
/*
|
||||
@ -102,13 +102,13 @@ namespace boost {
|
||||
template<typename T>
|
||||
struct is_ref
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_ref<reference_wrapper<T> >
|
||||
{
|
||||
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<typename T>
|
||||
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<typename S>
|
||||
class get_slot_tag {
|
||||
typedef typename IF<(is_signal<S>::value),
|
||||
signal_tag,
|
||||
value_tag>::type signal_or_value;
|
||||
typedef typename IF<(is_signal<S>::value),
|
||||
signal_tag,
|
||||
value_tag>::type signal_or_value;
|
||||
|
||||
public:
|
||||
typedef typename IF<(is_ref<S>::value),
|
||||
reference_tag,
|
||||
signal_or_value>::type type;
|
||||
public:
|
||||
typedef typename IF<(is_ref<S>::value),
|
||||
reference_tag,
|
||||
signal_or_value>::type type;
|
||||
};
|
||||
|
||||
// Forward declaration needed in lots of places
|
||||
|
@ -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 <class IteratorAdaptor>
|
||||
typename IteratorAdaptor::reference
|
||||
dereference(const IteratorAdaptor& x) const
|
||||
{
|
||||
if (!cache.get()) {
|
||||
cache.reset(new cached_return_value<result_type>(f(*x.base())));
|
||||
}
|
||||
|
||||
return cache->value;
|
||||
}
|
||||
|
||||
template<typename IteratorAdaptor>
|
||||
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<typename IteratorAdaptor1, typename IteratorAdaptor2>
|
||||
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 <class IteratorAdaptor>
|
||||
typename IteratorAdaptor::reference
|
||||
dereference(const IteratorAdaptor& x) const
|
||||
{
|
||||
if (!cache.get()) {
|
||||
cache.reset(new cached_return_value<result_type>(f(*x.base())));
|
||||
}
|
||||
|
||||
return cache->value;
|
||||
}
|
||||
|
||||
template<typename IteratorAdaptor>
|
||||
void increment(IteratorAdaptor& x)
|
||||
{
|
||||
++x.base();
|
||||
x.base() = std::find_if(x.base(), x.policies().end,
|
||||
std::not1(is_disconnected()));
|
||||
cache.reset();
|
||||
}
|
||||
|
||||
template<typename IteratorAdaptor1, typename IteratorAdaptor2>
|
||||
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<IteratorAdaptor1&>(x).base() = xb;
|
||||
const_cast<IteratorAdaptor1&>(y).base() = yb;
|
||||
return xb == yb;
|
||||
}
|
||||
|
||||
return xb == yb;
|
||||
}
|
||||
|
||||
private:
|
||||
Iterator end;
|
||||
Function f;
|
||||
Iterator end;
|
||||
Function f;
|
||||
mutable shared_ptr< cached_return_value<result_type> > cache;
|
||||
};
|
||||
|
||||
template<typename Function, typename Iterator>
|
||||
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<Function, Iterator> policy_type;
|
||||
typedef iterator_adaptor<Iterator, policy_type, value_type,
|
||||
value_type&, value_type*,
|
||||
std::input_iterator_tag> type;
|
||||
typedef slot_call_policies<Function, Iterator> policy_type;
|
||||
typedef iterator_adaptor<Iterator, policy_type, value_type,
|
||||
value_type&, value_type*,
|
||||
std::input_iterator_tag> type;
|
||||
};
|
||||
|
||||
template<typename Function, typename Iterator>
|
||||
inline typename slot_call_iterator_generator<Function, Iterator>::type
|
||||
make_slot_call_iterator(Iterator first, Iterator last, Function f)
|
||||
{
|
||||
typedef slot_call_iterator_generator<Function, Iterator> gen;
|
||||
typedef typename gen::type sc_iterator;
|
||||
typedef typename gen::policy_type sc_policy;
|
||||
typedef slot_call_iterator_generator<Function, Iterator> 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
|
||||
|
@ -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<typename R>
|
||||
struct BOOST_SIGNALS_CALL_BOUND {
|
||||
template<BOOST_SIGNALS_TEMPLATE_PARMS
|
||||
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
||||
template<BOOST_SIGNALS_TEMPLATE_PARMS
|
||||
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
||||
typename F>
|
||||
struct caller {
|
||||
typedef BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>*
|
||||
args_type;
|
||||
struct caller {
|
||||
typedef BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>*
|
||||
args_type;
|
||||
|
||||
args_type args;
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
caller() {}
|
||||
caller(args_type a) : args(a) {}
|
||||
caller(args_type a) : args(a) {}
|
||||
|
||||
template<typename Pair>
|
||||
R operator()(const Pair& slot) const
|
||||
@ -94,32 +94,32 @@ namespace boost {
|
||||
F* target = const_cast<F*>(any_cast<F>(&slot.second.second));
|
||||
return (*target)(BOOST_SIGNALS_BOUND_ARGS);
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct BOOST_SIGNALS_CALL_BOUND<void> {
|
||||
template<BOOST_SIGNALS_TEMPLATE_PARMS
|
||||
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
||||
template<BOOST_SIGNALS_TEMPLATE_PARMS
|
||||
BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
||||
typename F>
|
||||
struct caller {
|
||||
typedef BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>*
|
||||
args_type;
|
||||
struct caller {
|
||||
typedef BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>*
|
||||
args_type;
|
||||
|
||||
args_type args;
|
||||
|
||||
typedef unusable result_type;
|
||||
|
||||
caller(args_type a) : args(a) {}
|
||||
caller(args_type a) : args(a) {}
|
||||
|
||||
template<typename Pair>
|
||||
unusable operator()(const Pair& slot) const
|
||||
{
|
||||
F* target = const_cast<F*>(any_cast<F>(&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
|
||||
|
||||
|
@ -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 <class Char,
|
||||
class Traits = typename std::basic_string<Char>::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 <typename Char,
|
||||
typename Traits = typename std::basic_string<Char>::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 <class Char,
|
||||
class Traits = typename std::basic_string<Char>::traits_type >
|
||||
#else
|
||||
|
@ -648,8 +648,8 @@ namespace tuples {
|
||||
detail::assign_to_pointee<T2>(&t2),
|
||||
detail::assign_to_pointee<T3>(&t3),
|
||||
detail::assign_to_pointee<T4>(&t4),
|
||||
detail::assign_to_pointee<T6>(&t5),
|
||||
detail::assign_to_pointee<T5>(&t6));
|
||||
detail::assign_to_pointee<T5>(&t5),
|
||||
detail::assign_to_pointee<T6>(&t6));
|
||||
}
|
||||
|
||||
// Tie variables into a tuple
|
||||
|
@ -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 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#if defined(BOOST_MSVC)
|
||||
|
||||
//
|
||||
// MS specific version:
|
||||
|
@ -191,7 +191,7 @@ namespace detail{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <bool is_ref = true, bool array>
|
||||
template <bool is_ref, bool array>
|
||||
struct is_const_impl
|
||||
: ::boost::type_traits::false_unary_metafunction
|
||||
{};
|
||||
@ -257,7 +257,7 @@ struct is_const<const volatile void>
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <bool is_ref = true, bool array>
|
||||
template <bool is_ref, bool array>
|
||||
struct is_volatile_impl
|
||||
: ::boost::type_traits::false_unary_metafunction
|
||||
{};
|
||||
@ -397,3 +397,4 @@ struct add_cv<T&>{ typedef T& type; };
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ const bool is_same<T, T>::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
|
||||
|
@ -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 <boost/regex/config.hpp>
|
||||
|
||||
#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 charT,
|
||||
class traits = ::std::char_traits<charT> >
|
||||
class traits = ::std::char_traits<charT> >
|
||||
class parser_buf : public ::std::basic_streambuf<charT, traits>
|
||||
{
|
||||
typedef ::std::basic_streambuf<charT, traits> base_type;
|
||||
@ -129,22 +129,23 @@ parser_buf<charT, traits>::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<pos_type>(this->gptr() - this->eback());
|
||||
}
|
||||
@ -204,13 +205,13 @@ message_data<char>::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<char>::syntax_char, 256);
|
||||
unsigned i;
|
||||
@ -222,18 +223,18 @@ message_data<char>::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<char>::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<char>::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<char>::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<char>::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<wchar_t>& 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<wchar_t>::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<wchar_t>::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<wchar_t>, l).get(cat, 0, (int)i+100, s);
|
||||
s = BOOST_USE_FACET(std::messages<wchar_t>, 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<unsigned char>(i);
|
||||
else
|
||||
{
|
||||
m.c = s[j];
|
||||
m.type = static_cast<unsigned int>(i);
|
||||
syntax.push_back(m);
|
||||
}
|
||||
if((s[j] <= UCHAR_MAX) && (s[j] >= 0))
|
||||
syntax_[s[j]] = static_cast<unsigned char>(i);
|
||||
else
|
||||
{
|
||||
m.c = s[j];
|
||||
m.type = static_cast<unsigned int>(i);
|
||||
syntax.push_back(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -645,19 +646,19 @@ message_data<wchar_t>::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<wchar_t>(p1, p2)] = std::basic_string<wchar_t>(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<wchar_t>(p1, p2)] = std::basic_string<wchar_t>(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<wchar_t>::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<int>(i+300), c2);
|
||||
if(c1.size())
|
||||
classes[c1] = i;
|
||||
c1 = msgs.get(cat, 0, static_cast<int>(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<int>(i+200), c2);
|
||||
error_strings[i] = to_narrow(c1, cvt);
|
||||
c1 = msgs.get(cat, 0, static_cast<int>(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<wchar_t>::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<wchar_t>::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<wchar_t>::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<wchar_t>::strwiden(wchar_t *s1, st
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace boost {
|
||||
typedef std::list<BOOST_SIGNALS_NAMESPACE::detail::bound_object>::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);
|
||||
}
|
||||
}
|
||||
|
@ -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 <boost/signals/detail/signal_base.hpp>
|
||||
@ -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<const trackable*>& bound_objects)
|
||||
connect_slot(const any& slot,
|
||||
const any& name,
|
||||
const std::vector<const trackable*>& 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<slot_iterator> 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<slot_iterator> 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 trackable*>::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 trackable*>::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<slot_iterator, slot_iterator> group_slots =
|
||||
slots_.equal_range(group);
|
||||
while (group_slots.first != group_slots.second) {
|
||||
slot_iterator next = group_slots.first;
|
||||
++next;
|
||||
std::pair<slot_iterator, slot_iterator> 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<signal_base_impl*>(obj);
|
||||
signal_base_impl* self = reinterpret_cast<signal_base_impl*>(obj);
|
||||
|
||||
// We won't need the slot iterator after this
|
||||
std::auto_ptr<slot_iterator> slot(
|
||||
reinterpret_cast<slot_iterator*>(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_iterator> slot(
|
||||
reinterpret_cast<slot_iterator*>(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<signal_base_impl>& b) :
|
||||
call_notification(const shared_ptr<signal_base_impl>& 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<bool, boost::any, boost::any>;
|
||||
template class std::multimap<boost::any,
|
||||
boost::BOOST_SIGNALS_NAMESPACE::detail::connection_slot_pair,
|
||||
boost::function2<bool, boost::any, boost::any> >;
|
||||
template class std::multimap<boost::any,
|
||||
boost::BOOST_SIGNALS_NAMESPACE::detail::connection_slot_pair,
|
||||
boost::function2<bool, boost::any, boost::any> >;
|
||||
#endif
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user