, type_with_alignment<alignment_>
>::type align_;
} data_;
+ void* address() const { return const_cast<aligned_storage_imp*>(this); }
+};
+
+template< std::size_t alignment_ >
+struct aligned_storage_imp<0u,alignment_>
+{
+ /* intentionally empty */
+ void* address() const { return 0; }
};
}} // namespace detail::aligned_storage
std::size_t size_
, std::size_t alignment_ = std::size_t(-1)
>
-class aligned_storage
+class aligned_storage :
+#ifndef __BORLANDC__
+ private
+#else
+ public
+#endif
+ detail::aligned_storage::aligned_storage_imp<size_, alignment_>
{
-private: // representation
-
- detail::aligned_storage::aligned_storage_imp<size_, alignment_> data_;
-
+
public: // constants
typedef detail::aligned_storage::aligned_storage_imp<size_, alignment_> type;
void* address()
{
- return this;
+ return static_cast<type*>(this)->address();
}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
const void* address() const
{
- return this;
+ return static_cast<const type*>(this)->address();
}
#else // MSVC6
#include <cstddef>
#include <stdexcept>
#include <boost/assert.hpp>
+#include <boost/swap.hpp>
// Handles broken standard libraries better than <iterator>
#include <boost/detail/iterator.hpp>
// swap (note: linear complexity)
void swap (array<T,N>& y) {
- std::swap_ranges(begin(),end(),y.begin());
+ for (size_type i = 0; i < N; ++i)
+ boost::swap(elems[i],y.elems[i]);
}
// direct access to data (read-only)
}
// operator[]
- reference operator[](size_type i)
+ reference operator[](size_type /*i*/)
{
return failed_rangecheck();
}
- const_reference operator[](size_type i) const
+ const_reference operator[](size_type /*i*/) const
{
return failed_rangecheck();
}
// at() with range check
- reference at(size_type i) { return failed_rangecheck(); }
- const_reference at(size_type i) const { return failed_rangecheck(); }
+ reference at(size_type /*i*/) { return failed_rangecheck(); }
+ const_reference at(size_type /*i*/) const { return failed_rangecheck(); }
// front() and back()
reference front()
static size_type max_size() { return 0; }
enum { static_size = 0 };
- void swap (array<T,0>& y) {
+ void swap (array<T,0>& /*y*/) {
}
// direct access to data (read-only)
// protect.hpp
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2009 Steven Watanabe
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
namespace boost
{
return f_(a1);
}
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1> result_type operator()(const A1 & a1)
+ {
+ return f_(a1);
+ }
+
+ template<class A1> result_type operator()(const A1 & a1) const
+ {
+ return f_(a1);
+ }
+
+#endif
+
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
{
return f_(a1, a2);
return f_(a1, a2);
}
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2)
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2) const
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2)
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2) const
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2)
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2) const
+ {
+ return f_(a1, a2);
+ }
+
+#endif
+
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3)
{
return f_(a1, a2, a3);
{
return f_(a1, a2, a3);
}
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3)
+ {
+ return f_(a1, a2, a3);
+ }
+
+ template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const
+ {
+ return f_(a1, a2, a3);
+ }
+
+#endif
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4)
{
{
return f_(a1, a2, a3, a4);
}
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4)
+ {
+ return f_(a1, a2, a3, a4);
+ }
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const
+ {
+ return f_(a1, a2, a3, a4);
+ }
+
+#endif
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5)
{
{
return f_(a1, a2, a3, a4, a5);
}
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5)
+ {
+ return f_(a1, a2, a3, a4, a5);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const
+ {
+ return f_(a1, a2, a3, a4, a5);
+ }
+
+#endif
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6)
{
{
return f_(a1, a2, a3, a4, a5, a6);
}
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6)
+ {
+ return f_(a1, a2, a3, a4, a5, a6);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6);
+ }
+
+#endif
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7)
{
{
return f_(a1, a2, a3, a4, a5, a6, a7);
}
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7)
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+#endif
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8)
{
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
}
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8)
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+#endif
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9)
{
{
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9)
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+
+#endif
private:
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
# define BOOST_NO_USING_TEMPLATE
# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
+# define BOOST_NO_NESTED_FRIENDSHIP
+# define BOOST_NO_TYPENAME_WITH_CTOR
#endif
//
//
// C++0x Macros:
//
-#if defined( BOOST_CODEGEAR_0X_SUPPORT ) && (__BORLANDC__ >= 0x610)
+#if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610)
+# define BOOST_NO_CHAR16_T
+# define BOOST_NO_CHAR32_T
+# define BOOST_NO_DECLTYPE
+# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
+# define BOOST_NO_EXTERN_TEMPLATE
+# define BOOST_NO_RVALUE_REFERENCES
+# define BOOST_NO_SCOPED_ENUMS
+# define BOOST_NO_STATIC_ASSERT
+#else
# define BOOST_HAS_ALIGNOF
# define BOOST_HAS_CHAR16_T
# define BOOST_HAS_CHAR32_T
# define BOOST_HAS_REF_QUALIFIER
# define BOOST_HAS_RVALUE_REFS
# define BOOST_HAS_STATIC_ASSERT
-
-# define BOOST_NO_EXTERN_TEMPLATE
-# define BOOST_NO_SCOPED_ENUMS
-# define BOOST_NO_VARIADIC_TEMPLATES
-# define BOOST_NO_CONSTEXPR
-# define BOOST_NO_DEFAULTED_FUNCTIONS
-# define BOOST_NO_DELETED_FUNCTIONS
-# define BOOST_NO_RAW_LITERALS
-# define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported
-#else
-# define BOOST_NO_CHAR16_T
-# define BOOST_NO_CHAR32_T
-# define BOOST_NO_DECLTYPE
-# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
-# define BOOST_NO_EXTERN_TEMPLATE
-# define BOOST_NO_SCOPED_ENUMS
-# define BOOST_NO_STATIC_ASSERT
-# define BOOST_NO_RVALUE_REFERENCES
-# define BOOST_NO_VARIADIC_TEMPLATES
-# define BOOST_NO_CONSTEXPR
-# define BOOST_NO_DEFAULTED_FUNCTIONS
-# define BOOST_NO_DELETED_FUNCTIONS
-# define BOOST_NO_RAW_LITERALS
-# define BOOST_NO_UNICODE_LITERALS
#endif
#define BOOST_NO_AUTO_DECLARATIONS
#define BOOST_NO_AUTO_MULTIDECLARATIONS
+#define BOOST_NO_CONCEPTS
+#define BOOST_NO_CONSTEXPR
+#define BOOST_NO_DEFAULTED_FUNCTIONS
+#define BOOST_NO_DELETED_FUNCTIONS
#define BOOST_NO_INITIALIZER_LISTS
+#define BOOST_NO_LAMBDAS
+#define BOOST_NO_NULLPTR
+#define BOOST_NO_RAW_LITERALS
+#define BOOST_NO_RVALUE_REFERENCES
+#define BOOST_NO_SCOPED_ENUMS
+#define BOOST_NO_TEMPLATE_ALIASES
+#define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported
+#define BOOST_NO_VARIADIC_TEMPLATES
#if __BORLANDC__ >= 0x590
# define BOOST_HAS_TR1_HASH
// #define BOOST_HAS_STATIC_ASSERT\r
#define BOOST_HAS_STD_TYPE_TRAITS\r
\r
-#define BOOST_NO_EXTERN_TEMPLATE\r
-#define BOOST_NO_SCOPED_ENUMS\r
-#define BOOST_NO_STATIC_ASSERT\r
-#define BOOST_NO_RVALUE_REFERENCES\r
-#define BOOST_NO_VARIADIC_TEMPLATES\r
+#define BOOST_NO_AUTO_DECLARATIONS\r
+#define BOOST_NO_AUTO_MULTIDECLARATIONS\r
+#define BOOST_NO_CONCEPTS\r
#define BOOST_NO_CONSTEXPR\r
#define BOOST_NO_DEFAULTED_FUNCTIONS\r
#define BOOST_NO_DELETED_FUNCTIONS\r
+#define BOOST_NO_EXTERN_TEMPLATE\r
+#define BOOST_NO_INITIALIZER_LISTS\r
+#define BOOST_NO_LAMBDAS\r
+#define BOOST_NO_NULLPTR\r
#define BOOST_NO_RAW_LITERALS\r
+#define BOOST_NO_RVALUE_REFERENCES\r
+#define BOOST_NO_STATIC_ASSERT\r
+#define BOOST_NO_TEMPLATE_ALIASES\r
#define BOOST_NO_UNICODE_LITERALS\r
-#define BOOST_NO_AUTO_DECLARATIONS\r
-#define BOOST_NO_AUTO_MULTIDECLARATIONS\r
+#define BOOST_NO_VARIADIC_TEMPLATES\r
\r
//\r
// TR1 macros:\r
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
#endif
-#if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG)
-// No support for initializer lists
-# define BOOST_NO_INITIALIZER_LISTS
-#endif
-
// See also kai.hpp which checks a Kai-specific symbol for EH
# if !defined(__KCC) && !defined(__EXCEPTIONS)
# define BOOST_NO_EXCEPTIONS
//
// See above for BOOST_NO_LONG_LONG
//
+#if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG)
+// No support for initializer lists
+# define BOOST_NO_INITIALIZER_LISTS
+#endif
+
+#define BOOST_NO_AUTO_DECLARATIONS
+#define BOOST_NO_AUTO_MULTIDECLARATIONS
#define BOOST_NO_CHAR16_T
#define BOOST_NO_CHAR32_T
+#define BOOST_NO_CONCEPTS
#define BOOST_NO_CONSTEXPR
#define BOOST_NO_DECLTYPE
#define BOOST_NO_DEFAULTED_FUNCTIONS
#define BOOST_NO_DELETED_FUNCTIONS
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_NO_EXTERN_TEMPLATE
+#define BOOST_NO_LAMBDAS
+#define BOOST_NO_NULLPTR
#define BOOST_NO_RAW_LITERALS
#define BOOST_NO_RVALUE_REFERENCES
#define BOOST_NO_SCOPED_ENUMS
#define BOOST_NO_STATIC_ASSERT
+#define BOOST_NO_TEMPLATE_ALIASES
#define BOOST_NO_UNICODE_LITERALS
#define BOOST_NO_VARIADIC_TEMPLATES
-#define BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
+
#ifdef c_plusplus
// EDG has "long long" in non-strict mode
// However, some libraries have insufficient "long long" support
#define BOOST_NO_SFINAE\r
#define BOOST_NO_USING_TEMPLATE\r
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL\r
-#define BOOST_NO_INITIALIZER_LISTS\r
#endif\r
\r
//\r
//\r
// C++0x features\r
//\r
+#define BOOST_NO_AUTO_DECLARATIONS\r
+#define BOOST_NO_AUTO_MULTIDECLARATIONS\r
#define BOOST_NO_CHAR16_T\r
#define BOOST_NO_CHAR32_T\r
+#define BOOST_NO_CONCEPTS\r
#define BOOST_NO_CONSTEXPR\r
#define BOOST_NO_DECLTYPE\r
#define BOOST_NO_DEFAULTED_FUNCTIONS\r
#define BOOST_NO_DELETED_FUNCTIONS\r
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS\r
#define BOOST_NO_EXTERN_TEMPLATE\r
+#define BOOST_NO_INITIALIZER_LISTS\r
+#define BOOST_NO_LAMBDAS\r
+#define BOOST_NO_NULLPTR\r
#define BOOST_NO_RAW_LITERALS\r
#define BOOST_NO_RVALUE_REFERENCES\r
#define BOOST_NO_SCOPED_ENUMS\r
#define BOOST_NO_STATIC_ASSERT\r
+#define BOOST_NO_TEMPLATE_ALIASES\r
#define BOOST_NO_UNICODE_LITERALS\r
#define BOOST_NO_VARIADIC_TEMPLATES\r
-#define BOOST_NO_AUTO_DECLARATIONS\r
-#define BOOST_NO_AUTO_MULTIDECLARATIONS\r
+\r
#if __DMC__ < 0x800\r
#error "Compiler not supported or configured - please reconfigure"\r
#endif\r
# endif
#endif
+// C++0x features not implemented in any GCC version
//
-// C++0x features
-//
-
-#define BOOST_NO_CHAR16_T
-#define BOOST_NO_CHAR32_T
#define BOOST_NO_CONSTEXPR
-#define BOOST_NO_DEFAULTED_FUNCTIONS
-#define BOOST_NO_DELETED_FUNCTIONS
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_NO_EXTERN_TEMPLATE
+#define BOOST_NO_LAMBDAS
+#define BOOST_NO_NULLPTR
#define BOOST_NO_RAW_LITERALS
+// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS until it
+// gets fixed. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064
#define BOOST_NO_SCOPED_ENUMS
-#define BOOST_NO_UNICODE_LITERALS
-// See below for BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
+#define BOOST_NO_TEMPLATE_ALIASES
+// C++0x features in 4.3.n and later
+//
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__)
// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
// passed on the command line, which in turn defines
# endif
#endif
-#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4)
-# define BOOST_NO_INITIALIZER_LISTS
+// C++0x features in 4.4.n and later
+//
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
# define BOOST_NO_AUTO_DECLARATIONS
+# define BOOST_NO_AUTO_MULTIDECLARATIONS
+# define BOOST_NO_CHAR16_T
+# define BOOST_NO_CHAR32_T
+# define BOOST_NO_DEFAULTED_FUNCTIONS
+# define BOOST_NO_DELETED_FUNCTIONS
+# define BOOST_NO_INITIALIZER_LISTS
+# define BOOST_NO_SCOPED_ENUMS
+# define BOOST_NO_UNICODE_LITERALS
#endif
// ConceptGCC compiler:
#ifdef __GXX_CONCEPTS__
# define BOOST_HAS_CONCEPTS
# define BOOST_COMPILER "ConceptGCC version " __VERSION__
+#else
+# define BOOST_NO_CONCEPTS
#endif
#ifndef BOOST_COMPILER
//
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
//
+#if !defined(__EDG__)
+
+#define BOOST_NO_AUTO_DECLARATIONS
+#define BOOST_NO_AUTO_MULTIDECLARATIONS
#define BOOST_NO_CHAR16_T
#define BOOST_NO_CHAR32_T
+#define BOOST_NO_CONCEPTS
#define BOOST_NO_CONSTEXPR
#define BOOST_NO_DECLTYPE
#define BOOST_NO_DEFAULTED_FUNCTIONS
#define BOOST_NO_DELETED_FUNCTIONS
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_NO_EXTERN_TEMPLATE
+#define BOOST_NO_INITIALIZER_LISTS
+#define BOOST_NO_LAMBDAS
+#define BOOST_NO_NULLPTR
#define BOOST_NO_RAW_LITERALS
#define BOOST_NO_RVALUE_REFERENCES
#define BOOST_NO_SCOPED_ENUMS
#define BOOST_NO_STATIC_ASSERT
+#define BOOST_NO_TEMPLATE_ALIASES
#define BOOST_NO_UNICODE_LITERALS
#define BOOST_NO_VARIADIC_TEMPLATES
-#define BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
+#endif
//
// last known and checked version for HP-UX/ia64 is 61300
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
#endif
-//
-// C++0x features
-//
-// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
-//
-#define BOOST_NO_CHAR16_T
-#define BOOST_NO_CHAR32_T
-#define BOOST_NO_CONSTEXPR
-#define BOOST_NO_DECLTYPE
-#define BOOST_NO_DEFAULTED_FUNCTIONS
-#define BOOST_NO_DELETED_FUNCTIONS
-#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
-#define BOOST_NO_EXTERN_TEMPLATE
-#define BOOST_NO_RAW_LITERALS
-#define BOOST_NO_RVALUE_REFERENCES
-#define BOOST_NO_SCOPED_ENUMS
-#define BOOST_NO_STATIC_ASSERT
-#define BOOST_NO_UNICODE_LITERALS
-#define BOOST_NO_VARIADIC_TEMPLATES
-#define BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
-
//
// last known and checked version:
#if (BOOST_INTEL_CXX_VERSION > 1100)
# define BOOST_NO_EXCEPTIONS
# endif
-#define BOOST_COMPILER "Kai C++ version " BOOST_STRINGIZE(__KCC_VERSION)
-
//
// last known and checked version is 4001:
#if (__KCC_VERSION > 4001)
// the "|| !defined(BOOST_STRICT_CONFIG)" part should apply to the last
// tested version *only*:
-# if(__MWERKS__ <= 0x3206) || !defined(BOOST_STRICT_CONFIG) // 9.5
+# if(__MWERKS__ <= 0x3207) || !defined(BOOST_STRICT_CONFIG) // 9.6
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
# define BOOST_NO_IS_ABSTRACT
-# define BOOST_NO_INITIALIZER_LISTS
# endif
#if !__option(wchar_type)
# define BOOST_COMPILER_VERSION 9.4
# elif __MWERKS__ == 0x3206
# define BOOST_COMPILER_VERSION 9.5
+# elif __MWERKS__ == 0x3207
+# define BOOST_COMPILER_VERSION 9.6
# else
# define BOOST_COMPILER_VERSION __MWERKS__
# endif
#else
# define BOOST_NO_RVALUE_REFERENCES
#endif
+#define BOOST_NO_AUTO_DECLARATIONS
+#define BOOST_NO_AUTO_MULTIDECLARATIONS
#define BOOST_NO_CHAR16_T
#define BOOST_NO_CHAR32_T
+#define BOOST_NO_CONCEPTS
#define BOOST_NO_CONSTEXPR
#define BOOST_NO_DECLTYPE
#define BOOST_NO_DEFAULTED_FUNCTIONS
#define BOOST_NO_DELETED_FUNCTIONS
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_NO_EXTERN_TEMPLATE
+#define BOOST_NO_INITIALIZER_LISTS
+#define BOOST_NO_LAMBDAS
+#define BOOST_NO_NULLPTR
#define BOOST_NO_RAW_LITERALS
#define BOOST_NO_SCOPED_ENUMS
#define BOOST_NO_STATIC_ASSERT
+#define BOOST_NO_TEMPLATE_ALIASES
#define BOOST_NO_UNICODE_LITERALS
#define BOOST_NO_VARIADIC_TEMPLATES
-#define BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
#define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
# define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */
-# define BOOST_NO_INITIALIZER_LISTS
#endif
//
//
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
//
+#define BOOST_NO_AUTO_DECLARATIONS
+#define BOOST_NO_AUTO_MULTIDECLARATIONS
#define BOOST_NO_CHAR16_T
#define BOOST_NO_CHAR32_T
+#define BOOST_NO_CONCEPTS
#define BOOST_NO_CONSTEXPR
#define BOOST_NO_DECLTYPE
#define BOOST_NO_DEFAULTED_FUNCTIONS
#define BOOST_NO_DELETED_FUNCTIONS
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_NO_EXTERN_TEMPLATE
+#define BOOST_NO_INITIALIZER_LISTS
+#define BOOST_NO_LAMBDAS
+#define BOOST_NO_NULLPTR
#define BOOST_NO_RAW_LITERALS
#define BOOST_NO_RVALUE_REFERENCES
#define BOOST_NO_SCOPED_ENUMS
#define BOOST_NO_STATIC_ASSERT
+#define BOOST_NO_TEMPLATE_ALIASES
#define BOOST_NO_UNICODE_LITERALS
#define BOOST_NO_VARIADIC_TEMPLATES
-#define BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
//
// versions check:
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL \r
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP\r
#define BOOST_NO_SWPRINTF\r
-#define BOOST_NO_INITIALIZER_LISTS\r
\r
#else\r
\r
//\r
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG\r
//\r
+#define BOOST_NO_AUTO_DECLARATIONS\r
+#define BOOST_NO_AUTO_MULTIDECLARATIONS\r
#define BOOST_NO_CHAR16_T\r
#define BOOST_NO_CHAR32_T\r
+#define BOOST_NO_CONCEPTS\r
#define BOOST_NO_CONSTEXPR\r
#define BOOST_NO_DECLTYPE\r
#define BOOST_NO_DEFAULTED_FUNCTIONS\r
#define BOOST_NO_DELETED_FUNCTIONS\r
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS\r
#define BOOST_NO_EXTERN_TEMPLATE\r
+#define BOOST_NO_INITIALIZER_LISTS\r
+#define BOOST_NO_LAMBDAS\r
+#define BOOST_NO_NULLPTR\r
#define BOOST_NO_RAW_LITERALS\r
#define BOOST_NO_RVALUE_REFERENCES\r
#define BOOST_NO_SCOPED_ENUMS\r
#define BOOST_NO_STATIC_ASSERT\r
+#define BOOST_NO_TEMPLATE_ALIASES\r
#define BOOST_NO_UNICODE_LITERALS\r
#define BOOST_NO_VARIADIC_TEMPLATES\r
-#define BOOST_NO_AUTO_DECLARATIONS\r
-#define BOOST_NO_AUTO_MULTIDECLARATIONS\r
\r
//\r
// version check:\r
#undef BOOST_NO_SWPRINTF
#undef BOOST_DEDUCED_TYPENAME
-#define BOOST_NO_INITIALIZER_LISTS
-//
-// C++0x features
-//
-// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
-//
-#define BOOST_NO_CHAR16_T
-#define BOOST_NO_CHAR32_T
-#define BOOST_NO_CONSTEXPR
-#define BOOST_NO_DECLTYPE
-#define BOOST_NO_DEFAULTED_FUNCTIONS
-#define BOOST_NO_DELETED_FUNCTIONS
-#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
-#define BOOST_NO_EXTERN_TEMPLATE
-#define BOOST_NO_RAW_LITERALS
-#define BOOST_NO_RVALUE_REFERENCES
-#define BOOST_NO_SCOPED_ENUMS
-#define BOOST_NO_STATIC_ASSERT
-#define BOOST_NO_UNICODE_LITERALS
-#define BOOST_NO_VARIADIC_TEMPLATES
-#define BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
-
//
// version check:
// probably nothing to do here?
//
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
#define BOOST_NO_ADL_BARRIER
-#define BOOST_NO_INITIALIZER_LISTS
//
// C++0x features
# define BOOST_NO_LONG_LONG
#endif
+#define BOOST_NO_AUTO_DECLARATIONS
+#define BOOST_NO_AUTO_MULTIDECLARATIONS
#define BOOST_NO_CHAR16_T
#define BOOST_NO_CHAR32_T
+#define BOOST_NO_CONCEPTS
#define BOOST_NO_CONSTEXPR
#define BOOST_NO_DECLTYPE
#define BOOST_NO_DEFAULTED_FUNCTIONS
#define BOOST_NO_DELETED_FUNCTIONS
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_NO_EXTERN_TEMPLATE
+#define BOOST_NO_INITIALIZER_LISTS
+#define BOOST_NO_LAMBDAS
+#define BOOST_NO_NULLPTR
#define BOOST_NO_RAW_LITERALS
#define BOOST_NO_RVALUE_REFERENCES
#define BOOST_NO_SCOPED_ENUMS
#define BOOST_NO_STATIC_ASSERT
+#define BOOST_NO_TEMPLATE_ALIASES
#define BOOST_NO_UNICODE_LITERALS
#define BOOST_NO_VARIADIC_TEMPLATES
-#define BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
//
// Version
#endif
//
// last known and checked version is 600:
-#if (__IBMCPP__ > 600)
+#if (__IBMCPP__ > 1010)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# endif
//
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
//
+#define BOOST_NO_AUTO_DECLARATIONS
+#define BOOST_NO_AUTO_MULTIDECLARATIONS
#define BOOST_NO_CHAR16_T
#define BOOST_NO_CHAR32_T
+#define BOOST_NO_CONCEPTS
#define BOOST_NO_CONSTEXPR
#define BOOST_NO_DECLTYPE
#define BOOST_NO_DEFAULTED_FUNCTIONS
#define BOOST_NO_DELETED_FUNCTIONS
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_NO_EXTERN_TEMPLATE
+#define BOOST_NO_LAMBDAS
+#define BOOST_NO_NULLPTR
#define BOOST_NO_RAW_LITERALS
#define BOOST_NO_RVALUE_REFERENCES
#define BOOST_NO_SCOPED_ENUMS
#define BOOST_NO_STATIC_ASSERT
+#define BOOST_NO_TEMPLATE_ALIASES
#define BOOST_NO_UNICODE_LITERALS
#define BOOST_NO_VARIADIC_TEMPLATES
-#define BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
// disable Win32 API's if compiler extentions are
// turned off:
//
-#ifndef _MSC_EXTENSIONS
+#if !defined(_MSC_EXTENSIONS) && !defined(BOOST_DISABLE_WIN32)
# define BOOST_DISABLE_WIN32
#endif
-#ifndef _CPPRTTI
+#if !defined(_CPPRTTI) && !defined(BOOST_NO_RTTI)
# define BOOST_NO_RTTI
#endif
// all versions support __declspec:
//
#define BOOST_HAS_DECLSPEC
+
//
// C++0x features
//
// See above for BOOST_NO_LONG_LONG
+
+// C++ features supported by VC++ 10 (aka 2010)
+//
+#if _MSC_VER < 1600
+#define BOOST_NO_AUTO_DECLARATIONS
+#define BOOST_NO_AUTO_MULTIDECLARATIONS
+#define BOOST_NO_DECLTYPE
+#define BOOST_NO_LAMBDAS
+#define BOOST_NO_RVALUE_REFERENCES
+#define BOOST_NO_STATIC_ASSERT
+#endif // _MSC_VER < 1600
+
+// C++0x features not supported by any versions
#define BOOST_NO_CHAR16_T
#define BOOST_NO_CHAR32_T
+#define BOOST_NO_CONCEPTS
#define BOOST_NO_CONSTEXPR
-#define BOOST_NO_DECLTYPE
#define BOOST_NO_DEFAULTED_FUNCTIONS
#define BOOST_NO_DELETED_FUNCTIONS
#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_NO_EXTERN_TEMPLATE
+#define BOOST_NO_INITIALIZER_LISTS
+#define BOOST_NO_NULLPTR
#define BOOST_NO_RAW_LITERALS
#define BOOST_NO_SCOPED_ENUMS
+#define BOOST_NO_TEMPLATE_ALIASES
#define BOOST_NO_UNICODE_LITERALS
#define BOOST_NO_VARIADIC_TEMPLATES
-// MSVC 2010 CTP has some support for C++0x, but we still disable it until the compiler release
-// #if _MSC_VER < 1600
-#define BOOST_NO_RVALUE_REFERENCES
-#define BOOST_NO_STATIC_ASSERT
-#define BOOST_NO_AUTO_DECLARATIONS
-#define BOOST_NO_AUTO_MULTIDECLARATIONS
-// #endif // _MSC_VER < 1600
-
//
// prefix and suffix headers:
//
#error "Compiler not supported or configured - please reconfigure"
#endif
//
-// last known and checked version is 1500 (VC9):
+// last known and checked version is 1600 (VC10, aka 2010):
#if (_MSC_VER > 1600)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
--- /dev/null
+// (C) Copyright Dustin Spicuzza 2009. \r
+// Use, modification and distribution are subject to the \r
+// Boost Software License, Version 1.0. (See accompanying file \r
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+// See http://www.boost.org for most recent version.\r
+\r
+// vxWorks specific config options:\r
+\r
+#define BOOST_PLATFORM "vxWorks"\r
+\r
+#define BOOST_NO_CWCHAR\r
+#define BOOST_NO_INTRINSIC_WCHAR_T\r
+\r
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)\r
+#define BOOST_NO_INT64_T\r
+#endif\r
+\r
+#define BOOST_HAS_UNISTD_H\r
+\r
+// these allow posix_features to work, since vxWorks doesn't\r
+// define them itself\r
+#define _POSIX_TIMERS 1\r
+#define _POSIX_THREADS 1\r
+\r
+// vxworks doesn't work with asio serial ports\r
+#define BOOST_ASIO_DISABLE_SERIAL_PORT\r
+\r
+// boilerplate code:\r
+#include <boost/config/posix_features.hpp>\r
+ \r
// QNX:
# define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp"
+#elif defined(__VXWORKS__)
+// vxWorks:
+# define BOOST_PLATFORM_CONFIG "boost/config/platform/vxworks.hpp"
+
#else
# if defined(unix) \
// locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed:
-// we need to include a std lib header here in order to detect which
-// library is in use, use <utility> as it's about the smallest
-// of the std lib headers - do not rely on this header being included -
-// users can short-circuit this header if they know whose std lib
-// they are using.
-
-#include <boost/config/no_tr1/utility.hpp>
+// First include <cstddef> to determine if some version of STLport is in use as the std lib
+// (do not rely on this header being included since users can short-circuit this header
+// if they know whose std lib they are using.)
+#include <cstddef>
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
// STLPort library; this _must_ come first, otherwise since
// can end up detecting that first rather than STLport:
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp"
-#elif defined(__LIBCOMO__)
+#else
+
+// If our std lib was not some version of STLport, then include <utility> as it is about
+// the smallest of the std lib headers that includes real C++ stuff. (Some std libs do not
+// include their C++-related macros in <cstddef> so this additional include makes sure
+// we get those definitions)
+// (again do not rely on this header being included since users can short-circuit this
+// header if they know whose std lib they are using.)
+#include <boost/config/no_tr1/utility.hpp>
+
+#if defined(__LIBCOMO__)
// Comeau STL:
#define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp"
#endif
+#endif
+
# define BOOST_NO_STD_ITERATOR_TRAITS
#endif
-//
-// No std::unordered_* containers yet:
-//
-#define BOOST_NO_STD_UNORDERED
-
#if defined(__ICL) && (__ICL < 800) && defined(_CPPLIB_VER) && (_CPPLIB_VER <= 310)
// Intel C++ chokes over any non-trivial use of <locale>
// this may be an overly restrictive define, but regex fails without it:
# define BOOST_NO_STD_LOCALE
#endif
+// C++0x headers implemented in 520 (as shipped by Microsoft)
+//
+#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520
+# define BOOST_NO_0X_HDR_ARRAY
+# define BOOST_NO_0X_HDR_CODECVT
+# define BOOST_NO_0X_HDR_FORWARD_LIST
+# define BOOST_NO_0X_HDR_INITIALIZER_LIST
+# define BOOST_NO_0X_HDR_RANDOM
+# define BOOST_NO_0X_HDR_REGEX
+# define BOOST_NO_0X_HDR_SYSTEM_ERROR
+# define BOOST_NO_0X_HDR_TYPE_TRAITS
+# define BOOST_NO_STD_UNORDERED // deprecated; see following
+# define BOOST_NO_0X_HDR_UNORDERED_MAP
+# define BOOST_NO_0X_HDR_UNORDERED_SET
+#endif
+
+// C++0x headers not yet implemented
+//
+# define BOOST_NO_0X_HDR_CHRONO
+# define BOOST_NO_0X_HDR_CONCEPTS
+# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
+# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
+# define BOOST_NO_0X_HDR_FUTURE
+# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
+# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
+# define BOOST_NO_0X_HDR_MUTEX
+# define BOOST_NO_0X_HDR_RATIO
+# define BOOST_NO_0X_HDR_THREAD
+# define BOOST_NO_0X_HDR_TUPLE
+
#ifdef _CPPLIB_VER
# define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER
#else
# define BOOST_HAS_HASH
# define BOOST_HAS_SLIST
#endif
+
+// C++0x headers not yet implemented
//
-// We never have the new C++0x unordered containers:
-//
-#define BOOST_NO_STD_UNORDERED
+# define BOOST_NO_0X_HDR_ARRAY
+# define BOOST_NO_0X_HDR_CHRONO
+# define BOOST_NO_0X_HDR_CODECVT
+# define BOOST_NO_0X_HDR_CONCEPTS
+# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
+# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
+# define BOOST_NO_0X_HDR_FORWARD_LIST
+# define BOOST_NO_0X_HDR_FUTURE
+# define BOOST_NO_0X_HDR_INITIALIZER_LIST
+# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
+# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
+# define BOOST_NO_0X_HDR_MUTEX
+# define BOOST_NO_0X_HDR_RANDOM
+# define BOOST_NO_0X_HDR_RATIO
+# define BOOST_NO_0X_HDR_REGEX
+# define BOOST_NO_0X_HDR_SYSTEM_ERROR
+# define BOOST_NO_0X_HDR_THREAD
+# define BOOST_NO_0X_HDR_TUPLE
+# define BOOST_NO_0X_HDR_TYPE_TRAITS
+# define BOOST_NO_STD_UNORDERED // deprecated; see following
+# define BOOST_NO_0X_HDR_UNORDERED_MAP
+# define BOOST_NO_0X_HDR_UNORDERED_SET
//
// Intrinsic type_traits support.
# endif
#endif
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
-# define BOOST_NO_STD_UNORDERED
+// stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly
+// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++
+// developers. He also commented:
+//
+// "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in
+// GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305.
+// Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support
+// than any release in the 4.2 series."
+//
+// Another resource for understanding stdlibc++ features is:
+// http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x
+
+// C++0x headers in GCC 4.3.0 and later
+//
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_NO_0X_HDR_ARRAY
+# define BOOST_NO_0X_HDR_RANDOM
+# define BOOST_NO_0X_HDR_REGEX
+# define BOOST_NO_0X_HDR_TUPLE
+# define BOOST_NO_0X_HDR_TYPE_TRAITS
+# define BOOST_NO_STD_UNORDERED // deprecated; see following
+# define BOOST_NO_0X_HDR_UNORDERED_MAP
+# define BOOST_NO_0X_HDR_UNORDERED_SET
+#endif
+
+// C++0x headers in GCC 4.4.0 and later
+//
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_NO_0X_HDR_CHRONO
+# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
+# define BOOST_NO_0X_HDR_FORWARD_LIST
+# define BOOST_NO_0X_HDR_INITIALIZER_LIST
+# define BOOST_NO_0X_HDR_MUTEX
+# define BOOST_NO_0X_HDR_RATIO
+# define BOOST_NO_0X_HDR_SYSTEM_ERROR
+# define BOOST_NO_0X_HDR_THREAD
#endif
+// C++0x headers not yet implemented
+//
+# define BOOST_NO_0X_HDR_CODECVT
+# define BOOST_NO_0X_HDR_CONCEPTS
+# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
+# define BOOST_NO_0X_HDR_FUTURE
+# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
+# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
+
+// --- end ---
#ifndef MSIPL_WCHART
#define BOOST_NO_STD_WSTRING
#endif
+
+// C++0x headers not yet implemented
//
-// We never have the new C++0x unordered containers:
-//
-#define BOOST_NO_STD_UNORDERED
+# define BOOST_NO_0X_HDR_ARRAY
+# define BOOST_NO_0X_HDR_CHRONO
+# define BOOST_NO_0X_HDR_CODECVT
+# define BOOST_NO_0X_HDR_CONCEPTS
+# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
+# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
+# define BOOST_NO_0X_HDR_FORWARD_LIST
+# define BOOST_NO_0X_HDR_FUTURE
+# define BOOST_NO_0X_HDR_INITIALIZER_LIST
+# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
+# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
+# define BOOST_NO_0X_HDR_MUTEX
+# define BOOST_NO_0X_HDR_RANDOM
+# define BOOST_NO_0X_HDR_RATIO
+# define BOOST_NO_0X_HDR_REGEX
+# define BOOST_NO_0X_HDR_SYSTEM_ERROR
+# define BOOST_NO_0X_HDR_THREAD
+# define BOOST_NO_0X_HDR_TUPLE
+# define BOOST_NO_0X_HDR_TYPE_TRAITS
+# define BOOST_NO_STD_UNORDERED // deprecated; see following
+# define BOOST_NO_0X_HDR_UNORDERED_MAP
+# define BOOST_NO_0X_HDR_UNORDERED_SET
#define BOOST_STDLIB "Modena C++ standard library"
# define BOOST_NO_STD_USE_FACET
# define BOOST_HAS_TWO_ARG_USE_FACET
#endif
-//
-// We never have the new C++0x unordered containers:
-//
-#define BOOST_NO_STD_UNORDERED
+// C++0x headers not yet implemented
+//
+# define BOOST_NO_0X_HDR_ARRAY
+# define BOOST_NO_0X_HDR_CHRONO
+# define BOOST_NO_0X_HDR_CODECVT
+# define BOOST_NO_0X_HDR_CONCEPTS
+# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
+# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
+# define BOOST_NO_0X_HDR_FORWARD_LIST
+# define BOOST_NO_0X_HDR_FUTURE
+# define BOOST_NO_0X_HDR_INITIALIZER_LIST
+# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
+# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
+# define BOOST_NO_0X_HDR_MUTEX
+# define BOOST_NO_0X_HDR_RANDOM
+# define BOOST_NO_0X_HDR_RATIO
+# define BOOST_NO_0X_HDR_REGEX
+# define BOOST_NO_0X_HDR_SYSTEM_ERROR
+# define BOOST_NO_0X_HDR_THREAD
+# define BOOST_NO_0X_HDR_TUPLE
+# define BOOST_NO_0X_HDR_TYPE_TRAITS
+# define BOOST_NO_STD_UNORDERED // deprecated; see following
+# define BOOST_NO_0X_HDR_UNORDERED_MAP
+# define BOOST_NO_0X_HDR_UNORDERED_SET
#define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__)
# endif
#endif
-//
-// We never have the new C++0x unordered containers:
-//
-#define BOOST_NO_STD_UNORDERED
+// C++0x headers not yet implemented
+//
+# define BOOST_NO_0X_HDR_ARRAY
+# define BOOST_NO_0X_HDR_CHRONO
+# define BOOST_NO_0X_HDR_CODECVT
+# define BOOST_NO_0X_HDR_CONCEPTS
+# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
+# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
+# define BOOST_NO_0X_HDR_FORWARD_LIST
+# define BOOST_NO_0X_HDR_FUTURE
+# define BOOST_NO_0X_HDR_INITIALIZER_LIST
+# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
+# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
+# define BOOST_NO_0X_HDR_MUTEX
+# define BOOST_NO_0X_HDR_RANDOM
+# define BOOST_NO_0X_HDR_RATIO
+# define BOOST_NO_0X_HDR_REGEX
+# define BOOST_NO_0X_HDR_SYSTEM_ERROR
+# define BOOST_NO_0X_HDR_THREAD
+# define BOOST_NO_0X_HDR_TUPLE
+# define BOOST_NO_0X_HDR_TYPE_TRAITS
+# define BOOST_NO_STD_UNORDERED // deprecated; see following
+# define BOOST_NO_0X_HDR_UNORDERED_MAP
+# define BOOST_NO_0X_HDR_UNORDERED_SET
//
#define BOOST_HAS_HASH
#define BOOST_HAS_SLIST
-#define BOOST_NO_STD_UNORDERED
//
// If this is GNU libstdc++2, then no <limits> and no std::wstring:
//
#define BOOST_HAS_SGI_TYPE_TRAITS
+// C++0x headers not yet implemented
+//
+# define BOOST_NO_0X_HDR_ARRAY
+# define BOOST_NO_0X_HDR_CHRONO
+# define BOOST_NO_0X_HDR_CODECVT
+# define BOOST_NO_0X_HDR_CONCEPTS
+# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
+# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
+# define BOOST_NO_0X_HDR_FORWARD_LIST
+# define BOOST_NO_0X_HDR_FUTURE
+# define BOOST_NO_0X_HDR_INITIALIZER_LIST
+# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
+# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
+# define BOOST_NO_0X_HDR_MUTEX
+# define BOOST_NO_0X_HDR_RANDOM
+# define BOOST_NO_0X_HDR_RATIO
+# define BOOST_NO_0X_HDR_REGEX
+# define BOOST_NO_0X_HDR_SYSTEM_ERROR
+# define BOOST_NO_0X_HDR_THREAD
+# define BOOST_NO_0X_HDR_TUPLE
+# define BOOST_NO_0X_HDR_TYPE_TRAITS
+# define BOOST_NO_STD_UNORDERED // deprecated; see following
+# define BOOST_NO_0X_HDR_UNORDERED_MAP
+# define BOOST_NO_0X_HDR_UNORDERED_SET
+
#define BOOST_STDLIB "SGI standard library"
# endif
#endif
-#if defined(_STLPORT_VERSION) && (_STLPORT_VERSION < 0x500)
+#if defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x500) || (_STLPORT_VERSION >= 0x520))
# define BOOST_NO_STD_UNORDERED
#endif
+
+#if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520)
+# define BOOST_HAS_TR1_UNORDERED_SET
+# define BOOST_HAS_TR1_UNORDERED_MAP
+#endif
//
// Without member template support enabled, their are no template
// iterate constructors, and no std::allocator:
namespace boost { using std::min; using std::max; }
#endif
+// C++0x headers not yet implemented
+//
+# define BOOST_NO_0X_HDR_ARRAY
+# define BOOST_NO_0X_HDR_CHRONO
+# define BOOST_NO_0X_HDR_CODECVT
+# define BOOST_NO_0X_HDR_CONCEPTS
+# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
+# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
+# define BOOST_NO_0X_HDR_FORWARD_LIST
+# define BOOST_NO_0X_HDR_FUTURE
+# define BOOST_NO_0X_HDR_INITIALIZER_LIST
+# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
+# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
+# define BOOST_NO_0X_HDR_MUTEX
+# define BOOST_NO_0X_HDR_RANDOM
+# define BOOST_NO_0X_HDR_RATIO
+# define BOOST_NO_0X_HDR_REGEX
+# define BOOST_NO_0X_HDR_SYSTEM_ERROR
+# define BOOST_NO_0X_HDR_THREAD
+# define BOOST_NO_0X_HDR_TUPLE
+# define BOOST_NO_0X_HDR_TYPE_TRAITS
+# define BOOST_NO_STD_UNORDERED // deprecated; see following
+# define BOOST_NO_0X_HDR_UNORDERED_MAP
+# define BOOST_NO_0X_HDR_UNORDERED_SET
+
#define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT)
#define BOOST_HAS_MACRO_USE_FACET
#define BOOST_NO_STD_MESSAGES
-#define BOOST_NO_STD_UNORDERED
+
+// C++0x headers not yet implemented
+//
+# define BOOST_NO_0X_HDR_ARRAY
+# define BOOST_NO_0X_HDR_CHRONO
+# define BOOST_NO_0X_HDR_CODECVT
+# define BOOST_NO_0X_HDR_CONCEPTS
+# define BOOST_NO_0X_HDR_CONDITION_VARIABLE
+# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS
+# define BOOST_NO_0X_HDR_FORWARD_LIST
+# define BOOST_NO_0X_HDR_FUTURE
+# define BOOST_NO_0X_HDR_INITIALIZER_LIST
+# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS
+# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS
+# define BOOST_NO_0X_HDR_MUTEX
+# define BOOST_NO_0X_HDR_RANDOM
+# define BOOST_NO_0X_HDR_RATIO
+# define BOOST_NO_0X_HDR_REGEX
+# define BOOST_NO_0X_HDR_SYSTEM_ERROR
+# define BOOST_NO_0X_HDR_THREAD
+# define BOOST_NO_0X_HDR_TUPLE
+# define BOOST_NO_0X_HDR_TYPE_TRAITS
+# define BOOST_NO_STD_UNORDERED // deprecated; see following
+# define BOOST_NO_0X_HDR_UNORDERED_MAP
+# define BOOST_NO_0X_HDR_UNORDERED_SET
#define BOOST_STDLIB "Visual Age default standard library"
# define BOOST_HASH_MAP_HEADER <hash_map>
#endif
+//
+// Set BOOST_NO_INITIALIZER_LISTS if there is no library support.
+//
+
+#if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS)
+# define BOOST_NO_INITIALIZER_LISTS
+#endif
+
// BOOST_HAS_ABI_HEADERS
// This macro gets set if we have headers that fix the ABI,
// and prevent ODR violations when linking to external libraries:
// for some reason Borland's command line compiler (version 0x560)
// chokes over this unless we do the calculation for it:
typedef value_type table_type[ 0x100 ];
+#elif defined(__GNUC__)
+ // old versions of GCC (before 4.0.2) choke on using byte_combos
+ // as a constant expression when compiling with -pedantic.
+ typedef value_type table_type[1ul << CHAR_BIT];
#else
typedef value_type table_type[ byte_combos ];
#endif
-/* Copyright 2003-2008 Joaquin M Lopez Munoz.
+/* Copyright 2003-2009 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
new (p) Type(t);
}
+#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
+/* MSVC++ issues spurious warnings about unreferencend formal parameters
+ * in destroy<Type> when Type is a class with trivial dtor.
+ */
+
+#pragma warning(push)
+#pragma warning(disable:4100)
+#endif
+
template<typename Type>
void destroy(const Type* p)
{
+
+#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590))
+ const_cast<Type*>(p)->~Type();
+#else
p->~Type();
+#endif
+
}
+#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
+#pragma warning(pop)
+#endif
+
} /* namespace boost::detail::allocator */
} /* namespace boost::detail */
#include <boost/config.hpp>\r
#include <boost/detail/workaround.hpp>\r
\r
-#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\r
-#define BOOST_HASH_CHAR_TRAITS string_char_traits\r
-#else\r
-#define BOOST_HASH_CHAR_TRAITS char_traits\r
-#endif\r
-\r
#if ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) && defined(_GLIBCXX_DEBUG)) \\r
|| BOOST_WORKAROUND(__BORLANDC__, > 0x551) \\r
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \\r
{\r
template <class T> class allocator;\r
template <class charT, class traits, class Allocator> class basic_string;\r
- template <class charT> struct BOOST_HASH_CHAR_TRAITS;\r
+\r
+#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\r
+ template <class charT> struct string_char_traits;\r
+#else\r
+ template <class charT> struct char_traits;\r
+#endif\r
+\r
template <class T> class complex;\r
}\r
\r
tag operator,(tag,int);
# define BOOST_comma(a,b) (a,b)
# endif
-
+
+# if defined(BOOST_MSVC)
+# pragma warning(push)
+# pragma warning(disable:4913) // Warning about operator,
+# endif
+
// two check overloads help us identify which operator++ was picked
char (& check(tag) )[2];
, value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
);
};
+
+# if defined(BOOST_MSVC)
+# pragma warning(pop)
+# endif
+
}
# undef BOOST_comma
--- /dev/null
+// scoped_enum_emulation.hpp ---------------------------------------------------------//\r
+\r
+// Copyright Beman Dawes, 2009\r
+\r
+// Distributed under the Boost Software License, Version 1.0.\r
+// See http://www.boost.org/LICENSE_1_0.txt\r
+\r
+// Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x\r
+// scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS\r
+// macro is used to detect feature support.\r
+//\r
+// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a\r
+// description of the scoped enum feature. Note that the committee changed the name\r
+// from strongly typed enum to scoped enum. \r
+//\r
+// Caution: only the syntax is emulated; the semantics are not emulated and\r
+// the syntax emulation doesn't include being able to specify the underlying\r
+// representation type.\r
+//\r
+// The emulation is via struct rather than namespace to allow use within classes.\r
+// Thanks to Andrey Semashev for pointing that out.\r
+//\r
+// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,\r
+// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente\r
+// Botet, and Daniel James. \r
+//\r
+// Sample usage:\r
+//\r
+// BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END\r
+// ...\r
+// BOOST_SCOPED_ENUM(algae) sample( algae::red );\r
+// void foo( BOOST_SCOPED_ENUM(algae) color );\r
+// ...\r
+// sample = algae::green;\r
+// foo( algae::cyan );\r
+\r
+#ifndef BOOST_SCOPED_ENUM_EMULATION_HPP\r
+#define BOOST_SCOPED_ENUM_EMULATION_HPP\r
+\r
+#include <boost/config.hpp>\r
+\r
+#ifdef BOOST_NO_SCOPED_ENUMS\r
+\r
+# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_t\r
+# define BOOST_SCOPED_ENUM_END };\r
+# define BOOST_SCOPED_ENUM(name) name::enum_t\r
+\r
+#else\r
+\r
+# define BOOST_SCOPED_ENUM_START(name) enum class name\r
+# define BOOST_SCOPED_ENUM_END\r
+# define BOOST_SCOPED_ENUM(name) name\r
+\r
+#endif\r
+\r
+#endif // BOOST_SCOPED_ENUM_EMULATION_HPP\r
// specialized on those types for this to work.
#include <locale>
-// for mbstate_t
-#include <wchar.h>
-// for std::size_t
-#include <cstddef>
+#include <cwchar> // for mbstate_t
+#include <cstddef> // for std::size_t
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
+#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std {
- #if defined(__LIBCOMO__)
- using ::mbstate_t;
- #elif defined(BOOST_DINKUMWARE_STDLIB) && !defined(__BORLANDC__)
- using ::mbstate_t;
- #elif defined(__SGI_STL_PORT)
- #elif defined(BOOST_NO_STDC_NAMESPACE)
- using ::mbstate_t;
- using ::codecvt;
- #endif
-} // namespace std
+ using ::mbstate_t;
+ using ::size_t;
+}
+#endif
#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
#define BOOST_CODECVT_DO_LENGTH_CONST const
--- /dev/null
+//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593\r
+#define UUID_316FDA946C0D11DEA9CBAE5255D89593\r
+\r
+#include <boost/exception/diagnostic_information.hpp>\r
+#include <boost/exception/error_info.hpp>\r
+#include <boost/exception/exception.hpp>\r
+#include <boost/exception/get_error_info.hpp>\r
+#include <boost/exception/info.hpp>\r
+#include <boost/exception/info_tuple.hpp>\r
+#include <boost/exception/errinfo_api_function.hpp>\r
+#include <boost/exception/errinfo_at_line.hpp>\r
+#include <boost/exception/errinfo_errno.hpp>\r
+#include <boost/exception/errinfo_file_handle.hpp>\r
+#include <boost/exception/errinfo_file_name.hpp>\r
+#include <boost/exception/errinfo_file_open_mode.hpp>\r
+#include <boost/exception/errinfo_type_info_name.hpp>\r
+#ifndef BOOST_NO_EXCEPTIONS\r
+#include <boost/exception_ptr.hpp>\r
+#endif\r
+\r
+#endif\r
--- /dev/null
+//Copyright (c) 2009 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_61531AB0680611DEADD5846855D89593\r
+#define UUID_61531AB0680611DEADD5846855D89593\r
+\r
+#include <boost/config.hpp>\r
+\r
+#if defined(BOOST_MSVC)\r
+#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn)\r
+#elif defined(__GNUC__)\r
+#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn))\r
+#else\r
+#define BOOST_ATTRIBUTE_NORETURN\r
+#endif\r
+\r
+#endif\r
--- /dev/null
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_DC4208C6417811DEBF11E1EC55D89593\r
+#define UUID_DC4208C6417811DEBF11E1EC55D89593\r
+\r
+namespace\r
+boost\r
+ {\r
+ namespace\r
+ exception_detail\r
+ {\r
+ class\r
+ exception_ptr_base\r
+ {\r
+ public:\r
+\r
+ virtual void _rethrow() const=0;\r
+ virtual bool _empty() const=0;\r
+ };\r
+ }\r
+ }\r
+\r
+#endif\r
#include <boost/config.hpp>
#include <boost/exception/get_error_info.hpp>
+#include <boost/exception/detail/exception_ptr_base.hpp>
#include <boost/utility/enable_if.hpp>
#include <exception>
#include <sstream>
enum e { value = !enable_boost_exception_overload<T>::value && sizeof(check((T*)0))==sizeof(yes) };
};
-#ifndef BOOST_NO_RTTI
- template <class T>
- inline
- std::string
- dynamic_exception_type( T const & x )
- {
- return std::string("Dynamic exception type: ") + BOOST_EXCEPTION_DYNAMIC_TYPEID(x).name();
- }
-#endif
-
inline
char const *
get_diagnostic_information( exception const & x )
inline
std::string
- boost_diagnostic_information( exception const & x )
+ diagnostic_information_impl( boost::exception const * be, std::exception const * se )
{
- std::ostringstream tmp;
- if( char const * const * f=get_error_info<throw_file>(x) )
- {
- tmp << *f;
- if( int const * l=get_error_info<throw_line>(x) )
- tmp << '(' << *l << "): ";
- }
- tmp << "Throw in function ";
- if( char const * const * fn=get_error_info<throw_function>(x) )
- tmp << *fn;
- else
- tmp << "(unknown)";
- tmp << std::endl;
+ BOOST_ASSERT(be||se);
#ifndef BOOST_NO_RTTI
- tmp << dynamic_exception_type(x) << std::endl;
- if( std::exception const * e=dynamic_cast<std::exception const *>(&x) )
- tmp << "std::exception::what: " << e->what() << std::endl;
+ if( !se )
+ se = dynamic_cast<std::exception const *>(be);
+ if( !be )
+ be = dynamic_cast<boost::exception const *>(se);
#endif
- if( char const * s=exception_detail::get_diagnostic_information(x) )
- if( *s )
- tmp << s;
- return tmp.str();
- }
-
- inline
- std::string
- std_diagnostic_information( std::exception const & x )
- {
std::ostringstream tmp;
+ if( be )
+ {
+ if( char const * const * f=get_error_info<throw_file>(*be) )
+ {
+ tmp << *f;
+ if( int const * l=get_error_info<throw_line>(*be) )
+ tmp << '(' << *l << "): ";
+ }
+ tmp << "Throw in function ";
+ if( char const * const * fn=get_error_info<throw_function>(*be) )
+ tmp << *fn;
+ else
+ tmp << "(unknown)";
+ tmp << '\n';
+ }
#ifndef BOOST_NO_RTTI
- if( exception const * e=dynamic_cast<exception const *>(&x) )
- return boost_diagnostic_information(*e);
- tmp << dynamic_exception_type(x) << std::endl;
+ tmp << std::string("Dynamic exception type: ") <<
+ (be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
#endif
- tmp << "std::exception::what: " << x.what() << std::endl;
+ if( se )
+ tmp << "std::exception::what: " << se->what() << '\n';
+ if( be )
+ if( char const * s=exception_detail::get_diagnostic_information(*be) )
+ if( *s )
+ tmp << s;
return tmp.str();
}
}
typename enable_if<exception_detail::enable_boost_exception_overload<T>,std::string>::type
diagnostic_information( T const & e )
{
- return exception_detail::boost_diagnostic_information(e);
+ return exception_detail::diagnostic_information_impl(&e,0);
}
template <class T>
typename enable_if<exception_detail::enable_std_exception_overload<T>,std::string>::type
diagnostic_information( T const & e )
{
- return exception_detail::std_diagnostic_information(e);
+ return exception_detail::diagnostic_information_impl(0,&e);
}
}
std::string
current_exception_diagnostic_information()
{
- if( boost::exception const * e=current_exception_cast<boost::exception const>() )
- return diagnostic_information(*e);
- else if( std::exception const * e=current_exception_cast<std::exception const>() )
- return diagnostic_information(*e);
+ boost::exception const * be=current_exception_cast<boost::exception const>();
+ std::exception const * se=current_exception_cast<std::exception const>();
+ if( be || se )
+ return exception_detail::diagnostic_information_impl(be,se);
else
return "No diagnostic information available.";
}
- }
+
+ inline
+ std::string
+ diagnostic_information( exception_detail::exception_ptr_base const & p )
+ {
+ if( !p._empty() )
+ try
+ {
+ p._rethrow();
+ }
+ catch(
+ ... )
+ {
+ return current_exception_diagnostic_information();
+ }
+ return "<empty>";
+ }
+ }
#endif
#endif
--- /dev/null
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_DDFBB4546C1211DEA4659E9055D89593\r
+#define UUID_DDFBB4546C1211DEA4659E9055D89593\r
+\r
+#include "boost/exception/error_info.hpp"\r
+\r
+namespace\r
+boost\r
+ {\r
+ //Usage hint:\r
+ //if( api_function(....)!=0 )\r
+ // BOOST_THROW_EXCEPTION(\r
+ // failure() <<\r
+ // errinfo_api_function("api_function") );\r
+ typedef error_info<struct errinfo_api_function_,char const *> errinfo_api_function;\r
+ }\r
+\r
+#endif\r
--- /dev/null
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_E7255CE26C1211DE85800C9155D89593\r
+#define UUID_E7255CE26C1211DE85800C9155D89593\r
+\r
+namespace\r
+boost\r
+ {\r
+ template <class Tag,class T> class error_info;\r
+\r
+ //Use with parsing errors exceptions, for example in a XML file parser.\r
+ typedef error_info<struct errinfo_at_line_,int> errinfo_at_line;\r
+ }\r
+\r
+#endif\r
--- /dev/null
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_F0EE17BE6C1211DE87FF459155D89593\r
+#define UUID_F0EE17BE6C1211DE87FF459155D89593\r
+\r
+#include "boost/exception/info.hpp"\r
+#include <errno.h>\r
+#include <string.h>\r
+\r
+namespace\r
+boost\r
+ {\r
+ typedef error_info<struct errinfo_errno_,int> errinfo_errno;\r
+\r
+ //Usage hint:\r
+ //if( c_function(....)!=0 )\r
+ // BOOST_THROW_EXCEPTION(\r
+ // failure() <<\r
+ // errinfo_errno(errno) <<\r
+ // errinfo_api_function("c_function") );\r
+ inline\r
+ std::string\r
+ to_string( errinfo_errno const & e )\r
+ {\r
+ std::ostringstream tmp;\r
+ int v=e.value();\r
+ tmp << v << ", \"" << strerror(v) << "\"";\r
+ return tmp.str();\r
+ }\r
+ }\r
+\r
+#endif\r
--- /dev/null
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_F79E6EE26C1211DEB26E929155D89593\r
+#define UUID_F79E6EE26C1211DEB26E929155D89593\r
+\r
+#include <stdio.h>\r
+\r
+namespace\r
+boost\r
+ {\r
+ template <class> class weak_ptr;\r
+ template <class Tag,class T> class error_info;\r
+\r
+ typedef error_info<struct errinfo_file_handle_,weak_ptr<FILE> > errinfo_file_handle;\r
+ }\r
+\r
+#endif\r
--- /dev/null
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_FEE5120A6C1211DE94E8BC9155D89593\r
+#define UUID_FEE5120A6C1211DE94E8BC9155D89593\r
+\r
+#include <string>\r
+\r
+namespace\r
+boost\r
+ {\r
+ template <class Tag,class T> class error_info;\r
+\r
+ //Usage hint:\r
+ //FILE * f=fopen(name,mode);\r
+ //if( !f )\r
+ // BOOST_THROW_EXCEPTION(\r
+ // file_open_error() <<\r
+ // errinfo_file_name(name) <<\r
+ // errinfo_file_open_mode(mode) );\r
+ typedef error_info<struct errinfo_file_name_,std::string> errinfo_file_name;\r
+ }\r
+\r
+#endif\r
--- /dev/null
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_056F1F266C1311DE8E74299255D89593\r
+#define UUID_056F1F266C1311DE8E74299255D89593\r
+\r
+#include <string>\r
+\r
+namespace\r
+boost\r
+ {\r
+ template <class Tag,class T> class error_info;\r
+\r
+ //Usage hint:\r
+ //FILE * f=fopen(name,mode);\r
+ //if( !f )\r
+ // BOOST_THROW_EXCEPTION(\r
+ // file_open_error() <<\r
+ // errinfo_file_name(name) <<\r
+ // errinfo_file_open_mode(mode) );\r
+ typedef error_info<struct errinfo_file_open_mode_,std::string> errinfo_file_open_mode;\r
+ }\r
+\r
+#endif\r
--- /dev/null
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.\r
+\r
+//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef UUID_0E11109E6C1311DEB7EA649255D89593\r
+#define UUID_0E11109E6C1311DEB7EA649255D89593\r
+\r
+#include <string>\r
+\r
+namespace\r
+boost\r
+ {\r
+ template <class Tag,class T> class error_info;\r
+\r
+ //Usage hint:\r
+ //BOOST_THROW_EXCEPTION(\r
+ // bad_type() <<\r
+ // errinfo_type_info_name(typeid(x).name()) );\r
+ typedef error_info<struct errinfo_type_info_name_,std::string> errinfo_type_info_name;\r
+ }\r
+\r
+#endif\r
template <class Tag,class T>
class error_info;
- typedef error_info<struct tag_throw_function,char const *> throw_function;
- typedef error_info<struct tag_throw_file,char const *> throw_file;
- typedef error_info<struct tag_throw_line,int> throw_line;
+ typedef error_info<struct throw_function_,char const *> throw_function;
+ typedef error_info<struct throw_file_,char const *> throw_file;
+ typedef error_info<struct throw_line_,int> throw_line;
template <>
class
- error_info<tag_throw_function,char const *>
+ error_info<throw_function_,char const *>
{
public:
typedef char const * value_type;
template <>
class
- error_info<tag_throw_file,char const *>
+ error_info<throw_file_,char const *>
{
public:
typedef char const * value_type;
template <>
class
- error_info<tag_throw_line,int>
+ error_info<throw_line_,int>
{
public:
typedef int value_type;
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
{
shared_ptr<error_info_base const> const & x = i->second;
- tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << std::endl;
+ tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << '\n';
}
tmp.str().swap(diagnostic_info_str_);
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* s, const std::locale & loc)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
- loc_(loc), exceptions_(io::all_error_bits)
+ exceptions_(io::all_error_bits), loc_(loc)
{
if(s) parse( s );
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const string_type& s, const std::locale & loc)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
- loc_(loc), exceptions_(io::all_error_bits)
+ exceptions_(io::all_error_bits), loc_(loc)
{
parse(s);
}
#if ! defined( BOOST_NO_LOCALE_ISDIGIT )
return fac.is(std::ctype<Ch>::digit, c);
# else
- (void) fac; // remove "unused parameter" warning
+ (void) fac; // remove "unused parameter" warning
using namespace std;
return isdigit(c);
#endif
#include <typeinfo>
#include <boost/config.hpp>
#include <boost/assert.hpp>
+#include <boost/integer.hpp>
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_volatile.hpp>
#endif
// Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info.
-#ifdef BOOST_NO_EXCEPTION_STD_NAMESPACE
+#ifdef BOOST_NO_STD_TYPEINFO
// Embedded VC++ does not have type_info in namespace std
# define BOOST_FUNCTION_STD_NS
#else
A(a)
{
}
+
+ functor_wrapper(const functor_wrapper& f) :
+ F(static_cast<const F&>(f)),
+ A(static_cast<const A&>(f))
+ {
+ }
};
/**
if (!vtable) return typeid(void);
detail::function::function_buffer type;
- vtable->manager(functor, type, detail::function::get_functor_type_tag);
+ get_vtable()->manager(functor, type, detail::function::get_functor_type_tag);
return *type.type.type;
}
type_result.type.type = &typeid(Functor);
type_result.type.const_qualified = is_const<Functor>::value;
type_result.type.volatile_qualified = is_volatile<Functor>::value;
- vtable->manager(functor, type_result,
+ get_vtable()->manager(functor, type_result,
detail::function::check_functor_type_tag);
return static_cast<Functor*>(type_result.obj_ptr);
}
type_result.type.type = &typeid(Functor);
type_result.type.const_qualified = true;
type_result.type.volatile_qualified = is_volatile<Functor>::value;
- vtable->manager(functor, type_result,
+ get_vtable()->manager(functor, type_result,
detail::function::check_functor_type_tag);
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
// can't do the static_cast that we should do.
#endif
public: // should be protected, but GCC 2.95.3 will fail to allow access
+ detail::function::vtable_base* get_vtable() const {
+ return reinterpret_cast<detail::function::vtable_base*>(
+ reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01);
+ }
+
+ bool has_trivial_copy_and_destroy() const {
+ return reinterpret_cast<std::size_t>(vtable) & 0x01;
+ }
+
detail::function::vtable_base* vtable;
mutable detail::function::function_buffer functor;
};
#undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL
#undef BOOST_FUNCTION_COMPARE_TYPE_ID
+#if defined(BOOST_MSVC)
+# pragma warning( pop )
+#endif
+
#endif // BOOST_FUNCTION_BASE_HEADER
\r
#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \\r
|| defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \\r
- || !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540)\r
+ || !(defined(BOOST_STRICT_CONFIG) || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540)\r
# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX\r
#endif\r
\r
// Note: this header is a header template and must NOT have multiple-inclusion
// protection.
#include <boost/function/detail/prologue.hpp>
+#include <boost/detail/no_exceptions_support.hpp>
#if defined(BOOST_MSVC)
# pragma warning( push )
assign_to(const reference_wrapper<FunctionObj>& f,
function_buffer& functor, function_obj_ref_tag)
{
- if (!boost::detail::function::has_empty_target(f.get_pointer())) {
- functor.obj_ref.obj_ptr = (void *)f.get_pointer();
- functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value;
- functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value;
- return true;
- } else {
- return false;
- }
+ functor.obj_ref.obj_ptr = (void *)f.get_pointer();
+ functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value;
+ functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value;
+ return true;
}
template<typename FunctionObj,typename Allocator>
bool
R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>
vtable_type;
+ vtable_type* get_vtable() const {
+ return reinterpret_cast<vtable_type*>(
+ reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01);
+ }
+
struct clear_type {};
public:
if (this->empty())
boost::throw_exception(bad_function_call());
- return static_cast<vtable_type*>(vtable)->invoker
+ return get_vtable()->invoker
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
}
#else
operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
{
this->clear();
- try {
+ BOOST_TRY {
this->assign_to(f);
- } catch (...) {
+ } BOOST_CATCH (...) {
vtable = 0;
- throw;
+ BOOST_RETHROW;
}
+ BOOST_CATCH_END
return *this;
}
template<typename Functor,typename Allocator>
void assign(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a)
{
this->clear();
- try {
+ BOOST_TRY{
this->assign_to_a(f,a);
- } catch (...) {
+ } BOOST_CATCH (...) {
vtable = 0;
- throw;
+ BOOST_RETHROW;
}
+ BOOST_CATCH_END
}
#ifndef BOOST_NO_SFINAE
return *this;
this->clear();
- try {
+ BOOST_TRY {
this->assign_to_own(f);
- } catch (...) {
+ } BOOST_CATCH (...) {
vtable = 0;
- throw;
+ BOOST_RETHROW;
}
+ BOOST_CATCH_END
return *this;
}
void clear()
{
if (vtable) {
- reinterpret_cast<vtable_type*>(vtable)->clear(this->functor);
+ if (!this->has_trivial_copy_and_destroy())
+ get_vtable()->clear(this->functor);
vtable = 0;
}
}
{
if (!f.empty()) {
this->vtable = f.vtable;
- f.vtable->manager(f.functor, this->functor,
- boost::detail::function::clone_functor_tag);
+ if (this->has_trivial_copy_and_destroy())
+ this->functor = f.functor;
+ else
+ get_vtable()->base.manager(f.functor, this->functor,
+ boost::detail::function::clone_functor_tag);
}
}
static vtable_type stored_vtable =
{ { &manager_type::manage }, &invoker_type::invoke };
- if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable.base;
- else vtable = 0;
+ if (stored_vtable.assign_to(f, functor)) {
+ std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base);
+ if (boost::has_trivial_copy_constructor<Functor>::value &&
+ boost::has_trivial_destructor<Functor>::value &&
+ detail::function::function_allows_small_object_optimization<Functor>::value)
+ value |= (std::size_t)0x01;
+ vtable = reinterpret_cast<detail::function::vtable_base *>(value);
+ } else
+ vtable = 0;
}
template<typename Functor,typename Allocator>
static vtable_type stored_vtable =
{ { &manager_type::manage }, &invoker_type::invoke };
- if (stored_vtable.assign_to_a(f, functor, a)) vtable = &stored_vtable.base;
- else vtable = 0;
+ if (stored_vtable.assign_to_a(f, functor, a)) {
+ std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base);
+ if (boost::has_trivial_copy_constructor<Functor>::value &&
+ boost::has_trivial_destructor<Functor>::value &&
+ detail::function::function_allows_small_object_optimization<Functor>::value)
+ value |= (std::size_t)0x01;
+ vtable = reinterpret_cast<detail::function::vtable_base *>(value);
+ } else
+ vtable = 0;
}
// Moves the value from the specified argument to *this. If the argument
if (&f == this)
return;
-#if !defined(BOOST_NO_EXCEPTIONS)
- try {
-#endif
+ BOOST_TRY {
if (!f.empty()) {
this->vtable = f.vtable;
- f.vtable->manager(f.functor, this->functor,
- boost::detail::function::move_functor_tag);
- f.vtable = 0;
-#if !defined(BOOST_NO_EXCEPTIONS)
+ if (this->has_trivial_copy_and_destroy())
+ this->functor = f.functor;
+ else
+ get_vtable()->base.manager(f.functor, this->functor,
+ boost::detail::function::move_functor_tag);
+ f.vtable = 0;
} else {
clear();
}
- } catch (...) {
+ } BOOST_CATCH (...) {
vtable = 0;
- throw;
+ BOOST_RETHROW;
}
-#endif
+ BOOST_CATCH_END
}
};
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS>
typename BOOST_FUNCTION_FUNCTION<
R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>::result_type
- BOOST_FUNCTION_FUNCTION<R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>
+ inline
+ BOOST_FUNCTION_FUNCTION<R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>
::operator()(BOOST_FUNCTION_PARMS) const
{
if (this->empty())
boost::throw_exception(bad_function_call());
- return reinterpret_cast<const vtable_type*>(vtable)->invoker
+ return get_vtable()->invoker
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
}
#endif
--- /dev/null
+\r
+// Copyright 2005-2008 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+// Forwarding header for container_fwd.hpp's new location.\r
+// This header is deprecated, I'll be adding a warning in a future release,\r
+// then converting it to an error and finally removing this header completely.\r
+\r
+#if !defined(BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP)\r
+#define BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP\r
+\r
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)\r
+# pragma once\r
+#endif\r
+\r
+#include <boost/detail/container_fwd.hpp>\r
+\r
+#endif\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#include <boost/functional/hash/hash.hpp>\r
+\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP)\r
+#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP\r
+\r
+#include <boost/config.hpp>\r
+#include <boost/config/no_tr1/cmath.hpp>\r
+\r
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)\r
+# pragma once\r
+#endif\r
+\r
+// The C++ standard requires that the C float functions are overloarded\r
+// for float, double and long double in the std namespace, but some of the older\r
+// library implementations don't support this. On some that don't, the C99\r
+// float functions (frexpf, frexpl, etc.) are available.\r
+//\r
+// The following tries to automatically detect which are available.\r
+\r
+namespace boost {\r
+ namespace hash_detail {\r
+\r
+ // Returned by dummy versions of the float functions.\r
+ \r
+ struct not_found {\r
+ // Implicitly convertible to float and long double in order to avoid\r
+ // a compile error when the dummy float functions are used.\r
+\r
+ inline operator float() const { return 0; }\r
+ inline operator long double() const { return 0; }\r
+ };\r
+ \r
+ // A type for detecting the return type of functions.\r
+\r
+ template <typename T> struct is;\r
+ template <> struct is<float> { char x[10]; };\r
+ template <> struct is<double> { char x[20]; };\r
+ template <> struct is<long double> { char x[30]; };\r
+ template <> struct is<boost::hash_detail::not_found> { char x[40]; };\r
+ \r
+ // Used to convert the return type of a function to a type for sizeof.\r
+\r
+ template <typename T> is<T> float_type(T);\r
+\r
+ // call_ldexp\r
+ //\r
+ // This will get specialized for float and long double\r
+ \r
+ template <typename Float> struct call_ldexp\r
+ {\r
+ typedef double float_type;\r
+ \r
+ inline double operator()(double a, int b) const\r
+ {\r
+ using namespace std;\r
+ return ldexp(a, b);\r
+ }\r
+ };\r
+\r
+ // call_frexp\r
+ //\r
+ // This will get specialized for float and long double\r
+\r
+ template <typename Float> struct call_frexp\r
+ {\r
+ typedef double float_type;\r
+ \r
+ inline double operator()(double a, int* b) const\r
+ {\r
+ using namespace std;\r
+ return frexp(a, b);\r
+ }\r
+ };\r
+ }\r
+}\r
+ \r
+// A namespace for dummy functions to detect when the actual function we want\r
+// isn't available. ldexpl, ldexpf etc. might be added tby the macros below.\r
+//\r
+// AFAICT these have to be outside of the boost namespace, as if they're in\r
+// the boost namespace they'll always be preferable to any other function\r
+// (since the arguments are built in types, ADL can't be used).\r
+\r
+namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS {\r
+ template <class Float> boost::hash_detail::not_found ldexp(Float, int);\r
+ template <class Float> boost::hash_detail::not_found frexp(Float, int*); \r
+}\r
+\r
+// Macros for generating specializations of call_ldexp and call_frexp.\r
+//\r
+// check_cpp and check_c99 check if the C++ or C99 functions are available.\r
+//\r
+// Then the call_* functions select an appropriate implementation.\r
+//\r
+// I used c99_func in a few places just to get a unique name.\r
+//\r
+// Important: when using 'using namespace' at namespace level, include as\r
+// little as possible in that namespace, as Visual C++ has an odd bug which\r
+// can cause the namespace to be imported at the global level. This seems to\r
+// happen mainly when there's a template in the same namesapce.\r
+\r
+#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \\r
+namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS { \\r
+ template <class Float> \\r
+ boost::hash_detail::not_found c99_func(Float, type2); \\r
+} \\r
+ \\r
+namespace boost { \\r
+ namespace hash_detail { \\r
+ namespace c99_func##_detect { \\r
+ using namespace std; \\r
+ using namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS; \\r
+ \\r
+ struct check { \\r
+ static type1 x; \\r
+ static type2 y; \\r
+ BOOST_STATIC_CONSTANT(bool, cpp = \\r
+ sizeof(float_type(cpp_func(x,y))) \\r
+ == sizeof(is<type1>)); \\r
+ BOOST_STATIC_CONSTANT(bool, c99 = \\r
+ sizeof(float_type(c99_func(x,y))) \\r
+ == sizeof(is<type1>)); \\r
+ }; \\r
+ } \\r
+ \\r
+ template <bool x> \\r
+ struct call_c99_##c99_func : \\r
+ boost::hash_detail::call_##cpp_func<double> {}; \\r
+ \\r
+ template <> \\r
+ struct call_c99_##c99_func<true> { \\r
+ typedef type1 float_type; \\r
+ \\r
+ template <typename T> \\r
+ inline type1 operator()(type1 a, T b) const \\r
+ { \\r
+ using namespace std; \\r
+ return c99_func(a, b); \\r
+ } \\r
+ }; \\r
+ \\r
+ template <bool x> \\r
+ struct call_cpp_##c99_func : \\r
+ call_c99_##c99_func< \\r
+ ::boost::hash_detail::c99_func##_detect::check::c99 \\r
+ > {}; \\r
+ \\r
+ template <> \\r
+ struct call_cpp_##c99_func<true> { \\r
+ typedef type1 float_type; \\r
+ \\r
+ template <typename T> \\r
+ inline type1 operator()(type1 a, T b) const \\r
+ { \\r
+ using namespace std; \\r
+ return cpp_func(a, b); \\r
+ } \\r
+ }; \\r
+ \\r
+ template <> \\r
+ struct call_##cpp_func<type1> : \\r
+ call_cpp_##c99_func< \\r
+ ::boost::hash_detail::c99_func##_detect::check::cpp \\r
+ > {}; \\r
+ } \\r
+}\r
+\r
+#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2) \\r
+namespace boost { \\r
+ namespace hash_detail { \\r
+ \\r
+ template <> \\r
+ struct call_##cpp_func<type1> { \\r
+ typedef type1 float_type; \\r
+ inline type1 operator()(type1 x, type2 y) const { \\r
+ return c99_func(x, y); \\r
+ } \\r
+ }; \\r
+ } \\r
+}\r
+\r
+#if defined(ldexpf)\r
+BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int)\r
+#else\r
+BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int)\r
+#endif\r
+\r
+#if defined(ldexpl)\r
+BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int)\r
+#else\r
+BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int)\r
+#endif\r
+\r
+#if defined(frexpf)\r
+BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*)\r
+#else\r
+BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*)\r
+#endif\r
+\r
+#if defined(frexpl)\r
+BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*)\r
+#else\r
+BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*)\r
+#endif\r
+\r
+#undef BOOST_HASH_CALL_FLOAT_MACRO\r
+#undef BOOST_HASH_CALL_FLOAT_FUNC\r
+\r
+\r
+namespace boost\r
+{\r
+ namespace hash_detail\r
+ {\r
+ template <typename Float1, typename Float2>\r
+ struct select_hash_type_impl {\r
+ typedef double type;\r
+ };\r
+\r
+ template <>\r
+ struct select_hash_type_impl<float, float> {\r
+ typedef float type;\r
+ };\r
+\r
+ template <>\r
+ struct select_hash_type_impl<long double, long double> {\r
+ typedef long double type;\r
+ };\r
+\r
+\r
+ // select_hash_type\r
+ //\r
+ // If there is support for a particular floating point type, use that\r
+ // otherwise use double (there's always support for double).\r
+ \r
+ template <typename Float>\r
+ struct select_hash_type : select_hash_type_impl<\r
+ BOOST_DEDUCED_TYPENAME call_ldexp<Float>::float_type,\r
+ BOOST_DEDUCED_TYPENAME call_frexp<Float>::float_type\r
+ > {}; \r
+ }\r
+}\r
+\r
+#endif\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER)\r
+#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER\r
+\r
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)\r
+# pragma once\r
+#endif\r
+\r
+#include <boost/config.hpp>\r
+#include <boost/functional/hash/detail/float_functions.hpp>\r
+#include <boost/functional/hash/detail/limits.hpp>\r
+#include <boost/integer/static_log2.hpp>\r
+#include <boost/cstdint.hpp>\r
+#include <boost/assert.hpp>\r
+\r
+// Include hash implementation for the current platform.\r
+\r
+// Cygwn\r
+#if defined(__CYGWIN__)\r
+# if defined(__i386__) || defined(_M_IX86)\r
+# include <boost/functional/hash/detail/hash_float_x86.hpp>\r
+# else\r
+# include <boost/functional/hash/detail/hash_float_generic.hpp>\r
+# endif\r
+#else\r
+# include <boost/functional/hash/detail/hash_float_generic.hpp>\r
+#endif\r
+\r
+// Can we use fpclassify?\r
+\r
+// STLport\r
+#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)\r
+#define BOOST_HASH_USE_FPCLASSIFY 0\r
+\r
+// GNU libstdc++ 3\r
+#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)\r
+# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \\r
+ !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))\r
+# define BOOST_HASH_USE_FPCLASSIFY 1\r
+# else\r
+# define BOOST_HASH_USE_FPCLASSIFY 0\r
+# endif\r
+\r
+// Everything else\r
+#else\r
+# define BOOST_HASH_USE_FPCLASSIFY 0\r
+#endif\r
+\r
+#if BOOST_HASH_USE_FPCLASSIFY\r
+\r
+#include <boost/config/no_tr1/cmath.hpp>\r
+\r
+namespace boost\r
+{\r
+ namespace hash_detail\r
+ {\r
+ template <class T>\r
+ inline std::size_t float_hash_value(T v)\r
+ {\r
+ using namespace std;\r
+ switch (fpclassify(v)) {\r
+ case FP_ZERO:\r
+ return 0;\r
+ case FP_INFINITE:\r
+ return (std::size_t)(v > 0 ? -1 : -2);\r
+ case FP_NAN:\r
+ return (std::size_t)(-3);\r
+ case FP_NORMAL:\r
+ case FP_SUBNORMAL:\r
+ return float_hash_impl(v);\r
+ default:\r
+ BOOST_ASSERT(0);\r
+ return 0;\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+#else // !BOOST_HASH_USE_FPCLASSIFY\r
+\r
+namespace boost\r
+{\r
+ namespace hash_detail\r
+ {\r
+ template <class T>\r
+ inline std::size_t float_hash_value(T v)\r
+ {\r
+ return v == 0 ? 0 : float_hash_impl(v);\r
+ }\r
+ }\r
+}\r
+\r
+#endif // BOOST_HASH_USE_FPCLASSIFY\r
+\r
+#undef BOOST_HASH_USE_FPCLASSIFY\r
+\r
+#endif\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+// A general purpose hash function for non-zero floating point values.\r
+\r
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER)\r
+#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER\r
+\r
+#include <boost/functional/hash/detail/float_functions.hpp>\r
+#include <boost/integer/static_log2.hpp>\r
+#include <boost/functional/hash/detail/limits.hpp>\r
+\r
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)\r
+# pragma once\r
+#endif\r
+\r
+#if defined(BOOST_MSVC)\r
+#pragma warning(push)\r
+#if BOOST_MSVC >= 1400\r
+#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does\r
+ // not satisfy test. Loop body not executed \r
+#endif\r
+#endif\r
+\r
+namespace boost\r
+{\r
+ namespace hash_detail\r
+ {\r
+ inline void hash_float_combine(std::size_t& seed, std::size_t value)\r
+ {\r
+ seed ^= value + (seed<<6) + (seed>>2);\r
+ }\r
+\r
+ template <class T>\r
+ inline std::size_t float_hash_impl2(T v)\r
+ {\r
+ boost::hash_detail::call_frexp<T> frexp;\r
+ boost::hash_detail::call_ldexp<T> ldexp;\r
+ \r
+ int exp = 0;\r
+\r
+ v = frexp(v, &exp);\r
+\r
+ // A postive value is easier to hash, so combine the\r
+ // sign with the exponent and use the absolute value.\r
+ if(v < 0) {\r
+ v = -v;\r
+ exp += limits<T>::max_exponent -\r
+ limits<T>::min_exponent;\r
+ }\r
+\r
+ // The result of frexp is always between 0.5 and 1, so its\r
+ // top bit will always be 1. Subtract by 0.5 to remove that.\r
+ v -= T(0.5);\r
+ v = ldexp(v, limits<std::size_t>::digits + 1);\r
+ std::size_t seed = static_cast<std::size_t>(v);\r
+ v -= seed;\r
+\r
+ // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;\r
+ std::size_t const length\r
+ = (limits<T>::digits *\r
+ boost::static_log2<limits<T>::radix>::value - 1)\r
+ / limits<std::size_t>::digits;\r
+\r
+ for(std::size_t i = 0; i != length; ++i)\r
+ {\r
+ v = ldexp(v, limits<std::size_t>::digits);\r
+ std::size_t part = static_cast<std::size_t>(v);\r
+ v -= part;\r
+ hash_float_combine(seed, part);\r
+ }\r
+\r
+ hash_float_combine(seed, exp);\r
+\r
+ return seed;\r
+ }\r
+\r
+ template <class T>\r
+ inline std::size_t float_hash_impl(T v)\r
+ {\r
+ typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type;\r
+ return float_hash_impl2(static_cast<type>(v));\r
+ }\r
+ }\r
+}\r
+\r
+#if defined(BOOST_MSVC)\r
+#pragma warning(pop)\r
+#endif\r
+\r
+#endif\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+// A non-portable hash function form non-zero floats on x86.\r
+//\r
+// Even if you're on an x86 platform, this might not work if their floating\r
+// point isn't set up as this expects. So this should only be used if it's\r
+// absolutely certain that it will work.\r
+\r
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER)\r
+#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER\r
+\r
+#include <boost/cstdint.hpp>\r
+\r
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)\r
+# pragma once\r
+#endif\r
+\r
+namespace boost\r
+{\r
+ namespace hash_detail\r
+ {\r
+ inline void hash_float_combine(std::size_t& seed, std::size_t value)\r
+ {\r
+ seed ^= value + (seed<<6) + (seed>>2);\r
+ }\r
+\r
+ inline std::size_t float_hash_impl(float v)\r
+ {\r
+ boost::uint32_t* ptr = (boost::uint32_t*)&v;\r
+ std::size_t seed = *ptr;\r
+ return seed;\r
+ }\r
+\r
+ inline std::size_t float_hash_impl(double v)\r
+ {\r
+ boost::uint32_t* ptr = (boost::uint32_t*)&v;\r
+ std::size_t seed = *ptr++;\r
+ hash_float_combine(seed, *ptr);\r
+ return seed;\r
+ }\r
+\r
+ inline std::size_t float_hash_impl(long double v)\r
+ {\r
+ boost::uint32_t* ptr = (boost::uint32_t*)&v;\r
+ std::size_t seed = *ptr++;\r
+ hash_float_combine(seed, *ptr++);\r
+ hash_float_combine(seed, *(boost::uint16_t*)ptr);\r
+ return seed;\r
+ }\r
+ }\r
+}\r
+\r
+#endif\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+// On some platforms std::limits gives incorrect values for long double.\r
+// This tries to work around them.\r
+\r
+#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER)\r
+#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER\r
+\r
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)\r
+# pragma once\r
+#endif\r
+\r
+#include <boost/limits.hpp>\r
+\r
+// On OpenBSD, numeric_limits is not reliable for long doubles, but\r
+// the macros defined in <float.h> are and support long double when STLport\r
+// doesn't.\r
+\r
+#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)\r
+#include <float.h>\r
+#endif\r
+\r
+namespace boost\r
+{\r
+ namespace hash_detail\r
+ {\r
+ template <class T>\r
+ struct limits : std::numeric_limits<T> {};\r
+\r
+#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)\r
+ template <>\r
+ struct limits<long double>\r
+ : std::numeric_limits<long double>\r
+ {\r
+ static long double epsilon() {\r
+ return LDBL_EPSILON;\r
+ }\r
+\r
+ static long double (max)() {\r
+ return LDBL_MAX;\r
+ }\r
+\r
+ static long double (min)() {\r
+ return LDBL_MIN;\r
+ }\r
+\r
+ BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);\r
+ BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);\r
+ BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);\r
+#if defined(_STLP_NO_LONG_DOUBLE)\r
+ BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX);\r
+#endif\r
+ };\r
+#endif // __OpenBSD__\r
+ }\r
+}\r
+\r
+#endif\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+// Based on Peter Dimov's proposal\r
+// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf\r
+// issue 6.18. \r
+\r
+// This implements the extensions to the standard.\r
+// It's undocumented, so you shouldn't use it....\r
+\r
+#if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)\r
+#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP\r
+\r
+#include <boost/functional/hash/hash.hpp>\r
+#include <boost/detail/container_fwd.hpp>\r
+\r
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)\r
+# pragma once\r
+#endif\r
+\r
+#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)\r
+#include <boost/type_traits/is_array.hpp>\r
+#endif\r
+\r
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)\r
+#include <boost/type_traits/is_const.hpp>\r
+#endif\r
+\r
+namespace boost\r
+{\r
+ template <class A, class B>\r
+ std::size_t hash_value(std::pair<A, B> const&);\r
+ template <class T, class A>\r
+ std::size_t hash_value(std::vector<T, A> const&);\r
+ template <class T, class A>\r
+ std::size_t hash_value(std::list<T, A> const& v);\r
+ template <class T, class A>\r
+ std::size_t hash_value(std::deque<T, A> const& v);\r
+ template <class K, class C, class A>\r
+ std::size_t hash_value(std::set<K, C, A> const& v);\r
+ template <class K, class C, class A>\r
+ std::size_t hash_value(std::multiset<K, C, A> const& v);\r
+ template <class K, class T, class C, class A>\r
+ std::size_t hash_value(std::map<K, T, C, A> const& v);\r
+ template <class K, class T, class C, class A>\r
+ std::size_t hash_value(std::multimap<K, T, C, A> const& v);\r
+\r
+ template <class T>\r
+ std::size_t hash_value(std::complex<T> const&);\r
+\r
+ template <class A, class B>\r
+ std::size_t hash_value(std::pair<A, B> const& v)\r
+ {\r
+ std::size_t seed = 0;\r
+ hash_combine(seed, v.first);\r
+ hash_combine(seed, v.second);\r
+ return seed;\r
+ }\r
+\r
+ template <class T, class A>\r
+ std::size_t hash_value(std::vector<T, A> const& v)\r
+ {\r
+ return hash_range(v.begin(), v.end());\r
+ }\r
+\r
+ template <class T, class A>\r
+ std::size_t hash_value(std::list<T, A> const& v)\r
+ {\r
+ return hash_range(v.begin(), v.end());\r
+ }\r
+\r
+ template <class T, class A>\r
+ std::size_t hash_value(std::deque<T, A> const& v)\r
+ {\r
+ return hash_range(v.begin(), v.end());\r
+ }\r
+\r
+ template <class K, class C, class A>\r
+ std::size_t hash_value(std::set<K, C, A> const& v)\r
+ {\r
+ return hash_range(v.begin(), v.end());\r
+ }\r
+\r
+ template <class K, class C, class A>\r
+ std::size_t hash_value(std::multiset<K, C, A> const& v)\r
+ {\r
+ return hash_range(v.begin(), v.end());\r
+ }\r
+\r
+ template <class K, class T, class C, class A>\r
+ std::size_t hash_value(std::map<K, T, C, A> const& v)\r
+ {\r
+ return hash_range(v.begin(), v.end());\r
+ }\r
+\r
+ template <class K, class T, class C, class A>\r
+ std::size_t hash_value(std::multimap<K, T, C, A> const& v)\r
+ {\r
+ return hash_range(v.begin(), v.end());\r
+ }\r
+\r
+ template <class T>\r
+ std::size_t hash_value(std::complex<T> const& v)\r
+ {\r
+ boost::hash<T> hasher;\r
+ std::size_t seed = hasher(v.imag());\r
+ seed ^= hasher(v.real()) + (seed<<6) + (seed>>2);\r
+ return seed;\r
+ }\r
+\r
+ //\r
+ // call_hash_impl\r
+ //\r
+\r
+ // On compilers without function template ordering, this deals with arrays.\r
+\r
+#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)\r
+ namespace hash_detail\r
+ {\r
+ template <bool IsArray>\r
+ struct call_hash_impl\r
+ {\r
+ template <class T>\r
+ struct inner\r
+ {\r
+ static std::size_t call(T const& v)\r
+ {\r
+ using namespace boost;\r
+ return hash_value(v);\r
+ }\r
+ };\r
+ };\r
+\r
+ template <>\r
+ struct call_hash_impl<true>\r
+ {\r
+ template <class Array>\r
+ struct inner\r
+ {\r
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\r
+ static std::size_t call(Array const& v)\r
+#else\r
+ static std::size_t call(Array& v)\r
+#endif\r
+ {\r
+ const int size = sizeof(v) / sizeof(*v);\r
+ return boost::hash_range(v, v + size);\r
+ }\r
+ };\r
+ };\r
+\r
+ template <class T>\r
+ struct call_hash\r
+ : public call_hash_impl<boost::is_array<T>::value>\r
+ ::BOOST_NESTED_TEMPLATE inner<T>\r
+ {\r
+ };\r
+ }\r
+#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING\r
+\r
+ //\r
+ // boost::hash\r
+ //\r
+\r
+\r
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
+\r
+ template <class T> struct hash\r
+ : std::unary_function<T, std::size_t>\r
+ {\r
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)\r
+ std::size_t operator()(T const& val) const\r
+ {\r
+ return hash_value(val);\r
+ }\r
+#else\r
+ std::size_t operator()(T const& val) const\r
+ {\r
+ return hash_detail::call_hash<T>::call(val);\r
+ }\r
+#endif\r
+ };\r
+\r
+#if BOOST_WORKAROUND(__DMC__, <= 0x848)\r
+ template <class T, unsigned int n> struct hash<T[n]>\r
+ : std::unary_function<T[n], std::size_t>\r
+ {\r
+ std::size_t operator()(const T* val) const\r
+ {\r
+ return boost::hash_range(val, val+n);\r
+ }\r
+ };\r
+#endif\r
+\r
+#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION\r
+\r
+ // On compilers without partial specialization, boost::hash<T>\r
+ // has already been declared to deal with pointers, so just\r
+ // need to supply the non-pointer version of hash_impl.\r
+\r
+ namespace hash_detail\r
+ {\r
+ template <bool IsPointer>\r
+ struct hash_impl;\r
+\r
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\r
+\r
+ template <>\r
+ struct hash_impl<false>\r
+ {\r
+ template <class T>\r
+ struct inner\r
+ : std::unary_function<T, std::size_t>\r
+ {\r
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)\r
+ std::size_t operator()(T const& val) const\r
+ {\r
+ return hash_value(val);\r
+ }\r
+#else\r
+ std::size_t operator()(T const& val) const\r
+ {\r
+ return hash_detail::call_hash<T>::call(val);\r
+ }\r
+#endif\r
+ };\r
+ };\r
+\r
+#else // Visual C++ 6.5\r
+\r
+ // Visual C++ 6.5 has problems with nested member functions and\r
+ // applying const to const types in templates. So we get this:\r
+\r
+ template <bool IsConst>\r
+ struct hash_impl_msvc\r
+ {\r
+ template <class T>\r
+ struct inner\r
+ : public std::unary_function<T, std::size_t>\r
+ {\r
+ std::size_t operator()(T const& val) const\r
+ {\r
+ return hash_detail::call_hash<T const>::call(val);\r
+ }\r
+\r
+ std::size_t operator()(T& val) const\r
+ {\r
+ return hash_detail::call_hash<T>::call(val);\r
+ }\r
+ };\r
+ };\r
+\r
+ template <>\r
+ struct hash_impl_msvc<true>\r
+ {\r
+ template <class T>\r
+ struct inner\r
+ : public std::unary_function<T, std::size_t>\r
+ {\r
+ std::size_t operator()(T& val) const\r
+ {\r
+ return hash_detail::call_hash<T>::call(val);\r
+ }\r
+ };\r
+ };\r
+ \r
+ template <class T>\r
+ struct hash_impl_msvc2\r
+ : public hash_impl_msvc<boost::is_const<T>::value>\r
+ ::BOOST_NESTED_TEMPLATE inner<T> {};\r
+ \r
+ template <>\r
+ struct hash_impl<false>\r
+ {\r
+ template <class T>\r
+ struct inner : public hash_impl_msvc2<T> {};\r
+ };\r
+\r
+#endif // Visual C++ 6.5\r
+ }\r
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION\r
+}\r
+\r
+#endif\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+// Based on Peter Dimov's proposal\r
+// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf\r
+// issue 6.18. \r
+\r
+#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP)\r
+#define BOOST_FUNCTIONAL_HASH_HASH_HPP\r
+\r
+#include <boost/functional/hash/hash_fwd.hpp>\r
+#include <functional>\r
+#include <boost/functional/hash/detail/hash_float.hpp>\r
+#include <string>\r
+#include <boost/limits.hpp>\r
+\r
+#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
+#include <boost/type_traits/is_pointer.hpp>\r
+#endif\r
+\r
+#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\r
+#define BOOST_HASH_CHAR_TRAITS string_char_traits\r
+#else\r
+#define BOOST_HASH_CHAR_TRAITS char_traits\r
+#endif\r
+\r
+namespace boost\r
+{\r
+ std::size_t hash_value(bool);\r
+ std::size_t hash_value(char);\r
+ std::size_t hash_value(unsigned char);\r
+ std::size_t hash_value(signed char);\r
+ std::size_t hash_value(short);\r
+ std::size_t hash_value(unsigned short);\r
+ std::size_t hash_value(int);\r
+ std::size_t hash_value(unsigned int);\r
+ std::size_t hash_value(long);\r
+ std::size_t hash_value(unsigned long);\r
+\r
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)\r
+ std::size_t hash_value(wchar_t);\r
+#endif\r
+ \r
+#if defined(BOOST_HAS_LONG_LONG)\r
+ std::size_t hash_value(boost::long_long_type);\r
+ std::size_t hash_value(boost::ulong_long_type);\r
+#endif\r
+\r
+#if !BOOST_WORKAROUND(__DMC__, <= 0x848)\r
+ template <class T> std::size_t hash_value(T* const&);\r
+#else\r
+ template <class T> std::size_t hash_value(T*);\r
+#endif\r
+\r
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)\r
+ template< class T, unsigned N >\r
+ std::size_t hash_value(const T (&x)[N]);\r
+\r
+ template< class T, unsigned N >\r
+ std::size_t hash_value(T (&x)[N]);\r
+#endif\r
+\r
+ std::size_t hash_value(float v);\r
+ std::size_t hash_value(double v);\r
+ std::size_t hash_value(long double v);\r
+\r
+ template <class Ch, class A>\r
+ std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);\r
+\r
+ // Implementation\r
+\r
+ namespace hash_detail\r
+ {\r
+ template <class T>\r
+ inline std::size_t hash_value_signed(T val)\r
+ {\r
+ const int size_t_bits = std::numeric_limits<std::size_t>::digits;\r
+ // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1\r
+ const int length = (std::numeric_limits<T>::digits - 1)\r
+ / size_t_bits;\r
+\r
+ std::size_t seed = 0;\r
+ T positive = val < 0 ? -1 - val : val;\r
+\r
+ // Hopefully, this loop can be unrolled.\r
+ for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)\r
+ {\r
+ seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2);\r
+ }\r
+ seed ^= (std::size_t) val + (seed<<6) + (seed>>2);\r
+\r
+ return seed;\r
+ }\r
+\r
+ template <class T>\r
+ inline std::size_t hash_value_unsigned(T val)\r
+ {\r
+ const int size_t_bits = std::numeric_limits<std::size_t>::digits;\r
+ // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1\r
+ const int length = (std::numeric_limits<T>::digits - 1)\r
+ / size_t_bits;\r
+\r
+ std::size_t seed = 0;\r
+\r
+ // Hopefully, this loop can be unrolled.\r
+ for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)\r
+ {\r
+ seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2);\r
+ }\r
+ seed ^= (std::size_t) val + (seed<<6) + (seed>>2);\r
+\r
+ return seed;\r
+ }\r
+ }\r
+\r
+ inline std::size_t hash_value(bool v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(char v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(unsigned char v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(signed char v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(short v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(unsigned short v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(int v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(unsigned int v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(long v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(unsigned long v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+\r
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)\r
+ inline std::size_t hash_value(wchar_t v)\r
+ {\r
+ return static_cast<std::size_t>(v);\r
+ }\r
+#endif\r
+\r
+#if defined(BOOST_HAS_LONG_LONG)\r
+ inline std::size_t hash_value(boost::long_long_type v)\r
+ {\r
+ return hash_detail::hash_value_signed(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(boost::ulong_long_type v)\r
+ {\r
+ return hash_detail::hash_value_unsigned(v);\r
+ }\r
+#endif\r
+\r
+ // Implementation by Alberto Barbati and Dave Harris.\r
+#if !BOOST_WORKAROUND(__DMC__, <= 0x848)\r
+ template <class T> std::size_t hash_value(T* const& v)\r
+#else\r
+ template <class T> std::size_t hash_value(T* v)\r
+#endif\r
+ {\r
+ std::size_t x = static_cast<std::size_t>(\r
+ reinterpret_cast<std::ptrdiff_t>(v));\r
+\r
+ return x + (x >> 3);\r
+ }\r
+\r
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)\r
+ template <class T>\r
+ inline void hash_combine(std::size_t& seed, T& v)\r
+#else\r
+ template <class T>\r
+ inline void hash_combine(std::size_t& seed, T const& v)\r
+#endif\r
+ {\r
+ boost::hash<T> hasher;\r
+ seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);\r
+ }\r
+\r
+ template <class It>\r
+ inline std::size_t hash_range(It first, It last)\r
+ {\r
+ std::size_t seed = 0;\r
+\r
+ for(; first != last; ++first)\r
+ {\r
+ hash_combine(seed, *first);\r
+ }\r
+\r
+ return seed;\r
+ }\r
+\r
+ template <class It>\r
+ inline void hash_range(std::size_t& seed, It first, It last)\r
+ {\r
+ for(; first != last; ++first)\r
+ {\r
+ hash_combine(seed, *first);\r
+ }\r
+ }\r
+\r
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))\r
+ template <class T>\r
+ inline std::size_t hash_range(T* first, T* last)\r
+ {\r
+ std::size_t seed = 0;\r
+\r
+ for(; first != last; ++first)\r
+ {\r
+ boost::hash<T> hasher;\r
+ seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);\r
+ }\r
+\r
+ return seed;\r
+ }\r
+\r
+ template <class T>\r
+ inline void hash_range(std::size_t& seed, T* first, T* last)\r
+ {\r
+ for(; first != last; ++first)\r
+ {\r
+ boost::hash<T> hasher;\r
+ seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);\r
+ }\r
+ }\r
+#endif\r
+\r
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)\r
+ template< class T, unsigned N >\r
+ inline std::size_t hash_value(const T (&x)[N])\r
+ {\r
+ return hash_range(x, x + N);\r
+ }\r
+\r
+ template< class T, unsigned N >\r
+ inline std::size_t hash_value(T (&x)[N])\r
+ {\r
+ return hash_range(x, x + N);\r
+ }\r
+#endif\r
+\r
+ template <class Ch, class A>\r
+ inline std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)\r
+ {\r
+ return hash_range(v.begin(), v.end());\r
+ }\r
+\r
+ inline std::size_t hash_value(float v)\r
+ {\r
+ return boost::hash_detail::float_hash_value(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(double v)\r
+ {\r
+ return boost::hash_detail::float_hash_value(v);\r
+ }\r
+\r
+ inline std::size_t hash_value(long double v)\r
+ {\r
+ return boost::hash_detail::float_hash_value(v);\r
+ }\r
+\r
+ //\r
+ // boost::hash\r
+ //\r
+ \r
+ // Define the specializations required by the standard. The general purpose\r
+ // boost::hash is defined later in extensions.hpp if BOOST_HASH_NO_EXTENSIONS\r
+ // is not defined.\r
+ \r
+ // BOOST_HASH_SPECIALIZE - define a specialization for a type which is\r
+ // passed by copy.\r
+ //\r
+ // BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is\r
+ // passed by copy.\r
+ //\r
+ // These are undefined later.\r
+\r
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\r
+#define BOOST_HASH_SPECIALIZE(type) \\r
+ template <> struct hash<type> \\r
+ : public std::unary_function<type, std::size_t> \\r
+ { \\r
+ std::size_t operator()(type v) const \\r
+ { \\r
+ return boost::hash_value(v); \\r
+ } \\r
+ };\r
+\r
+#define BOOST_HASH_SPECIALIZE_REF(type) \\r
+ template <> struct hash<type> \\r
+ : public std::unary_function<type, std::size_t> \\r
+ { \\r
+ std::size_t operator()(type const& v) const \\r
+ { \\r
+ return boost::hash_value(v); \\r
+ } \\r
+ };\r
+#else\r
+#define BOOST_HASH_SPECIALIZE(type) \\r
+ template <> struct hash<type> \\r
+ : public std::unary_function<type, std::size_t> \\r
+ { \\r
+ std::size_t operator()(type v) const \\r
+ { \\r
+ return boost::hash_value(v); \\r
+ } \\r
+ }; \\r
+ \\r
+ template <> struct hash<const type> \\r
+ : public std::unary_function<const type, std::size_t> \\r
+ { \\r
+ std::size_t operator()(const type v) const \\r
+ { \\r
+ return boost::hash_value(v); \\r
+ } \\r
+ };\r
+\r
+#define BOOST_HASH_SPECIALIZE_REF(type) \\r
+ template <> struct hash<type> \\r
+ : public std::unary_function<type, std::size_t> \\r
+ { \\r
+ std::size_t operator()(type const& v) const \\r
+ { \\r
+ return boost::hash_value(v); \\r
+ } \\r
+ }; \\r
+ \\r
+ template <> struct hash<const type> \\r
+ : public std::unary_function<const type, std::size_t> \\r
+ { \\r
+ std::size_t operator()(type const& v) const \\r
+ { \\r
+ return boost::hash_value(v); \\r
+ } \\r
+ };\r
+#endif\r
+\r
+ BOOST_HASH_SPECIALIZE(bool)\r
+ BOOST_HASH_SPECIALIZE(char)\r
+ BOOST_HASH_SPECIALIZE(signed char)\r
+ BOOST_HASH_SPECIALIZE(unsigned char)\r
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)\r
+ BOOST_HASH_SPECIALIZE(wchar_t)\r
+#endif\r
+ BOOST_HASH_SPECIALIZE(short)\r
+ BOOST_HASH_SPECIALIZE(unsigned short)\r
+ BOOST_HASH_SPECIALIZE(int)\r
+ BOOST_HASH_SPECIALIZE(unsigned int)\r
+ BOOST_HASH_SPECIALIZE(long)\r
+ BOOST_HASH_SPECIALIZE(unsigned long)\r
+\r
+ BOOST_HASH_SPECIALIZE(float)\r
+ BOOST_HASH_SPECIALIZE(double)\r
+ BOOST_HASH_SPECIALIZE(long double)\r
+\r
+ BOOST_HASH_SPECIALIZE_REF(std::string)\r
+#if !defined(BOOST_NO_STD_WSTRING)\r
+ BOOST_HASH_SPECIALIZE_REF(std::wstring)\r
+#endif\r
+\r
+#if defined(BOOST_HAS_LONG_LONG)\r
+ BOOST_HASH_SPECIALIZE(boost::long_long_type)\r
+ BOOST_HASH_SPECIALIZE(boost::ulong_long_type)\r
+#endif\r
+\r
+#undef BOOST_HASH_SPECIALIZE\r
+#undef BOOST_HASH_SPECIALIZE_REF\r
+\r
+// Specializing boost::hash for pointers.\r
+\r
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
+\r
+ template <class T>\r
+ struct hash<T*>\r
+ : public std::unary_function<T*, std::size_t>\r
+ {\r
+ std::size_t operator()(T* v) const\r
+ {\r
+#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)\r
+ return boost::hash_value(v);\r
+#else\r
+ std::size_t x = static_cast<std::size_t>(\r
+ reinterpret_cast<std::ptrdiff_t>(v));\r
+\r
+ return x + (x >> 3);\r
+#endif\r
+ }\r
+ };\r
+\r
+#else\r
+\r
+ // For compilers without partial specialization, we define a\r
+ // boost::hash for all remaining types. But hash_impl is only defined\r
+ // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS\r
+ // is defined there will still be a compile error for types not supported\r
+ // in the standard.\r
+\r
+ namespace hash_detail\r
+ {\r
+ template <bool IsPointer>\r
+ struct hash_impl;\r
+\r
+ template <>\r
+ struct hash_impl<true>\r
+ {\r
+ template <class T>\r
+ struct inner\r
+ : public std::unary_function<T, std::size_t>\r
+ {\r
+ std::size_t operator()(T val) const\r
+ {\r
+#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590)\r
+ return boost::hash_value(val);\r
+#else\r
+ std::size_t x = static_cast<std::size_t>(\r
+ reinterpret_cast<std::ptrdiff_t>(val));\r
+\r
+ return x + (x >> 3);\r
+#endif\r
+ }\r
+ };\r
+ };\r
+ }\r
+\r
+ template <class T> struct hash\r
+ : public boost::hash_detail::hash_impl<boost::is_pointer<T>::value>\r
+ ::BOOST_NESTED_TEMPLATE inner<T>\r
+ {\r
+ };\r
+\r
+#endif\r
+}\r
+\r
+#undef BOOST_HASH_CHAR_TRAITS\r
+\r
+#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP\r
+\r
+// Include this outside of the include guards in case the file is included\r
+// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it\r
+// undefined.\r
+\r
+#if !defined(BOOST_HASH_NO_EXTENSIONS) \\r
+ && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)\r
+#include <boost/functional/hash/extensions.hpp>\r
+#endif\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+// Based on Peter Dimov's proposal\r
+// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf\r
+// issue 6.18. \r
+\r
+#if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP)\r
+#define BOOST_FUNCTIONAL_HASH_FWD_HPP\r
+\r
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)\r
+# pragma once\r
+#endif\r
+\r
+#include <boost/config.hpp>\r
+#include <cstddef>\r
+#include <boost/detail/workaround.hpp>\r
+\r
+namespace boost\r
+{\r
+ template <class T> struct hash;\r
+\r
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)\r
+ template <class T> void hash_combine(std::size_t& seed, T& v);\r
+#else\r
+ template <class T> void hash_combine(std::size_t& seed, T const& v);\r
+#endif\r
+\r
+ template <class It> std::size_t hash_range(It, It);\r
+ template <class It> void hash_range(std::size_t&, It, It);\r
+\r
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))\r
+ template <class T> inline std::size_t hash_range(T*, T*);\r
+ template <class T> inline void hash_range(std::size_t&, T*, T*);\r
+#endif\r
+}\r
+\r
+#endif\r
--- /dev/null
+\r
+// Copyright 2005-2009 Daniel James.\r
+// Distributed under the Boost Software License, Version 1.0. (See accompanying\r
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#include <boost/functional/hash/hash_fwd.hpp>\r
+\r
template <result_type n>
struct choose_initial_n {
- enum { c = (argument_type(1) << n << n) != 0 };
+ BOOST_STATIC_CONSTANT(bool, c = (argument_type(1) << n << n) != 0);
BOOST_STATIC_CONSTANT(
result_type,
value = !c*n + choose_initial_n<2*c*n>::value
template <argument_type x, result_type n = initial_n>
struct static_log2_impl {
- enum { c = (x >> n) > 0 }; // x >= 2**n ?
+ BOOST_STATIC_CONSTANT(bool, c = (x >> n) > 0); // x >= 2**n ?
BOOST_STATIC_CONSTANT(
result_type,
value = c*n + (static_log2_impl< (x>>c*n), n/2 >::value)
//
// See http://www.boost.org/libs/mpl for documentation.
-// $Id: compiler.hpp 49272 2008-10-11 06:50:46Z agurtovoy $
-// $Date: 2008-10-11 02:50:46 -0400 (Sat, 11 Oct 2008) $
-// $Revision: 49272 $
+// $Id: compiler.hpp 53189 2009-05-22 20:07:55Z hkaiser $
+// $Date: 2009-05-22 16:07:55 -0400 (Fri, 22 May 2009) $
+// $Revision: 53189 $
#if !defined(BOOST_MPL_CFG_COMPILER_DIR)
# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610))
# if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
# define BOOST_MPL_CFG_COMPILER_DIR bcc551
-# elseif BOOST_WORKAROUND(__BORLANDC__, >= 0x590)
+# elif BOOST_WORKAROUND(__BORLANDC__, >= 0x590)
# define BOOST_MPL_CFG_COMPILER_DIR bcc
# else
# define BOOST_MPL_CFG_COMPILER_DIR bcc_pre590
//
// See http://www.boost.org/libs/mpl for documentation.
-// $Id: inserter_algorithm.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
-// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
-// $Revision: 49267 $
+// $Id: inserter_algorithm.hpp 55648 2009-08-18 05:16:53Z agurtovoy $
+// $Date: 2009-08-18 01:16:53 -0400 (Tue, 18 Aug 2009) $
+// $Revision: 55648 $
#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/front_inserter.hpp>
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
> \
struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
- : if_< has_push_back<P1> \
+ : if_< has_push_back< typename clear<P1>::type> \
, aux::name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, back_inserter< typename clear<P1>::type > \
//
// See http://www.boost.org/libs/mpl for documentation.
-// $Id: push_back_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
-// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
-// $Revision: 49267 $
+// $Id: push_back_impl.hpp 55679 2009-08-20 07:50:16Z agurtovoy $
+// $Date: 2009-08-20 03:50:16 -0400 (Thu, 20 Aug 2009) $
+// $Revision: 55679 $
#include <boost/mpl/push_back_fwd.hpp>
#include <boost/mpl/assert.hpp>
namespace boost { namespace mpl {
-template< typename Tag >
-struct has_push_back_impl;
+struct has_push_back_arg {};
// agurt 05/feb/04: no default implementation; the stub definition is needed
// to enable the default 'has_push_back' implementation below
// if you've got an assert here, you are requesting a 'push_back'
// specialization that doesn't exist.
BOOST_MPL_ASSERT_MSG(
- ( boost::is_same< T, has_push_back_impl<T> >::value )
+ ( boost::is_same< T, has_push_back_arg >::value )
, REQUESTED_PUSH_BACK_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST
, ( Sequence )
);
{
template< typename Seq > struct apply
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
- : aux::has_type< push_back< Seq, has_push_back_impl<Tag> > >
+ : aux::has_type< push_back< Seq, has_push_back_arg > >
{
#else
{
- typedef aux::has_type< push_back< Seq, has_push_back_impl<Tag> > > type;
+ typedef aux::has_type< push_back< Seq, has_push_back_arg > > type;
BOOST_STATIC_CONSTANT(bool, value =
- (aux::has_type< push_back< Seq, has_push_back_impl<Tag> > >::value)
+ (aux::has_type< push_back< Seq, has_push_back_arg > >::value)
);
#endif
};
//
// See http://www.boost.org/libs/mpl for documentation.
-// $Id: push_front_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
-// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
-// $Revision: 49267 $
+// $Id: push_front_impl.hpp 55679 2009-08-20 07:50:16Z agurtovoy $
+// $Date: 2009-08-20 03:50:16 -0400 (Thu, 20 Aug 2009) $
+// $Revision: 55679 $
#include <boost/mpl/push_front_fwd.hpp>
#include <boost/mpl/assert.hpp>
namespace boost { namespace mpl {
-template< typename Tag >
-struct has_push_front_impl;
+struct has_push_front_arg {};
// agurt 05/feb/04: no default implementation; the stub definition is needed
// to enable the default 'has_push_front' implementation below
// if you've got an assert here, you are requesting a 'push_front'
// specialization that doesn't exist.
BOOST_MPL_ASSERT_MSG(
- ( boost::is_same< T, has_push_front_impl<T> >::value )
+ ( boost::is_same< T, has_push_front_arg >::value )
, REQUESTED_PUSH_FRONT_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST
, ( Sequence )
);
{
template< typename Seq > struct apply
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
- : aux::has_type< push_front< Seq, has_push_front_impl<Tag> > >
+ : aux::has_type< push_front< Seq, has_push_front_arg > >
{
#else
{
- typedef aux::has_type< push_front< Seq, has_push_front_impl<Tag> > > type;
+ typedef aux::has_type< push_front< Seq, has_push_front_arg > > type;
BOOST_STATIC_CONSTANT(bool, value =
- (aux::has_type< push_front< Seq, has_push_front_impl<Tag> > >::value)
+ (aux::has_type< push_front< Seq, has_push_front_arg > >::value)
);
#endif
};
--- /dev/null
+\r
+#ifndef BOOST_MPL_CHAR_HPP_INCLUDED\r
+#define BOOST_MPL_CHAR_HPP_INCLUDED\r
+\r
+// Copyright Eric Niebler 2008\r
+//\r
+// Distributed under the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at \r
+// http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+// See http://www.boost.org/libs/mpl for documentation.\r
+\r
+// $Source$\r
+// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $\r
+// $Revision: 24874 $\r
+\r
+#include <boost/mpl/char_fwd.hpp>\r
+\r
+#define AUX_WRAPPER_VALUE_TYPE char\r
+#include <boost/mpl/aux_/integral_wrapper.hpp>\r
+\r
+#endif // BOOST_MPL_CHAR_HPP_INCLUDED\r
--- /dev/null
+\r
+#ifndef BOOST_MPL_CHAR_FWD_HPP_INCLUDED\r
+#define BOOST_MPL_CHAR_FWD_HPP_INCLUDED\r
+\r
+// Copyright Eric Niebler 2008\r
+//\r
+// Distributed under the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at \r
+// http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+// See http://www.boost.org/libs/mpl for documentation.\r
+\r
+// $Source$\r
+// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $\r
+// $Revision: 24874 $\r
+\r
+#include <boost/mpl/aux_/adl_barrier.hpp>\r
+#include <boost/mpl/aux_/nttp_decl.hpp>\r
+\r
+BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN\r
+\r
+template< BOOST_MPL_AUX_NTTP_DECL(char, N) > struct char_;\r
+\r
+BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE\r
+BOOST_MPL_AUX_ADL_BARRIER_DECL(char_)\r
+\r
+#endif // BOOST_MPL_CHAR_FWD_HPP_INCLUDED\r
//
// See http://www.boost.org/libs/mpl for documentation.
-// $Id: for_each.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
-// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
-// $Revision: 49267 $
+// $Id: for_each.hpp 55648 2009-08-18 05:16:53Z agurtovoy $
+// $Date: 2009-08-18 01:16:53 -0400 (Tue, 18 Aug 2009) $
+// $Revision: 55648 $
#include <boost/mpl/is_sequence.hpp>
#include <boost/mpl/begin_end.hpp>
typedef typename mpl::next<Iterator>::type iter;
for_each_impl<boost::is_same<iter,LastIterator>::value>
- ::execute((iter*)0, (LastIterator*)0, (TransformFunc*)0, f);
+ ::execute( static_cast<iter*>(0), static_cast<LastIterator*>(0), static_cast<TransformFunc*>(0), f);
}
};
typedef typename end<Sequence>::type last;
aux::for_each_impl< boost::is_same<first,last>::value >
- ::execute((first*)0, (last*)0, (TransformOp*)0, f);
+ ::execute(static_cast<first*>(0), static_cast<last*>(0), static_cast<TransformOp*>(0), f);
}
template<
--- /dev/null
+\r
+#ifndef BOOST_MPL_LIMITS_STRING_HPP_INCLUDED\r
+#define BOOST_MPL_LIMITS_STRING_HPP_INCLUDED\r
+\r
+// Copyright Eric Niebler 2009\r
+//\r
+// Distributed under the Boost Software License, Version 1.0. \r
+// (See accompanying file LICENSE_1_0.txt or copy at \r
+// http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+// See http://www.boost.org/libs/mpl for documentation.\r
+\r
+// $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $\r
+// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $\r
+// $Revision: 49239 $\r
+\r
+#if !defined(BOOST_MPL_LIMIT_STRING_SIZE)\r
+# define BOOST_MPL_LIMIT_STRING_SIZE 32\r
+#endif\r
+\r
+#endif // BOOST_MPL_LIMITS_STRING_HPP_INCLUDED\r
//
// See http://www.boost.org/libs/mpl for documentation.
-// $Id: insert_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
-// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
-// $Revision: 49267 $
+// $Id: insert_impl.hpp 55751 2009-08-24 04:11:00Z agurtovoy $
+// $Date: 2009-08-24 00:11:00 -0400 (Mon, 24 Aug 2009) $
+// $Revision: 55751 $
#include <boost/mpl/insert_fwd.hpp>
#include <boost/mpl/next_prior.hpp>
>
#else
, m_item<
- next< typename Map::size >::type::value
+ Map::order::value
, typename Pair::first
, typename Pair::second
, Map
--- /dev/null
+\r
+#ifndef BOOST_MPL_STRING_HPP_INCLUDED\r
+#define BOOST_MPL_STRING_HPP_INCLUDED\r
+\r
+// Copyright Eric Niebler 2009\r
+//\r
+// Distributed under the Boost Software License, Version 1.0.\r
+// (See accompanying file LICENSE_1_0.txt or copy at\r
+// http://www.boost.org/LICENSE_1_0.txt)\r
+//\r
+// See http://www.boost.org/libs/mpl for documentation.\r
+\r
+// $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $\r
+// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $\r
+// $Revision: 49239 $\r
+//\r
+// Thanks to:\r
+// Dmitry Goncharov for porting this to the Sun compiler\r
+\r
+#include <boost/config.hpp>\r
+#include <boost/detail/workaround.hpp>\r
+#include <boost/detail/endian.hpp>\r
+#include <boost/mpl/limits/string.hpp>\r
+#include <boost/mpl/if.hpp>\r
+#include <boost/mpl/char.hpp>\r
+#include <boost/mpl/copy.hpp>\r
+#include <boost/mpl/size.hpp>\r
+#include <boost/mpl/empty.hpp>\r
+#include <boost/mpl/assert.hpp>\r
+#include <boost/mpl/size_t.hpp>\r
+#include <boost/mpl/begin_end.hpp>\r
+#include <boost/mpl/joint_view.hpp>\r
+#include <boost/mpl/insert_range.hpp>\r
+#include <boost/mpl/back_inserter.hpp>\r
+#include <boost/mpl/front_inserter.hpp>\r
+#include <boost/mpl/iterator_range.hpp>\r
+#include <boost/preprocessor/arithmetic/dec.hpp>\r
+#include <boost/preprocessor/arithmetic/add.hpp>\r
+#include <boost/preprocessor/arithmetic/div.hpp>\r
+#include <boost/preprocessor/punctuation/comma_if.hpp>\r
+#include <boost/preprocessor/repetition/repeat.hpp>\r
+#include <boost/preprocessor/repetition/enum_params.hpp>\r
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>\r
+#include <boost/preprocessor/repetition/enum_shifted_params.hpp>\r
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>\r
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>\r
+\r
+#include <iterator> // for bidirectional_iterator_tag\r
+#include <climits>\r
+\r
+namespace boost { namespace mpl\r
+{\r
+ #define BOOST_MPL_STRING_MAX_PARAMS \\r
+ BOOST_PP_DIV(BOOST_PP_ADD(BOOST_MPL_LIMIT_STRING_SIZE, 3), 4)\r
+\r
+ // Low-level bit-twiddling is done by macros. Any implementation-defined behavior of\r
+ // multi-character literals should be localized to these macros.\r
+\r
+ #define BOOST_MPL_MULTICHAR_LENGTH(c) \\r
+ (std::size_t)((c<CHAR_MIN) ? 4 : ((c>0xffffff)+(c>0xffff)+(c>0xff)+1))\r
+\r
+ #if defined(BOOST_LITTLE_ENDIAN) && defined(__SUNPRO_CC)\r
+\r
+ #define BOOST_MPL_MULTICHAR_AT(c,i) \\r
+ (char)(0xff&((unsigned)(c)>>(8*(std::size_t)(i))))\r
+\r
+ #define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \\r
+ ((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c))\r
+\r
+ #define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \\r
+ (((unsigned)(c)<<8)|(unsigned char)(i))\r
+\r
+ #define BOOST_MPL_MULTICHAR_POP_BACK(c) \\r
+ (((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c))\r
+\r
+ #define BOOST_MPL_MULTICHAR_POP_FRONT(c) \\r
+ ((unsigned)(c)>>8)\r
+\r
+ #else\r
+\r
+ #define BOOST_MPL_MULTICHAR_AT(c,i) \\r
+ (char)(0xff&((unsigned)(c)>>(8*(BOOST_MPL_MULTICHAR_LENGTH(c)-(std::size_t)(i)-1))))\r
+\r
+ #define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \\r
+ (((unsigned)(c)<<8)|(unsigned char)(i))\r
+\r
+ #define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \\r
+ ((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c))\r
+\r
+ #define BOOST_MPL_MULTICHAR_POP_BACK(c) \\r
+ ((unsigned)(c)>>8)\r
+\r
+ #define BOOST_MPL_MULTICHAR_POP_FRONT(c) \\r
+ (((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c))\r
+\r
+ #endif\r
+\r
+ struct string_tag;\r
+ struct string_iterator_tag;\r
+\r
+ template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_MPL_STRING_MAX_PARAMS, int C, 0)>\r
+ struct string;\r
+\r
+ template<typename Sequence, int I, int J>\r
+ struct string_iterator;\r
+\r
+ template<typename Sequence>\r
+ struct sequence_tag;\r
+\r
+ template<typename Tag>\r
+ struct size_impl;\r
+\r
+ template<>\r
+ struct size_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence>\r
+ struct apply;\r
+\r
+ #define M0(z, n, data) \\r
+ + BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C,n))\r
+\r
+ #define M1(z, n, data) \\r
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \\r
+ struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \\r
+ : mpl::size_t<(0 BOOST_PP_REPEAT_ ## z(n, M0, ~))> \\r
+ {};\r
+\r
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M1, ~)\r
+ #undef M0\r
+ #undef M1\r
+ };\r
+\r
+ template<>\r
+ struct size_impl<mpl::string_tag>::apply<mpl::string<> >\r
+ : mpl::size_t<0>\r
+ {};\r
+\r
+ template<typename Tag>\r
+ struct begin_impl;\r
+\r
+ template<>\r
+ struct begin_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence>\r
+ struct apply\r
+ {\r
+ typedef mpl::string_iterator<Sequence, 0, 0> type;\r
+ };\r
+ };\r
+\r
+ template<typename Tag>\r
+ struct end_impl;\r
+\r
+ template<>\r
+ struct end_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence>\r
+ struct apply;\r
+\r
+ #define M0(z,n,data) \\r
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \\r
+ struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \\r
+ { \\r
+ typedef mpl::string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, n, 0> type; \\r
+ };\r
+\r
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~)\r
+ #undef M0\r
+ };\r
+\r
+ template<>\r
+ struct end_impl<mpl::string_tag>::apply<mpl::string<> >\r
+ {\r
+ typedef mpl::string_iterator<mpl::string<>, 0, 0> type;\r
+ };\r
+\r
+ template<typename Tag>\r
+ struct push_back_impl;\r
+\r
+ template<>\r
+ struct push_back_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence, typename Value, bool B = (4==BOOST_MPL_MULTICHAR_LENGTH(Sequence::back_))>\r
+ struct apply\r
+ {\r
+ BOOST_MPL_ASSERT_MSG(\r
+ (BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value)\r
+ , PUSH_BACK_FAILED_MPL_STRING_IS_FULL\r
+ , (Sequence)\r
+ );\r
+ // If the above assertion didn't fire, then the string is sparse.\r
+ // Repack the string and retry the push_back\r
+ typedef\r
+ typename mpl::push_back<\r
+ typename mpl::copy<\r
+ Sequence\r
+ , mpl::back_inserter<mpl::string<> >\r
+ >::type\r
+ , Value\r
+ >::type\r
+ type;\r
+ };\r
+\r
+ template<typename Value>\r
+ struct apply<mpl::string<>, Value, false>\r
+ {\r
+ typedef mpl::string<(char)Value::value> type;\r
+ };\r
+\r
+ #define M0(z,n,data) \\r
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C), typename Value> \\r
+ struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, Value, false> \\r
+ { \\r
+ typedef \\r
+ mpl::string< \\r
+ BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \\r
+ BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \\r
+ ((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \\r
+ ?BOOST_PP_CAT(C,BOOST_PP_DEC(n)) \\r
+ :BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n)), Value::value) \\r
+ , ((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \\r
+ ?(char)Value::value \\r
+ :0 \\r
+ > \\r
+ type; \\r
+ };\r
+\r
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~)\r
+ #undef M0\r
+\r
+ template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), typename Value>\r
+ struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, Value, false>\r
+ {\r
+ typedef\r
+ mpl::string<\r
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS), C)\r
+ , BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS)), Value::value)\r
+ >\r
+ type;\r
+ };\r
+ };\r
+\r
+ template<typename Tag>\r
+ struct pop_back_impl;\r
+\r
+ template<>\r
+ struct pop_back_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence>\r
+ struct apply;\r
+\r
+ #define M0(z,n,data) \\r
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \\r
+ struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \\r
+ { \\r
+ BOOST_MPL_ASSERT_MSG((C0 != 0), POP_BACK_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \\r
+ typedef \\r
+ mpl::string< \\r
+ BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \\r
+ BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \\r
+ BOOST_MPL_MULTICHAR_POP_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n))) \\r
+ > \\r
+ type; \\r
+ };\r
+\r
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~)\r
+ #undef M0\r
+ };\r
+\r
+ template<typename Tag>\r
+ struct push_front_impl;\r
+\r
+ template<>\r
+ struct push_front_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence, typename Value, bool B = (4==BOOST_MPL_MULTICHAR_LENGTH(Sequence::front_))>\r
+ struct apply\r
+ {\r
+ BOOST_MPL_ASSERT_MSG(\r
+ (BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value)\r
+ , PUSH_FRONT_FAILED_MPL_STRING_IS_FULL\r
+ , (Sequence)\r
+ );\r
+ // If the above assertion didn't fire, then the string is sparse.\r
+ // Repack the string and retry the push_front.\r
+ typedef\r
+ typename mpl::push_front<\r
+ typename mpl::reverse_copy<\r
+ Sequence\r
+ , mpl::front_inserter<string<> >\r
+ >::type\r
+ , Value\r
+ >::type\r
+ type;\r
+ };\r
+\r
+ #if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))\r
+ template<typename Value>\r
+ struct apply<mpl::string<>, Value, false>\r
+ {\r
+ typedef mpl::string<(char)Value::value> type;\r
+ };\r
+ #endif\r
+\r
+ #define M0(z,n,data) \\r
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C), typename Value> \\r
+ struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, Value, true> \\r
+ { \\r
+ typedef \\r
+ mpl::string< \\r
+ (char)Value::value \\r
+ BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, C) \\r
+ > \\r
+ type; \\r
+ };\r
+\r
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~)\r
+ #undef M0\r
+\r
+ template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), typename Value>\r
+ struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, Value, false>\r
+ {\r
+ typedef\r
+ mpl::string<\r
+ BOOST_MPL_MULTICHAR_PUSH_FRONT(C0, Value::value)\r
+ , BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)\r
+ >\r
+ type0;\r
+\r
+ #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))\r
+ typedef\r
+ typename mpl::if_<\r
+ mpl::empty<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> >\r
+ , mpl::string<(char)Value::value>\r
+ , type0\r
+ >::type\r
+ type;\r
+ #else\r
+ typedef type0 type;\r
+ #endif\r
+ };\r
+ };\r
+\r
+ template<typename Tag>\r
+ struct pop_front_impl;\r
+\r
+ template<>\r
+ struct pop_front_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence, bool B = (1==BOOST_MPL_MULTICHAR_LENGTH(Sequence::front_))>\r
+ struct apply;\r
+\r
+ #define M0(z,n,data) \\r
+ template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \\r
+ struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, true> \\r
+ { \\r
+ BOOST_MPL_ASSERT_MSG((C0 != 0), POP_FRONT_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \\r
+ typedef \\r
+ mpl::string<BOOST_PP_ENUM_SHIFTED_PARAMS_Z(z, n, C)> \\r
+ type; \\r
+ };\r
+\r
+ BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~)\r
+ #undef M0\r
+\r
+ template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)>\r
+ struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, false>\r
+ {\r
+ typedef\r
+ mpl::string<\r
+ BOOST_MPL_MULTICHAR_POP_FRONT(C0)\r
+ , BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)\r
+ >\r
+ type;\r
+ };\r
+ };\r
+\r
+ template<typename Tag>\r
+ struct insert_range_impl;\r
+\r
+ template<>\r
+ struct insert_range_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence, typename Pos, typename Range>\r
+ struct apply\r
+ : mpl::copy<\r
+ mpl::joint_view<\r
+ mpl::iterator_range<\r
+ mpl::string_iterator<Sequence, 0, 0>\r
+ , Pos\r
+ >\r
+ , mpl::joint_view<\r
+ Range\r
+ , mpl::iterator_range<\r
+ Pos\r
+ , typename mpl::end<Sequence>::type\r
+ >\r
+ >\r
+ >\r
+ , mpl::back_inserter<mpl::string<> >\r
+ >\r
+ {};\r
+ };\r
+\r
+ template<typename Tag>\r
+ struct insert_impl;\r
+\r
+ template<>\r
+ struct insert_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence, typename Pos, typename Value>\r
+ struct apply\r
+ : mpl::insert_range<Sequence, Pos, mpl::string<(char)Value::value> >\r
+ {};\r
+ };\r
+\r
+ template<typename Tag>\r
+ struct erase_impl;\r
+\r
+ template<>\r
+ struct erase_impl<mpl::string_tag>\r
+ {\r
+ template<typename Sequence, typename First, typename Last>\r
+ struct apply\r
+ : mpl::copy<\r
+ mpl::joint_view<\r
+ mpl::iterator_range<\r
+ mpl::string_iterator<Sequence, 0, 0>\r
+ , First\r
+ >\r
+ , mpl::iterator_range<\r
+ typename mpl::if_na<Last, typename mpl::next<First>::type>::type\r
+ , typename mpl::end<Sequence>::type\r
+ >\r
+ >\r
+ , mpl::back_inserter<mpl::string<> >\r
+ >\r
+ {};\r
+ };\r
+\r
+ template<typename Tag>\r
+ struct clear_impl;\r
+\r
+ template<>\r
+ struct clear_impl<mpl::string_tag>\r
+ {\r
+ template<typename>\r
+ struct apply\r
+ {\r
+ typedef mpl::string<> type;\r
+ };\r
+ };\r
+\r
+ #define M0(z, n, data) \\r
+ template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), int J> \\r
+ struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, J> \\r
+ { \\r
+ enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == J + 1) }; \\r
+ typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \\r
+ typedef std::bidirectional_iterator_tag category; \\r
+ typedef \\r
+ mpl::string_iterator<string, n + eomc_, eomc_ ? 0 : J + 1> \\r
+ next; \\r
+ typedef \\r
+ mpl::string_iterator<string, n, J - 1> \\r
+ prior; \\r
+ typedef mpl::char_<BOOST_MPL_MULTICHAR_AT(BOOST_PP_CAT(C, n), J)> type; \\r
+ }; \\r
+ template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)> \\r
+ struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, 0> \\r
+ { \\r
+ enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == 1) }; \\r
+ typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \\r
+ typedef std::bidirectional_iterator_tag category; \\r
+ typedef \\r
+ mpl::string_iterator<string, n + eomc_, !eomc_> \\r
+ next; \\r
+ typedef \\r
+ mpl::string_iterator< \\r
+ string \\r
+ , n - 1 \\r
+ , BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, BOOST_PP_DEC(n))) - 1 \\r
+ > \\r
+ prior; \\r
+ typedef mpl::char_<BOOST_MPL_MULTICHAR_AT(BOOST_PP_CAT(C, n), 0)> type; \\r
+ };\r
+\r
+ BOOST_PP_REPEAT(BOOST_MPL_STRING_MAX_PARAMS, M0, ~)\r
+ #undef M0\r
+\r
+ template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)>\r
+ struct string\r
+ {\r
+ /// INTERNAL ONLY\r
+ enum\r
+ {\r
+ front_ = C0\r
+ , back_ = BOOST_PP_CAT(C, BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS))\r
+ };\r
+\r
+ typedef char value_type;\r
+ typedef string type;\r
+ typedef string_tag tag;\r
+ };\r
+\r
+ namespace aux_\r
+ {\r
+ template<typename It, typename End>\r
+ struct next_unless\r
+ : mpl::next<It>\r
+ {};\r
+\r
+ template<typename End>\r
+ struct next_unless<End, End>\r
+ {\r
+ typedef End type;\r
+ };\r
+\r
+ template<typename It, typename End>\r
+ struct deref_unless\r
+ : mpl::deref<It>\r
+ {};\r
+\r
+ template<typename End>\r
+ struct deref_unless<End, End>\r
+ {\r
+ typedef mpl::char_<'\0'> type;\r
+ };\r
+ }\r
+\r
+ template<typename Sequence>\r
+ struct c_str\r
+ {\r
+ typedef typename mpl::end<Sequence>::type iend;\r
+ typedef typename mpl::begin<Sequence>::type i0;\r
+ #define M0(z, n, data) \\r
+ typedef \\r
+ typename mpl::aux_::next_unless<BOOST_PP_CAT(i, n), iend>::type \\r
+ BOOST_PP_CAT(i, BOOST_PP_INC(n));\r
+ BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~)\r
+ #undef M0\r
+\r
+ typedef c_str type;\r
+ static typename Sequence::value_type const value[BOOST_MPL_LIMIT_STRING_SIZE+1];\r
+ };\r
+\r
+ template<typename Sequence>\r
+ typename Sequence::value_type const c_str<Sequence>::value[BOOST_MPL_LIMIT_STRING_SIZE+1] =\r
+ {\r
+ #define M0(z, n, data) \\r
+ mpl::aux_::deref_unless<BOOST_PP_CAT(i, n), iend>::type::value,\r
+ BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~)\r
+ #undef M0\r
+ '\0'\r
+ };\r
+\r
+}} // namespace boost\r
+\r
+#endif // BOOST_MPL_STRING_HPP_INCLUDED\r
// See http://www.boost.org/libs/utility/operators.htm for documentation.
// Revision History
+// 07 Aug 08 Added "euclidean" spelling. (Daniel Frey)
+// 03 Apr 08 Make sure "convertible to bool" is sufficient
+// for T::operator<, etc. (Daniel Frey)
// 24 May 07 Changed empty_base to depend on T, see
// http://svn.boost.org/trac/boost/ticket/979
// 21 Oct 02 Modified implementation of operators to allow compilers with a
template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct less_than_comparable2 : B
{
- friend bool operator<=(const T& x, const U& y) { return !(x > y); }
- friend bool operator>=(const T& x, const U& y) { return !(x < y); }
+ friend bool operator<=(const T& x, const U& y) { return !static_cast<bool>(x > y); }
+ friend bool operator>=(const T& x, const U& y) { return !static_cast<bool>(x < y); }
friend bool operator>(const U& x, const T& y) { return y < x; }
friend bool operator<(const U& x, const T& y) { return y > x; }
- friend bool operator<=(const U& x, const T& y) { return !(y < x); }
- friend bool operator>=(const U& x, const T& y) { return !(y > x); }
+ friend bool operator<=(const U& x, const T& y) { return !static_cast<bool>(y < x); }
+ friend bool operator>=(const U& x, const T& y) { return !static_cast<bool>(y > x); }
};
template <class T, class B = ::boost::detail::empty_base<T> >
struct less_than_comparable1 : B
{
friend bool operator>(const T& x, const T& y) { return y < x; }
- friend bool operator<=(const T& x, const T& y) { return !(y < x); }
- friend bool operator>=(const T& x, const T& y) { return !(x < y); }
+ friend bool operator<=(const T& x, const T& y) { return !static_cast<bool>(y < x); }
+ friend bool operator>=(const T& x, const T& y) { return !static_cast<bool>(x < y); }
};
template <class T, class U, class B = ::boost::detail::empty_base<T> >
struct equality_comparable2 : B
{
friend bool operator==(const U& y, const T& x) { return x == y; }
- friend bool operator!=(const U& y, const T& x) { return !(x == y); }
- friend bool operator!=(const T& y, const U& x) { return !(y == x); }
+ friend bool operator!=(const U& y, const T& x) { return !static_cast<bool>(x == y); }
+ friend bool operator!=(const T& y, const U& x) { return !static_cast<bool>(y == x); }
};
template <class T, class B = ::boost::detail::empty_base<T> >
struct equality_comparable1 : B
{
- friend bool operator!=(const T& x, const T& y) { return !(x == y); }
+ friend bool operator!=(const T& x, const T& y) { return !static_cast<bool>(x == y); }
};
// A macro which produces "name_2left" from "name".
{
friend bool operator==(const T& x, const U& y)
{
- return !(x < y) && !(x > y);
+ return !static_cast<bool>(x < y) && !static_cast<bool>(x > y);
}
};
{
friend bool operator==(const T&x, const T&y)
{
- return !(x < y) && !(y < x);
+ return !static_cast<bool>(x < y) && !static_cast<bool>(y < x);
}
};
struct partially_ordered2 : B
{
friend bool operator<=(const T& x, const U& y)
- { return (x < y) || (x == y); }
+ { return static_cast<bool>(x < y) || static_cast<bool>(x == y); }
friend bool operator>=(const T& x, const U& y)
- { return (x > y) || (x == y); }
+ { return static_cast<bool>(x > y) || static_cast<bool>(x == y); }
friend bool operator>(const U& x, const T& y)
{ return y < x; }
friend bool operator<(const U& x, const T& y)
{ return y > x; }
friend bool operator<=(const U& x, const T& y)
- { return (y > x) || (y == x); }
+ { return static_cast<bool>(y > x) || static_cast<bool>(y == x); }
friend bool operator>=(const U& x, const T& y)
- { return (y < x) || (y == x); }
+ { return static_cast<bool>(y < x) || static_cast<bool>(y == x); }
};
template <class T, class B = ::boost::detail::empty_base<T> >
friend bool operator>(const T& x, const T& y)
{ return y < x; }
friend bool operator<=(const T& x, const T& y)
- { return (x < y) || (x == y); }
+ { return static_cast<bool>(x < y) || static_cast<bool>(x == y); }
friend bool operator>=(const T& x, const T& y)
- { return (y < x) || (x == y); }
+ { return static_cast<bool>(y < x) || static_cast<bool>(x == y); }
};
// Combined operator classes (contributed by Daryle Walker) ----------------//
: totally_ordered1<T
, euclidian_ring_operators1<T, B
> > {};
-
+
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
+struct euclidean_ring_operators2
+ : ring_operators2<T, U
+ , dividable2<T, U
+ , dividable2_left<T, U
+ , modable2<T, U
+ , modable2_left<T, U, B
+ > > > > > {};
+
+template <class T, class B = ::boost::detail::empty_base<T> >
+struct euclidean_ring_operators1
+ : ring_operators1<T
+ , dividable1<T
+ , modable1<T, B
+ > > > {};
+
+template <class T, class U, class B = ::boost::detail::empty_base<T> >
+struct ordered_euclidean_ring_operators2
+ : totally_ordered2<T, U
+ , euclidean_ring_operators2<T, U, B
+ > > {};
+
+template <class T, class B = ::boost::detail::empty_base<T> >
+struct ordered_euclidean_ring_operators1
+ : totally_ordered1<T
+ , euclidean_ring_operators1<T, B
+ > > {};
+
template <class T, class P, class B = ::boost::detail::empty_base<T> >
struct input_iteratable
: equality_comparable1<T
BOOST_OPERATOR_TEMPLATE(ordered_field_operators)
BOOST_OPERATOR_TEMPLATE(euclidian_ring_operators)
BOOST_OPERATOR_TEMPLATE(ordered_euclidian_ring_operators)
+BOOST_OPERATOR_TEMPLATE(euclidean_ring_operators)
+BOOST_OPERATOR_TEMPLATE(ordered_euclidean_ring_operators)
BOOST_OPERATOR_TEMPLATE2(input_iteratable)
BOOST_OPERATOR_TEMPLATE1(output_iteratable)
BOOST_OPERATOR_TEMPLATE2(forward_iteratable)
-// (C) Copyright Jeremy Siek 1999-2001.
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
+/*=============================================================================
+Copyright (c) 2009 Trustees of Indiana University
-// See http://www.boost.org/libs/property_map for documentation.
+Distributed under the Boost Software License, Version 1.0. (See accompanying
+file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+// Redirect/warning header, adapted from the version in Spirit
-#ifndef BOOST_PROPERTY_MAP_HPP
-#define BOOST_PROPERTY_MAP_HPP
+#include <boost/version.hpp>
-#include <cassert>
-#include <boost/config.hpp>
-#include <boost/pending/cstddef.hpp>
-#include <boost/detail/iterator.hpp>
-#include <boost/concept_check.hpp>
-#include <boost/concept_archetype.hpp>
-#include <boost/mpl/assert.hpp>
-#include <boost/mpl/or.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-namespace boost {
-
- //=========================================================================
- // property_traits class
-
- template <typename PA>
- struct property_traits {
- typedef typename PA::key_type key_type;
- typedef typename PA::value_type value_type;
- typedef typename PA::reference reference;
- typedef typename PA::category category;
- };
-
- //=========================================================================
- // property_traits category tags
-
- namespace detail {
- enum ePropertyMapID { READABLE_PA, WRITABLE_PA,
- READ_WRITE_PA, LVALUE_PA, OP_BRACKET_PA,
- RAND_ACCESS_ITER_PA, LAST_PA };
- }
- struct readable_property_map_tag { enum { id = detail::READABLE_PA }; };
- struct writable_property_map_tag { enum { id = detail::WRITABLE_PA }; };
- struct read_write_property_map_tag :
- public readable_property_map_tag,
- public writable_property_map_tag
- { enum { id = detail::READ_WRITE_PA }; };
-
- struct lvalue_property_map_tag : public read_write_property_map_tag
- { enum { id = detail::LVALUE_PA }; };
-
- //=========================================================================
- // property_traits specialization for pointers
-
-#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
- // The user will just have to create their own specializations for
- // other pointers types if the compiler does not have partial
- // specializations. Sorry!
-#define BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(TYPE) \
- template <> \
- struct property_traits<TYPE*> { \
- typedef TYPE value_type; \
- typedef value_type& reference; \
- typedef std::ptrdiff_t key_type; \
- typedef lvalue_property_map_tag category; \
- }; \
- template <> \
- struct property_traits<const TYPE*> { \
- typedef TYPE value_type; \
- typedef const value_type& reference; \
- typedef std::ptrdiff_t key_type; \
- typedef lvalue_property_map_tag category; \
- }
-
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(long);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned long);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(int);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned int);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(short);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned short);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(char);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned char);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(signed char);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(bool);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(float);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(double);
- BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(long double);
-
- // This may need to be turned off for some older compilers that don't have
- // wchar_t intrinsically.
-# ifndef BOOST_NO_INTRINSIC_WCHAR_T
- template <>
- struct property_traits<wchar_t*> {
- typedef wchar_t value_type;
- typedef value_type& reference;
- typedef std::ptrdiff_t key_type;
- typedef lvalue_property_map_tag category;
- };
- template <>
- struct property_traits<const wchar_t*> {
- typedef wchar_t value_type;
- typedef const value_type& reference;
- typedef std::ptrdiff_t key_type;
- typedef lvalue_property_map_tag category;
- };
-# endif
-
-#else
- template <class T>
- struct property_traits<T*> {
- typedef T value_type;
- typedef value_type& reference;
- typedef std::ptrdiff_t key_type;
- typedef lvalue_property_map_tag category;
- };
- template <class T>
- struct property_traits<const T*> {
- typedef T value_type;
- typedef const value_type& reference;
- typedef std::ptrdiff_t key_type;
- typedef lvalue_property_map_tag category;
- };
-#endif
-
-#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.
-} // namespace boost
-#endif
-
- // These need to go in global namespace because Koenig
- // lookup does not apply to T*.
-
- // V must be convertible to T
- template <class T, class V>
- inline void put(T* pa, std::ptrdiff_t k, const V& val) { pa[k] = val; }
-
- template <class T>
- inline const T& get(const T* pa, std::ptrdiff_t k) { return pa[k]; }
-
-#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
-namespace boost {
- using ::put;
- using ::get;
-#endif
-
- //=========================================================================
- // concept checks for property maps
-
- template <class PMap, class Key>
- struct ReadablePropertyMapConcept
- {
- typedef typename property_traits<PMap>::key_type key_type;
- typedef typename property_traits<PMap>::reference reference;
- typedef typename property_traits<PMap>::category Category;
- typedef boost::readable_property_map_tag ReadableTag;
- void constraints() {
- function_requires< ConvertibleConcept<Category, ReadableTag> >();
-
- val = get(pmap, k);
- }
- PMap pmap;
- Key k;
- typename property_traits<PMap>::value_type val;
- };
- template <typename KeyArchetype, typename ValueArchetype>
- struct readable_property_map_archetype {
- typedef KeyArchetype key_type;
- typedef ValueArchetype value_type;
- typedef convertible_to_archetype<ValueArchetype> reference;
- typedef readable_property_map_tag category;
- };
- template <typename K, typename V>
- const typename readable_property_map_archetype<K,V>::reference&
- get(const readable_property_map_archetype<K,V>&,
- const typename readable_property_map_archetype<K,V>::key_type&)
- {
- typedef typename readable_property_map_archetype<K,V>::reference R;
- return static_object<R>::get();
- }
-
-
- template <class PMap, class Key>
- struct WritablePropertyMapConcept
- {
- typedef typename property_traits<PMap>::key_type key_type;
- typedef typename property_traits<PMap>::category Category;
- typedef boost::writable_property_map_tag WritableTag;
- void constraints() {
- function_requires< ConvertibleConcept<Category, WritableTag> >();
- put(pmap, k, val);
- }
- PMap pmap;
- Key k;
- typename property_traits<PMap>::value_type val;
- };
- template <typename KeyArchetype, typename ValueArchetype>
- struct writable_property_map_archetype {
- typedef KeyArchetype key_type;
- typedef ValueArchetype value_type;
- typedef void reference;
- typedef writable_property_map_tag category;
- };
- template <typename K, typename V>
- void put(const writable_property_map_archetype<K,V>&,
- const typename writable_property_map_archetype<K,V>::key_type&,
- const typename writable_property_map_archetype<K,V>::value_type&) { }
-
-
- template <class PMap, class Key>
- struct ReadWritePropertyMapConcept
- {
- typedef typename property_traits<PMap>::category Category;
- typedef boost::read_write_property_map_tag ReadWriteTag;
- void constraints() {
- function_requires< ReadablePropertyMapConcept<PMap, Key> >();
- function_requires< WritablePropertyMapConcept<PMap, Key> >();
- function_requires< ConvertibleConcept<Category, ReadWriteTag> >();
- }
- };
- template <typename KeyArchetype, typename ValueArchetype>
- struct read_write_property_map_archetype
- : public readable_property_map_archetype<KeyArchetype, ValueArchetype>,
- public writable_property_map_archetype<KeyArchetype, ValueArchetype>
- {
- typedef KeyArchetype key_type;
- typedef ValueArchetype value_type;
- typedef convertible_to_archetype<ValueArchetype> reference;
- typedef read_write_property_map_tag category;
- };
-
-
- template <class PMap, class Key>
- struct LvaluePropertyMapConcept
- {
- typedef typename property_traits<PMap>::category Category;
- typedef boost::lvalue_property_map_tag LvalueTag;
- typedef typename property_traits<PMap>::reference reference;
-
- void constraints() {
- function_requires< ReadablePropertyMapConcept<PMap, Key> >();
- function_requires< ConvertibleConcept<Category, LvalueTag> >();
-
- typedef typename property_traits<PMap>::value_type value_type;
- BOOST_MPL_ASSERT((boost::mpl::or_<
- boost::is_same<const value_type&, reference>,
- boost::is_same<value_type&, reference> >));
-
- reference ref = pmap[k];
- ignore_unused_variable_warning(ref);
- }
- PMap pmap;
- Key k;
- };
- template <typename KeyArchetype, typename ValueArchetype>
- struct lvalue_property_map_archetype
- : public readable_property_map_archetype<KeyArchetype, ValueArchetype>
- {
- typedef KeyArchetype key_type;
- typedef ValueArchetype value_type;
- typedef const ValueArchetype& reference;
- typedef lvalue_property_map_tag category;
- const value_type& operator[](const key_type&) const {
- return static_object<value_type>::get();
- }
- };
-
- template <class PMap, class Key>
- struct Mutable_LvaluePropertyMapConcept
- {
- typedef typename property_traits<PMap>::category Category;
- typedef boost::lvalue_property_map_tag LvalueTag;
- typedef typename property_traits<PMap>::reference reference;
- void constraints() {
- boost::function_requires< ReadWritePropertyMapConcept<PMap, Key> >();
- boost::function_requires<ConvertibleConcept<Category, LvalueTag> >();
-
- typedef typename property_traits<PMap>::value_type value_type;
- BOOST_MPL_ASSERT((boost::is_same<value_type&, reference>));
-
- reference ref = pmap[k];
- ignore_unused_variable_warning(ref);
- }
- PMap pmap;
- Key k;
- };
- template <typename KeyArchetype, typename ValueArchetype>
- struct mutable_lvalue_property_map_archetype
- : public readable_property_map_archetype<KeyArchetype, ValueArchetype>,
- public writable_property_map_archetype<KeyArchetype, ValueArchetype>
- {
- typedef KeyArchetype key_type;
- typedef ValueArchetype value_type;
- typedef ValueArchetype& reference;
- typedef lvalue_property_map_tag category;
- value_type& operator[](const key_type&) const {
- return static_object<value_type>::get();
- }
- };
-
- struct identity_property_map;
-
- // A helper class for constructing a property map
- // from a class that implements operator[]
-
- template <class Reference, class LvaluePropertyMap>
- struct put_get_helper { };
-
- template <class PropertyMap, class Reference, class K>
- inline Reference
- get(const put_get_helper<Reference, PropertyMap>& pa, const K& k)
- {
- Reference v = static_cast<const PropertyMap&>(pa)[k];
- return v;
- }
- template <class PropertyMap, class Reference, class K, class V>
- inline void
- put(const put_get_helper<Reference, PropertyMap>& pa, K k, const V& v)
- {
- static_cast<const PropertyMap&>(pa)[k] = v;
- }
-
- //=========================================================================
- // Adapter to turn a RandomAccessIterator into a property map
-
- template <class RandomAccessIterator,
- class IndexMap
-#ifdef BOOST_NO_STD_ITERATOR_TRAITS
- , class T, class R
-#else
- , class T = typename std::iterator_traits<RandomAccessIterator>::value_type
- , class R = typename std::iterator_traits<RandomAccessIterator>::reference
-#endif
- >
- class iterator_property_map
- : public boost::put_get_helper< R,
- iterator_property_map<RandomAccessIterator, IndexMap,
- T, R> >
- {
- public:
- typedef typename property_traits<IndexMap>::key_type key_type;
- typedef T value_type;
- typedef R reference;
- typedef boost::lvalue_property_map_tag category;
-
- inline iterator_property_map(
- RandomAccessIterator cc = RandomAccessIterator(),
- const IndexMap& _id = IndexMap() )
- : iter(cc), index(_id) { }
- inline R operator[](key_type v) const { return *(iter + get(index, v)) ; }
- protected:
- RandomAccessIterator iter;
- IndexMap index;
- };
-
-#if !defined BOOST_NO_STD_ITERATOR_TRAITS
- template <class RAIter, class ID>
- inline iterator_property_map<
- RAIter, ID,
- typename std::iterator_traits<RAIter>::value_type,
- typename std::iterator_traits<RAIter>::reference>
- make_iterator_property_map(RAIter iter, ID id) {
- function_requires< RandomAccessIteratorConcept<RAIter> >();
- typedef iterator_property_map<
- RAIter, ID,
- typename std::iterator_traits<RAIter>::value_type,
- typename std::iterator_traits<RAIter>::reference> PA;
- return PA(iter, id);
- }
+#if BOOST_VERSION >= 103800
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
+# pragma message ("Warning: This header is deprecated. Please use: boost/property_map/property_map.hpp")
+#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
+# warning "This header is deprecated. Please use: boost/property_map/property_map.hpp"
#endif
- template <class RAIter, class Value, class ID>
- inline iterator_property_map<RAIter, ID, Value, Value&>
- make_iterator_property_map(RAIter iter, ID id, Value) {
- function_requires< RandomAccessIteratorConcept<RAIter> >();
- typedef iterator_property_map<RAIter, ID, Value, Value&> PMap;
- return PMap(iter, id);
- }
-
- template <class RandomAccessIterator,
- class IndexMap
-#ifdef BOOST_NO_STD_ITERATOR_TRAITS
- , class T, class R
-#else
- , class T = typename std::iterator_traits<RandomAccessIterator>::value_type
- , class R = typename std::iterator_traits<RandomAccessIterator>::reference
-#endif
- >
- class safe_iterator_property_map
- : public boost::put_get_helper< R,
- safe_iterator_property_map<RandomAccessIterator, IndexMap,
- T, R> >
- {
- public:
- typedef typename property_traits<IndexMap>::key_type key_type;
- typedef T value_type;
- typedef R reference;
- typedef boost::lvalue_property_map_tag category;
-
- inline safe_iterator_property_map(
- RandomAccessIterator first,
- std::size_t n_ = 0,
- const IndexMap& _id = IndexMap() )
- : iter(first), n(n_), index(_id) { }
- inline safe_iterator_property_map() { }
- inline R operator[](key_type v) const {
- assert(get(index, v) < n);
- return *(iter + get(index, v)) ;
- }
- typename property_traits<IndexMap>::value_type size() const { return n; }
- protected:
- RandomAccessIterator iter;
- typename property_traits<IndexMap>::value_type n;
- IndexMap index;
- };
-
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
- template <class RAIter, class ID>
- inline safe_iterator_property_map<
- RAIter, ID,
- typename boost::detail::iterator_traits<RAIter>::value_type,
- typename boost::detail::iterator_traits<RAIter>::reference>
- make_safe_iterator_property_map(RAIter iter, std::size_t n, ID id) {
- function_requires< RandomAccessIteratorConcept<RAIter> >();
- typedef safe_iterator_property_map<
- RAIter, ID,
- typename boost::detail::iterator_traits<RAIter>::value_type,
- typename boost::detail::iterator_traits<RAIter>::reference> PA;
- return PA(iter, n, id);
- }
#endif
- template <class RAIter, class Value, class ID>
- inline safe_iterator_property_map<RAIter, ID, Value, Value&>
- make_safe_iterator_property_map(RAIter iter, std::size_t n, ID id, Value) {
- function_requires< RandomAccessIteratorConcept<RAIter> >();
- typedef safe_iterator_property_map<RAIter, ID, Value, Value&> PMap;
- return PMap(iter, n, id);
- }
-
- //=========================================================================
- // An adaptor to turn a Unique Pair Associative Container like std::map or
- // std::hash_map into an Lvalue Property Map.
-
- template <typename UniquePairAssociativeContainer>
- class associative_property_map
- : public boost::put_get_helper<
- typename UniquePairAssociativeContainer::value_type::second_type&,
- associative_property_map<UniquePairAssociativeContainer> >
- {
- typedef UniquePairAssociativeContainer C;
- public:
- typedef typename C::key_type key_type;
- typedef typename C::value_type::second_type value_type;
- typedef value_type& reference;
- typedef lvalue_property_map_tag category;
- associative_property_map() : m_c(0) { }
- associative_property_map(C& c) : m_c(&c) { }
- reference operator[](const key_type& k) const {
- return (*m_c)[k];
- }
- private:
- C* m_c;
- };
-
- template <class UniquePairAssociativeContainer>
- associative_property_map<UniquePairAssociativeContainer>
- make_assoc_property_map(UniquePairAssociativeContainer& c)
- {
- return associative_property_map<UniquePairAssociativeContainer>(c);
- }
-
- template <typename UniquePairAssociativeContainer>
- class const_associative_property_map
- : public boost::put_get_helper<
- const typename UniquePairAssociativeContainer::value_type::second_type&,
- const_associative_property_map<UniquePairAssociativeContainer> >
- {
- typedef UniquePairAssociativeContainer C;
- public:
- typedef typename C::key_type key_type;
- typedef typename C::value_type::second_type value_type;
- typedef const value_type& reference;
- typedef lvalue_property_map_tag category;
- const_associative_property_map() : m_c(0) { }
- const_associative_property_map(const C& c) : m_c(&c) { }
- reference operator[](const key_type& k) const {
- return m_c->find(k)->second;
- }
- private:
- C const* m_c;
- };
-
- template <class UniquePairAssociativeContainer>
- const_associative_property_map<UniquePairAssociativeContainer>
- make_assoc_property_map(const UniquePairAssociativeContainer& c)
- {
- return const_associative_property_map<UniquePairAssociativeContainer>(c);
- }
-
- //=========================================================================
- // A property map that always returns a reference to the same object.
- //
-template <typename KeyType, typename ValueType>
-class ref_property_map :
- public
- boost::put_get_helper<ValueType&,ref_property_map<KeyType,ValueType> >
-{
- ValueType* value;
-public:
- typedef KeyType key_type;
- typedef ValueType value_type;
- typedef ValueType& reference;
- typedef lvalue_property_map_tag category;
- ref_property_map(ValueType& v) : value(&v) {}
- ValueType& operator[](key_type const&) const { return *value; }
-
-};
-
-
- //=========================================================================
- // A property map that applies the identity function to integers
- struct identity_property_map
- : public boost::put_get_helper<std::size_t,
- identity_property_map>
- {
- typedef std::size_t key_type;
- typedef std::size_t value_type;
- typedef std::size_t reference;
- typedef boost::readable_property_map_tag category;
-
- inline value_type operator[](const key_type& v) const { return v; }
- };
-
- //=========================================================================
- // A property map that does not do anything, for
- // when you have to supply a property map, but don't need it.
- namespace detail {
- struct dummy_pmap_reference {
- template <class T>
- dummy_pmap_reference& operator=(const T&) { return *this; }
- operator int() { return 0; }
- };
- }
- class dummy_property_map
- : public boost::put_get_helper<detail::dummy_pmap_reference,
- dummy_property_map >
- {
- public:
- typedef void key_type;
- typedef int value_type;
- typedef detail::dummy_pmap_reference reference;
- typedef boost::read_write_property_map_tag category;
- inline dummy_property_map() : c(0) { }
- inline dummy_property_map(value_type cc) : c(cc) { }
- inline dummy_property_map(const dummy_property_map& x)
- : c(x.c) { }
- template <class Vertex>
- inline reference operator[](Vertex) const { return reference(); }
- protected:
- value_type c;
- };
-
-
-} // namespace boost
-
-
-#endif /* BOOST_PROPERTY_MAP_HPP */
+#include <boost/property_map/property_map.hpp>
-// (C) Copyright Jeremy Siek, 2001.
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
+/*=============================================================================
+Copyright (c) 2009 Trustees of Indiana University
-// See http://www.boost.org/libs/property_map for documentation.
+Distributed under the Boost Software License, Version 1.0. (See accompanying
+file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+// Redirect/warning header, adapted from the version in Spirit
-#ifndef BOOST_PROPERTY_MAP_ITERATOR_HPP
-#define BOOST_PROPERTY_MAP_ITERATOR_HPP
+#include <boost/version.hpp>
-#include <boost/property_map.hpp>
-#include <boost/iterator/iterator_adaptor.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-namespace boost {
-
- //======================================================================
- // property iterator, generalized from ideas by François Faure
-
- namespace detail {
-
- template <class Iterator, class LvaluePropertyMap>
- class lvalue_pmap_iter
- : public iterator_adaptor< lvalue_pmap_iter< Iterator, LvaluePropertyMap >,
- Iterator,
- typename property_traits<LvaluePropertyMap>::value_type,
- use_default,
- typename property_traits<LvaluePropertyMap>::reference>
- {
- friend class boost::iterator_core_access;
-
- typedef iterator_adaptor< lvalue_pmap_iter< Iterator, LvaluePropertyMap >,
- Iterator,
- typename property_traits<LvaluePropertyMap>::value_type,
- use_default,
- typename property_traits<LvaluePropertyMap>::reference> super_t;
-
- public:
- lvalue_pmap_iter() { }
- lvalue_pmap_iter(Iterator const& it,
- LvaluePropertyMap m)
- : super_t(it),
- m_map(m) {}
-
- private:
- typename super_t::reference
- dereference() const
- {
- return m_map[*(this->base_reference())];
- }
-
- LvaluePropertyMap m_map;
- };
-
- template <class Iterator, class ReadablePropertyMap>
- class readable_pmap_iter :
- public iterator_adaptor< readable_pmap_iter< Iterator, ReadablePropertyMap >,
- Iterator,
- typename property_traits<ReadablePropertyMap>::value_type,
- use_default,
- typename property_traits<ReadablePropertyMap>::value_type>
-
-
- {
- friend class boost::iterator_core_access;
-
- typedef iterator_adaptor< readable_pmap_iter< Iterator, ReadablePropertyMap >,
- Iterator,
- typename property_traits<ReadablePropertyMap>::value_type,
- use_default,
- typename property_traits<ReadablePropertyMap>::value_type> super_t;
-
- public:
- readable_pmap_iter() { }
- readable_pmap_iter(Iterator const& it,
- ReadablePropertyMap m)
- : super_t(it),
- m_map(m) {}
-
- private:
- typename super_t::reference
- dereference() const
- {
- return get(m_map, *(this->base_reference()));
- }
-
- ReadablePropertyMap m_map;
- };
-
-
- } // namespace detail
-
- template <class PropertyMap, class Iterator>
- struct property_map_iterator_generator :
- mpl::if_< is_same< typename property_traits<PropertyMap>::category, lvalue_property_map_tag>,
- detail::lvalue_pmap_iter<Iterator, PropertyMap>,
- detail::readable_pmap_iter<Iterator, PropertyMap> >
- {};
-
- template <class PropertyMap, class Iterator>
- typename property_map_iterator_generator<PropertyMap, Iterator>::type
- make_property_map_iterator(PropertyMap pmap, Iterator iter)
- {
- typedef typename property_map_iterator_generator<PropertyMap,
- Iterator>::type Iter;
- return Iter(iter, pmap);
- }
-
-} // namespace boost
-
-#endif // BOOST_PROPERTY_MAP_ITERATOR_HPP
+#if BOOST_VERSION >= 103800
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
+# pragma message ("Warning: This header is deprecated. Please use: boost/property_map/property_map_iterator.hpp")
+#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
+# warning "This header is deprecated. Please use: boost/property_map/property_map_iterator.hpp"
+#endif
+#endif
+#include <boost/property_map/property_map_iterator.hpp>
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+template <class T> inline typename unwrap_reference<T>::type&
+unwrap_ref(T& t)
+{
+ return t;
+}
+
template<class T> inline T* get_pointer( reference_wrapper<T> const & r )
{
return r.get_pointer();
m_string = m_char + m_sub;\r
ignore_unused_variable_warning(m_string);\r
\r
+ // Named sub-expressions:\r
+ m_sub = m_cresults[&m_char];\r
+ ignore_unused_variable_warning(m_sub);\r
+ m_sub = m_cresults[m_string];\r
+ ignore_unused_variable_warning(m_sub);\r
+ m_sub = m_cresults[""];\r
+ ignore_unused_variable_warning(m_sub);\r
+ m_sub = m_cresults[std::string("")];\r
+ ignore_unused_variable_warning(m_sub);\r
+ m_string = m_cresults.str(&m_char);\r
+ ignore_unused_variable_warning(m_string);\r
+ m_string = m_cresults.str(m_string);\r
+ ignore_unused_variable_warning(m_string);\r
+ m_string = m_cresults.str("");\r
+ ignore_unused_variable_warning(m_string);\r
+ m_string = m_cresults.str(std::string(""));\r
+ ignore_unused_variable_warning(m_string);\r
+\r
+ typename match_results_type::difference_type diff;\r
+ diff = m_cresults.length(&m_char);\r
+ ignore_unused_variable_warning(diff);\r
+ diff = m_cresults.length(m_string);\r
+ ignore_unused_variable_warning(diff);\r
+ diff = m_cresults.length("");\r
+ ignore_unused_variable_warning(diff);\r
+ diff = m_cresults.length(std::string(""));\r
+ ignore_unused_variable_warning(diff);\r
+ diff = m_cresults.position(&m_char);\r
+ ignore_unused_variable_warning(diff);\r
+ diff = m_cresults.position(m_string);\r
+ ignore_unused_variable_warning(diff);\r
+ diff = m_cresults.position("");\r
+ ignore_unused_variable_warning(diff);\r
+ diff = m_cresults.position(std::string(""));\r
+ ignore_unused_variable_warning(diff);\r
+\r
#ifndef BOOST_NO_STD_LOCALE\r
m_stream << m_sub;\r
m_stream << m_cresults;\r
# pragma warning(push)
# pragma warning(disable : 4251 4231 4660)
# endif
-# ifdef _DLL
+# if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
# include <string>
extern template class __declspec(dllimport) std::basic_string<unsigned short>;
# endif
offset_underscore = U_CHAR_CATEGORY_COUNT+3,\r
offset_unicode = U_CHAR_CATEGORY_COUNT+4,\r
offset_any = U_CHAR_CATEGORY_COUNT+5,\r
- offset_ascii = U_CHAR_CATEGORY_COUNT+6\r
+ offset_ascii = U_CHAR_CATEGORY_COUNT+6,\r
+ offset_horizontal = U_CHAR_CATEGORY_COUNT+7,\r
+ offset_vertical = U_CHAR_CATEGORY_COUNT+8\r
};\r
\r
//\r
static const char_class_type mask_unicode;\r
static const char_class_type mask_any;\r
static const char_class_type mask_ascii;\r
+ static const char_class_type mask_horizontal;\r
+ static const char_class_type mask_vertical;\r
\r
static char_class_type lookup_icu_mask(const ::UChar32* p1, const ::UChar32* p2);\r
\r
boost::regex_constants::syntax_option_type opt, \r
const boost::mpl::int_<4>*)\r
{\r
- typedef std::vector<UCHAR32> vector_type;\r
+ typedef std::vector<UChar32> vector_type;\r
vector_type v;\r
while(i != j)\r
{\r
- v.push_back((UCHAR32)(*i));\r
- ++a;\r
+ v.push_back((UChar32)(*i));\r
+ ++i;\r
}\r
if(v.size())\r
return u32regex(&*v.begin(), v.size(), opt);\r
#ifndef BOOST_REGEX_V4_BASIC_REGEX_HPP
#define BOOST_REGEX_V4_BASIC_REGEX_HPP
+#include <boost/type_traits/is_same.hpp>
+#include <boost/functional/hash.hpp>
+
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
template <class charT, class traits>
class basic_regex_parser;
+template <class I>
+void bubble_down_one(I first, I last)
+{
+ if(first != last)
+ {
+ I next = last - 1;
+ while((next != first) && !(*(next-1) < *next))
+ {
+ (next-1)->swap(*next);
+ --next;
+ }
+ }
+}
+
+//
+// Class named_subexpressions
+// Contains information about named subexpressions within the regex.
+//
+template <class charT>
+class named_subexpressions_base
+{
+public:
+ virtual int get_id(const charT* i, const charT* j)const = 0;
+ virtual int get_id(std::size_t hash)const = 0;
+#ifdef __GNUC__
+ // warning supression:
+ virtual ~named_subexpressions_base(){}
+#endif
+};
+
+template <class Iterator>
+inline std::size_t hash_value_from_capture_name(Iterator i, Iterator j)
+{
+ std::size_t r = boost::hash_range(i, j);
+ r %= ((std::numeric_limits<int>::max)() - 10001);
+ r += 10000;
+ return r;
+}
+
+template <class charT>
+class named_subexpressions : public named_subexpressions_base<charT>
+{
+ struct name
+ {
+ name(const charT* i, const charT* j, int idx)
+ : /*n(i, j), */ index(idx)
+ {
+ hash = hash_value_from_capture_name(i, j);
+ }
+ name(std::size_t h, int idx)
+ : index(idx), hash(h)
+ {
+ }
+ //std::vector<charT> n;
+ int index;
+ std::size_t hash;
+ bool operator < (const name& other)const
+ {
+ return hash < other.hash; //std::lexicographical_compare(n.begin(), n.end(), other.n.begin(), other.n.end());
+ }
+ bool operator == (const name& other)const
+ {
+ return hash == other.hash; //n == other.n;
+ }
+ void swap(name& other)
+ {
+ //n.swap(other.n);
+ std::swap(index, other.index);
+ std::swap(hash, other.hash);
+ }
+ };
+public:
+ named_subexpressions(){}
+ void set_name(const charT* i, const charT* j, int index)
+ {
+ m_sub_names.push_back(name(i, j, index));
+ bubble_down_one(m_sub_names.begin(), m_sub_names.end());
+ }
+ int get_id(const charT* i, const charT* j)const
+ {
+ name t(i, j, 0);
+ typename std::vector<name>::const_iterator pos = std::lower_bound(m_sub_names.begin(), m_sub_names.end(), t);
+ if((pos != m_sub_names.end()) && (*pos == t))
+ {
+ return pos->index;
+ }
+ return -1;
+ }
+ int get_id(std::size_t h)const
+ {
+ name t(h, 0);
+ typename std::vector<name>::const_iterator pos = std::lower_bound(m_sub_names.begin(), m_sub_names.end(), t);
+ if((pos != m_sub_names.end()) && (*pos == t))
+ {
+ return pos->index;
+ }
+ return -1;
+ }
+private:
+ std::vector<name> m_sub_names;
+};
+
+template <class charT, class Other>
+class named_subexpressions_converter : public named_subexpressions_base<charT>
+{
+ boost::shared_ptr<named_subexpressions<Other> > m_converter;
+public:
+ named_subexpressions_converter(boost::shared_ptr<named_subexpressions<Other> > s)
+ : m_converter(s) {}
+ int get_id(const charT* i, const charT* j)const
+ {
+ if(i == j)
+ return -1;
+ std::vector<Other> v;
+ while(i != j)
+ {
+ v.push_back(*i);
+ ++i;
+ }
+ return m_converter->get_id(&v[0], &v[0] + v.size());
+ }
+ int get_id(std::size_t h)const
+ {
+ return m_converter->get_id(h);
+ }
+};
+
+template <class To>
+inline boost::shared_ptr<named_subexpressions_base<To> > convert_to_named_subs_imp(
+ boost::shared_ptr<named_subexpressions<To> > s,
+ boost::integral_constant<bool,true> const&)
+{
+ return s;
+}
+template <class To, class From>
+inline boost::shared_ptr<named_subexpressions_base<To> > convert_to_named_subs_imp(
+ boost::shared_ptr<named_subexpressions<From> > s,
+ boost::integral_constant<bool,false> const&)
+{
+ return boost::shared_ptr<named_subexpressions_converter<To, From> >(new named_subexpressions_converter<To, From>(s));
+}
+template <class To, class From>
+inline boost::shared_ptr<named_subexpressions_base<To> > convert_to_named_subs(
+ boost::shared_ptr<named_subexpressions<From> > s)
+{
+ typedef typename boost::is_same<To, From>::type tag_type;
+ return convert_to_named_subs_imp<To>(s, tag_type());
+}
//
// class regex_data:
// represents the data we wish to expose to the matching algorithms.
//
template <class charT, class traits>
-struct regex_data
+struct regex_data : public named_subexpressions<charT>
{
typedef regex_constants::syntax_option_type flag_type;
typedef std::size_t size_type;
std::vector<
std::pair<
std::size_t, std::size_t> > m_subs; // Position of sub-expressions within the *string*.
+ bool m_has_recursions; // whether we have recursive expressions;
};
//
// class basic_regex_implementation
BOOST_ASSERT(0 != m_pimpl.get());
return m_pimpl->get_data();
}
+ boost::shared_ptr<re_detail::named_subexpressions<charT> > get_named_subs()const
+ {
+ return m_pimpl;
+ }
private:
shared_ptr<re_detail::basic_regex_implementation<charT, traits> > m_pimpl;
bool m_has_backrefs; // true if there are actually any backrefs
unsigned m_backrefs; // bitmask of permitted backrefs
boost::uintmax_t m_bad_repeats; // bitmask of repeats we can't deduce a startmap for;
+ bool m_has_recursions; // set when we have recursive expresisons to fixup
typename traits::char_class_type m_word_mask; // mask used to determine if a character is a word character
typename traits::char_class_type m_mask_space; // mask used to determine if a character is a word character
typename traits::char_class_type m_lower_mask; // mask used to determine if a character is a lowercase character
basic_regex_creator(const basic_regex_creator&);
void fixup_pointers(re_syntax_base* state);
+ void fixup_recursions(re_syntax_base* state);
void create_startmaps(re_syntax_base* state);
int calculate_backstep(re_syntax_base* state);
void create_startmap(re_syntax_base* state, unsigned char* l_map, unsigned int* pnull, unsigned char mask);
template <class charT, class traits>
basic_regex_creator<charT, traits>::basic_regex_creator(regex_data<charT, traits>* data)
- : m_pdata(data), m_traits(*(data->m_ptraits)), m_last_state(0), m_repeater_id(0), m_has_backrefs(false), m_backrefs(0)
+ : m_pdata(data), m_traits(*(data->m_ptraits)), m_last_state(0), m_repeater_id(0), m_has_backrefs(false), m_backrefs(0), m_has_recursions(false)
{
m_pdata->m_data.clear();
m_pdata->m_status = ::boost::regex_constants::error_ok;
m_pdata->m_first_state = static_cast<re_syntax_base*>(m_pdata->m_data.data());
// fixup pointers in the machine:
fixup_pointers(m_pdata->m_first_state);
+ if(m_has_recursions)
+ {
+ m_pdata->m_has_recursions = true;
+ fixup_recursions(m_pdata->m_first_state);
+ }
+ else
+ m_pdata->m_has_recursions = false;
// create nested startmaps:
create_startmaps(m_pdata->m_first_state);
// create main startmap:
{
switch(state->type)
{
+ case syntax_element_recurse:
+ m_has_recursions = true;
+ if(state->next.i)
+ state->next.p = getaddress(state->next.i, state);
+ else
+ state->next.p = 0;
+ break;
case syntax_element_rep:
case syntax_element_dot_rep:
case syntax_element_char_rep:
}
}
+template <class charT, class traits>
+void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
+{
+ re_syntax_base* base = state;
+ while(state)
+ {
+ switch(state->type)
+ {
+ case syntax_element_assert_backref:
+ {
+ // just check that the index is valid:
+ int id = static_cast<const re_brace*>(state)->index;
+ if(id < 0)
+ {
+ id = -id-1;
+ if(id >= 10000)
+ {
+ id = m_pdata->get_id(id);
+ if(id <= 0)
+ {
+ // check of sub-expression that doesn't exist:
+ if(0 == this->m_pdata->m_status) // update the error code if not already set
+ this->m_pdata->m_status = boost::regex_constants::error_bad_pattern;
+ //
+ // clear the expression, we should be empty:
+ //
+ this->m_pdata->m_expression = 0;
+ this->m_pdata->m_expression_len = 0;
+ //
+ // and throw if required:
+ //
+ if(0 == (this->flags() & regex_constants::no_except))
+ {
+ std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
+ boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
+ e.raise();
+ }
+ }
+ }
+ }
+ }
+ break;
+ case syntax_element_recurse:
+ {
+ bool ok = false;
+ re_syntax_base* p = base;
+ int id = static_cast<re_jump*>(state)->alt.i;
+ if(id > 10000)
+ id = m_pdata->get_id(id);
+ while(p)
+ {
+ if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == id))
+ {
+ static_cast<re_jump*>(state)->alt.p = p;
+ ok = true;
+ break;
+ }
+ p = p->next.p;
+ }
+ if(!ok)
+ {
+ // recursion to sub-expression that doesn't exist:
+ if(0 == this->m_pdata->m_status) // update the error code if not already set
+ this->m_pdata->m_status = boost::regex_constants::error_bad_pattern;
+ //
+ // clear the expression, we should be empty:
+ //
+ this->m_pdata->m_expression = 0;
+ this->m_pdata->m_expression_len = 0;
+ //
+ // and throw if required:
+ //
+ if(0 == (this->flags() & regex_constants::no_except))
+ {
+ std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
+ boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
+ e.raise();
+ }
+ }
+ }
+ default:
+ break;
+ }
+ state = state->next.p;
+ }
+}
+
template <class charT, class traits>
void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
{
create_startmap(state->next.p, 0, pnull, mask);
return;
}
+ case syntax_element_recurse:
case syntax_element_backref:
// can be null, and any character can match:
if(pnull)
const charT* m_end; // the end of the string being parsed
const charT* m_position; // our current parser position
unsigned m_mark_count; // how many sub-expressions we have
+ int m_mark_reset; // used to indicate that we're inside a (?|...) block.
+ unsigned m_max_mark; // largest mark count seen inside a (?|...) block.
std::ptrdiff_t m_paren_start; // where the last seen ')' began (where repeats are inserted).
std::ptrdiff_t m_alt_insert_point; // where to insert the next alternative
bool m_has_case_change; // true if somewhere in the current block the case has changed
template <class charT, class traits>
basic_regex_parser<charT, traits>::basic_regex_parser(regex_data<charT, traits>* data)
- : basic_regex_creator<charT, traits>(data), m_mark_count(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false)
+ : basic_regex_creator<charT, traits>(data), m_mark_count(0), m_mark_reset(-1), m_max_mark(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false)
{
}
switch(l_flags & regbase::main_option_type)
{
case regbase::perl_syntax_group:
- m_parser_proc = &basic_regex_parser<charT, traits>::parse_extended;
- break;
+ {
+ m_parser_proc = &basic_regex_parser<charT, traits>::parse_extended;
+ //
+ // Add a leading paren with index zero to give recursions a target:
+ //
+ re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace)));
+ br->index = 0;
+ br->icase = this->flags() & regbase::icase;
+ break;
+ }
case regbase::basic_syntax_group:
m_parser_proc = &basic_regex_parser<charT, traits>::parse_basic;
break;
if(0 == (this->flags() & regbase::nosubs))
{
markid = ++m_mark_count;
+#ifndef BOOST_NO_STD_DISTANCE
if(this->flags() & regbase::save_subexpression_location)
this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>(std::distance(m_base, m_position) - 1, 0));
+#else
+ if(this->flags() & regbase::save_subexpression_location)
+ this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>((m_position - m_base) - 1, 0));
+#endif
}
re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace)));
pb->index = markid;
+ pb->icase = this->flags() & regbase::icase;
std::ptrdiff_t last_paren_start = this->getoffset(pb);
// back up insertion point for alternations, and set new point:
std::ptrdiff_t last_alt_point = m_alt_insert_point;
bool old_case_change = m_has_case_change;
m_has_case_change = false; // no changes to this scope as yet...
//
+ // Back up branch reset data in case we have a nested (?|...)
+ //
+ int mark_reset = m_mark_reset;
+ m_mark_reset = -1;
+ //
// now recursively add more states, this will terminate when we get to a
// matching ')' :
//
this->flags(opts);
m_has_case_change = old_case_change;
//
+ // restore branch reset:
+ //
+ m_mark_reset = mark_reset;
+ //
// we either have a ')' or we have run out of characters prematurely:
//
if(m_position == m_end)
return false;
}
BOOST_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark);
+#ifndef BOOST_NO_STD_DISTANCE
if(markid && (this->flags() & regbase::save_subexpression_location))
this->m_pdata->m_subs.at(markid - 1).second = std::distance(m_base, m_position);
+#else
+ if(markid && (this->flags() & regbase::save_subexpression_location))
+ this->m_pdata->m_subs.at(markid - 1).second = (m_position - m_base);
+#endif
++m_position;
//
// append closing parenthesis state:
//
pb = static_cast<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace)));
pb->index = markid;
+ pb->icase = this->flags() & regbase::icase;
this->m_paren_start = last_paren_start;
//
// restore the alternate insertion point:
// fall through:
case regex_constants::escape_type_class:
{
+escape_type_class_jump:
typedef typename traits::char_class_type mask_type;
mask_type m = this->m_traits.lookup_classname(m_position, m_position+1);
if(m != 0)
return true;
}
fail(regex_constants::error_ctype, m_position - m_base);
+ return false;
+ }
+ case regex_constants::escape_type_reset_start_mark:
+ if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex)))
+ {
+ re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace)));
+ pb->index = -5;
+ pb->icase = this->flags() & regbase::icase;
+ this->m_pdata->m_data.align();
+ ++m_position;
+ return true;
+ }
+ goto escape_type_class_jump;
+ case regex_constants::escape_type_line_ending:
+ if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex)))
+ {
+ const charT* e = get_escape_R_string<charT>();
+ const charT* old_position = m_position;
+ const charT* old_end = m_end;
+ const charT* old_base = m_base;
+ m_position = e;
+ m_base = e;
+ m_end = e + traits::length(e);
+ bool r = parse_all();
+ m_position = ++old_position;
+ m_end = old_end;
+ m_base = old_base;
+ return r;
+ }
+ goto escape_type_class_jump;
+ case regex_constants::escape_type_extended_backref:
+ if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex)))
+ {
+ bool have_brace = false;
+ bool negative = false;
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ // maybe have \g{ddd}
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace)
+ {
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ have_brace = true;
+ }
+ negative = (*m_position == static_cast<charT>('-'));
+ if((negative) && (++m_position == m_end))
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ const charT* pc = m_position;
+ int i = this->m_traits.toi(pc, m_end, 10);
+ if(i < 0)
+ {
+ // Check for a named capture:
+ const charT* base = m_position;
+ while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
+ ++m_position;
+ i = this->m_pdata->get_id(base, m_position);
+ pc = m_position;
+ }
+ if(negative)
+ i = 1 + m_mark_count - i;
+ if((i > 0) && (this->m_backrefs & (1u << (i-1))))
+ {
+ m_position = pc;
+ re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_backref, sizeof(re_brace)));
+ pb->index = i;
+ pb->icase = this->flags() & regbase::icase;
+ }
+ else
+ {
+ fail(regex_constants::error_backref, m_position - m_end);
+ return false;
+ }
+ m_position = pc;
+ if(have_brace)
+ {
+ if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ ++m_position;
+ }
+ return true;
}
+ goto escape_type_class_jump;
+ case regex_constants::escape_type_control_v:
+ if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex)))
+ goto escape_type_class_jump;
+ // fallthrough:
default:
this->append_literal(unescape_character());
break;
bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_t high)
{
bool greedy = true;
+ bool pocessive = false;
std::size_t insert_point;
//
// when we get to here we may have a non-greedy ? mark still to come:
)
)
{
- // OK we have a perl regex, check for a '?':
+ // OK we have a perl or emacs regex, check for a '?':
if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_question)
{
greedy = false;
++m_position;
}
+ // for perl regexes only check for pocessive ++ repeats.
+ if((0 == (this->flags() & regbase::main_option_type))
+ && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_plus))
+ {
+ pocessive = true;
+ ++m_position;
+ }
}
if(0 == this->m_last_state)
{
// now fill in the alt jump for the repeat:
rep = static_cast<re_repeat*>(this->getaddress(rep_off));
rep->alt.i = this->m_pdata->m_data.size() - rep_off;
+ //
+ // If the repeat is pocessive then bracket the repeat with a (?>...)
+ // independent sub-expression construct:
+ //
+ if(pocessive)
+ {
+ re_brace* pb = static_cast<re_brace*>(this->insert_state(insert_point, syntax_element_startmark, sizeof(re_brace)));
+ pb->index = -3;
+ pb->icase = this->flags() & regbase::icase;
+ re_jump* jmp = static_cast<re_jump*>(this->insert_state(insert_point + sizeof(re_brace), syntax_element_jump, sizeof(re_jump)));
+ this->m_pdata->m_data.align();
+ jmp->alt.i = this->m_pdata->m_data.size() - this->getoffset(jmp);
+ pb = static_cast<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace)));
+ pb->index = -3;
+ pb->icase = this->flags() & regbase::icase;
+ }
return true;
}
fail(regex_constants::error_empty, this->m_position - this->m_base);
return false;
}
+ //
+ // Reset mark count if required:
+ //
+ if(m_max_mark < m_mark_count)
+ m_max_mark = m_mark_count;
+ if(m_mark_reset >= 0)
+ m_mark_count = m_mark_reset;
+
++m_position;
//
// we need to append a trailing jump:
int i = this->m_traits.toi(m_position, m_end, 16);
if((m_position == m_end)
|| (i < 0)
- || ((std::numeric_limits<charT>::is_specialized) && (charT(i) > (std::numeric_limits<charT>::max)()))
+ || ((std::numeric_limits<charT>::is_specialized) && (i > (int)(std::numeric_limits<charT>::max)()))
|| (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
{
fail(regex_constants::error_badbrace, m_position - m_base);
m_position = pc;
re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_backref, sizeof(re_brace)));
pb->index = i;
+ pb->icase = this->flags() & regbase::icase;
}
else
{
int markid = 0;
std::ptrdiff_t jump_offset = 0;
re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace)));
+ pb->icase = this->flags() & regbase::icase;
std::ptrdiff_t last_paren_start = this->getoffset(pb);
// back up insertion point for alternations, and set new point:
std::ptrdiff_t last_alt_point = m_alt_insert_point;
regex_constants::syntax_option_type old_flags = this->flags();
bool old_case_change = m_has_case_change;
m_has_case_change = false;
+ charT name_delim;
+ int mark_reset = m_mark_reset;
+ m_mark_reset = -1;
+ int v;
//
// select the actual extension used:
//
switch(this->m_traits.syntax_type(*m_position))
{
+ case regex_constants::syntax_or:
+ m_mark_reset = m_mark_count;
+ // fall through:
case regex_constants::syntax_colon:
//
// a non-capturing mark:
pb->index = markid = 0;
++m_position;
break;
+ case regex_constants::syntax_digit:
+ {
+ //
+ // a recursive subexpression:
+ //
+ v = this->m_traits.toi(m_position, m_end, 10);
+ if((v < 0) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark))
+ {
+ fail(regex_constants::error_backref, m_position - m_base);
+ return false;
+ }
+insert_recursion:
+ pb->index = markid = 0;
+ static_cast<re_jump*>(this->append_state(syntax_element_recurse, sizeof(re_jump)))->alt.i = v;
+ static_cast<re_case*>(
+ this->append_state(syntax_element_toggle_case, sizeof(re_case))
+ )->icase = this->flags() & regbase::icase;
+ break;
+ }
+ case regex_constants::syntax_plus:
+ //
+ // A forward-relative recursive subexpression:
+ //
+ ++m_position;
+ v = this->m_traits.toi(m_position, m_end, 10);
+ if((v <= 0) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark))
+ {
+ fail(regex_constants::error_backref, m_position - m_base);
+ return false;
+ }
+ v += m_mark_count;
+ goto insert_recursion;
+ case regex_constants::syntax_dash:
+ //
+ // Possibly a backward-relative recursive subexpression:
+ //
+ ++m_position;
+ v = this->m_traits.toi(m_position, m_end, 10);
+ if(v <= 0)
+ {
+ --m_position;
+ // Oops not a relative recursion at all, but a (?-imsx) group:
+ goto option_group_jump;
+ }
+ v = m_mark_count + 1 - v;
+ if(v <= 0)
+ {
+ fail(regex_constants::error_backref, m_position - m_base);
+ return false;
+ }
+ goto insert_recursion;
case regex_constants::syntax_equal:
pb->index = markid = -1;
++m_position;
pb->index = markid = -1;
else
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
- return false;
+ // Probably a named capture which also starts (?< :
+ name_delim = '>';
+ --m_position;
+ goto named_capture_jump;
}
++m_position;
jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump)));
return false;
}
int v = this->m_traits.toi(m_position, m_end, 10);
- if(v > 0)
+ if(*m_position == charT('R'))
+ {
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ if(*m_position == charT('&'))
+ {
+ const charT* base = ++m_position;
+ while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark))
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ v = -static_cast<int>(hash_value_from_capture_name(base, m_position));
+ }
+ else
+ {
+ v = -this->m_traits.toi(m_position, m_end, 10);
+ }
+ re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_assert_backref, sizeof(re_brace)));
+ br->index = v < 0 ? (v - 1) : 0;
+ if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ }
+ else if((*m_position == charT('\'')) || (*m_position == charT('<')))
+ {
+ const charT* base = ++m_position;
+ while((m_position != m_end) && (*m_position != charT('>')) && (*m_position != charT('\'')))
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ v = static_cast<int>(hash_value_from_capture_name(base, m_position));
+ re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_assert_backref, sizeof(re_brace)));
+ br->index = v;
+ if((*m_position != charT('>')) && (*m_position != charT('\'')) || (++m_position == m_end))
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ }
+ else if(*m_position == charT('D'))
+ {
+ const char* def = "DEFINE";
+ while(*def && (m_position != m_end) && (*m_position == charT(*def)))
+ ++m_position, ++def;
+ if((m_position == m_end) || *def)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_assert_backref, sizeof(re_brace)));
+ br->index = 9999; // special magic value!
+ if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ }
+ else if(v > 0)
{
re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_assert_backref, sizeof(re_brace)));
br->index = v;
if((this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)
&& (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_not))
{
- fail(regex_constants::error_badrepeat, m_position - m_base);
+ fail(regex_constants::error_paren, m_position - m_base);
return false;
}
m_position -= 2;
case regex_constants::syntax_close_mark:
fail(regex_constants::error_badrepeat, m_position - m_base);
return false;
+ case regex_constants::escape_type_end_buffer:
+ {
+ name_delim = *m_position;
+named_capture_jump:
+ markid = 0;
+ if(0 == (this->flags() & regbase::nosubs))
+ {
+ markid = ++m_mark_count;
+ #ifndef BOOST_NO_STD_DISTANCE
+ if(this->flags() & regbase::save_subexpression_location)
+ this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>(std::distance(m_base, m_position) - 2, 0));
+ #else
+ if(this->flags() & regbase::save_subexpression_location)
+ this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>((m_position - m_base) - 2, 0));
+ #endif
+ }
+ pb->index = markid;
+ const charT* base = ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_paren, m_position - m_base);
+ return false;
+ }
+ while((m_position != m_end) && (*m_position != name_delim))
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_paren, m_position - m_base);
+ return false;
+ }
+ this->m_pdata->set_name(base, m_position, markid);
+ ++m_position;
+ break;
+ }
default:
+ if(*m_position == charT('R'))
+ {
+ ++m_position;
+ v = 0;
+ if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
+ {
+ fail(regex_constants::error_backref, m_position - m_base);
+ return false;
+ }
+ goto insert_recursion;
+ }
+ if(*m_position == charT('&'))
+ {
+ ++m_position;
+ const charT* base = m_position;
+ while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark))
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_backref, m_position - m_base);
+ return false;
+ }
+ v = static_cast<int>(hash_value_from_capture_name(base, m_position));
+ goto insert_recursion;
+ }
+ if(*m_position == charT('P'))
+ {
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_backref, m_position - m_base);
+ return false;
+ }
+ if(*m_position == charT('>'))
+ {
+ ++m_position;
+ const charT* base = m_position;
+ while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark))
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_backref, m_position - m_base);
+ return false;
+ }
+ v = static_cast<int>(hash_value_from_capture_name(base, m_position));
+ goto insert_recursion;
+ }
+ }
//
// lets assume that we have a (?imsx) group and try and parse it:
//
+option_group_jump:
regex_constants::syntax_option_type opts = parse_options();
if(m_position == m_end)
return false;
}
else if(this->getaddress(static_cast<re_alt*>(b)->alt.i, b)->type == syntax_element_alt)
{
+ // Can't have seen more than one alternative:
fail(regex_constants::error_bad_pattern, m_position - m_base);
return false;
}
+ else
+ {
+ // We must *not* have seen an alternative inside a (DEFINE) block:
+ b = this->getaddress(b->next.i, b);
+ if((b->type == syntax_element_assert_backref) && (static_cast<re_brace*>(b)->index == 9999))
+ {
+ fail(regex_constants::error_bad_pattern, m_position - m_base);
+ return false;
+ }
+ }
// check for invalid repetition of next state:
b = this->getaddress(expected_alt_point);
b = this->getaddress(static_cast<re_alt*>(b)->next.i, b);
//
pb = static_cast<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace)));
pb->index = markid;
+ pb->icase = this->flags() & regbase::icase;
this->m_paren_start = last_paren_start;
//
// restore the alternate insertion point:
// and the case change data:
//
m_has_case_change = old_case_change;
+ //
+ // And the mark_reset data:
+ //
+ if(m_max_mark > m_mark_count)
+ {
+ m_mark_count = m_max_mark;
+ }
+ m_mark_reset = mark_reset;
+
+
+ if(markid > 0)
+ {
+#ifndef BOOST_NO_STD_DISTANCE
+ if(this->flags() & regbase::save_subexpression_location)
+ this->m_pdata->m_subs.at(markid - 1).second = std::distance(m_base, m_position) - 1;
+#else
+ if(this->flags() & regbase::save_subexpression_location)
+ this->m_pdata->m_subs.at(markid - 1).second = (m_position - m_base) - 1;
+#endif
+ //
+ // allow backrefs to this mark:
+ //
+ if((markid > 0) && (markid < (int)(sizeof(unsigned) * CHAR_BIT)))
+ this->m_backrefs |= 1u << (markid - 1);
+ }
return true;
}
char_class_graph=char_class_alnum|char_class_punct,
char_class_blank=1<<9,
char_class_word=1<<10,
- char_class_unicode=1<<11
+ char_class_unicode=1<<11,
+ char_class_horizontal_space=1<<12,
+ char_class_vertical_space=1<<13
};
#endif
BOOST_STATIC_CONSTANT(char_class_type, mask_blank = 1u << 24);
BOOST_STATIC_CONSTANT(char_class_type, mask_word = 1u << 25);
BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 1u << 26);
+ BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 1u << 27);
+ BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 1u << 28);
#endif
typedef std::basic_string<charT> string_type;
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_word;
template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_unicode;
+template <class charT>
+typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_vertical;
+template <class charT>
+typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_horizontal;
#endif
#endif
// Custom class names:
//
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
- static const char_class_type masks[14] =
+ static const char_class_type masks[16] =
{
std::ctype<charT>::alnum,
std::ctype<charT>::alpha,
std::ctype<charT>::cntrl,
std::ctype<charT>::digit,
std::ctype<charT>::graph,
+ cpp_regex_traits_implementation<charT>::mask_horizontal,
std::ctype<charT>::lower,
std::ctype<charT>::print,
std::ctype<charT>::punct,
std::ctype<charT>::space,
std::ctype<charT>::upper,
+ cpp_regex_traits_implementation<charT>::mask_vertical,
std::ctype<charT>::xdigit,
cpp_regex_traits_implementation<charT>::mask_blank,
cpp_regex_traits_implementation<charT>::mask_word,
::boost::re_detail::char_class_cntrl,
::boost::re_detail::char_class_digit,
::boost::re_detail::char_class_graph,
+ ::boost::re_detail::char_class_horizontal_space,
::boost::re_detail::char_class_lower,
::boost::re_detail::char_class_print,
::boost::re_detail::char_class_punct,
::boost::re_detail::char_class_space,
::boost::re_detail::char_class_upper,
+ ::boost::re_detail::char_class_vertical_space,
::boost::re_detail::char_class_xdigit,
::boost::re_detail::char_class_blank,
::boost::re_detail::char_class_word,
cpp_regex_traits_implementation<charT>::lookup_classname_imp(const charT* p1, const charT* p2) const
{
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
- static const char_class_type masks[20] =
+ static const char_class_type masks[22] =
{
0,
std::ctype<char>::alnum,
std::ctype<char>::digit,
std::ctype<char>::digit,
std::ctype<char>::graph,
+ cpp_regex_traits_implementation<charT>::mask_horizontal,
std::ctype<char>::lower,
std::ctype<char>::lower,
std::ctype<char>::print,
std::ctype<char>::upper,
cpp_regex_traits_implementation<charT>::mask_unicode,
std::ctype<char>::upper,
+ cpp_regex_traits_implementation<charT>::mask_vertical,
std::ctype<char>::alnum | cpp_regex_traits_implementation<charT>::mask_word,
std::ctype<char>::alnum | cpp_regex_traits_implementation<charT>::mask_word,
std::ctype<char>::xdigit,
};
#else
- static const char_class_type masks[20] =
+ static const char_class_type masks[22] =
{
0,
::boost::re_detail::char_class_alnum,
::boost::re_detail::char_class_digit,
::boost::re_detail::char_class_digit,
::boost::re_detail::char_class_graph,
+ ::boost::re_detail::char_class_horizontal_space,
::boost::re_detail::char_class_lower,
::boost::re_detail::char_class_lower,
::boost::re_detail::char_class_print,
::boost::re_detail::char_class_upper,
::boost::re_detail::char_class_unicode,
::boost::re_detail::char_class_upper,
+ ::boost::re_detail::char_class_vertical_space,
::boost::re_detail::char_class_alnum | ::boost::re_detail::char_class_word,
::boost::re_detail::char_class_alnum | ::boost::re_detail::char_class_word,
::boost::re_detail::char_class_xdigit,
|| ((mask & ::boost::re_detail::char_class_xdigit) && (m_pctype->is(std::ctype<charT>::xdigit, c)))
|| ((mask & ::boost::re_detail::char_class_blank) && (m_pctype->is(std::ctype<charT>::space, c)) && !::boost::re_detail::is_separator(c))
|| ((mask & ::boost::re_detail::char_class_word) && (c == '_'))
- || ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c));
+ || ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c))
+ || ((mask & ::boost::re_detail::char_class_vertical) && (is_separator(c) || (c == '\v')))
+ || ((mask & ::boost::re_detail::char_class_horizontal) && m_pctype->is(std::ctype<charT>::space, c) && !(is_separator(c) || (c == '\v')));
}
#endif
&& m_pimpl->m_pctype->is(std::ctype<charT>::space, c)
&& !re_detail::is_separator(c))
return true;
+ else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_vertical)
+ && (::boost::re_detail::is_separator(c) || (c == '\v')))
+ return true;
+ else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_horizontal)
+ && this->isctype(c, std::ctype<charT>::space) && !this->isctype(c, re_detail::cpp_regex_traits_implementation<charT>::mask_vertical))
+ return true;
return false;
#else
return m_pimpl->isctype(c, f);
template <class I>
struct is_random_imp
{
+#ifndef BOOST_NO_STD_ITERATOR_TRAITS
private:
typedef typename std::iterator_traits<I>::iterator_category cat;
public:
BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible<cat*, std::random_access_iterator_tag*>::value));
+#else
+ BOOST_STATIC_CONSTANT(bool, value = false);
+#endif
};
template <class I>
#pragma warning(disable : 4251 4231 4660)
#endif
+namespace re_detail{
+
+template <class charT>
+class named_subexpressions;
+
+}
+
template <class BidiIterator, class Allocator>
class match_results
{
typedef typename re_detail::regex_iterator_traits<
BidiIterator>::value_type char_type;
typedef std::basic_string<char_type> string_type;
+ typedef re_detail::named_subexpressions_base<char_type> named_sub_type;
// construct/copy/destroy:
explicit match_results(const Allocator& a = Allocator())
#ifndef BOOST_NO_STD_ALLOCATOR
- : m_subs(a), m_base() {}
+ : m_subs(a), m_base(), m_last_closed_paren(0) {}
#else
- : m_subs(), m_base() { (void)a; }
+ : m_subs(), m_base(), m_last_closed_paren(0) { (void)a; }
#endif
match_results(const match_results& m)
: m_subs(m.m_subs), m_base(m.m_base) {}
return m_subs[sub].length();
return 0;
}
+ difference_type length(const char_type* sub) const
+ {
+ const char_type* end = sub;
+ while(*end) ++end;
+ return length(named_subexpression_index(sub, end));
+ }
+ template <class charT>
+ difference_type length(const charT* sub) const
+ {
+ const charT* end = sub;
+ while(*end) ++end;
+ return length(named_subexpression_index(sub, end));
+ }
+ template <class charT, class Traits, class A>
+ difference_type length(const std::basic_string<charT, Traits, A>& sub) const
+ {
+ return length(sub.c_str());
+ }
difference_type position(size_type sub = 0) const
{
sub += 2;
}
return ~static_cast<difference_type>(0);
}
+ difference_type position(const char_type* sub) const
+ {
+ const char_type* end = sub;
+ while(*end) ++end;
+ return position(named_subexpression_index(sub, end));
+ }
+ template <class charT>
+ difference_type position(const charT* sub) const
+ {
+ const charT* end = sub;
+ while(*end) ++end;
+ return position(named_subexpression_index(sub, end));
+ }
+ template <class charT, class Traits, class A>
+ difference_type position(const std::basic_string<charT, Traits, A>& sub) const
+ {
+ return position(sub.c_str());
+ }
string_type str(int sub = 0) const
{
sub += 2;
}
return result;
}
+ string_type str(const char_type* sub) const
+ {
+ return (*this)[sub].str();
+ }
+ template <class Traits, class A>
+ string_type str(const std::basic_string<char_type, Traits, A>& sub) const
+ {
+ return (*this)[sub].str();
+ }
+ template <class charT>
+ string_type str(const charT* sub) const
+ {
+ return (*this)[sub].str();
+ }
+ template <class charT, class Traits, class A>
+ string_type str(const std::basic_string<charT, Traits, A>& sub) const
+ {
+ return (*this)[sub].str();
+ }
const_reference operator[](int sub) const
{
sub += 2;
}
return m_null;
}
+ //
+ // Named sub-expressions:
+ //
+ const_reference named_subexpression(const char_type* i, const char_type* j) const
+ {
+ int index = m_named_subs->get_id(i, j);
+ return index > 0 ? (*this)[index] : m_null;
+ }
+ template <class charT>
+ const_reference named_subexpression(const charT* i, const charT* j) const
+ {
+ BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
+ if(i == j)
+ return m_null;
+ std::vector<char_type> s;
+ while(i != j)
+ s.insert(s.end(), *i++);
+ return named_subexpression(&*s.begin(), &*s.begin() + s.size());
+ }
+ int named_subexpression_index(const char_type* i, const char_type* j) const
+ {
+ int index = m_named_subs->get_id(i, j);
+ return index > 0 ? index : -20;
+ }
+ template <class charT>
+ int named_subexpression_index(const charT* i, const charT* j) const
+ {
+ BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
+ if(i == j)
+ return -20;
+ std::vector<char_type> s;
+ while(i != j)
+ s.insert(s.end(), *i++);
+ return named_subexpression_index(&*s.begin(), &*s.begin() + s.size());
+ }
+ template <class Traits, class A>
+ const_reference operator[](const std::basic_string<char_type, Traits, A>& s) const
+ {
+ return named_subexpression(s.c_str(), s.c_str() + s.size());
+ }
+ const_reference operator[](const char_type* p) const
+ {
+ const char_type* e = p;
+ while(*e) ++e;
+ return named_subexpression(p, e);
+ }
+
+ template <class charT>
+ const_reference operator[](const charT* p) const
+ {
+ BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
+ if(*p == 0)
+ return m_null;
+ std::vector<char_type> s;
+ while(*p)
+ s.insert(s.end(), *p++);
+ return named_subexpression(&*s.begin(), &*s.begin() + s.size());
+ }
+ template <class charT, class Traits, class A>
+ const_reference operator[](const std::basic_string<charT, Traits, A>& ns) const
+ {
+ BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type));
+ if(ns.empty())
+ return m_null;
+ std::vector<char_type> s;
+ for(unsigned i = 0; i < ns.size(); ++i)
+ s.insert(s.end(), ns[i]);
+ return named_subexpression(&*s.begin(), &*s.begin() + s.size());
+ }
const_reference prefix() const
{
::boost::re_detail::regex_format_imp(i, *this, fmt.data(), fmt.data() + fmt.size(), flags, re.get_traits());
return result;
}
+ const_reference get_last_closed_paren()const
+ {
+ return m_last_closed_paren == 0 ? m_null : (*this)[m_last_closed_paren];
+ }
allocator_type get_allocator() const
{
m_null.matched = false;
}
- void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true)
+ void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false)
{
+ if(pos)
+ m_last_closed_paren = pos;
pos += 2;
BOOST_ASSERT(m_subs.size() > pos);
m_subs[pos].second = i;
m_subs[pos].matched = m;
- if(pos == 2)
+ if((pos == 2) && !escape_k)
{
m_subs[0].first = i;
m_subs[0].matched = (m_subs[0].first != m_subs[0].second);
m_subs.insert(m_subs.end(), n+2-len, v);
}
m_subs[1].first = i;
+ m_last_closed_paren = 0;
}
void BOOST_REGEX_CALL set_base(BidiIterator pos)
{
m_subs[n].matched = false;
}
}
- void BOOST_REGEX_CALL set_first(BidiIterator i, size_type pos)
+ void BOOST_REGEX_CALL set_first(BidiIterator i, size_type pos, bool escape_k = false)
{
BOOST_ASSERT(pos+2 < m_subs.size());
- if(pos)
+ if(pos || escape_k)
+ {
m_subs[pos+2].first = i;
+ if(escape_k)
+ {
+ m_subs[1].second = i;
+ m_subs[1].matched = (m_subs[1].first != m_subs[1].second);
+ }
+ }
else
set_first(i);
}
void BOOST_REGEX_CALL maybe_assign(const match_results<BidiIterator, Allocator>& m);
+ void BOOST_REGEX_CALL set_named_subs(boost::shared_ptr<named_sub_type> subs)
+ {
+ m_named_subs = subs;
+ }
private:
vector_type m_subs; // subexpressions
BidiIterator m_base; // where the search started from
sub_match<BidiIterator> m_null; // a null match
+ boost::shared_ptr<named_sub_type> m_named_subs;
+ int m_last_closed_paren;
};
template <class BidiIterator, class Allocator>
}
~repeater_count()
{
- *stack = next;
+ if(next)
+ *stack = next;
}
std::size_t get_count() { return count; }
int get_id() { return state_id; }
saved_state_count = 14
};
+template <class Results>
+struct recursion_info
+{
+ typedef typename Results::value_type value_type;
+ typedef typename value_type::iterator iterator;
+ int id;
+ const re_syntax_base* preturn_address;
+ Results results;
+ repeater_count<iterator>* repeater_stack;
+};
+
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4251 4231 4660)
typedef std::size_t traits_size_type;
typedef typename is_byte<char_type>::width_type width_type;
typedef typename regex_iterator_traits<BidiIterator>::difference_type difference_type;
+ typedef match_results<BidiIterator, Allocator> results_type;
perl_matcher(BidiIterator first, BidiIterator end,
match_results<BidiIterator, Allocator>& what,
BidiIterator l_base)
: m_result(what), base(first), last(end),
position(first), backstop(l_base), re(e), traits_inst(e.get_traits()),
- m_independent(false), next_count(&rep_obj), rep_obj(&next_count)
+ m_independent(false), next_count(&rep_obj), rep_obj(&next_count), recursion_stack_position(0)
{
construct_init(e, f);
}
bool match_char_repeat();
bool match_dot_repeat_fast();
bool match_dot_repeat_slow();
+ bool match_dot_repeat_dispatch()
+ {
+ return ::boost::is_random_access_iterator<BidiIterator>::value ? match_dot_repeat_fast() : match_dot_repeat_slow();
+ }
bool match_backstep();
bool match_assert_backref();
bool match_toggle_case();
#ifdef BOOST_REGEX_RECURSIVE
bool backtrack_till_match(std::size_t count);
#endif
+ bool match_recursion();
// find procs stored in s_find_vtable:
bool find_restart_any();
typename traits::char_class_type m_word_mask;
// the bitmask to use when determining whether a match_any matches a newline or not:
unsigned char match_any_mask;
+ // recursion information:
+ recursion_info<results_type> recursion_stack[50];
+ unsigned recursion_stack_position;
#ifdef BOOST_REGEX_NON_RECURSIVE
//
bool unwind_short_set_repeat(bool);
bool unwind_long_set_repeat(bool);
bool unwind_non_greedy_repeat(bool);
+ bool unwind_recursion(bool);
+ bool unwind_recursion_pop(bool);
void destroy_single_repeat();
void push_matched_paren(int index, const sub_match<BidiIterator>& sub);
void push_recursion_stopper();
void push_repeater_count(int i, repeater_count<BidiIterator>** s);
void push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int state_id);
void push_non_greedy_repeat(const re_syntax_base* ps);
-
+ void push_recursion(int id, const re_syntax_base* p, results_type* presults);
+ void push_recursion_pop();
// pointer to base of stack:
saved_state* m_stack_base;
m_match_flags |= regex_constants::match_all;
m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), search_base, last);
m_presult->set_base(base);
+ m_presult->set_named_subs(re_detail::convert_to_named_subs<typename match_results<BidiIterator>::char_type>(this->re.get_named_subs()));
if(m_match_flags & match_posix)
m_result = *m_presult;
verify_options(re.flags(), m_match_flags);
if(0 == match_prefix())
return false;
- return m_result[0].second == last;
+ return (m_result[0].second == last) && (m_result[0].first == base);
#if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_NO_EXCEPTIONS)
}
pstate = re.get_first_state();
m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), base, last);
m_presult->set_base(base);
+ m_presult->set_named_subs(re_detail::convert_to_named_subs<typename match_results<BidiIterator>::char_type>(this->re.get_named_subs()));
m_match_flags |= regex_constants::match_init;
}
else
return m_has_found_match;
}
-template <class BidiIterator, class Allocator, class traits>
-bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark()
-{
- int index = static_cast<const re_brace*>(pstate)->index;
- if(index > 0)
- {
- if((m_match_flags & match_nosubs) == 0)
- m_presult->set_second(position, index);
- }
- else if((index < 0) && (index != -4))
- {
- // matched forward lookahead:
- pstate = 0;
- return true;
- }
- pstate = pstate->next.p;
- return true;
-}
-
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::match_literal()
{
return true;
}
-template <class BidiIterator, class Allocator, class traits>
-bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
-{
- if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first))
- return false;
- if((m_match_flags & match_all) && (position != last))
- return false;
- if((m_match_flags & regex_constants::match_not_initial_null) && (position == search_base))
- return false;
- m_presult->set_second(position);
- pstate = 0;
- m_has_found_match = true;
- if((m_match_flags & match_posix) == match_posix)
- {
- m_result.maybe_assign(*m_presult);
- if((m_match_flags & match_any) == 0)
- return false;
- }
-#ifdef BOOST_REGEX_MATCH_EXTRA
- if(match_extra & m_match_flags)
- {
- for(unsigned i = 0; i < m_presult->size(); ++i)
- if((*m_presult)[i].matched)
- ((*m_presult)[i]).get_captures().push_back((*m_presult)[i]);
- }
-#endif
- return true;
-}
-
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::match_word_boundary()
{
inline bool perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref()
{
// return true if marked sub-expression N has been matched:
- bool result = (*m_presult)[static_cast<const re_brace*>(pstate)->index].matched;
- pstate = pstate->next.p;
+ int index = static_cast<const re_brace*>(pstate)->index;
+ bool result;
+ if(index == 9999)
+ {
+ // Magic value for a (DEFINE) block:
+ return false;
+ }
+ else if(index > 0)
+ {
+ // Check if index is a hash value:
+ if(index >= 10000)
+ index = re.get_data().get_id(index);
+ // Have we matched subexpression "index"?
+ result = (*m_presult)[index].matched;
+ pstate = pstate->next.p;
+ }
+ else
+ {
+ // Have we recursed into subexpression "index"?
+ // If index == 0 then check for any recursion at all, otherwise for recursion to -index-1.
+ int id = -index-1;
+ if(id >= 10000)
+ id = re.get_data().get_id(id);
+ result = recursion_stack_position && ((recursion_stack[recursion_stack_position-1].id == id) || (index == 0));
+ pstate = pstate->next.p;
+ }
return result;
}
: saved_state(arg_id), count(c), rep(r), last_position(lp){}
};
+template <class Results>
+struct saved_recursion : public saved_state
+{
+ saved_recursion(int id, const re_syntax_base* p, Results* pr)
+ : saved_state(14), recursion_id(id), preturn_address(p), results(*pr)
+ {}
+ int recursion_id;
+ const re_syntax_base* preturn_address;
+ Results results;
+};
+
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
{
- static matcher_proc_type const s_match_vtable[29] =
+ static matcher_proc_type const s_match_vtable[30] =
{
(&perl_matcher<BidiIterator, Allocator, traits>::match_startmark),
&perl_matcher<BidiIterator, Allocator, traits>::match_endmark,
&perl_matcher<BidiIterator, Allocator, traits>::match_combining,
&perl_matcher<BidiIterator, Allocator, traits>::match_soft_buffer_end,
&perl_matcher<BidiIterator, Allocator, traits>::match_restart_continue,
- (::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ // Although this next line *should* be evaluated at compile time, in practice
+ // some compilers (VC++) emit run-time initialisation which breaks thread
+ // safety, so use a dispatch function instead:
+ //(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_dispatch,
&perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat,
&perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits>::match_backstep,
&perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref,
&perl_matcher<BidiIterator, Allocator, traits>::match_toggle_case,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_recursion,
};
push_recursion_stopper();
template <class BidiIterator, class Allocator, class traits>
inline void perl_matcher<BidiIterator, Allocator, traits>::push_matched_paren(int index, const sub_match<BidiIterator>& sub)
{
- BOOST_ASSERT(index);
+ //BOOST_ASSERT(index);
saved_matched_paren<BidiIterator>* pmp = static_cast<saved_matched_paren<BidiIterator>*>(m_backup_state);
--pmp;
if(pmp < m_stack_base)
m_backup_state = pmp;
}
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion(int id, const re_syntax_base* p, results_type* presults)
+{
+ saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
+ --pmp;
+ if(pmp < m_stack_base)
+ {
+ extend_stack();
+ pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
+ --pmp;
+ }
+ (void) new (pmp)saved_recursion<results_type>(id, p, presults);
+ m_backup_state = pmp;
+}
+
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
{
int index = static_cast<const re_brace*>(pstate)->index;
+ icase = static_cast<const re_brace*>(pstate)->icase;
switch(index)
{
case 0:
break;
}
}
+ case -5:
+ {
+ push_matched_paren(0, (*m_presult)[0]);
+ m_presult->set_first(position, 0, true);
+ pstate = pstate->next.p;
+ break;
+ }
default:
{
BOOST_ASSERT(index > 0);
#endif
}
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
+{
+ BOOST_ASSERT(pstate->type == syntax_element_recurse);
+ //
+ // Backup call stack:
+ //
+ push_recursion_pop();
+ //
+ // Set new call stack:
+ //
+ if(recursion_stack_position >= static_cast<int>(sizeof(recursion_stack)/sizeof(recursion_stack[0])))
+ {
+ return false;
+ }
+ recursion_stack[recursion_stack_position].preturn_address = pstate->next.p;
+ recursion_stack[recursion_stack_position].results = *m_presult;
+ pstate = static_cast<const re_jump*>(pstate)->alt.p;
+ recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index;
+ ++recursion_stack_position;
+ //BOOST_ASSERT(recursion_stack[recursion_stack_position-1].id);
+ return true;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark()
+{
+ int index = static_cast<const re_brace*>(pstate)->index;
+ icase = static_cast<const re_brace*>(pstate)->icase;
+ if(index > 0)
+ {
+ if((m_match_flags & match_nosubs) == 0)
+ {
+ m_presult->set_second(position, index);
+ }
+ if(recursion_stack_position)
+ {
+ if(index == recursion_stack[recursion_stack_position-1].id)
+ {
+ --recursion_stack_position;
+ pstate = recursion_stack[recursion_stack_position].preturn_address;
+ *m_presult = recursion_stack[recursion_stack_position].results;
+ push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results);
+ }
+ }
+ }
+ else if((index < 0) && (index != -4))
+ {
+ // matched forward lookahead:
+ pstate = 0;
+ return true;
+ }
+ pstate = pstate->next.p;
+ return true;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
+{
+ if(recursion_stack_position)
+ {
+ BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id);
+ --recursion_stack_position;
+ pstate = recursion_stack[recursion_stack_position].preturn_address;
+ *m_presult = recursion_stack[recursion_stack_position].results;
+ push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results);
+ return true;
+ }
+ if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first))
+ return false;
+ if((m_match_flags & match_all) && (position != last))
+ return false;
+ if((m_match_flags & regex_constants::match_not_initial_null) && (position == search_base))
+ return false;
+ m_presult->set_second(position);
+ pstate = 0;
+ m_has_found_match = true;
+ if((m_match_flags & match_posix) == match_posix)
+ {
+ m_result.maybe_assign(*m_presult);
+ if((m_match_flags & match_any) == 0)
+ return false;
+ }
+#ifdef BOOST_REGEX_MATCH_EXTRA
+ if(match_extra & m_match_flags)
+ {
+ for(unsigned i = 0; i < m_presult->size(); ++i)
+ if((*m_presult)[i].matched)
+ ((*m_presult)[i]).get_captures().push_back((*m_presult)[i]);
+ }
+#endif
+ return true;
+}
+
/****************************************************************************
Unwind and associated proceedures follow, these perform what normal stack
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::unwind(bool have_match)
{
- static unwind_proc_type const s_unwind_table[14] =
+ static unwind_proc_type const s_unwind_table[18] =
{
&perl_matcher<BidiIterator, Allocator, traits>::unwind_end,
&perl_matcher<BidiIterator, Allocator, traits>::unwind_paren,
&perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits>::unwind_non_greedy_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion_pop,
};
m_recursive_result = have_match;
// restore previous values if no match was found:
if(have_match == false)
{
- m_presult->set_first(pmp->sub.first, pmp->index);
- m_presult->set_second(pmp->sub.second, pmp->index, pmp->sub.matched);
+ m_presult->set_first(pmp->sub.first, pmp->index, pmp->index == 0);
+ m_presult->set_second(pmp->sub.second, pmp->index, pmp->sub.matched, pmp->index == 0);
}
#ifdef BOOST_REGEX_MATCH_EXTRA
//
return r;
}
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion(bool r)
+{
+ saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
+ if(!r)
+ {
+ recursion_stack[recursion_stack_position].id = pmp->recursion_id;
+ recursion_stack[recursion_stack_position].preturn_address = pmp->preturn_address;
+ recursion_stack[recursion_stack_position].results = pmp->results;
+ ++recursion_stack_position;
+ }
+ boost::re_detail::inplace_destroy(pmp++);
+ m_backup_state = pmp;
+ return true;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion_pop(bool r)
+{
+ saved_state* pmp = static_cast<saved_state*>(m_backup_state);
+ if(!r)
+ {
+ --recursion_stack_position;
+ }
+ boost::re_detail::inplace_destroy(pmp++);
+ m_backup_state = pmp;
+ return true;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+void perl_matcher<BidiIterator, Allocator, traits>::push_recursion_pop()
+{
+ saved_state* pmp = static_cast<saved_state*>(m_backup_state);
+ --pmp;
+ if(pmp < m_stack_base)
+ {
+ extend_stack();
+ pmp = static_cast<saved_state*>(m_backup_state);
+ --pmp;
+ }
+ (void) new (pmp)saved_state(15);
+ m_backup_state = pmp;
+}
+/*
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_parenthesis_pop(bool r)
+{
+ saved_state* pmp = static_cast<saved_state*>(m_backup_state);
+ if(!r)
+ {
+ --parenthesis_stack_position;
+ }
+ boost::re_detail::inplace_destroy(pmp++);
+ m_backup_state = pmp;
+ return true;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+void perl_matcher<BidiIterator, Allocator, traits>::push_parenthesis_pop()
+{
+ saved_state* pmp = static_cast<saved_state*>(m_backup_state);
+ --pmp;
+ if(pmp < m_stack_base)
+ {
+ extend_stack();
+ pmp = static_cast<saved_state*>(m_backup_state);
+ --pmp;
+ }
+ (void) new (pmp)saved_state(16);
+ m_backup_state = pmp;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_parenthesis_push(bool r)
+{
+ saved_position<BidiIterator>* pmp = static_cast<saved_position<BidiIterator>*>(m_backup_state);
+ if(!r)
+ {
+ parenthesis_stack[parenthesis_stack_position++] = pmp->position;
+ }
+ boost::re_detail::inplace_destroy(pmp++);
+ m_backup_state = pmp;
+ return true;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_parenthesis_push(BidiIterator p)
+{
+ saved_position<BidiIterator>* pmp = static_cast<saved_position<BidiIterator>*>(m_backup_state);
+ --pmp;
+ if(pmp < m_stack_base)
+ {
+ extend_stack();
+ pmp = static_cast<saved_position<BidiIterator>*>(m_backup_state);
+ --pmp;
+ }
+ (void) new (pmp)saved_position<BidiIterator>(0, p, 17);
+ m_backup_state = pmp;
+}
+*/
} // namespace re_detail
} // namespace boost
template <class A>
void restore(match_results<BidiIterator, A>& w)
{
- w.set_first(sub.first, index);
- w.set_second(sub.second, index, sub.matched);
+ w.set_first(sub.first, index, index == 0);
+ w.set_second(sub.second, index, sub.matched, index == 0);
}
const sub_match<BidiIterator>& get() { return sub; }
};
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
{
- static matcher_proc_type const s_match_vtable[29] =
+ static matcher_proc_type const s_match_vtable[30] =
{
(&perl_matcher<BidiIterator, Allocator, traits>::match_startmark),
&perl_matcher<BidiIterator, Allocator, traits>::match_endmark,
&perl_matcher<BidiIterator, Allocator, traits>::match_combining,
&perl_matcher<BidiIterator, Allocator, traits>::match_soft_buffer_end,
&perl_matcher<BidiIterator, Allocator, traits>::match_restart_continue,
- (::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ // Although this next line *should* be evaluated at compile time, in practice
+ // some compilers (VC++) emit run-time initialisation which breaks thread
+ // safety, so use a dispatch function instead:
+ //(::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_dispatch,
&perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat,
&perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat,
&perl_matcher<BidiIterator, Allocator, traits>::match_backstep,
&perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref,
&perl_matcher<BidiIterator, Allocator, traits>::match_toggle_case,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_recursion,
};
if(state_count > max_state_count)
bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
{
int index = static_cast<const re_brace*>(pstate)->index;
+ icase = static_cast<const re_brace*>(pstate)->icase;
bool r = true;
switch(index)
{
break;
}
}
+ case -5:
+ {
+ // Reset start of $0, since we have a \K escape
+ backup_subex<BidiIterator> sub(*m_presult, 0);
+ m_presult->set_first(position, 0, true);
+ pstate = pstate->next.p;
+ r = match_all_states();
+ if(r == false)
+ sub.restore(*m_presult);
+ break;
+ }
default:
{
BOOST_ASSERT(index > 0);
#endif
}
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
+{
+ BOOST_ASSERT(pstate->type == syntax_element_recurse);
+ //
+ // Set new call stack:
+ //
+ if(recursion_stack_position >= static_cast<int>(sizeof(recursion_stack)/sizeof(recursion_stack[0])))
+ {
+ return false;
+ }
+ recursion_stack[recursion_stack_position].preturn_address = pstate->next.p;
+ recursion_stack[recursion_stack_position].results = *m_presult;
+ recursion_stack[recursion_stack_position].repeater_stack = next_count;
+ pstate = static_cast<const re_jump*>(pstate)->alt.p;
+ recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index;
+ ++recursion_stack_position;
+
+ repeater_count<BidiIterator>* saved = next_count;
+ repeater_count<BidiIterator> r(&next_count); // resets all repeat counts since we're recursing and starting fresh on those
+ next_count = &r;
+ bool result = match_all_states();
+ next_count = saved;
+
+ if(!result)
+ {
+ --recursion_stack_position;
+ next_count = recursion_stack[recursion_stack_position].repeater_stack;
+ *m_presult = recursion_stack[recursion_stack_position].results;
+ return false;
+ }
+ return true;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark()
+{
+ int index = static_cast<const re_brace*>(pstate)->index;
+ icase = static_cast<const re_brace*>(pstate)->icase;
+ if(index > 0)
+ {
+ if((m_match_flags & match_nosubs) == 0)
+ {
+ m_presult->set_second(position, index);
+ }
+ if(recursion_stack_position)
+ {
+ if(index == recursion_stack[recursion_stack_position-1].id)
+ {
+ --recursion_stack_position;
+ recursion_info<results_type> saved = recursion_stack[recursion_stack_position];
+ const re_syntax_base* saved_state = pstate = saved.preturn_address;
+ repeater_count<BidiIterator>* saved_count = next_count;
+ next_count = saved.repeater_stack;
+ *m_presult = saved.results;
+ if(!match_all_states())
+ {
+ recursion_stack[recursion_stack_position] = saved;
+ ++recursion_stack_position;
+ next_count = saved_count;
+ return false;
+ }
+ }
+ }
+ }
+ else if((index < 0) && (index != -4))
+ {
+ // matched forward lookahead:
+ pstate = 0;
+ return true;
+ }
+ pstate = pstate ? pstate->next.p : 0;
+ return true;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
+{
+ if(recursion_stack_position)
+ {
+ BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id);
+ --recursion_stack_position;
+ const re_syntax_base* saved_state = pstate = recursion_stack[recursion_stack_position].preturn_address;
+ *m_presult = recursion_stack[recursion_stack_position].results;
+ if(!match_all_states())
+ {
+ recursion_stack[recursion_stack_position].preturn_address = saved_state;
+ recursion_stack[recursion_stack_position].results = *m_presult;
+ ++recursion_stack_position;
+ return false;
+ }
+ return true;
+ }
+ if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first))
+ return false;
+ if((m_match_flags & match_all) && (position != last))
+ return false;
+ if((m_match_flags & regex_constants::match_not_initial_null) && (position == search_base))
+ return false;
+ m_presult->set_second(position);
+ pstate = 0;
+ m_has_found_match = true;
+ if((m_match_flags & match_posix) == match_posix)
+ {
+ m_result.maybe_assign(*m_presult);
+ if((m_match_flags & match_any) == 0)
+ return false;
+ }
+#ifdef BOOST_REGEX_MATCH_EXTRA
+ if(match_extra & m_match_flags)
+ {
+ for(unsigned i = 0; i < m_presult->size(); ++i)
+ if((*m_presult)[i].matched)
+ ((*m_presult)[i]).get_captures().push_back((*m_presult)[i]);
+ }
+#endif
+ return true;
+}
+
+
+
} // namespace re_detail
} // namespace boost
#ifdef BOOST_MSVC
void format_escape();
void format_conditional();
void format_until_scope_end();
+ bool handle_perl_verb(bool have_brace);
const traits& m_traits; // the traits class for localised formatting operations
const Results& m_results; // the match_results being used.
case '$':
put(*m_position++);
break;
+ case '+':
+ if((++m_position != m_end) && (*m_position == '{'))
+ {
+ const char_type* base = ++m_position;
+ while((m_position != m_end) && (*m_position != '}')) ++m_position;
+ if(m_position != m_end)
+ {
+ // Named sub-expression:
+ put(this->m_results.named_subexpression(base, m_position));
+ ++m_position;
+ break;
+ }
+ else
+ {
+ m_position = --base;
+ }
+ }
+ put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]);
+ break;
case '{':
have_brace = true;
++m_position;
// see if we have a number:
{
std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
- len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
+ //len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
int v = m_traits.toi(m_position, m_position + len, 10);
if((v < 0) || (have_brace && ((m_position == m_end) || (*m_position != '}'))))
{
- // leave the $ as is, and carry on:
- m_position = --save_position;
- put(*m_position);
- ++m_position;
+ // Look for a Perl-5.10 verb:
+ if(!handle_perl_verb(have_brace))
+ {
+ // leave the $ as is, and carry on:
+ m_position = --save_position;
+ put(*m_position);
+ ++m_position;
+ }
break;
}
// otherwise output sub v:
}
}
+template <class OutputIterator, class Results, class traits>
+bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bool have_brace)
+{
+ //
+ // We may have a capitalised string containing a Perl action:
+ //
+ static const char_type MATCH[] = { 'M', 'A', 'T', 'C', 'H' };
+ static const char_type PREMATCH[] = { 'P', 'R', 'E', 'M', 'A', 'T', 'C', 'H' };
+ static const char_type POSTMATCH[] = { 'P', 'O', 'S', 'T', 'M', 'A', 'T', 'C', 'H' };
+ static const char_type LAST_PAREN_MATCH[] = { 'L', 'A', 'S', 'T', '_', 'P', 'A', 'R', 'E', 'N', '_', 'M', 'A', 'T', 'C', 'H' };
+ static const char_type LAST_SUBMATCH_RESULT[] = { 'L', 'A', 'S', 'T', '_', 'S', 'U', 'B', 'M', 'A', 'T', 'C', 'H', '_', 'R', 'E', 'S', 'U', 'L', 'T' };
+ static const char_type LAST_SUBMATCH_RESULT_ALT[] = { '^', 'N' };
+
+ if(have_brace && (*m_position == '^'))
+ ++m_position;
+
+ int max_len = m_end - m_position;
+
+ if((max_len >= 5) && std::equal(m_position, m_position + 5, MATCH))
+ {
+ m_position += 5;
+ if(have_brace)
+ {
+ if(*m_position == '}')
+ ++m_position;
+ else
+ {
+ m_position -= 5;
+ return false;
+ }
+ }
+ put(this->m_results[0]);
+ return true;
+ }
+ if((max_len >= 8) && std::equal(m_position, m_position + 8, PREMATCH))
+ {
+ m_position += 8;
+ if(have_brace)
+ {
+ if(*m_position == '}')
+ ++m_position;
+ else
+ {
+ m_position -= 8;
+ return false;
+ }
+ }
+ put(this->m_results.prefix());
+ return true;
+ }
+ if((max_len >= 9) && std::equal(m_position, m_position + 9, POSTMATCH))
+ {
+ m_position += 9;
+ if(have_brace)
+ {
+ if(*m_position == '}')
+ ++m_position;
+ else
+ {
+ m_position -= 9;
+ return false;
+ }
+ }
+ put(this->m_results.suffix());
+ return true;
+ }
+ if((max_len >= 16) && std::equal(m_position, m_position + 16, LAST_PAREN_MATCH))
+ {
+ m_position += 16;
+ if(have_brace)
+ {
+ if(*m_position == '}')
+ ++m_position;
+ else
+ {
+ m_position -= 16;
+ return false;
+ }
+ }
+ put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]);
+ return true;
+ }
+ if((max_len >= 20) && std::equal(m_position, m_position + 20, LAST_SUBMATCH_RESULT))
+ {
+ m_position += 20;
+ if(have_brace)
+ {
+ if(*m_position == '}')
+ ++m_position;
+ else
+ {
+ m_position -= 20;
+ return false;
+ }
+ }
+ put(this->m_results.get_last_closed_paren());
+ return true;
+ }
+ if((max_len >= 2) && std::equal(m_position, m_position + 2, LAST_SUBMATCH_RESULT_ALT))
+ {
+ m_position += 2;
+ if(have_brace)
+ {
+ if(*m_position == '}')
+ ++m_position;
+ else
+ {
+ m_position -= 2;
+ return false;
+ }
+ }
+ put(this->m_results.get_last_closed_paren());
+ return true;
+ }
+ return false;
+}
+
template <class OutputIterator, class Results, class traits>
void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
{
put(static_cast<char_type>('?'));
return;
}
- std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
- len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
- int v = m_traits.toi(m_position, m_position + len, 10);
+ int v;
+ if(*m_position == '{')
+ {
+ const char_type* base = m_position;
+ ++m_position;
+ v = m_traits.toi(m_position, m_end, 10);
+ if(v < 0)
+ {
+ // Try a named subexpression:
+ while((m_position != m_end) && (*m_position != '}'))
+ ++m_position;
+ v = m_results.named_subexpression_index(base + 1, m_position);
+ }
+ if((v < 0) || (*m_position != '}'))
+ {
+ m_position = base;
+ // oops trailing '?':
+ put(static_cast<char_type>('?'));
+ return;
+ }
+ // Skip trailing '}':
+ ++m_position;
+ }
+ else
+ {
+ std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
+ len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
+ v = m_traits.toi(m_position, m_position + len, 10);
+ }
if(v < 0)
{
// oops not a number:
template <class charT>
int get_default_class_id(const charT* p1, const charT* p2)
{
- static const charT data[72] = {
+ static const charT data[73] = {
'a', 'l', 'n', 'u', 'm',
'a', 'l', 'p', 'h', 'a',
'b', 'l', 'a', 'n', 'k',
's', 'p', 'a', 'c', 'e',
'u', 'n', 'i', 'c', 'o', 'd', 'e',
'u', 'p', 'p', 'e', 'r',
+ 'v',
'w', 'o', 'r', 'd',
'x', 'd', 'i', 'g', 'i', 't',
};
- static const character_pointer_range<charT> ranges[19] =
+ static const character_pointer_range<charT> ranges[21] =
{
{data+0, data+5,}, // alnum
{data+5, data+10,}, // alpha
{data+20, data+21,}, // d
{data+20, data+25,}, // digit
{data+25, data+30,}, // graph
+ {data+29, data+30,}, // h
{data+30, data+31,}, // l
{data+30, data+35,}, // lower
{data+35, data+40,}, // print
{data+57, data+58,}, // u
{data+50, data+57,}, // unicode
{data+57, data+62,}, // upper
- {data+62, data+63,}, // w
- {data+62, data+66,}, // word
- {data+66, data+72,}, // xdigit
+ {data+62, data+63,}, // v
+ {data+63, data+64,}, // w
+ {data+63, data+67,}, // word
+ {data+67, data+73,}, // xdigit
};
static const character_pointer_range<charT>* ranges_begin = ranges;
static const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
return result;
}
+template <class charT>
+inline const charT* get_escape_R_string()
+{
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable:4309)
+#endif
+ static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?',
+ '|', '[', '\x0A', '\x0B', '\x0C', '\x85', '\\', 'x', '{', '2', '0', '2', '8', '}',
+ '\\', 'x', '{', '2', '0', '2', '9', '}', ']', ')', '\0' };
+ static const charT e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
+ '|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' };
+
+ charT c = static_cast<charT>(0x2029u);
+ bool b = (static_cast<unsigned>(c) == 0x2029u);
+
+ return (b ? e1 : e2);
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+}
+
+template <>
+inline const char* get_escape_R_string<char>()
+{
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable:4309)
+#endif
+ static const char e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
+ '|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' };
+ return e2;
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+}
+
} // re_detail
} // boost
#ifdef __cplusplus
namespace boost{ namespace re_detail{
-#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(_CPPLIB_VER) && defined(BOOST_DINKUMWARE_STDLIB) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
+#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && BOOST_WORKAROUND(BOOST_MSVC, <1600) && defined(_CPPLIB_VER) && defined(BOOST_DINKUMWARE_STDLIB) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
//
// MSVC 8 will either emit warnings or else refuse to compile
// code that makes perfectly legitimate use of std::copy, when
syntax_element_backstep = syntax_element_long_set_rep + 1,
// an assertion that a mark was matched:
syntax_element_assert_backref = syntax_element_backstep + 1,
- syntax_element_toggle_case = syntax_element_assert_backref + 1
+ syntax_element_toggle_case = syntax_element_assert_backref + 1,
+ // a recursive expression:
+ syntax_element_recurse = syntax_element_toggle_case + 1
};
#ifdef BOOST_REGEX_DEBUG
// The index to match, can be zero (don't mark the sub-expression)
// or negative (for perl style (?...) extentions):
int index;
+ bool icase;
};
/*** struct re_dot **************************************************
static const escape_syntax_type escape_type_property = 54; // for \p
static const escape_syntax_type escape_type_not_property = 55; // for \P
static const escape_syntax_type escape_type_named_char = 56; // for \N
+static const escape_syntax_type escape_type_extended_backref = 57; // for \g
+static const escape_syntax_type escape_type_reset_start_mark = 58; // for \K
+static const escape_syntax_type escape_type_line_ending = 59; // for \R
-static const escape_syntax_type syntax_max = 57;
+static const escape_syntax_type syntax_max = 60;
}
}
typedef typename w32_regex_traits<charT>::char_class_type char_class_type;
BOOST_STATIC_CONSTANT(char_class_type, mask_word = 0x0400); // must be C1_DEFINED << 1
BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 0x0800); // must be C1_DEFINED << 2
+ BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 0x1000); // must be C1_DEFINED << 3
+ BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 0x2000); // must be C1_DEFINED << 4
BOOST_STATIC_CONSTANT(char_class_type, mask_base = 0x3ff); // all the masks used by the CT_CTYPE1 group
typedef std::basic_string<charT> string_type;
typename w32_regex_traits_implementation<charT>::char_class_type
w32_regex_traits_implementation<charT>::lookup_classname_imp(const charT* p1, const charT* p2) const
{
- static const char_class_type masks[20] =
+ static const char_class_type masks[22] =
{
0,
0x0104u, // C1_ALPHA | C1_DIGIT
0x0004u, // C1_DIGIT
0x0004u, // C1_DIGIT
(~(0x0020u|0x0008u|0x0040) & 0x01ffu) | 0x0400u, // not C1_CNTRL or C1_SPACE or C1_BLANK
+ w32_regex_traits_implementation<charT>::mask_horizontal,
0x0002u, // C1_LOWER
0x0002u, // C1_LOWER
(~0x0020u & 0x01ffu) | 0x0400, // not C1_CNTRL
0x0001u, // C1_UPPER
w32_regex_traits_implementation<charT>::mask_unicode,
0x0001u, // C1_UPPER
+ w32_regex_traits_implementation<charT>::mask_vertical,
0x0104u | w32_regex_traits_implementation<charT>::mask_word,
0x0104u | w32_regex_traits_implementation<charT>::mask_word,
0x0080u, // C1_XDIGIT
return true;
else if((f & re_detail::w32_regex_traits_implementation<charT>::mask_word) && (c == '_'))
return true;
+ else if((f & re_detail::w32_regex_traits_implementation<charT>::mask_vertical)
+ && (::boost::re_detail::is_separator(c) || (c == '\v')))
+ return true;
+ else if((f & re_detail::w32_regex_traits_implementation<charT>::mask_horizontal)
+ && this->isctype(c, 0x0008u) && !this->isctype(c, re_detail::w32_regex_traits_implementation<charT>::mask_vertical))
+ return true;
return false;
}
int toi(const charT*& p1, const charT* p2, int radix)const
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type;
+#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type;
#include <boost/signals/signal_template.hpp>
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;T8 a8;T9 a9;T10 a10;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7, T8 ia8, T9 ia9, T10 ia10
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7), a8(ia8), a9(ia9), a10(ia10)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type; typedef T8 arg9_type; typedef T9 arg10_type; typedef T10 arg11_type;
+#define BOOST_SIGNALS_ARG_TYPES 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;
#include <boost/signals/signal_template.hpp>
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type;
+#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type;
#include <boost/signals/signal_template.hpp>
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type;
+#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type;
#include <boost/signals/signal_template.hpp>
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type;
+#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type;
#include <boost/signals/signal_template.hpp>
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type;
+#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type;
#include <boost/signals/signal_template.hpp>
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type;
+#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type;
#include <boost/signals/signal_template.hpp>
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type;
+#define BOOST_SIGNALS_ARG_TYPES 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;
#include <boost/signals/signal_template.hpp>
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;T8 a8;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7, T8 ia8
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7), a8(ia8)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type; typedef T8 arg9_type;
+#define BOOST_SIGNALS_ARG_TYPES 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;
#include <boost/signals/signal_template.hpp>
#define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;T8 a8;T9 a9;
#define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7, T8 ia8, T9 ia9
#define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7), a8(ia8), a9(ia9)
-#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type; typedef T8 arg9_type; typedef T9 arg10_type;
+#define BOOST_SIGNALS_ARG_TYPES 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;
#include <boost/signals/signal_template.hpp>
if(pi_ != 0) pi_->weak_add_ref();\r
}\r
\r
+// Move support\r
+\r
+#if defined( BOOST_HAS_RVALUE_REFS )\r
+\r
+ weak_count(weak_count && r): pi_(r.pi_) // nothrow\r
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)\r
+ , id_(weak_count_id)\r
+#endif\r
+ {\r
+ r.pi_ = 0;\r
+ }\r
+\r
+#endif\r
+\r
~weak_count() // nothrow\r
{\r
if(pi_ != 0) pi_->weak_release();\r
static yes f( T* );\r
static no f( ... );\r
\r
- enum _vt { value = sizeof( f( (Y*)0 ) ) == sizeof(yes) };\r
+ enum _vt { value = sizeof( f( static_cast<Y*>(0) ) ) == sizeof(yes) };\r
};\r
\r
struct sp_empty\r
--- /dev/null
+#ifndef BOOST_ENABLE_SHARED_FROM_THIS2_HPP_INCLUDED\r
+#define BOOST_ENABLE_SHARED_FROM_THIS2_HPP_INCLUDED\r
+\r
+//\r
+// enable_shared_from_this2.hpp\r
+//\r
+// Copyright 2002, 2009 Peter Dimov\r
+// Copyright 2008 Frank Mori Hess\r
+//\r
+// Distributed under the Boost Software License, Version 1.0.\r
+// See accompanying file LICENSE_1_0.txt or copy at\r
+// http://www.boost.org/LICENSE_1_0.txt\r
+//\r
+\r
+#include <boost/config.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+#include <boost/assert.hpp>\r
+#include <boost/detail/workaround.hpp>\r
+\r
+namespace boost\r
+{\r
+\r
+namespace detail\r
+{\r
+\r
+class esft2_deleter_wrapper\r
+{\r
+private:\r
+\r
+ shared_ptr<void> deleter_;\r
+\r
+public:\r
+\r
+ esft2_deleter_wrapper()\r
+ {\r
+ }\r
+\r
+ template< class T > void set_deleter( shared_ptr<T> const & deleter )\r
+ {\r
+ deleter_ = deleter;\r
+ }\r
+\r
+ template< class T> void operator()( T* )\r
+ {\r
+ BOOST_ASSERT( deleter_.use_count() <= 1 );\r
+ deleter_.reset();\r
+ }\r
+};\r
+\r
+} // namespace detail\r
+\r
+template< class T > class enable_shared_from_this2\r
+{\r
+protected:\r
+\r
+ enable_shared_from_this2()\r
+ {\r
+ }\r
+\r
+ enable_shared_from_this2( enable_shared_from_this2 const & )\r
+ {\r
+ }\r
+\r
+ enable_shared_from_this2 & operator=( enable_shared_from_this2 const & )\r
+ {\r
+ return *this;\r
+ }\r
+\r
+ ~enable_shared_from_this2()\r
+ {\r
+ BOOST_ASSERT( shared_this_.use_count() <= 1 ); // make sure no dangling shared_ptr objects exist\r
+ }\r
+\r
+private:\r
+\r
+ mutable weak_ptr<T> weak_this_;\r
+ mutable shared_ptr<T> shared_this_;\r
+\r
+public:\r
+\r
+ shared_ptr<T> shared_from_this()\r
+ {\r
+ init_weak_once();\r
+ return shared_ptr<T>( weak_this_ );\r
+ }\r
+\r
+ shared_ptr<T const> shared_from_this() const\r
+ {\r
+ init_weak_once();\r
+ return shared_ptr<T>( weak_this_ );\r
+ }\r
+\r
+private:\r
+\r
+ void init_weak_once() const\r
+ {\r
+ if( weak_this_._empty() )\r
+ {\r
+ shared_this_.reset( static_cast< T* >( 0 ), detail::esft2_deleter_wrapper() );\r
+ weak_this_ = shared_this_;\r
+ }\r
+ }\r
+\r
+public: // actually private, but avoids compiler template friendship issues\r
+\r
+ // Note: invoked automatically by shared_ptr; do not call\r
+ template<class X, class Y> void _internal_accept_owner( shared_ptr<X> * ppx, Y * py ) const\r
+ {\r
+ BOOST_ASSERT( ppx != 0 );\r
+\r
+ if( weak_this_.use_count() == 0 )\r
+ {\r
+ weak_this_ = shared_ptr<T>( *ppx, py );\r
+ }\r
+ else if( shared_this_.use_count() != 0 )\r
+ {\r
+ BOOST_ASSERT( ppx->unique() ); // no weak_ptrs should exist either, but there's no way to check that\r
+\r
+ detail::esft2_deleter_wrapper * pd = boost::get_deleter<detail::esft2_deleter_wrapper>( shared_this_ );\r
+ BOOST_ASSERT( pd != 0 );\r
+\r
+ pd->set_deleter( *ppx );\r
+\r
+ ppx->reset( shared_this_, ppx->get() );\r
+ shared_this_.reset();\r
+ }\r
+ }\r
+};\r
+\r
+} // namespace boost\r
+\r
+#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS2_HPP_INCLUDED\r
return *this;\r
}\r
\r
+#endif\r
+\r
+// Move support\r
+\r
+#if defined( BOOST_HAS_RVALUE_REFS )\r
+\r
+ intrusive_ptr(intrusive_ptr && rhs): px( rhs.px )\r
+ {\r
+ rhs.px = 0;\r
+ }\r
+\r
+ intrusive_ptr & operator=(intrusive_ptr && rhs)\r
+ {\r
+ this_type(std::move(rhs)).swap(*this);\r
+ return *this;\r
+ }\r
+\r
#endif\r
\r
intrusive_ptr & operator=(intrusive_ptr const & rhs)\r
template<class T> class shared_ptr;\r
template<class T> class weak_ptr;\r
template<class T> class enable_shared_from_this;\r
+template<class T> class enable_shared_from_this2;\r
\r
namespace detail\r
{\r
}\r
}\r
\r
+template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr<X> * ppx, Y const * py, boost::enable_shared_from_this2< T > const * pe )\r
+{\r
+ if( pe != 0 )\r
+ {\r
+ pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) );\r
+ }\r
+}\r
+\r
#ifdef _MANAGED\r
\r
// Avoid C4793, ... causes native code generation\r
\r
shared_ptr & operator=( shared_ptr && r ) // never throws\r
{\r
- this_type( static_cast< shared_ptr && >( r ) ).swap( *this );\r
+ this_type( std::move( r ) ).swap( *this );\r
return *this;\r
}\r
\r
template<class Y>\r
shared_ptr & operator=( shared_ptr<Y> && r ) // never throws\r
{\r
- this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );\r
+ this_type( std::move( r ) ).swap( *this );\r
return *this;\r
}\r
\r
weak_ptr( weak_ptr<Y> const & r )\r
\r
#endif\r
- : pn(r.pn) // never throws\r
+ : px(r.lock().get()), pn(r.pn) // never throws\r
{\r
- px = r.lock().get();\r
}\r
\r
+#if defined( BOOST_HAS_RVALUE_REFS )\r
+\r
+ template<class Y>\r
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )\r
+\r
+ weak_ptr( weak_ptr<Y> && r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )\r
+\r
+#else\r
+\r
+ weak_ptr( weak_ptr<Y> && r )\r
+\r
+#endif\r
+ : px(r.lock().get()), pn(std::move(r.pn)) // never throws\r
+ {\r
+ r.px = 0;\r
+ }\r
+\r
+ // for better efficiency in the T == Y case\r
+ weak_ptr( weak_ptr && r ): px( r.px ), pn(std::move(r.pn)) // never throws\r
+ {\r
+ r.px = 0;\r
+ }\r
+\r
+ // for better efficiency in the T == Y case\r
+ weak_ptr & operator=( weak_ptr && r ) // never throws\r
+ {\r
+ this_type( std::move( r ) ).swap( *this );\r
+ return *this;\r
+ }\r
+\r
+\r
+#endif\r
+\r
template<class Y>\r
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )\r
\r
return *this;\r
}\r
\r
+#if defined( BOOST_HAS_RVALUE_REFS )\r
+\r
+ template<class Y>\r
+ weak_ptr & operator=(weak_ptr<Y> && r)\r
+ {\r
+ this_type( std::move( r ) ).swap( *this );\r
+ return *this;\r
+ }\r
+\r
+#endif\r
+\r
template<class Y>\r
weak_ptr & operator=(shared_ptr<Y> const & r) // never throws\r
{\r
return pn.use_count() == 0;\r
}\r
\r
+ bool _empty() const // extension, not in std::weak_ptr\r
+ {\r
+ return pn.empty();\r
+ }\r
+\r
void reset() // never throws in 1.30+\r
{\r
this_type().swap(*this);\r
--- /dev/null
+// Copyright (C) 2007 Joseph Gauterin\r
+//\r
+// Distributed under the Boost Software License, Version 1.0. (See\r
+// accompanying file LICENSE_1_0.txt or copy at\r
+// http://www.boost.org/LICENSE_1_0.txt)\r
+\r
+#ifndef BOOST_SWAP_HPP\r
+#define BOOST_SWAP_HPP\r
+\r
+#include "boost/utility/swap.hpp"\r
+\r
+#endif\r
// http://www.boost.org/libs/utility/throw_exception.html
//
-#include <boost/config.hpp>
+#include <boost/exception/detail/attribute_noreturn.hpp>
#include <boost/detail/workaround.hpp>
#include <exception>
inline void throw_exception_assert_compatibility( std::exception const & ) { }
-template<class E> inline void throw_exception( E const & e )
+template<class E> BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const & e )
{
//All boost exceptions are required to derive std::exception,
//to ensure compatibility with BOOST_NO_EXCEPTIONS.
template<int N, class T>
-struct element:
+struct element:
public detail::element_impl<N, T, ::boost::is_const<T>::value>
{
};
BOOST_STATIC_CONSTANT(int, value = 0);
};
+template<>
+struct length<tuple<> const> {
+ BOOST_STATIC_CONSTANT(int, value = 0);
+};
+
template<>
struct length<null_type> {
BOOST_STATIC_CONSTANT(int, value = 0);
};
+template<>
+struct length<null_type const> {
+ BOOST_STATIC_CONSTANT(int, value = 0);
+};
namespace detail {
} // namespace detail
#if defined (BOOST_NO_TEMPLATED_STREAMS)
+
+inline std::ostream& operator<<(std::ostream& o, const null_type& t) {
+ if (!o.good() ) return o;
+
+ const char l =
+ detail::format_info::get_manipulator(o, detail::format_info::open);
+ const char r =
+ detail::format_info::get_manipulator(o, detail::format_info::close);
+
+ o << l;
+ o << r;
+
+ return o;
+}
+
template<class T1, class T2>
inline std::ostream& operator<<(std::ostream& o, const cons<T1, T2>& t) {
if (!o.good() ) return o;
#else
+template<class CharType, class CharTrait>
+inline std::basic_ostream<CharType, CharTrait>&
+operator<<(std::basic_ostream<CharType, CharTrait>& o,
+ const null_type& t) {
+ if (!o.good() ) return o;
+
+ const CharType l =
+ detail::format_info::get_manipulator(o, detail::format_info::open);
+ const CharType r =
+ detail::format_info::get_manipulator(o, detail::format_info::close);
+
+ o << l;
+ o << r;
+
+ return o;
+}
+
template<class CharType, class CharTrait, class T1, class T2>
inline std::basic_ostream<CharType, CharTrait>&
operator<<(std::basic_ostream<CharType, CharTrait>& o,
struct alignment_of_impl
{
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
- //
- // With MSVC both the native __alignof operator
- // and our own logic gets things wrong from time to time :-(
- // Using a combination of the two seems to make the most of a bad job:
- //
+ //
+ // With MSVC both the native __alignof operator
+ // and our own logic gets things wrong from time to time :-(
+ // Using a combination of the two seems to make the most of a bad job:
+ //
BOOST_STATIC_CONSTANT(std::size_t, value =
(::boost::detail::alignment_logic<
sizeof(::boost::detail::alignment_of_hack<T>) - sizeof(T),
inline addr_impl_ref( T & v ): v_( v ) {}
inline operator T& () const { return v_; }
+
+private:
+ addr_impl_ref & operator=(const addr_impl_ref &);
};
template<class T> struct addressof_impl
template<typename F, typename FArgs>\r
struct result_of_impl<F, FArgs, false>\r
: mpl::if_<is_function_with_no_args<FArgs>,\r
- result_of_void_impl<F>,\r
- result_of_nested_result<F, FArgs> >::type\r
+ result_of_void_impl<F>,\r
+ result_of_nested_result<F, FArgs> >::type\r
{};\r
\r
} // end namespace detail\r
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
-#define BOOST_VERSION 103900
+#define BOOST_VERSION 104000
//
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
// number, y is the minor version number, and z is the patch level if not 0.
// This is used by <config/auto_link.hpp> to select which library version to link to.
-#define BOOST_LIB_VERSION "1_39"
+#define BOOST_LIB_VERSION "1_40"
#endif
--- /dev/null
+#\r
+# Copyright Troy D. Straszheim\r
+#\r
+# Distributed under the Boost Software License, Version 1.0.\r
+# See http://www.boost.org/LICENSE_1_0.txt\r
+#\r
+# Look for the ICU library. If we find it, we'll compile in support for ICU\r
+include(FindICU)\r
+set(BOOST_REGEX_LIBRARIES)\r
+if (ICU_FOUND AND ICU_I18N_FOUND)\r
+ add_definitions(-DBOOST_HAS_ICU=1)\r
+ include_directories(${ICU_INCLUDE_DIRS})\r
+ set(BOOST_REGEX_LIBRARIES ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})\r
+endif (ICU_FOUND AND ICU_I18N_FOUND)\r
+ \r
+boost_add_library(boost_regex\r
+ c_regex_traits.cpp\r
+ cpp_regex_traits.cpp\r
+ cregex.cpp\r
+ fileiter.cpp\r
+ icu.cpp\r
+ instances.cpp\r
+ posix_api.cpp\r
+ regex.cpp\r
+ regex_debug.cpp\r
+ regex_raw_buffer.cpp\r
+ regex_traits_defaults.cpp\r
+ static_mutex.cpp\r
+ w32_regex_traits.cpp\r
+ wc_regex_traits.cpp\r
+ wide_posix_api.cpp\r
+ winstances.cpp \r
+ usinstances.cpp \r
+ LINK_LIBS ${BOOST_REGEX_LIBRARIES}\r
+ SHARED_COMPILE_FLAGS -DBOOST_REGEX_DYN_LINK=1)\r
+\r
+\r
+\r
+\r
+\r
char_class_graph=char_class_alnum|char_class_punct,
char_class_blank=1<<9,
char_class_word=1<<10,
- char_class_unicode=1<<11
+ char_class_unicode=1<<11,
+ char_class_horizontal=1<<12,
+ char_class_vertical=1<<13
};
c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_classname(const char* p1, const char* p2)
char_class_digit,
char_class_digit,
char_class_graph,
+ char_class_horizontal,
char_class_lower,
char_class_lower,
char_class_print,
char_class_upper,
char_class_unicode,
char_class_upper,
+ char_class_vertical,
char_class_alnum | char_class_word,
char_class_alnum | char_class_word,
char_class_xdigit,
|| ((mask & char_class_punct) && (std::ispunct)(static_cast<unsigned char>(c)))
|| ((mask & char_class_xdigit) && (std::isxdigit)(static_cast<unsigned char>(c)))
|| ((mask & char_class_blank) && (std::isspace)(static_cast<unsigned char>(c)) && !::boost::re_detail::is_separator(c))
- || ((mask & char_class_word) && (c == '_'));
+ || ((mask & char_class_word) && (c == '_'))
+ || ((mask & char_class_vertical) && (::boost::re_detail::is_separator(c) || (c == '\v')))
+ || ((mask & char_class_horizontal) && (std::isspace)(static_cast<unsigned char>(c)) && !::boost::re_detail::is_separator(c) && (c != '\v'));
}
c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_collatename(const char* p1, const char* p2)
typedef boost::match_flag_type match_flag_type;
#include <cstdio>
+#ifdef BOOST_MSVC
+#pragma warning(disable:4309)
+#endif
+
namespace boost{
#ifdef __BORLANDC__
return result;
}
-#if defined(BOOST_HAS_LONG_LONG) && !defined(_MSC_VER)
+#ifdef BOOST_HAS_LONG_LONG
const std::size_t RegEx::npos = static_cast<std::size_t>(~0ULL);
#else
const std::size_t RegEx::npos = static_cast<std::size_t>(~0UL);
+
--- /dev/null
+/*\r
+ *\r
+ * Copyright (c) 2004\r
+ * John Maddock\r
+ *\r
+ * Use, modification and distribution are subject to the \r
+ * Boost Software License, Version 1.0. (See accompanying file \r
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+ *\r
+ */\r
+\r
+ /*\r
+ * LOCATION: see http://www.boost.org for most recent version.\r
+ * FILE icu.cpp\r
+ * VERSION see <boost/version.hpp>\r
+ * DESCRIPTION: Unicode regular expressions on top of the ICU Library.\r
+ */\r
+#define BOOST_REGEX_SOURCE\r
+\r
+#include <boost/regex/config.hpp>\r
+#ifdef BOOST_HAS_ICU\r
+#define BOOST_REGEX_ICU_INSTANTIATE\r
+#include <boost/regex/icu.hpp>\r
+\r
+namespace boost{\r
+\r
+namespace re_detail{\r
+\r
+icu_regex_traits_implementation::string_type icu_regex_traits_implementation::do_transform(const char_type* p1, const char_type* p2, const U_NAMESPACE_QUALIFIER Collator* pcoll) const\r
+{\r
+ // TODO make thread safe!!!! :\r
+ typedef u32_to_u16_iterator<const char_type*, ::UChar> itt;\r
+ itt i(p1), j(p2);\r
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS\r
+ std::vector< ::UChar> t(i, j);\r
+#else\r
+ std::vector< ::UChar> t;\r
+ while(i != j)\r
+ t.push_back(*i++);\r
+#endif\r
+ ::uint8_t result[100];\r
+ ::int32_t len;\r
+ if(t.size())\r
+ len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), result, sizeof(result));\r
+ else\r
+ len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast< ::int32_t>(0), result, sizeof(result));\r
+ if(std::size_t(len) > sizeof(result))\r
+ {\r
+ scoped_array< ::uint8_t> presult(new ::uint8_t[len+1]);\r
+ if(t.size())\r
+ len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), presult.get(), len+1);\r
+ else\r
+ len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast< ::int32_t>(0), presult.get(), len+1);\r
+ if((0 == presult[len-1]) && (len > 1))\r
+ --len;\r
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS\r
+ return string_type(presult.get(), presult.get()+len);\r
+#else\r
+ string_type sresult;\r
+ ::uint8_t const* ia = presult.get();\r
+ ::uint8_t const* ib = presult.get()+len;\r
+ while(ia != ib)\r
+ sresult.push_back(*ia++);\r
+ return sresult;\r
+#endif\r
+ }\r
+ if((0 == result[len-1]) && (len > 1))\r
+ --len;\r
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS\r
+ return string_type(result, result+len);\r
+#else\r
+ string_type sresult;\r
+ ::uint8_t const* ia = result;\r
+ ::uint8_t const* ib = result+len;\r
+ while(ia != ib)\r
+ sresult.push_back(*ia++);\r
+ return sresult;\r
+#endif\r
+}\r
+\r
+}\r
+\r
+icu_regex_traits::size_type icu_regex_traits::length(const char_type* p)\r
+{\r
+ size_type result = 0;\r
+ while(*p)\r
+ {\r
+ ++p;\r
+ ++result;\r
+ }\r
+ return result;\r
+}\r
+\r
+//\r
+// define our bitmasks:\r
+//\r
+const icu_regex_traits::char_class_type icu_regex_traits::mask_blank = icu_regex_traits::char_class_type(1) << offset_blank;\r
+const icu_regex_traits::char_class_type icu_regex_traits::mask_space = icu_regex_traits::char_class_type(1) << offset_space;\r
+const icu_regex_traits::char_class_type icu_regex_traits::mask_xdigit = icu_regex_traits::char_class_type(1) << offset_xdigit;\r
+const icu_regex_traits::char_class_type icu_regex_traits::mask_underscore = icu_regex_traits::char_class_type(1) << offset_underscore;\r
+const icu_regex_traits::char_class_type icu_regex_traits::mask_unicode = icu_regex_traits::char_class_type(1) << offset_unicode;\r
+const icu_regex_traits::char_class_type icu_regex_traits::mask_any = icu_regex_traits::char_class_type(1) << offset_any;\r
+const icu_regex_traits::char_class_type icu_regex_traits::mask_ascii = icu_regex_traits::char_class_type(1) << offset_ascii;\r
+const icu_regex_traits::char_class_type icu_regex_traits::mask_horizontal = icu_regex_traits::char_class_type(1) << offset_horizontal;\r
+const icu_regex_traits::char_class_type icu_regex_traits::mask_vertical = icu_regex_traits::char_class_type(1) << offset_vertical;\r
+\r
+icu_regex_traits::char_class_type icu_regex_traits::lookup_icu_mask(const ::UChar32* p1, const ::UChar32* p2)\r
+{\r
+ static const ::UChar32 prop_name_table[] = {\r
+ /* any */ 'a', 'n', 'y', \r
+ /* ascii */ 'a', 's', 'c', 'i', 'i', \r
+ /* assigned */ 'a', 's', 's', 'i', 'g', 'n', 'e', 'd', \r
+ /* c* */ 'c', '*', \r
+ /* cc */ 'c', 'c', \r
+ /* cf */ 'c', 'f', \r
+ /* closepunctuation */ 'c', 'l', 'o', 's', 'e', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', \r
+ /* cn */ 'c', 'n', \r
+ /* co */ 'c', 'o', \r
+ /* connectorpunctuation */ 'c', 'o', 'n', 'n', 'e', 'c', 't', 'o', 'r', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', \r
+ /* control */ 'c', 'o', 'n', 't', 'r', 'o', 'l', \r
+ /* cs */ 'c', 's', \r
+ /* currencysymbol */ 'c', 'u', 'r', 'r', 'e', 'n', 'c', 'y', 's', 'y', 'm', 'b', 'o', 'l', \r
+ /* dashpunctuation */ 'd', 'a', 's', 'h', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', \r
+ /* decimaldigitnumber */ 'd', 'e', 'c', 'i', 'm', 'a', 'l', 'd', 'i', 'g', 'i', 't', 'n', 'u', 'm', 'b', 'e', 'r', \r
+ /* enclosingmark */ 'e', 'n', 'c', 'l', 'o', 's', 'i', 'n', 'g', 'm', 'a', 'r', 'k', \r
+ /* finalpunctuation */ 'f', 'i', 'n', 'a', 'l', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', \r
+ /* format */ 'f', 'o', 'r', 'm', 'a', 't', \r
+ /* initialpunctuation */ 'i', 'n', 'i', 't', 'i', 'a', 'l', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', \r
+ /* l* */ 'l', '*', \r
+ /* letter */ 'l', 'e', 't', 't', 'e', 'r', \r
+ /* letternumber */ 'l', 'e', 't', 't', 'e', 'r', 'n', 'u', 'm', 'b', 'e', 'r', \r
+ /* lineseparator */ 'l', 'i', 'n', 'e', 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r', \r
+ /* ll */ 'l', 'l', \r
+ /* lm */ 'l', 'm', \r
+ /* lo */ 'l', 'o', \r
+ /* lowercaseletter */ 'l', 'o', 'w', 'e', 'r', 'c', 'a', 's', 'e', 'l', 'e', 't', 't', 'e', 'r', \r
+ /* lt */ 'l', 't', \r
+ /* lu */ 'l', 'u', \r
+ /* m* */ 'm', '*', \r
+ /* mark */ 'm', 'a', 'r', 'k', \r
+ /* mathsymbol */ 'm', 'a', 't', 'h', 's', 'y', 'm', 'b', 'o', 'l', \r
+ /* mc */ 'm', 'c', \r
+ /* me */ 'm', 'e', \r
+ /* mn */ 'm', 'n', \r
+ /* modifierletter */ 'm', 'o', 'd', 'i', 'f', 'i', 'e', 'r', 'l', 'e', 't', 't', 'e', 'r', \r
+ /* modifiersymbol */ 'm', 'o', 'd', 'i', 'f', 'i', 'e', 'r', 's', 'y', 'm', 'b', 'o', 'l', \r
+ /* n* */ 'n', '*', \r
+ /* nd */ 'n', 'd', \r
+ /* nl */ 'n', 'l', \r
+ /* no */ 'n', 'o', \r
+ /* nonspacingmark */ 'n', 'o', 'n', 's', 'p', 'a', 'c', 'i', 'n', 'g', 'm', 'a', 'r', 'k', \r
+ /* notassigned */ 'n', 'o', 't', 'a', 's', 's', 'i', 'g', 'n', 'e', 'd', \r
+ /* number */ 'n', 'u', 'm', 'b', 'e', 'r', \r
+ /* openpunctuation */ 'o', 'p', 'e', 'n', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', \r
+ /* other */ 'o', 't', 'h', 'e', 'r', \r
+ /* otherletter */ 'o', 't', 'h', 'e', 'r', 'l', 'e', 't', 't', 'e', 'r', \r
+ /* othernumber */ 'o', 't', 'h', 'e', 'r', 'n', 'u', 'm', 'b', 'e', 'r', \r
+ /* otherpunctuation */ 'o', 't', 'h', 'e', 'r', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', \r
+ /* othersymbol */ 'o', 't', 'h', 'e', 'r', 's', 'y', 'm', 'b', 'o', 'l', \r
+ /* p* */ 'p', '*', \r
+ /* paragraphseparator */ 'p', 'a', 'r', 'a', 'g', 'r', 'a', 'p', 'h', 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r', \r
+ /* pc */ 'p', 'c', \r
+ /* pd */ 'p', 'd', \r
+ /* pe */ 'p', 'e', \r
+ /* pf */ 'p', 'f', \r
+ /* pi */ 'p', 'i', \r
+ /* po */ 'p', 'o', \r
+ /* privateuse */ 'p', 'r', 'i', 'v', 'a', 't', 'e', 'u', 's', 'e', \r
+ /* ps */ 'p', 's', \r
+ /* punctuation */ 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', \r
+ /* s* */ 's', '*', \r
+ /* sc */ 's', 'c', \r
+ /* separator */ 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r', \r
+ /* sk */ 's', 'k', \r
+ /* sm */ 's', 'm', \r
+ /* so */ 's', 'o', \r
+ /* spaceseparator */ 's', 'p', 'a', 'c', 'e', 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r', \r
+ /* spacingcombiningmark */ 's', 'p', 'a', 'c', 'i', 'n', 'g', 'c', 'o', 'm', 'b', 'i', 'n', 'i', 'n', 'g', 'm', 'a', 'r', 'k', \r
+ /* surrogate */ 's', 'u', 'r', 'r', 'o', 'g', 'a', 't', 'e', \r
+ /* symbol */ 's', 'y', 'm', 'b', 'o', 'l', \r
+ /* titlecase */ 't', 'i', 't', 'l', 'e', 'c', 'a', 's', 'e', \r
+ /* titlecaseletter */ 't', 'i', 't', 'l', 'e', 'c', 'a', 's', 'e', 'l', 'e', 't', 't', 'e', 'r', \r
+ /* uppercaseletter */ 'u', 'p', 'p', 'e', 'r', 'c', 'a', 's', 'e', 'l', 'e', 't', 't', 'e', 'r', \r
+ /* z* */ 'z', '*', \r
+ /* zl */ 'z', 'l', \r
+ /* zp */ 'z', 'p', \r
+ /* zs */ 'z', 's', \r
+ };\r
+\r
+ static const re_detail::character_pointer_range< ::UChar32> range_data[] = {\r
+ { prop_name_table+0, prop_name_table+3, }, // any\r
+ { prop_name_table+3, prop_name_table+8, }, // ascii\r
+ { prop_name_table+8, prop_name_table+16, }, // assigned\r
+ { prop_name_table+16, prop_name_table+18, }, // c*\r
+ { prop_name_table+18, prop_name_table+20, }, // cc\r
+ { prop_name_table+20, prop_name_table+22, }, // cf\r
+ { prop_name_table+22, prop_name_table+38, }, // closepunctuation\r
+ { prop_name_table+38, prop_name_table+40, }, // cn\r
+ { prop_name_table+40, prop_name_table+42, }, // co\r
+ { prop_name_table+42, prop_name_table+62, }, // connectorpunctuation\r
+ { prop_name_table+62, prop_name_table+69, }, // control\r
+ { prop_name_table+69, prop_name_table+71, }, // cs\r
+ { prop_name_table+71, prop_name_table+85, }, // currencysymbol\r
+ { prop_name_table+85, prop_name_table+100, }, // dashpunctuation\r
+ { prop_name_table+100, prop_name_table+118, }, // decimaldigitnumber\r
+ { prop_name_table+118, prop_name_table+131, }, // enclosingmark\r
+ { prop_name_table+131, prop_name_table+147, }, // finalpunctuation\r
+ { prop_name_table+147, prop_name_table+153, }, // format\r
+ { prop_name_table+153, prop_name_table+171, }, // initialpunctuation\r
+ { prop_name_table+171, prop_name_table+173, }, // l*\r
+ { prop_name_table+173, prop_name_table+179, }, // letter\r
+ { prop_name_table+179, prop_name_table+191, }, // letternumber\r
+ { prop_name_table+191, prop_name_table+204, }, // lineseparator\r
+ { prop_name_table+204, prop_name_table+206, }, // ll\r
+ { prop_name_table+206, prop_name_table+208, }, // lm\r
+ { prop_name_table+208, prop_name_table+210, }, // lo\r
+ { prop_name_table+210, prop_name_table+225, }, // lowercaseletter\r
+ { prop_name_table+225, prop_name_table+227, }, // lt\r
+ { prop_name_table+227, prop_name_table+229, }, // lu\r
+ { prop_name_table+229, prop_name_table+231, }, // m*\r
+ { prop_name_table+231, prop_name_table+235, }, // mark\r
+ { prop_name_table+235, prop_name_table+245, }, // mathsymbol\r
+ { prop_name_table+245, prop_name_table+247, }, // mc\r
+ { prop_name_table+247, prop_name_table+249, }, // me\r
+ { prop_name_table+249, prop_name_table+251, }, // mn\r
+ { prop_name_table+251, prop_name_table+265, }, // modifierletter\r
+ { prop_name_table+265, prop_name_table+279, }, // modifiersymbol\r
+ { prop_name_table+279, prop_name_table+281, }, // n*\r
+ { prop_name_table+281, prop_name_table+283, }, // nd\r
+ { prop_name_table+283, prop_name_table+285, }, // nl\r
+ { prop_name_table+285, prop_name_table+287, }, // no\r
+ { prop_name_table+287, prop_name_table+301, }, // nonspacingmark\r
+ { prop_name_table+301, prop_name_table+312, }, // notassigned\r
+ { prop_name_table+312, prop_name_table+318, }, // number\r
+ { prop_name_table+318, prop_name_table+333, }, // openpunctuation\r
+ { prop_name_table+333, prop_name_table+338, }, // other\r
+ { prop_name_table+338, prop_name_table+349, }, // otherletter\r
+ { prop_name_table+349, prop_name_table+360, }, // othernumber\r
+ { prop_name_table+360, prop_name_table+376, }, // otherpunctuation\r
+ { prop_name_table+376, prop_name_table+387, }, // othersymbol\r
+ { prop_name_table+387, prop_name_table+389, }, // p*\r
+ { prop_name_table+389, prop_name_table+407, }, // paragraphseparator\r
+ { prop_name_table+407, prop_name_table+409, }, // pc\r
+ { prop_name_table+409, prop_name_table+411, }, // pd\r
+ { prop_name_table+411, prop_name_table+413, }, // pe\r
+ { prop_name_table+413, prop_name_table+415, }, // pf\r
+ { prop_name_table+415, prop_name_table+417, }, // pi\r
+ { prop_name_table+417, prop_name_table+419, }, // po\r
+ { prop_name_table+419, prop_name_table+429, }, // privateuse\r
+ { prop_name_table+429, prop_name_table+431, }, // ps\r
+ { prop_name_table+431, prop_name_table+442, }, // punctuation\r
+ { prop_name_table+442, prop_name_table+444, }, // s*\r
+ { prop_name_table+444, prop_name_table+446, }, // sc\r
+ { prop_name_table+446, prop_name_table+455, }, // separator\r
+ { prop_name_table+455, prop_name_table+457, }, // sk\r
+ { prop_name_table+457, prop_name_table+459, }, // sm\r
+ { prop_name_table+459, prop_name_table+461, }, // so\r
+ { prop_name_table+461, prop_name_table+475, }, // spaceseparator\r
+ { prop_name_table+475, prop_name_table+495, }, // spacingcombiningmark\r
+ { prop_name_table+495, prop_name_table+504, }, // surrogate\r
+ { prop_name_table+504, prop_name_table+510, }, // symbol\r
+ { prop_name_table+510, prop_name_table+519, }, // titlecase\r
+ { prop_name_table+519, prop_name_table+534, }, // titlecaseletter\r
+ { prop_name_table+534, prop_name_table+549, }, // uppercaseletter\r
+ { prop_name_table+549, prop_name_table+551, }, // z*\r
+ { prop_name_table+551, prop_name_table+553, }, // zl\r
+ { prop_name_table+553, prop_name_table+555, }, // zp\r
+ { prop_name_table+555, prop_name_table+557, }, // zs\r
+ };\r
+\r
+ static const icu_regex_traits::char_class_type icu_class_map[] = {\r
+ icu_regex_traits::mask_any, // any\r
+ icu_regex_traits::mask_ascii, // ascii\r
+ (0x3FFFFFFFu) & ~(U_GC_CN_MASK), // assigned\r
+ U_GC_C_MASK, // c*\r
+ U_GC_CC_MASK, // cc\r
+ U_GC_CF_MASK, // cf\r
+ U_GC_PE_MASK, // closepunctuation\r
+ U_GC_CN_MASK, // cn\r
+ U_GC_CO_MASK, // co\r
+ U_GC_PC_MASK, // connectorpunctuation\r
+ U_GC_CC_MASK, // control\r
+ U_GC_CS_MASK, // cs\r
+ U_GC_SC_MASK, // currencysymbol\r
+ U_GC_PD_MASK, // dashpunctuation\r
+ U_GC_ND_MASK, // decimaldigitnumber\r
+ U_GC_ME_MASK, // enclosingmark\r
+ U_GC_PF_MASK, // finalpunctuation\r
+ U_GC_CF_MASK, // format\r
+ U_GC_PI_MASK, // initialpunctuation\r
+ U_GC_L_MASK, // l*\r
+ U_GC_L_MASK, // letter\r
+ U_GC_NL_MASK, // letternumber\r
+ U_GC_ZL_MASK, // lineseparator\r
+ U_GC_LL_MASK, // ll\r
+ U_GC_LM_MASK, // lm\r
+ U_GC_LO_MASK, // lo\r
+ U_GC_LL_MASK, // lowercaseletter\r
+ U_GC_LT_MASK, // lt\r
+ U_GC_LU_MASK, // lu\r
+ U_GC_M_MASK, // m*\r
+ U_GC_M_MASK, // mark\r
+ U_GC_SM_MASK, // mathsymbol\r
+ U_GC_MC_MASK, // mc\r
+ U_GC_ME_MASK, // me\r
+ U_GC_MN_MASK, // mn\r
+ U_GC_LM_MASK, // modifierletter\r
+ U_GC_SK_MASK, // modifiersymbol\r
+ U_GC_N_MASK, // n*\r
+ U_GC_ND_MASK, // nd\r
+ U_GC_NL_MASK, // nl\r
+ U_GC_NO_MASK, // no\r
+ U_GC_MN_MASK, // nonspacingmark\r
+ U_GC_CN_MASK, // notassigned\r
+ U_GC_N_MASK, // number\r
+ U_GC_PS_MASK, // openpunctuation\r
+ U_GC_C_MASK, // other\r
+ U_GC_LO_MASK, // otherletter\r
+ U_GC_NO_MASK, // othernumber\r
+ U_GC_PO_MASK, // otherpunctuation\r
+ U_GC_SO_MASK, // othersymbol\r
+ U_GC_P_MASK, // p*\r
+ U_GC_ZP_MASK, // paragraphseparator\r
+ U_GC_PC_MASK, // pc\r
+ U_GC_PD_MASK, // pd\r
+ U_GC_PE_MASK, // pe\r
+ U_GC_PF_MASK, // pf\r
+ U_GC_PI_MASK, // pi\r
+ U_GC_PO_MASK, // po\r
+ U_GC_CO_MASK, // privateuse\r
+ U_GC_PS_MASK, // ps\r
+ U_GC_P_MASK, // punctuation\r
+ U_GC_S_MASK, // s*\r
+ U_GC_SC_MASK, // sc\r
+ U_GC_Z_MASK, // separator\r
+ U_GC_SK_MASK, // sk\r
+ U_GC_SM_MASK, // sm\r
+ U_GC_SO_MASK, // so\r
+ U_GC_ZS_MASK, // spaceseparator\r
+ U_GC_MC_MASK, // spacingcombiningmark\r
+ U_GC_CS_MASK, // surrogate\r
+ U_GC_S_MASK, // symbol\r
+ U_GC_LT_MASK, // titlecase\r
+ U_GC_LT_MASK, // titlecaseletter\r
+ U_GC_LU_MASK, // uppercaseletter\r
+ U_GC_Z_MASK, // z*\r
+ U_GC_ZL_MASK, // zl\r
+ U_GC_ZP_MASK, // zp\r
+ U_GC_ZS_MASK, // zs\r
+ };\r
+\r
+\r
+ static const re_detail::character_pointer_range< ::UChar32>* ranges_begin = range_data;\r
+ static const re_detail::character_pointer_range< ::UChar32>* ranges_end = range_data + (sizeof(range_data)/sizeof(range_data[0]));\r
+ \r
+ re_detail::character_pointer_range< ::UChar32> t = { p1, p2, };\r
+ const re_detail::character_pointer_range< ::UChar32>* p = std::lower_bound(ranges_begin, ranges_end, t);\r
+ if((p != ranges_end) && (t == *p))\r
+ return icu_class_map[p - ranges_begin];\r
+ return 0;\r
+}\r
+\r
+icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_type* p1, const char_type* p2) const\r
+{\r
+ static const char_class_type masks[] = \r
+ {\r
+ 0,\r
+ U_GC_L_MASK | U_GC_ND_MASK, \r
+ U_GC_L_MASK,\r
+ mask_blank,\r
+ U_GC_CC_MASK | U_GC_CF_MASK | U_GC_ZL_MASK | U_GC_ZP_MASK,\r
+ U_GC_ND_MASK,\r
+ U_GC_ND_MASK,\r
+ (0x3FFFFFFFu) & ~(U_GC_CC_MASK | U_GC_CF_MASK | U_GC_CS_MASK | U_GC_CN_MASK | U_GC_Z_MASK),\r
+ mask_horizontal,\r
+ U_GC_LL_MASK,\r
+ U_GC_LL_MASK,\r
+ ~(U_GC_C_MASK),\r
+ U_GC_P_MASK,\r
+ char_class_type(U_GC_Z_MASK) | mask_space,\r
+ char_class_type(U_GC_Z_MASK) | mask_space,\r
+ U_GC_LU_MASK,\r
+ mask_unicode,\r
+ U_GC_LU_MASK,\r
+ mask_vertical,\r
+ char_class_type(U_GC_L_MASK | U_GC_ND_MASK | U_GC_MN_MASK) | mask_underscore, \r
+ char_class_type(U_GC_L_MASK | U_GC_ND_MASK | U_GC_MN_MASK) | mask_underscore, \r
+ char_class_type(U_GC_ND_MASK) | mask_xdigit,\r
+ };\r
+\r
+ int id = ::boost::re_detail::get_default_class_id(p1, p2);\r
+ if(id >= 0)\r
+ return masks[id+1];\r
+ char_class_type result = lookup_icu_mask(p1, p2);\r
+ if(result != 0)\r
+ return result;\r
+\r
+ if(id < 0)\r
+ {\r
+ string_type s(p1, p2);\r
+ string_type::size_type i = 0;\r
+ while(i < s.size())\r
+ {\r
+ s[i] = static_cast<char>((::u_tolower)(s[i]));\r
+ if(::u_isspace(s[i]) || (s[i] == '-') || (s[i] == '_'))\r
+ s.erase(s.begin()+i, s.begin()+i+1);\r
+ else\r
+ {\r
+ s[i] = static_cast<char>((::u_tolower)(s[i]));\r
+ ++i;\r
+ }\r
+ }\r
+ if(s.size())\r
+ id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());\r
+ if(id >= 0)\r
+ return masks[id+1];\r
+ if(s.size())\r
+ result = lookup_icu_mask(&*s.begin(), &*s.begin() + s.size());\r
+ if(result != 0)\r
+ return result;\r
+ }\r
+ BOOST_ASSERT(std::size_t(id+1) < sizeof(masks) / sizeof(masks[0]));\r
+ return masks[id+1];\r
+}\r
+\r
+icu_regex_traits::string_type icu_regex_traits::lookup_collatename(const char_type* p1, const char_type* p2) const\r
+{\r
+ string_type result;\r
+ if(std::find_if(p1, p2, std::bind2nd(std::greater< ::UChar32>(), 0x7f)) == p2)\r
+ {\r
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS\r
+ std::string s(p1, p2);\r
+#else\r
+ std::string s;\r
+ const char_type* p3 = p1;\r
+ while(p3 != p2)\r
+ s.append(1, *p3++);\r
+#endif\r
+ // Try Unicode name:\r
+ UErrorCode err = U_ZERO_ERROR;\r
+ UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, s.c_str(), &err);\r
+ if(U_SUCCESS(err))\r
+ {\r
+ result.push_back(c);\r
+ return result;\r
+ }\r
+ // Try Unicode-extended name:\r
+ err = U_ZERO_ERROR;\r
+ c = ::u_charFromName(U_EXTENDED_CHAR_NAME, s.c_str(), &err);\r
+ if(U_SUCCESS(err))\r
+ {\r
+ result.push_back(c);\r
+ return result;\r
+ }\r
+ // try POSIX name:\r
+ s = ::boost::re_detail::lookup_default_collate_name(s);\r
+#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS\r
+ result.assign(s.begin(), s.end());\r
+#else\r
+ result.clear();\r
+ std::string::const_iterator si, sj;\r
+ si = s.begin();\r
+ sj = s.end();\r
+ while(si != sj)\r
+ result.push_back(*si++);\r
+#endif\r
+ }\r
+ if(result.empty() && (p2-p1 == 1))\r
+ result.push_back(*p1);\r
+ return result;\r
+}\r
+\r
+bool icu_regex_traits::isctype(char_type c, char_class_type f) const\r
+{\r
+ // check for standard catagories first:\r
+ char_class_type m = char_class_type(1u << u_charType(c));\r
+ if((m & f) != 0) \r
+ return true;\r
+ // now check for special cases:\r
+ if(((f & mask_blank) != 0) && u_isblank(c))\r
+ return true;\r
+ if(((f & mask_space) != 0) && u_isspace(c))\r
+ return true;\r
+ if(((f & mask_xdigit) != 0) && (u_digit(c, 16) >= 0))\r
+ return true;\r
+ if(((f & mask_unicode) != 0) && (c >= 0x100))\r
+ return true;\r
+ if(((f & mask_underscore) != 0) && (c == '_'))\r
+ return true;\r
+ if(((f & mask_any) != 0) && (c <= 0x10FFFF))\r
+ return true;\r
+ if(((f & mask_ascii) != 0) && (c <= 0x7F))\r
+ return true;\r
+ if(((f & mask_vertical) != 0) && (::boost::re_detail::is_separator(c) || (c == static_cast<char_type>('\v')) || (m == U_GC_ZL_MASK) || (m == U_GC_ZP_MASK)))\r
+ return true;\r
+ if(((f & mask_horizontal) != 0) && !::boost::re_detail::is_separator(c) && u_isspace(c) && (c != static_cast<char_type>('\v')))\r
+ return true;\r
+ return false;\r
+}\r
+\r
+}\r
+\r
+#endif // BOOST_HAS_ICU\r
"p",
"P",
"N",
+ "g",
+ "K",
+ "R",
};
return ((n >= (sizeof(messages) / sizeof(messages[1]))) ? "" : messages[n]);
regex_constants::escape_type_not_class, /*H*/
regex_constants::escape_type_not_class, /*I*/
regex_constants::escape_type_not_class, /*J*/
- regex_constants::escape_type_not_class, /*K*/
+ regex_constants::escape_type_reset_start_mark, /*K*/
regex_constants::escape_type_not_class, /*L*/
regex_constants::escape_type_not_class, /*M*/
regex_constants::escape_type_named_char, /*N*/
regex_constants::escape_type_not_class, /*O*/
regex_constants::escape_type_not_property, /*P*/
regex_constants::escape_type_Q, /*Q*/
- regex_constants::escape_type_not_class, /*R*/
+ regex_constants::escape_type_line_ending, /*R*/
regex_constants::escape_type_not_class, /*S*/
regex_constants::escape_type_not_class, /*T*/
regex_constants::escape_type_not_class, /*U*/
regex_constants::escape_type_class, /*d*/
regex_constants::escape_type_e, /*e*/
regex_constants::escape_type_control_f, /*f*/
- regex_constants::escape_type_class, /*g*/
+ regex_constants::escape_type_extended_backref, /*g*/
regex_constants::escape_type_class, /*h*/
regex_constants::escape_type_class, /*i*/
regex_constants::escape_type_class, /*j*/
- regex_constants::escape_type_class, /*k*/
+ regex_constants::escape_type_extended_backref, /*k*/
regex_constants::escape_type_class, /*l*/
regex_constants::escape_type_class, /*m*/
regex_constants::escape_type_control_n, /*n*/
regex_constants::syntax_dollar, /*$*/
regex_constants::syntax_char, /*%*/
regex_constants::syntax_char, /*&*/
- regex_constants::syntax_char, /*'*/
+ regex_constants::escape_type_end_buffer, /*'*/
regex_constants::syntax_open_mark, /*(*/
regex_constants::syntax_close_mark, /*)*/
regex_constants::syntax_star, /***/
--- /dev/null
+/*\r
+ *\r
+ * Copyright (c) 2004\r
+ * John Maddock\r
+ *\r
+ * Use, modification and distribution are subject to the \r
+ * Boost Software License, Version 1.0. (See accompanying file \r
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+ *\r
+ */\r
+ \r
+ /*\r
+ * LOCATION: see http://www.boost.org for most recent version.\r
+ * FILE static_mutex.cpp\r
+ * VERSION see <boost/version.hpp>\r
+ * DESCRIPTION: Declares static_mutex lock type.\r
+ */\r
+\r
+#define BOOST_REGEX_SOURCE\r
+#include <boost/config.hpp>\r
+\r
+#ifdef BOOST_HAS_THREADS\r
+\r
+#include <boost/regex/pending/static_mutex.hpp>\r
+\r
+#if defined(BOOST_HAS_WINTHREADS)\r
+#ifndef NOMINMAX\r
+# define NOMINMAX\r
+#endif\r
+#define WIN32_LEAN_AND_MEAN\r
+#include <windows.h>\r
+#include <boost/static_assert.hpp>\r
+#endif\r
+\r
+\r
+namespace boost{\r
+\r
+#if defined(BOOST_HAS_PTHREADS) && defined(PTHREAD_MUTEX_INITIALIZER)\r
+\r
+scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk)\r
+: m_mutex(m), m_have_lock(false)\r
+{\r
+ if(lk)\r
+ lock();\r
+}\r
+\r
+scoped_static_mutex_lock::~scoped_static_mutex_lock()\r
+{\r
+ if(m_have_lock)\r
+ unlock();\r
+}\r
+\r
+void scoped_static_mutex_lock::lock()\r
+{\r
+ if(0 == m_have_lock)\r
+ {\r
+ pthread_mutex_lock(&(m_mutex.m_mutex));\r
+ m_have_lock = true;\r
+ }\r
+}\r
+\r
+void scoped_static_mutex_lock::unlock()\r
+{\r
+ if(m_have_lock)\r
+ {\r
+ pthread_mutex_unlock(&(m_mutex.m_mutex));\r
+ m_have_lock = false;\r
+ }\r
+}\r
+\r
+#elif defined(BOOST_HAS_WINTHREADS)\r
+\r
+BOOST_STATIC_ASSERT(sizeof(LONG) == sizeof(boost::int32_t));\r
+\r
+scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk)\r
+: m_mutex(m), m_have_lock(false)\r
+{\r
+ if(lk)\r
+ lock();\r
+}\r
+\r
+scoped_static_mutex_lock::~scoped_static_mutex_lock()\r
+{\r
+ if(m_have_lock)\r
+ unlock();\r
+}\r
+\r
+void scoped_static_mutex_lock::lock()\r
+{\r
+ if(0 == m_have_lock)\r
+ {\r
+#if !defined(InterlockedCompareExchangePointer)\r
+ while(0 != InterlockedCompareExchange(reinterpret_cast<void**>((boost::uint_least16_t*)&(m_mutex.m_mutex)), (void*)1, 0))\r
+#else\r
+ while(0 != InterlockedCompareExchange(reinterpret_cast<LONG*>(&(m_mutex.m_mutex)), 1, 0))\r
+#endif\r
+ {\r
+ Sleep(0);\r
+ }\r
+ m_have_lock = true;\r
+ }\r
+}\r
+\r
+void scoped_static_mutex_lock::unlock()\r
+{\r
+ if(m_have_lock)\r
+ {\r
+#if !defined(InterlockedCompareExchangePointer)\r
+ InterlockedExchange((LONG*)&(m_mutex.m_mutex), 0);\r
+#else\r
+ InterlockedExchange(reinterpret_cast<LONG*>(&(m_mutex.m_mutex)), 0);\r
+#endif\r
+ m_have_lock = false;\r
+ }\r
+}\r
+\r
+#else\r
+//\r
+// Portable version of a static mutex based on Boost.Thread library:\r
+//\r
+#include <stdlib.h>\r
+#include <boost/assert.hpp>\r
+\r
+boost::recursive_mutex* static_mutex::m_pmutex = 0;\r
+boost::once_flag static_mutex::m_once = BOOST_ONCE_INIT;\r
+\r
+extern "C" BOOST_REGEX_DECL void free_static_mutex()\r
+{\r
+ delete static_mutex::m_pmutex;\r
+ static_mutex::m_pmutex = 0;\r
+}\r
+\r
+void static_mutex::init()\r
+{\r
+ m_pmutex = new boost::recursive_mutex();\r
+ int r = atexit(free_static_mutex);\r
+ BOOST_ASSERT(0 == r);\r
+}\r
+\r
+scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& , bool lk)\r
+: m_plock(0), m_have_lock(false)\r
+{\r
+ if(lk)\r
+ lock();\r
+}\r
+\r
+scoped_static_mutex_lock::~scoped_static_mutex_lock()\r
+{\r
+ if(m_have_lock)\r
+ unlock();\r
+ delete m_plock;\r
+}\r
+\r
+void scoped_static_mutex_lock::lock()\r
+{\r
+ if(0 == m_have_lock)\r
+ {\r
+ boost::call_once(static_mutex::m_once,&static_mutex::init);\r
+ if(0 == m_plock)\r
+ m_plock = new boost::recursive_mutex::scoped_lock(*static_mutex::m_pmutex, false);\r
+ m_plock->lock();\r
+ m_have_lock = true;\r
+ }\r
+}\r
+\r
+void scoped_static_mutex_lock::unlock()\r
+{\r
+ if(m_have_lock)\r
+ {\r
+ m_plock->unlock();\r
+ m_have_lock = false;\r
+ }\r
+}\r
+\r
+#endif\r
+\r
+}\r
+\r
+#endif // BOOST_HAS_THREADS\r
--- /dev/null
+/*\r
+ *\r
+ * Copyright (c) 1998-2002\r
+ * John Maddock\r
+ *\r
+ * Use, modification and distribution are subject to the \r
+ * Boost Software License, Version 1.0. (See accompanying file \r
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+ *\r
+ */\r
+\r
+ /*\r
+ * LOCATION: see http://www.boost.org for most recent version.\r
+ * FILE: winstances.cpp\r
+ * VERSION: see <boost/version.hpp>\r
+ * DESCRIPTION: regex unsigned short template instances (MSVC only).\r
+ */\r
+\r
+#define BOOST_REGEX_SOURCE\r
+\r
+#include <boost/detail/workaround.hpp>\r
+#include <memory>\r
+#include <string>\r
+\r
+#if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \\r
+ && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\\r
+ && BOOST_WORKAROUND(BOOST_MSVC, <1600)\r
+//\r
+// This is a horrible workaround, but without declaring these symbols extern we get\r
+// duplicate symbol errors when linking if the application is built without\r
+// /Zc:wchar_t\r
+//\r
+#ifdef _CRTIMP2_PURE\r
+# define BOOST_REGEX_STDLIB_DECL _CRTIMP2_PURE\r
+#else\r
+# define BOOST_REGEX_STDLIB_DECL _CRTIMP2\r
+#endif\r
+\r
+namespace std{\r
+\r
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)\r
+template class BOOST_REGEX_STDLIB_DECL allocator<unsigned short>;\r
+template class BOOST_REGEX_STDLIB_DECL _String_val<unsigned short, allocator<unsigned short> >;\r
+template class BOOST_REGEX_STDLIB_DECL basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >;\r
+#endif\r
+\r
+#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))\r
+template<> BOOST_REGEX_STDLIB_DECL std::size_t __cdecl char_traits<unsigned short>::length(unsigned short const*);\r
+#endif\r
+\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(\r
+ const unsigned short *,\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,\r
+ const unsigned short *);\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator<(\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator>(\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);\r
+}\r
+#endif\r
+\r
+#include <boost/regex/config.hpp>\r
+\r
+#if !defined(BOOST_NO_WREGEX) && defined(BOOST_REGEX_HAS_OTHER_WCHAR_T) && !defined(BOOST_REGEX_NO_EXTERNAL_TEMPLATES)\r
+#define BOOST_REGEX_US_INSTANTIATE\r
+\r
+#include <boost/regex.hpp>\r
+\r
+#endif\r
+\r
+\r
--- /dev/null
+/*\r
+ *\r
+ * Copyright (c) 2004\r
+ * John Maddock\r
+ *\r
+ * Use, modification and distribution are subject to the \r
+ * Boost Software License, Version 1.0. (See accompanying file \r
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
+ *\r
+ */\r
+\r
+ /*\r
+ * LOCATION: see http://www.boost.org for most recent version.\r
+ * FILE: wc_regex_traits.cpp\r
+ * VERSION: see <boost/version.hpp>\r
+ * DESCRIPTION: Implements out of line members for c_regex_traits<wchar_t>\r
+ */\r
+\r
+\r
+#define BOOST_REGEX_SOURCE\r
+\r
+#include <boost/detail/workaround.hpp>\r
+#include <memory>\r
+#include <string>\r
+\r
+#if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \\r
+ && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\\r
+ && BOOST_WORKAROUND(BOOST_MSVC, <1600)\r
+//\r
+// This is a horrible workaround, but without declaring these symbols extern we get\r
+// duplicate symbol errors when linking if the application is built without\r
+// /Zc:wchar_t\r
+//\r
+#ifdef _CRTIMP2_PURE\r
+# define BOOST_REGEX_STDLIB_DECL _CRTIMP2_PURE\r
+#else\r
+# define BOOST_REGEX_STDLIB_DECL _CRTIMP2\r
+#endif\r
+\r
+namespace std{\r
+\r
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)\r
+template class BOOST_REGEX_STDLIB_DECL allocator<unsigned short>;\r
+template class BOOST_REGEX_STDLIB_DECL _String_val<unsigned short, allocator<unsigned short> >;\r
+template class BOOST_REGEX_STDLIB_DECL basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >;\r
+#endif\r
+\r
+#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))\r
+template<> BOOST_REGEX_STDLIB_DECL std::size_t __cdecl char_traits<unsigned short>::length(unsigned short const*);\r
+#endif\r
+\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(\r
+ const unsigned short *,\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==(\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,\r
+ const unsigned short *);\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator<(\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);\r
+template BOOST_REGEX_STDLIB_DECL bool __cdecl operator>(\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&,\r
+ const basic_string<unsigned short, char_traits<unsigned short>, allocator<unsigned short> >&);\r
+}\r
+#endif\r
+\r
+#include <boost/regex/config.hpp>\r
+#include <boost/detail/workaround.hpp>\r
+\r
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)\r
+\r
+#include <boost/regex/v4/c_regex_traits.hpp>\r
+#ifndef BOOST_NO_WREGEX\r
+#include <boost/regex/v4/primary_transform.hpp>\r
+#include <boost/regex/v4/regex_traits_defaults.hpp>\r
+\r
+#if defined(BOOST_NO_STDC_NAMESPACE)\r
+namespace std{\r
+ using ::wcstol;\r
+}\r
+#endif\r
+\r
+namespace boost{\r
+\r
+c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::transform(const wchar_t* p1, const wchar_t* p2) \r
+{ \r
+ std::size_t r;\r
+ std::size_t s = 10;\r
+ std::wstring src(p1, p2);\r
+ std::wstring result(s, L' ');\r
+ while(s < (r = std::wcsxfrm(&*result.begin(), src.c_str(), s)))\r
+ {\r
+ result.append(r - s + 3, L' ');\r
+ s = result.size();\r
+ }\r
+ result.erase(r);\r
+ return result; \r
+}\r
+\r
+c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::transform_primary(const wchar_t* p1, const wchar_t* p2) \r
+{\r
+ static wchar_t s_delim;\r
+ static const int s_collate_type = ::boost::re_detail::find_sort_syntax(static_cast<const c_regex_traits<wchar_t>*>(0), &s_delim);\r
+ std::wstring result;\r
+ //\r
+ // What we do here depends upon the format of the sort key returned by\r
+ // sort key returned by this->transform:\r
+ //\r
+ switch(s_collate_type)\r
+ {\r
+ case ::boost::re_detail::sort_C:\r
+ case ::boost::re_detail::sort_unknown:\r
+ // the best we can do is translate to lower case, then get a regular sort key:\r
+ {\r
+ result.assign(p1, p2);\r
+ for(std::wstring::size_type i = 0; i < result.size(); ++i)\r
+ result[i] = (std::towlower)(result[i]);\r
+ result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());\r
+ break;\r
+ }\r
+ case ::boost::re_detail::sort_fixed:\r
+ {\r
+ // get a regular sort key, and then truncate it:\r
+ result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());\r
+ result.erase(s_delim);\r
+ break;\r
+ }\r
+ case ::boost::re_detail::sort_delim:\r
+ // get a regular sort key, and then truncate everything after the delim:\r
+ result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());\r
+ if(result.size() && (result[0] == s_delim))\r
+ break;\r
+ std::size_t i;\r
+ for(i = 0; i < result.size(); ++i)\r
+ {\r
+ if(result[i] == s_delim)\r
+ break;\r
+ }\r
+ result.erase(i);\r
+ break;\r
+ }\r
+ if(result.empty())\r
+ result = std::wstring(1, char(0));\r
+ return result;\r
+}\r
+\r
+enum\r
+{\r
+ char_class_space=1<<0, \r
+ char_class_print=1<<1, \r
+ char_class_cntrl=1<<2, \r
+ char_class_upper=1<<3, \r
+ char_class_lower=1<<4,\r
+ char_class_alpha=1<<5, \r
+ char_class_digit=1<<6, \r
+ char_class_punct=1<<7, \r
+ char_class_xdigit=1<<8,\r
+ char_class_alnum=char_class_alpha|char_class_digit, \r
+ char_class_graph=char_class_alnum|char_class_punct,\r
+ char_class_blank=1<<9,\r
+ char_class_word=1<<10,\r
+ char_class_unicode=1<<11,\r
+ char_class_horizontal=1<<12,\r
+ char_class_vertical=1<<13\r
+};\r
+\r
+c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_classname(const wchar_t* p1, const wchar_t* p2) \r
+{\r
+ static const char_class_type masks[] = \r
+ {\r
+ 0,\r
+ char_class_alnum, \r
+ char_class_alpha,\r
+ char_class_blank,\r
+ char_class_cntrl,\r
+ char_class_digit,\r
+ char_class_digit,\r
+ char_class_graph,\r
+ char_class_horizontal,\r
+ char_class_lower,\r
+ char_class_lower,\r
+ char_class_print,\r
+ char_class_punct,\r
+ char_class_space,\r
+ char_class_space,\r
+ char_class_upper,\r
+ char_class_unicode,\r
+ char_class_upper,\r
+ char_class_vertical,\r
+ char_class_alnum | char_class_word, \r
+ char_class_alnum | char_class_word, \r
+ char_class_xdigit,\r
+ };\r
+\r
+ int id = ::boost::re_detail::get_default_class_id(p1, p2);\r
+ if(id < 0)\r
+ {\r
+ std::wstring s(p1, p2);\r
+ for(std::wstring::size_type i = 0; i < s.size(); ++i)\r
+ s[i] = (std::towlower)(s[i]);\r
+ id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());\r
+ }\r
+ BOOST_ASSERT(id+1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));\r
+ return masks[id+1];\r
+}\r
+\r
+bool BOOST_REGEX_CALL c_regex_traits<wchar_t>::isctype(wchar_t c, char_class_type mask) \r
+{\r
+ return\r
+ ((mask & char_class_space) && (std::iswspace)(c))\r
+ || ((mask & char_class_print) && (std::iswprint)(c))\r
+ || ((mask & char_class_cntrl) && (std::iswcntrl)(c))\r
+ || ((mask & char_class_upper) && (std::iswupper)(c))\r
+ || ((mask & char_class_lower) && (std::iswlower)(c))\r
+ || ((mask & char_class_alpha) && (std::iswalpha)(c))\r
+ || ((mask & char_class_digit) && (std::iswdigit)(c))\r
+ || ((mask & char_class_punct) && (std::iswpunct)(c))\r
+ || ((mask & char_class_xdigit) && (std::iswxdigit)(c))\r
+ || ((mask & char_class_blank) && (std::iswspace)(c) && !::boost::re_detail::is_separator(c))\r
+ || ((mask & char_class_word) && (c == '_'))\r
+ || ((mask & char_class_unicode) && (c & ~static_cast<wchar_t>(0xff)))\r
+ || ((mask & char_class_vertical) && (::boost::re_detail::is_separator(c) || (c == L'\v')))\r
+ || ((mask & char_class_horizontal) && (std::iswspace)(c) && !::boost::re_detail::is_separator(c) && (c != L'\v'));\r
+}\r
+\r
+c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_collatename(const wchar_t* p1, const wchar_t* p2) \r
+{\r
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\\r
+ && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\\r
+ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)\r
+ std::string name(p1, p2);\r
+#else\r
+ std::string name;\r
+ const wchar_t* p0 = p1;\r
+ while(p0 != p2)\r
+ name.append(1, char(*p0++));\r
+#endif\r
+ name = ::boost::re_detail::lookup_default_collate_name(name);\r
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\\r
+ && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\\r
+ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)\r
+ if(name.size())\r
+ return string_type(name.begin(), name.end());\r
+#else\r
+ if(name.size())\r
+ {\r
+ string_type result;\r
+ typedef std::string::const_iterator iter;\r
+ iter b = name.begin();\r
+ iter e = name.end();\r
+ while(b != e)\r
+ result.append(1, wchar_t(*b++));\r
+ return result;\r
+ }\r
+#endif\r
+ if(p2 - p1 == 1)\r
+ return string_type(1, *p1);\r
+ return string_type();\r
+}\r
+\r
+int BOOST_REGEX_CALL c_regex_traits<wchar_t>::value(wchar_t c, int radix) \r
+{\r
+#ifdef __BORLANDC__\r
+ // workaround for broken wcstol:\r
+ if((std::iswxdigit)(c) == 0)\r
+ return -1;\r
+#endif\r
+ wchar_t b[2] = { c, '\0', };\r
+ wchar_t* ep;\r
+ int result = std::wcstol(b, &ep, radix);\r
+ if(ep == b)\r
+ return -1;\r
+ return result;\r
+}\r
+\r
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T\r
+c_regex_traits<unsigned short>::string_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::transform(const unsigned short* p1, const unsigned short* p2)\r
+{\r
+ std::wstring result = c_regex_traits<wchar_t>::transform((const wchar_t*)p1, (const wchar_t*)p2);\r
+ return string_type(result.begin(), result.end());\r
+}\r
+\r
+c_regex_traits<unsigned short>::string_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::transform_primary(const unsigned short* p1, const unsigned short* p2)\r
+{\r
+ std::wstring result = c_regex_traits<wchar_t>::transform_primary((const wchar_t*)p1, (const wchar_t*)p2);\r
+ return string_type(result.begin(), result.end());\r
+}\r
+\r
+c_regex_traits<unsigned short>::char_class_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::lookup_classname(const unsigned short* p1, const unsigned short* p2)\r
+{\r
+ return c_regex_traits<wchar_t>::lookup_classname((const wchar_t*)p1, (const wchar_t*)p2);\r
+}\r
+\r
+c_regex_traits<unsigned short>::string_type BOOST_REGEX_CALL c_regex_traits<unsigned short>::lookup_collatename(const unsigned short* p1, const unsigned short* p2)\r
+{\r
+ std::wstring result = c_regex_traits<wchar_t>::lookup_collatename((const wchar_t*)p1, (const wchar_t*)p2);\r
+ return string_type(result.begin(), result.end());\r
+}\r
+\r
+bool BOOST_REGEX_CALL c_regex_traits<unsigned short>::isctype(unsigned short c, char_class_type m)\r
+{\r
+ return c_regex_traits<wchar_t>::isctype(c, m);\r
+}\r
+\r
+int BOOST_REGEX_CALL c_regex_traits<unsigned short>::value(unsigned short c, int radix)\r
+{\r
+ return c_regex_traits<wchar_t>::value(c, radix);\r
+}\r
+\r
+#endif\r
+\r
+}\r
+\r
+#endif // BOOST_NO_WREGEX\r
+\r
+#endif // __BORLANDC__\r
+\r
#include <cstring>
#include <cstdio>
-#if defined(BOOST_NO_STDC_NAMESPACE)
+#if defined(BOOST_NO_STDC_NAMESPACE) || defined(__NetBSD__)
namespace std{
# ifndef BOOST_NO_SWPRINTF
using ::swprintf;
--- /dev/null
+#\r
+# Copyright Troy D. Straszheim\r
+#\r
+# Distributed under the Boost Software License, Version 1.0.\r
+# See http://www.boost.org/LICENSE_1_0.txt\r
+#\r
+add_definitions(-DBOOST_SIGNALS_NO_LIB=1)\r
+\r
+boost_add_library(\r
+ boost_signals \r
+ trackable.cpp connection.cpp named_slot_map.cpp signal_base.cpp slot.cpp\r
+ SHARED_COMPILE_FLAGS "-DBOOST_SIGNALS_DYN_LINK=1"\r
+ )\r