mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
boost: update to version 1.40
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31888 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
651631e812
commit
131298543b
@ -54,6 +54,14 @@ struct aligned_storage_imp
|
||||
, 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
|
||||
@ -62,12 +70,15 @@ template <
|
||||
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;
|
||||
@ -118,14 +129,14 @@ public: // accessors
|
||||
|
||||
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
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
|
||||
// Handles broken standard libraries better than <iterator>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
@ -131,7 +132,8 @@ namespace boost {
|
||||
|
||||
// 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)
|
||||
@ -209,19 +211,19 @@ namespace boost {
|
||||
}
|
||||
|
||||
// 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()
|
||||
@ -250,7 +252,7 @@ namespace boost {
|
||||
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)
|
||||
|
@ -5,12 +5,16 @@
|
||||
// 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
|
||||
{
|
||||
|
||||
@ -47,6 +51,22 @@ public:
|
||||
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);
|
||||
@ -57,6 +77,41 @@ public:
|
||||
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);
|
||||
@ -66,6 +121,21 @@ public:
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -76,6 +146,21 @@ public:
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -86,6 +171,21 @@ public:
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -96,6 +196,21 @@ public:
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -106,6 +221,21 @@ public:
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -116,6 +246,21 @@ public:
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -126,6 +271,21 @@ public:
|
||||
{
|
||||
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:
|
||||
|
||||
|
@ -129,6 +129,8 @@
|
||||
# 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
|
||||
|
||||
//
|
||||
@ -141,7 +143,16 @@
|
||||
//
|
||||
// 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
|
||||
@ -150,35 +161,23 @@
|
||||
# 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
|
||||
|
@ -73,18 +73,22 @@
|
||||
// #define BOOST_HAS_STATIC_ASSERT
|
||||
#define BOOST_HAS_STD_TYPE_TRAITS
|
||||
|
||||
#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_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_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_STATIC_ASSERT
|
||||
#define BOOST_NO_TEMPLATE_ALIASES
|
||||
#define BOOST_NO_UNICODE_LITERALS
|
||||
#define BOOST_NO_AUTO_DECLARATIONS
|
||||
#define BOOST_NO_AUTO_MULTIDECLARATIONS
|
||||
#define BOOST_NO_VARIADIC_TEMPLATES
|
||||
|
||||
//
|
||||
// TR1 macros:
|
||||
|
@ -43,11 +43,6 @@
|
||||
# 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
|
||||
@ -64,22 +59,32 @@
|
||||
//
|
||||
// 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
|
||||
|
@ -26,7 +26,6 @@
|
||||
#define BOOST_NO_SFINAE
|
||||
#define BOOST_NO_USING_TEMPLATE
|
||||
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -59,22 +58,28 @@
|
||||
//
|
||||
// C++0x features
|
||||
//
|
||||
#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
|
||||
|
||||
#if __DMC__ < 0x800
|
||||
#error "Compiler not supported or configured - please reconfigure"
|
||||
#endif
|
||||
|
@ -101,23 +101,21 @@
|
||||
# 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
|
||||
@ -140,9 +138,18 @@
|
||||
# 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:
|
||||
@ -150,6 +157,8 @@
|
||||
#ifdef __GXX_CONCEPTS__
|
||||
# define BOOST_HAS_CONCEPTS
|
||||
# define BOOST_COMPILER "ConceptGCC version " __VERSION__
|
||||
#else
|
||||
# define BOOST_NO_CONCEPTS
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_COMPILER
|
||||
|
@ -90,22 +90,30 @@
|
||||
//
|
||||
// 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
|
||||
|
@ -157,28 +157,6 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {};
|
||||
# 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)
|
||||
|
@ -21,8 +21,6 @@
|
||||
# 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)
|
||||
|
@ -39,10 +39,9 @@
|
||||
|
||||
// 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)
|
||||
@ -74,6 +73,8 @@
|
||||
# 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
|
||||
@ -91,21 +92,26 @@
|
||||
#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)
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
|
||||
# define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */
|
||||
|
||||
# define BOOST_NO_INITIALIZER_LISTS
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -41,22 +40,27 @@
|
||||
//
|
||||
// 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:
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#define BOOST_NO_SWPRINTF
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
|
||||
#else
|
||||
|
||||
@ -33,22 +32,27 @@
|
||||
//
|
||||
// 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
|
||||
|
||||
//
|
||||
// version check:
|
||||
|
@ -22,29 +22,6 @@
|
||||
#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?
|
||||
|
@ -74,7 +74,6 @@
|
||||
//
|
||||
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
|
||||
#define BOOST_NO_ADL_BARRIER
|
||||
#define BOOST_NO_INITIALIZER_LISTS
|
||||
|
||||
//
|
||||
// C++0x features
|
||||
@ -86,22 +85,27 @@
|
||||
# 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
|
||||
|
@ -47,7 +47,7 @@
|
||||
#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
|
||||
@ -61,22 +61,26 @@
|
||||
//
|
||||
// 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
|
||||
|
||||
|
||||
|
||||
|
@ -131,10 +131,10 @@
|
||||
// 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
|
||||
|
||||
@ -142,31 +142,40 @@
|
||||
// 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:
|
||||
//
|
||||
@ -231,7 +240,7 @@
|
||||
#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"
|
||||
|
31
boost/boost/config/platform/vxworks.hpp
Executable file
31
boost/boost/config/platform/vxworks.hpp
Executable file
@ -0,0 +1,31 @@
|
||||
// (C) Copyright Dustin Spicuzza 2009.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for most recent version.
|
||||
|
||||
// vxWorks specific config options:
|
||||
|
||||
#define BOOST_PLATFORM "vxWorks"
|
||||
|
||||
#define BOOST_NO_CWCHAR
|
||||
#define BOOST_NO_INTRINSIC_WCHAR_T
|
||||
|
||||
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
|
||||
#define BOOST_NO_INT64_T
|
||||
#endif
|
||||
|
||||
#define BOOST_HAS_UNISTD_H
|
||||
|
||||
// these allow posix_features to work, since vxWorks doesn't
|
||||
// define them itself
|
||||
#define _POSIX_TIMERS 1
|
||||
#define _POSIX_THREADS 1
|
||||
|
||||
// vxworks doesn't work with asio serial ports
|
||||
#define BOOST_ASIO_DISABLE_SERIAL_PORT
|
||||
|
||||
// boilerplate code:
|
||||
#include <boost/config/posix_features.hpp>
|
||||
|
@ -61,6 +61,10 @@
|
||||
// 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) \
|
||||
|
@ -11,13 +11,10 @@
|
||||
|
||||
// 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
|
||||
@ -25,7 +22,17 @@
|
||||
// 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"
|
||||
|
||||
@ -64,5 +71,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -78,17 +78,42 @@
|
||||
# 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
|
||||
|
@ -32,10 +32,31 @@
|
||||
# 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.
|
||||
|
@ -77,7 +77,51 @@
|
||||
# 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 ---
|
||||
|
@ -21,10 +21,31 @@
|
||||
#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"
|
||||
|
||||
|
@ -45,11 +45,31 @@
|
||||
# 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__)
|
||||
|
||||
|
@ -152,8 +152,28 @@
|
||||
# endif
|
||||
#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
|
||||
|
||||
|
@ -76,7 +76,6 @@
|
||||
//
|
||||
#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:
|
||||
@ -106,6 +105,31 @@
|
||||
//
|
||||
#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"
|
||||
|
||||
|
||||
|
@ -61,9 +61,14 @@
|
||||
# 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:
|
||||
@ -195,6 +200,31 @@ namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy;
|
||||
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)
|
||||
|
||||
|
||||
|
@ -11,7 +11,31 @@
|
||||
|
||||
#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"
|
||||
|
||||
|
@ -306,6 +306,14 @@
|
||||
# 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:
|
||||
|
@ -464,6 +464,10 @@ namespace detail
|
||||
// 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
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* 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)
|
||||
@ -178,12 +178,31 @@ void construct(void* p,const Type& t)
|
||||
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 */
|
||||
|
@ -13,12 +13,6 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
#define BOOST_HASH_CHAR_TRAITS string_char_traits
|
||||
#else
|
||||
#define BOOST_HASH_CHAR_TRAITS char_traits
|
||||
#endif
|
||||
|
||||
#if ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) && defined(_GLIBCXX_DEBUG)) \
|
||||
|| BOOST_WORKAROUND(__BORLANDC__, > 0x551) \
|
||||
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \
|
||||
@ -65,7 +59,13 @@ namespace std
|
||||
{
|
||||
template <class T> class allocator;
|
||||
template <class charT, class traits, class Allocator> class basic_string;
|
||||
template <class charT> struct BOOST_HASH_CHAR_TRAITS;
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
template <class charT> struct string_char_traits;
|
||||
#else
|
||||
template <class charT> struct char_traits;
|
||||
#endif
|
||||
|
||||
template <class T> class complex;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,12 @@ namespace is_incrementable_
|
||||
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];
|
||||
|
||||
@ -92,6 +97,11 @@ namespace is_incrementable_
|
||||
, value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
|
||||
);
|
||||
};
|
||||
|
||||
# if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
# endif
|
||||
|
||||
}
|
||||
|
||||
# undef BOOST_comma
|
||||
|
56
boost/boost/detail/scoped_enum_emulation.hpp
Executable file
56
boost/boost/detail/scoped_enum_emulation.hpp
Executable file
@ -0,0 +1,56 @@
|
||||
// scoped_enum_emulation.hpp ---------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes, 2009
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
|
||||
// scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS
|
||||
// macro is used to detect feature support.
|
||||
//
|
||||
// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
|
||||
// description of the scoped enum feature. Note that the committee changed the name
|
||||
// from strongly typed enum to scoped enum.
|
||||
//
|
||||
// Caution: only the syntax is emulated; the semantics are not emulated and
|
||||
// the syntax emulation doesn't include being able to specify the underlying
|
||||
// representation type.
|
||||
//
|
||||
// The emulation is via struct rather than namespace to allow use within classes.
|
||||
// Thanks to Andrey Semashev for pointing that out.
|
||||
//
|
||||
// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,
|
||||
// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente
|
||||
// Botet, and Daniel James.
|
||||
//
|
||||
// Sample usage:
|
||||
//
|
||||
// BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END
|
||||
// ...
|
||||
// BOOST_SCOPED_ENUM(algae) sample( algae::red );
|
||||
// void foo( BOOST_SCOPED_ENUM(algae) color );
|
||||
// ...
|
||||
// sample = algae::green;
|
||||
// foo( algae::cyan );
|
||||
|
||||
#ifndef BOOST_SCOPED_ENUM_EMULATION_HPP
|
||||
#define BOOST_SCOPED_ENUM_EMULATION_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_SCOPED_ENUMS
|
||||
|
||||
# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_t
|
||||
# define BOOST_SCOPED_ENUM_END };
|
||||
# define BOOST_SCOPED_ENUM(name) name::enum_t
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_SCOPED_ENUM_START(name) enum class name
|
||||
# define BOOST_SCOPED_ENUM_END
|
||||
# define BOOST_SCOPED_ENUM(name) name
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPED_ENUM_EMULATION_HPP
|
@ -79,25 +79,18 @@
|
||||
// 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
|
||||
|
26
boost/boost/exception/all.hpp
Normal file
26
boost/boost/exception/all.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593
|
||||
#define UUID_316FDA946C0D11DEA9CBAE5255D89593
|
||||
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/exception/error_info.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/exception/info_tuple.hpp>
|
||||
#include <boost/exception/errinfo_api_function.hpp>
|
||||
#include <boost/exception/errinfo_at_line.hpp>
|
||||
#include <boost/exception/errinfo_errno.hpp>
|
||||
#include <boost/exception/errinfo_file_handle.hpp>
|
||||
#include <boost/exception/errinfo_file_name.hpp>
|
||||
#include <boost/exception/errinfo_file_open_mode.hpp>
|
||||
#include <boost/exception/errinfo_type_info_name.hpp>
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#endif
|
||||
|
||||
#endif
|
19
boost/boost/exception/detail/attribute_noreturn.hpp
Normal file
19
boost/boost/exception/detail/attribute_noreturn.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
//Copyright (c) 2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_61531AB0680611DEADD5846855D89593
|
||||
#define UUID_61531AB0680611DEADD5846855D89593
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn)
|
||||
#elif defined(__GNUC__)
|
||||
#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
#define BOOST_ATTRIBUTE_NORETURN
|
||||
#endif
|
||||
|
||||
#endif
|
26
boost/boost/exception/detail/exception_ptr_base.hpp
Normal file
26
boost/boost/exception/detail/exception_ptr_base.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_DC4208C6417811DEBF11E1EC55D89593
|
||||
#define UUID_DC4208C6417811DEBF11E1EC55D89593
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class
|
||||
exception_ptr_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void _rethrow() const=0;
|
||||
virtual bool _empty() const=0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -8,6 +8,7 @@
|
||||
|
||||
#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>
|
||||
@ -41,16 +42,6 @@ boost
|
||||
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 )
|
||||
@ -72,43 +63,41 @@ boost
|
||||
|
||||
inline
|
||||
std::string
|
||||
boost_diagnostic_information( exception const & x )
|
||||
diagnostic_information_impl( boost::exception const * be, std::exception const * se )
|
||||
{
|
||||
BOOST_ASSERT(be||se);
|
||||
#ifndef BOOST_NO_RTTI
|
||||
if( !se )
|
||||
se = dynamic_cast<std::exception const *>(be);
|
||||
if( !be )
|
||||
be = dynamic_cast<boost::exception const *>(se);
|
||||
#endif
|
||||
std::ostringstream tmp;
|
||||
if( char const * const * f=get_error_info<throw_file>(x) )
|
||||
if( be )
|
||||
{
|
||||
tmp << *f;
|
||||
if( int const * l=get_error_info<throw_line>(x) )
|
||||
tmp << '(' << *l << "): ";
|
||||
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';
|
||||
}
|
||||
tmp << "Throw in function ";
|
||||
if( char const * const * fn=get_error_info<throw_function>(x) )
|
||||
tmp << *fn;
|
||||
else
|
||||
tmp << "(unknown)";
|
||||
tmp << std::endl;
|
||||
#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;
|
||||
tmp << std::string("Dynamic exception type: ") <<
|
||||
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
|
||||
#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;
|
||||
#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;
|
||||
#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();
|
||||
}
|
||||
}
|
||||
@ -118,7 +107,7 @@ boost
|
||||
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>
|
||||
@ -126,7 +115,7 @@ boost
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,14 +128,31 @@ boost
|
||||
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
|
||||
|
22
boost/boost/exception/errinfo_api_function.hpp
Normal file
22
boost/boost/exception/errinfo_api_function.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_DDFBB4546C1211DEA4659E9055D89593
|
||||
#define UUID_DDFBB4546C1211DEA4659E9055D89593
|
||||
|
||||
#include "boost/exception/error_info.hpp"
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
//Usage hint:
|
||||
//if( api_function(....)!=0 )
|
||||
// BOOST_THROW_EXCEPTION(
|
||||
// failure() <<
|
||||
// errinfo_api_function("api_function") );
|
||||
typedef error_info<struct errinfo_api_function_,char const *> errinfo_api_function;
|
||||
}
|
||||
|
||||
#endif
|
18
boost/boost/exception/errinfo_at_line.hpp
Normal file
18
boost/boost/exception/errinfo_at_line.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_E7255CE26C1211DE85800C9155D89593
|
||||
#define UUID_E7255CE26C1211DE85800C9155D89593
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
//Use with parsing errors exceptions, for example in a XML file parser.
|
||||
typedef error_info<struct errinfo_at_line_,int> errinfo_at_line;
|
||||
}
|
||||
|
||||
#endif
|
35
boost/boost/exception/errinfo_errno.hpp
Normal file
35
boost/boost/exception/errinfo_errno.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
|
||||
#define UUID_F0EE17BE6C1211DE87FF459155D89593
|
||||
|
||||
#include "boost/exception/info.hpp"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
typedef error_info<struct errinfo_errno_,int> errinfo_errno;
|
||||
|
||||
//Usage hint:
|
||||
//if( c_function(....)!=0 )
|
||||
// BOOST_THROW_EXCEPTION(
|
||||
// failure() <<
|
||||
// errinfo_errno(errno) <<
|
||||
// errinfo_api_function("c_function") );
|
||||
inline
|
||||
std::string
|
||||
to_string( errinfo_errno const & e )
|
||||
{
|
||||
std::ostringstream tmp;
|
||||
int v=e.value();
|
||||
tmp << v << ", \"" << strerror(v) << "\"";
|
||||
return tmp.str();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
20
boost/boost/exception/errinfo_file_handle.hpp
Normal file
20
boost/boost/exception/errinfo_file_handle.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_F79E6EE26C1211DEB26E929155D89593
|
||||
#define UUID_F79E6EE26C1211DEB26E929155D89593
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class> class weak_ptr;
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
typedef error_info<struct errinfo_file_handle_,weak_ptr<FILE> > errinfo_file_handle;
|
||||
}
|
||||
|
||||
#endif
|
26
boost/boost/exception/errinfo_file_name.hpp
Normal file
26
boost/boost/exception/errinfo_file_name.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_FEE5120A6C1211DE94E8BC9155D89593
|
||||
#define UUID_FEE5120A6C1211DE94E8BC9155D89593
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
//Usage hint:
|
||||
//FILE * f=fopen(name,mode);
|
||||
//if( !f )
|
||||
// BOOST_THROW_EXCEPTION(
|
||||
// file_open_error() <<
|
||||
// errinfo_file_name(name) <<
|
||||
// errinfo_file_open_mode(mode) );
|
||||
typedef error_info<struct errinfo_file_name_,std::string> errinfo_file_name;
|
||||
}
|
||||
|
||||
#endif
|
26
boost/boost/exception/errinfo_file_open_mode.hpp
Normal file
26
boost/boost/exception/errinfo_file_open_mode.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_056F1F266C1311DE8E74299255D89593
|
||||
#define UUID_056F1F266C1311DE8E74299255D89593
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
//Usage hint:
|
||||
//FILE * f=fopen(name,mode);
|
||||
//if( !f )
|
||||
// BOOST_THROW_EXCEPTION(
|
||||
// file_open_error() <<
|
||||
// errinfo_file_name(name) <<
|
||||
// errinfo_file_open_mode(mode) );
|
||||
typedef error_info<struct errinfo_file_open_mode_,std::string> errinfo_file_open_mode;
|
||||
}
|
||||
|
||||
#endif
|
23
boost/boost/exception/errinfo_type_info_name.hpp
Normal file
23
boost/boost/exception/errinfo_type_info_name.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_0E11109E6C1311DEB7EA649255D89593
|
||||
#define UUID_0E11109E6C1311DEB7EA649255D89593
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
template <class Tag,class T> class error_info;
|
||||
|
||||
//Usage hint:
|
||||
//BOOST_THROW_EXCEPTION(
|
||||
// bad_type() <<
|
||||
// errinfo_type_info_name(typeid(x).name()) );
|
||||
typedef error_info<struct errinfo_type_info_name_,std::string> errinfo_type_info_name;
|
||||
}
|
||||
|
||||
#endif
|
@ -80,13 +80,13 @@ boost
|
||||
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;
|
||||
@ -100,7 +100,7 @@ boost
|
||||
|
||||
template <>
|
||||
class
|
||||
error_info<tag_throw_file,char const *>
|
||||
error_info<throw_file_,char const *>
|
||||
{
|
||||
public:
|
||||
typedef char const * value_type;
|
||||
@ -114,7 +114,7 @@ boost
|
||||
|
||||
template <>
|
||||
class
|
||||
error_info<tag_throw_line,int>
|
||||
error_info<throw_line_,int>
|
||||
{
|
||||
public:
|
||||
typedef int value_type;
|
||||
|
@ -106,7 +106,7 @@ boost
|
||||
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_);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace boost {
|
||||
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 );
|
||||
}
|
||||
@ -45,7 +45,7 @@ namespace boost {
|
||||
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);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace detail {
|
||||
#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
|
||||
|
@ -18,6 +18,9 @@
|
||||
#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>
|
||||
@ -42,7 +45,7 @@
|
||||
#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
|
||||
@ -259,6 +262,12 @@ namespace boost {
|
||||
A(a)
|
||||
{
|
||||
}
|
||||
|
||||
functor_wrapper(const functor_wrapper& f) :
|
||||
F(static_cast<const F&>(f)),
|
||||
A(static_cast<const A&>(f))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -625,7 +634,7 @@ public:
|
||||
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;
|
||||
}
|
||||
|
||||
@ -638,7 +647,7 @@ public:
|
||||
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);
|
||||
}
|
||||
@ -656,7 +665,7 @@ public:
|
||||
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.
|
||||
@ -702,6 +711,15 @@ public:
|
||||
#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;
|
||||
};
|
||||
@ -877,4 +895,8 @@ namespace detail {
|
||||
#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
|
||||
|
@ -21,7 +21,7 @@ namespace boost { namespace python { namespace objects {
|
||||
|
||||
#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||
|| defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \
|
||||
|| !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540)
|
||||
|| !(defined(BOOST_STRICT_CONFIG) || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540)
|
||||
# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
|
||||
#endif
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
// 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 )
|
||||
@ -624,14 +625,10 @@ namespace boost {
|
||||
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
|
||||
@ -678,6 +675,11 @@ namespace boost {
|
||||
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:
|
||||
@ -757,7 +759,7 @@ namespace boost {
|
||||
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
|
||||
@ -781,24 +783,26 @@ namespace boost {
|
||||
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
|
||||
@ -823,12 +827,13 @@ namespace boost {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -847,7 +852,8 @@ namespace boost {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -876,8 +882,11 @@ namespace boost {
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -903,8 +912,15 @@ namespace boost {
|
||||
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>
|
||||
@ -930,8 +946,15 @@ namespace boost {
|
||||
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
|
||||
@ -942,23 +965,23 @@ namespace boost {
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
@ -979,13 +1002,14 @@ namespace boost {
|
||||
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
|
||||
|
19
boost/boost/functional/detail/container_fwd.hpp
Normal file
19
boost/boost/functional/detail/container_fwd.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// 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)
|
||||
|
||||
// Forwarding header for container_fwd.hpp's new location.
|
||||
// This header is deprecated, I'll be adding a warning in a future release,
|
||||
// then converting it to an error and finally removing this header completely.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP)
|
||||
#define BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
|
||||
#endif
|
7
boost/boost/functional/hash.hpp
Normal file
7
boost/boost/functional/hash.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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/functional/hash/hash.hpp>
|
||||
|
246
boost/boost/functional/hash/detail/float_functions.hpp
Normal file
246
boost/boost/functional/hash/detail/float_functions.hpp
Normal file
@ -0,0 +1,246 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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)
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
// The C++ standard requires that the C float functions are overloarded
|
||||
// for float, double and long double in the std namespace, but some of the older
|
||||
// library implementations don't support this. On some that don't, the C99
|
||||
// float functions (frexpf, frexpl, etc.) are available.
|
||||
//
|
||||
// The following tries to automatically detect which are available.
|
||||
|
||||
namespace boost {
|
||||
namespace hash_detail {
|
||||
|
||||
// Returned by dummy versions of the float functions.
|
||||
|
||||
struct not_found {
|
||||
// Implicitly convertible to float and long double in order to avoid
|
||||
// a compile error when the dummy float functions are used.
|
||||
|
||||
inline operator float() const { return 0; }
|
||||
inline operator long double() const { return 0; }
|
||||
};
|
||||
|
||||
// A type for detecting the return type of functions.
|
||||
|
||||
template <typename T> struct is;
|
||||
template <> struct is<float> { char x[10]; };
|
||||
template <> struct is<double> { char x[20]; };
|
||||
template <> struct is<long double> { char x[30]; };
|
||||
template <> struct is<boost::hash_detail::not_found> { char x[40]; };
|
||||
|
||||
// Used to convert the return type of a function to a type for sizeof.
|
||||
|
||||
template <typename T> is<T> float_type(T);
|
||||
|
||||
// call_ldexp
|
||||
//
|
||||
// This will get specialized for float and long double
|
||||
|
||||
template <typename Float> struct call_ldexp
|
||||
{
|
||||
typedef double float_type;
|
||||
|
||||
inline double operator()(double a, int b) const
|
||||
{
|
||||
using namespace std;
|
||||
return ldexp(a, b);
|
||||
}
|
||||
};
|
||||
|
||||
// call_frexp
|
||||
//
|
||||
// This will get specialized for float and long double
|
||||
|
||||
template <typename Float> struct call_frexp
|
||||
{
|
||||
typedef double float_type;
|
||||
|
||||
inline double operator()(double a, int* b) const
|
||||
{
|
||||
using namespace std;
|
||||
return frexp(a, b);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// A namespace for dummy functions to detect when the actual function we want
|
||||
// isn't available. ldexpl, ldexpf etc. might be added tby the macros below.
|
||||
//
|
||||
// AFAICT these have to be outside of the boost namespace, as if they're in
|
||||
// the boost namespace they'll always be preferable to any other function
|
||||
// (since the arguments are built in types, ADL can't be used).
|
||||
|
||||
namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS {
|
||||
template <class Float> boost::hash_detail::not_found ldexp(Float, int);
|
||||
template <class Float> boost::hash_detail::not_found frexp(Float, int*);
|
||||
}
|
||||
|
||||
// Macros for generating specializations of call_ldexp and call_frexp.
|
||||
//
|
||||
// check_cpp and check_c99 check if the C++ or C99 functions are available.
|
||||
//
|
||||
// Then the call_* functions select an appropriate implementation.
|
||||
//
|
||||
// I used c99_func in a few places just to get a unique name.
|
||||
//
|
||||
// Important: when using 'using namespace' at namespace level, include as
|
||||
// little as possible in that namespace, as Visual C++ has an odd bug which
|
||||
// can cause the namespace to be imported at the global level. This seems to
|
||||
// happen mainly when there's a template in the same namesapce.
|
||||
|
||||
#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \
|
||||
namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS { \
|
||||
template <class Float> \
|
||||
boost::hash_detail::not_found c99_func(Float, type2); \
|
||||
} \
|
||||
\
|
||||
namespace boost { \
|
||||
namespace hash_detail { \
|
||||
namespace c99_func##_detect { \
|
||||
using namespace std; \
|
||||
using namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS; \
|
||||
\
|
||||
struct check { \
|
||||
static type1 x; \
|
||||
static type2 y; \
|
||||
BOOST_STATIC_CONSTANT(bool, cpp = \
|
||||
sizeof(float_type(cpp_func(x,y))) \
|
||||
== sizeof(is<type1>)); \
|
||||
BOOST_STATIC_CONSTANT(bool, c99 = \
|
||||
sizeof(float_type(c99_func(x,y))) \
|
||||
== sizeof(is<type1>)); \
|
||||
}; \
|
||||
} \
|
||||
\
|
||||
template <bool x> \
|
||||
struct call_c99_##c99_func : \
|
||||
boost::hash_detail::call_##cpp_func<double> {}; \
|
||||
\
|
||||
template <> \
|
||||
struct call_c99_##c99_func<true> { \
|
||||
typedef type1 float_type; \
|
||||
\
|
||||
template <typename T> \
|
||||
inline type1 operator()(type1 a, T b) const \
|
||||
{ \
|
||||
using namespace std; \
|
||||
return c99_func(a, b); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <bool x> \
|
||||
struct call_cpp_##c99_func : \
|
||||
call_c99_##c99_func< \
|
||||
::boost::hash_detail::c99_func##_detect::check::c99 \
|
||||
> {}; \
|
||||
\
|
||||
template <> \
|
||||
struct call_cpp_##c99_func<true> { \
|
||||
typedef type1 float_type; \
|
||||
\
|
||||
template <typename T> \
|
||||
inline type1 operator()(type1 a, T b) const \
|
||||
{ \
|
||||
using namespace std; \
|
||||
return cpp_func(a, b); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <> \
|
||||
struct call_##cpp_func<type1> : \
|
||||
call_cpp_##c99_func< \
|
||||
::boost::hash_detail::c99_func##_detect::check::cpp \
|
||||
> {}; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2) \
|
||||
namespace boost { \
|
||||
namespace hash_detail { \
|
||||
\
|
||||
template <> \
|
||||
struct call_##cpp_func<type1> { \
|
||||
typedef type1 float_type; \
|
||||
inline type1 operator()(type1 x, type2 y) const { \
|
||||
return c99_func(x, y); \
|
||||
} \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined(ldexpf)
|
||||
BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int)
|
||||
#else
|
||||
BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int)
|
||||
#endif
|
||||
|
||||
#if defined(ldexpl)
|
||||
BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int)
|
||||
#else
|
||||
BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int)
|
||||
#endif
|
||||
|
||||
#if defined(frexpf)
|
||||
BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*)
|
||||
#else
|
||||
BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*)
|
||||
#endif
|
||||
|
||||
#if defined(frexpl)
|
||||
BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*)
|
||||
#else
|
||||
BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*)
|
||||
#endif
|
||||
|
||||
#undef BOOST_HASH_CALL_FLOAT_MACRO
|
||||
#undef BOOST_HASH_CALL_FLOAT_FUNC
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
template <typename Float1, typename Float2>
|
||||
struct select_hash_type_impl {
|
||||
typedef double type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct select_hash_type_impl<float, float> {
|
||||
typedef float type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct select_hash_type_impl<long double, long double> {
|
||||
typedef long double type;
|
||||
};
|
||||
|
||||
|
||||
// select_hash_type
|
||||
//
|
||||
// If there is support for a particular floating point type, use that
|
||||
// otherwise use double (there's always support for double).
|
||||
|
||||
template <typename Float>
|
||||
struct select_hash_type : select_hash_type_impl<
|
||||
BOOST_DEDUCED_TYPENAME call_ldexp<Float>::float_type,
|
||||
BOOST_DEDUCED_TYPENAME call_frexp<Float>::float_type
|
||||
> {};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
101
boost/boost/functional/hash/detail/hash_float.hpp
Normal file
101
boost/boost/functional/hash/detail/hash_float.hpp
Normal file
@ -0,0 +1,101 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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)
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/functional/hash/detail/float_functions.hpp>
|
||||
#include <boost/functional/hash/detail/limits.hpp>
|
||||
#include <boost/integer/static_log2.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
// Include hash implementation for the current platform.
|
||||
|
||||
// Cygwn
|
||||
#if defined(__CYGWIN__)
|
||||
# if defined(__i386__) || defined(_M_IX86)
|
||||
# include <boost/functional/hash/detail/hash_float_x86.hpp>
|
||||
# else
|
||||
# include <boost/functional/hash/detail/hash_float_generic.hpp>
|
||||
# endif
|
||||
#else
|
||||
# include <boost/functional/hash/detail/hash_float_generic.hpp>
|
||||
#endif
|
||||
|
||||
// Can we use fpclassify?
|
||||
|
||||
// STLport
|
||||
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
#define BOOST_HASH_USE_FPCLASSIFY 0
|
||||
|
||||
// GNU libstdc++ 3
|
||||
#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
||||
# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \
|
||||
!(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
|
||||
# define BOOST_HASH_USE_FPCLASSIFY 1
|
||||
# else
|
||||
# define BOOST_HASH_USE_FPCLASSIFY 0
|
||||
# endif
|
||||
|
||||
// Everything else
|
||||
#else
|
||||
# define BOOST_HASH_USE_FPCLASSIFY 0
|
||||
#endif
|
||||
|
||||
#if BOOST_HASH_USE_FPCLASSIFY
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
template <class T>
|
||||
inline std::size_t float_hash_value(T v)
|
||||
{
|
||||
using namespace std;
|
||||
switch (fpclassify(v)) {
|
||||
case FP_ZERO:
|
||||
return 0;
|
||||
case FP_INFINITE:
|
||||
return (std::size_t)(v > 0 ? -1 : -2);
|
||||
case FP_NAN:
|
||||
return (std::size_t)(-3);
|
||||
case FP_NORMAL:
|
||||
case FP_SUBNORMAL:
|
||||
return float_hash_impl(v);
|
||||
default:
|
||||
BOOST_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else // !BOOST_HASH_USE_FPCLASSIFY
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
template <class T>
|
||||
inline std::size_t float_hash_value(T v)
|
||||
{
|
||||
return v == 0 ? 0 : float_hash_impl(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_HASH_USE_FPCLASSIFY
|
||||
|
||||
#undef BOOST_HASH_USE_FPCLASSIFY
|
||||
|
||||
#endif
|
93
boost/boost/functional/hash/detail/hash_float_generic.hpp
Normal file
93
boost/boost/functional/hash/detail/hash_float_generic.hpp
Normal file
@ -0,0 +1,93 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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)
|
||||
|
||||
// A general purpose hash function for non-zero floating point values.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER
|
||||
|
||||
#include <boost/functional/hash/detail/float_functions.hpp>
|
||||
#include <boost/integer/static_log2.hpp>
|
||||
#include <boost/functional/hash/detail/limits.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#if BOOST_MSVC >= 1400
|
||||
#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
|
||||
// not satisfy test. Loop body not executed
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
inline void hash_float_combine(std::size_t& seed, std::size_t value)
|
||||
{
|
||||
seed ^= value + (seed<<6) + (seed>>2);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::size_t float_hash_impl2(T v)
|
||||
{
|
||||
boost::hash_detail::call_frexp<T> frexp;
|
||||
boost::hash_detail::call_ldexp<T> ldexp;
|
||||
|
||||
int exp = 0;
|
||||
|
||||
v = frexp(v, &exp);
|
||||
|
||||
// A postive value is easier to hash, so combine the
|
||||
// sign with the exponent and use the absolute value.
|
||||
if(v < 0) {
|
||||
v = -v;
|
||||
exp += limits<T>::max_exponent -
|
||||
limits<T>::min_exponent;
|
||||
}
|
||||
|
||||
// The result of frexp is always between 0.5 and 1, so its
|
||||
// top bit will always be 1. Subtract by 0.5 to remove that.
|
||||
v -= T(0.5);
|
||||
v = ldexp(v, limits<std::size_t>::digits + 1);
|
||||
std::size_t seed = static_cast<std::size_t>(v);
|
||||
v -= seed;
|
||||
|
||||
// ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
|
||||
std::size_t const length
|
||||
= (limits<T>::digits *
|
||||
boost::static_log2<limits<T>::radix>::value - 1)
|
||||
/ limits<std::size_t>::digits;
|
||||
|
||||
for(std::size_t i = 0; i != length; ++i)
|
||||
{
|
||||
v = ldexp(v, limits<std::size_t>::digits);
|
||||
std::size_t part = static_cast<std::size_t>(v);
|
||||
v -= part;
|
||||
hash_float_combine(seed, part);
|
||||
}
|
||||
|
||||
hash_float_combine(seed, exp);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::size_t float_hash_impl(T v)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type;
|
||||
return float_hash_impl2(static_cast<type>(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
56
boost/boost/functional/hash/detail/hash_float_x86.hpp
Normal file
56
boost/boost/functional/hash/detail/hash_float_x86.hpp
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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)
|
||||
|
||||
// A non-portable hash function form non-zero floats on x86.
|
||||
//
|
||||
// Even if you're on an x86 platform, this might not work if their floating
|
||||
// point isn't set up as this expects. So this should only be used if it's
|
||||
// absolutely certain that it will work.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
inline void hash_float_combine(std::size_t& seed, std::size_t value)
|
||||
{
|
||||
seed ^= value + (seed<<6) + (seed>>2);
|
||||
}
|
||||
|
||||
inline std::size_t float_hash_impl(float v)
|
||||
{
|
||||
boost::uint32_t* ptr = (boost::uint32_t*)&v;
|
||||
std::size_t seed = *ptr;
|
||||
return seed;
|
||||
}
|
||||
|
||||
inline std::size_t float_hash_impl(double v)
|
||||
{
|
||||
boost::uint32_t* ptr = (boost::uint32_t*)&v;
|
||||
std::size_t seed = *ptr++;
|
||||
hash_float_combine(seed, *ptr);
|
||||
return seed;
|
||||
}
|
||||
|
||||
inline std::size_t float_hash_impl(long double v)
|
||||
{
|
||||
boost::uint32_t* ptr = (boost::uint32_t*)&v;
|
||||
std::size_t seed = *ptr++;
|
||||
hash_float_combine(seed, *ptr++);
|
||||
hash_float_combine(seed, *(boost::uint16_t*)ptr);
|
||||
return seed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
61
boost/boost/functional/hash/detail/limits.hpp
Normal file
61
boost/boost/functional/hash/detail/limits.hpp
Normal file
@ -0,0 +1,61 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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)
|
||||
//
|
||||
// On some platforms std::limits gives incorrect values for long double.
|
||||
// This tries to work around them.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
// On OpenBSD, numeric_limits is not reliable for long doubles, but
|
||||
// the macros defined in <float.h> are and support long double when STLport
|
||||
// doesn't.
|
||||
|
||||
#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
|
||||
#include <float.h>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
template <class T>
|
||||
struct limits : std::numeric_limits<T> {};
|
||||
|
||||
#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
|
||||
template <>
|
||||
struct limits<long double>
|
||||
: std::numeric_limits<long double>
|
||||
{
|
||||
static long double epsilon() {
|
||||
return LDBL_EPSILON;
|
||||
}
|
||||
|
||||
static long double (max)() {
|
||||
return LDBL_MAX;
|
||||
}
|
||||
|
||||
static long double (min)() {
|
||||
return LDBL_MIN;
|
||||
}
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);
|
||||
BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);
|
||||
BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);
|
||||
#if defined(_STLP_NO_LONG_DOUBLE)
|
||||
BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX);
|
||||
#endif
|
||||
};
|
||||
#endif // __OpenBSD__
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
286
boost/boost/functional/hash/extensions.hpp
Normal file
286
boost/boost/functional/hash/extensions.hpp
Normal file
@ -0,0 +1,286 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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)
|
||||
|
||||
// Based on Peter Dimov's proposal
|
||||
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
||||
// issue 6.18.
|
||||
|
||||
// This implements the extensions to the standard.
|
||||
// It's undocumented, so you shouldn't use it....
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
|
||||
#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP
|
||||
|
||||
#include <boost/functional/hash/hash.hpp>
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class A, class B>
|
||||
std::size_t hash_value(std::pair<A, B> const&);
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::vector<T, A> const&);
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::list<T, A> const& v);
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::deque<T, A> const& v);
|
||||
template <class K, class C, class A>
|
||||
std::size_t hash_value(std::set<K, C, A> const& v);
|
||||
template <class K, class C, class A>
|
||||
std::size_t hash_value(std::multiset<K, C, A> const& v);
|
||||
template <class K, class T, class C, class A>
|
||||
std::size_t hash_value(std::map<K, T, C, A> const& v);
|
||||
template <class K, class T, class C, class A>
|
||||
std::size_t hash_value(std::multimap<K, T, C, A> const& v);
|
||||
|
||||
template <class T>
|
||||
std::size_t hash_value(std::complex<T> const&);
|
||||
|
||||
template <class A, class B>
|
||||
std::size_t hash_value(std::pair<A, B> const& v)
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
hash_combine(seed, v.first);
|
||||
hash_combine(seed, v.second);
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::vector<T, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::list<T, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::deque<T, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class K, class C, class A>
|
||||
std::size_t hash_value(std::set<K, C, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class K, class C, class A>
|
||||
std::size_t hash_value(std::multiset<K, C, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class K, class T, class C, class A>
|
||||
std::size_t hash_value(std::map<K, T, C, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class K, class T, class C, class A>
|
||||
std::size_t hash_value(std::multimap<K, T, C, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::size_t hash_value(std::complex<T> const& v)
|
||||
{
|
||||
boost::hash<T> hasher;
|
||||
std::size_t seed = hasher(v.imag());
|
||||
seed ^= hasher(v.real()) + (seed<<6) + (seed>>2);
|
||||
return seed;
|
||||
}
|
||||
|
||||
//
|
||||
// call_hash_impl
|
||||
//
|
||||
|
||||
// On compilers without function template ordering, this deals with arrays.
|
||||
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
namespace hash_detail
|
||||
{
|
||||
template <bool IsArray>
|
||||
struct call_hash_impl
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
{
|
||||
static std::size_t call(T const& v)
|
||||
{
|
||||
using namespace boost;
|
||||
return hash_value(v);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct call_hash_impl<true>
|
||||
{
|
||||
template <class Array>
|
||||
struct inner
|
||||
{
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
static std::size_t call(Array const& v)
|
||||
#else
|
||||
static std::size_t call(Array& v)
|
||||
#endif
|
||||
{
|
||||
const int size = sizeof(v) / sizeof(*v);
|
||||
return boost::hash_range(v, v + size);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct call_hash
|
||||
: public call_hash_impl<boost::is_array<T>::value>
|
||||
::BOOST_NESTED_TEMPLATE inner<T>
|
||||
{
|
||||
};
|
||||
}
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
//
|
||||
// boost::hash
|
||||
//
|
||||
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template <class T> struct hash
|
||||
: std::unary_function<T, std::size_t>
|
||||
{
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_value(val);
|
||||
}
|
||||
#else
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T>::call(val);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(__DMC__, <= 0x848)
|
||||
template <class T, unsigned int n> struct hash<T[n]>
|
||||
: std::unary_function<T[n], std::size_t>
|
||||
{
|
||||
std::size_t operator()(const T* val) const
|
||||
{
|
||||
return boost::hash_range(val, val+n);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
// On compilers without partial specialization, boost::hash<T>
|
||||
// has already been declared to deal with pointers, so just
|
||||
// need to supply the non-pointer version of hash_impl.
|
||||
|
||||
namespace hash_detail
|
||||
{
|
||||
template <bool IsPointer>
|
||||
struct hash_impl;
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
|
||||
template <>
|
||||
struct hash_impl<false>
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
: std::unary_function<T, std::size_t>
|
||||
{
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_value(val);
|
||||
}
|
||||
#else
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T>::call(val);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#else // Visual C++ 6.5
|
||||
|
||||
// Visual C++ 6.5 has problems with nested member functions and
|
||||
// applying const to const types in templates. So we get this:
|
||||
|
||||
template <bool IsConst>
|
||||
struct hash_impl_msvc
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
: public std::unary_function<T, std::size_t>
|
||||
{
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T const>::call(val);
|
||||
}
|
||||
|
||||
std::size_t operator()(T& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T>::call(val);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash_impl_msvc<true>
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
: public std::unary_function<T, std::size_t>
|
||||
{
|
||||
std::size_t operator()(T& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T>::call(val);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct hash_impl_msvc2
|
||||
: public hash_impl_msvc<boost::is_const<T>::value>
|
||||
::BOOST_NESTED_TEMPLATE inner<T> {};
|
||||
|
||||
template <>
|
||||
struct hash_impl<false>
|
||||
{
|
||||
template <class T>
|
||||
struct inner : public hash_impl_msvc2<T> {};
|
||||
};
|
||||
|
||||
#endif // Visual C++ 6.5
|
||||
}
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
}
|
||||
|
||||
#endif
|
478
boost/boost/functional/hash/hash.hpp
Normal file
478
boost/boost/functional/hash/hash.hpp
Normal file
@ -0,0 +1,478 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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)
|
||||
|
||||
// Based on Peter Dimov's proposal
|
||||
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
||||
// issue 6.18.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP)
|
||||
#define BOOST_FUNCTIONAL_HASH_HASH_HPP
|
||||
|
||||
#include <boost/functional/hash/hash_fwd.hpp>
|
||||
#include <functional>
|
||||
#include <boost/functional/hash/detail/hash_float.hpp>
|
||||
#include <string>
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
#define BOOST_HASH_CHAR_TRAITS string_char_traits
|
||||
#else
|
||||
#define BOOST_HASH_CHAR_TRAITS char_traits
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
std::size_t hash_value(bool);
|
||||
std::size_t hash_value(char);
|
||||
std::size_t hash_value(unsigned char);
|
||||
std::size_t hash_value(signed char);
|
||||
std::size_t hash_value(short);
|
||||
std::size_t hash_value(unsigned short);
|
||||
std::size_t hash_value(int);
|
||||
std::size_t hash_value(unsigned int);
|
||||
std::size_t hash_value(long);
|
||||
std::size_t hash_value(unsigned long);
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
std::size_t hash_value(wchar_t);
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
std::size_t hash_value(boost::long_long_type);
|
||||
std::size_t hash_value(boost::ulong_long_type);
|
||||
#endif
|
||||
|
||||
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
|
||||
template <class T> std::size_t hash_value(T* const&);
|
||||
#else
|
||||
template <class T> std::size_t hash_value(T*);
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
template< class T, unsigned N >
|
||||
std::size_t hash_value(const T (&x)[N]);
|
||||
|
||||
template< class T, unsigned N >
|
||||
std::size_t hash_value(T (&x)[N]);
|
||||
#endif
|
||||
|
||||
std::size_t hash_value(float v);
|
||||
std::size_t hash_value(double v);
|
||||
std::size_t hash_value(long double v);
|
||||
|
||||
template <class Ch, class A>
|
||||
std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
|
||||
|
||||
// Implementation
|
||||
|
||||
namespace hash_detail
|
||||
{
|
||||
template <class T>
|
||||
inline std::size_t hash_value_signed(T val)
|
||||
{
|
||||
const int size_t_bits = std::numeric_limits<std::size_t>::digits;
|
||||
// ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
|
||||
const int length = (std::numeric_limits<T>::digits - 1)
|
||||
/ size_t_bits;
|
||||
|
||||
std::size_t seed = 0;
|
||||
T positive = val < 0 ? -1 - val : val;
|
||||
|
||||
// Hopefully, this loop can be unrolled.
|
||||
for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
|
||||
{
|
||||
seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2);
|
||||
}
|
||||
seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::size_t hash_value_unsigned(T val)
|
||||
{
|
||||
const int size_t_bits = std::numeric_limits<std::size_t>::digits;
|
||||
// ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
|
||||
const int length = (std::numeric_limits<T>::digits - 1)
|
||||
/ size_t_bits;
|
||||
|
||||
std::size_t seed = 0;
|
||||
|
||||
// Hopefully, this loop can be unrolled.
|
||||
for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
|
||||
{
|
||||
seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2);
|
||||
}
|
||||
seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
|
||||
|
||||
return seed;
|
||||
}
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(bool v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(char v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(unsigned char v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(signed char v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(short v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(unsigned short v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(int v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(unsigned int v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(long v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(unsigned long v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
inline std::size_t hash_value(wchar_t v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
inline std::size_t hash_value(boost::long_long_type v)
|
||||
{
|
||||
return hash_detail::hash_value_signed(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(boost::ulong_long_type v)
|
||||
{
|
||||
return hash_detail::hash_value_unsigned(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Implementation by Alberto Barbati and Dave Harris.
|
||||
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
|
||||
template <class T> std::size_t hash_value(T* const& v)
|
||||
#else
|
||||
template <class T> std::size_t hash_value(T* v)
|
||||
#endif
|
||||
{
|
||||
std::size_t x = static_cast<std::size_t>(
|
||||
reinterpret_cast<std::ptrdiff_t>(v));
|
||||
|
||||
return x + (x >> 3);
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template <class T>
|
||||
inline void hash_combine(std::size_t& seed, T& v)
|
||||
#else
|
||||
template <class T>
|
||||
inline void hash_combine(std::size_t& seed, T const& v)
|
||||
#endif
|
||||
{
|
||||
boost::hash<T> hasher;
|
||||
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||
}
|
||||
|
||||
template <class It>
|
||||
inline std::size_t hash_range(It first, It last)
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
|
||||
for(; first != last; ++first)
|
||||
{
|
||||
hash_combine(seed, *first);
|
||||
}
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class It>
|
||||
inline void hash_range(std::size_t& seed, It first, It last)
|
||||
{
|
||||
for(; first != last; ++first)
|
||||
{
|
||||
hash_combine(seed, *first);
|
||||
}
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template <class T>
|
||||
inline std::size_t hash_range(T* first, T* last)
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
|
||||
for(; first != last; ++first)
|
||||
{
|
||||
boost::hash<T> hasher;
|
||||
seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||
}
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void hash_range(std::size_t& seed, T* first, T* last)
|
||||
{
|
||||
for(; first != last; ++first)
|
||||
{
|
||||
boost::hash<T> hasher;
|
||||
seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
template< class T, unsigned N >
|
||||
inline std::size_t hash_value(const T (&x)[N])
|
||||
{
|
||||
return hash_range(x, x + N);
|
||||
}
|
||||
|
||||
template< class T, unsigned N >
|
||||
inline std::size_t hash_value(T (&x)[N])
|
||||
{
|
||||
return hash_range(x, x + N);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class Ch, class A>
|
||||
inline std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(float v)
|
||||
{
|
||||
return boost::hash_detail::float_hash_value(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(double v)
|
||||
{
|
||||
return boost::hash_detail::float_hash_value(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(long double v)
|
||||
{
|
||||
return boost::hash_detail::float_hash_value(v);
|
||||
}
|
||||
|
||||
//
|
||||
// boost::hash
|
||||
//
|
||||
|
||||
// Define the specializations required by the standard. The general purpose
|
||||
// boost::hash is defined later in extensions.hpp if BOOST_HASH_NO_EXTENSIONS
|
||||
// is not defined.
|
||||
|
||||
// BOOST_HASH_SPECIALIZE - define a specialization for a type which is
|
||||
// passed by copy.
|
||||
//
|
||||
// BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is
|
||||
// passed by copy.
|
||||
//
|
||||
// These are undefined later.
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#define BOOST_HASH_SPECIALIZE(type) \
|
||||
template <> struct hash<type> \
|
||||
: public std::unary_function<type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define BOOST_HASH_SPECIALIZE_REF(type) \
|
||||
template <> struct hash<type> \
|
||||
: public std::unary_function<type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type const& v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
};
|
||||
#else
|
||||
#define BOOST_HASH_SPECIALIZE(type) \
|
||||
template <> struct hash<type> \
|
||||
: public std::unary_function<type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <> struct hash<const type> \
|
||||
: public std::unary_function<const type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(const type v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define BOOST_HASH_SPECIALIZE_REF(type) \
|
||||
template <> struct hash<type> \
|
||||
: public std::unary_function<type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type const& v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <> struct hash<const type> \
|
||||
: public std::unary_function<const type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type const& v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
};
|
||||
#endif
|
||||
|
||||
BOOST_HASH_SPECIALIZE(bool)
|
||||
BOOST_HASH_SPECIALIZE(char)
|
||||
BOOST_HASH_SPECIALIZE(signed char)
|
||||
BOOST_HASH_SPECIALIZE(unsigned char)
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
BOOST_HASH_SPECIALIZE(wchar_t)
|
||||
#endif
|
||||
BOOST_HASH_SPECIALIZE(short)
|
||||
BOOST_HASH_SPECIALIZE(unsigned short)
|
||||
BOOST_HASH_SPECIALIZE(int)
|
||||
BOOST_HASH_SPECIALIZE(unsigned int)
|
||||
BOOST_HASH_SPECIALIZE(long)
|
||||
BOOST_HASH_SPECIALIZE(unsigned long)
|
||||
|
||||
BOOST_HASH_SPECIALIZE(float)
|
||||
BOOST_HASH_SPECIALIZE(double)
|
||||
BOOST_HASH_SPECIALIZE(long double)
|
||||
|
||||
BOOST_HASH_SPECIALIZE_REF(std::string)
|
||||
#if !defined(BOOST_NO_STD_WSTRING)
|
||||
BOOST_HASH_SPECIALIZE_REF(std::wstring)
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
BOOST_HASH_SPECIALIZE(boost::long_long_type)
|
||||
BOOST_HASH_SPECIALIZE(boost::ulong_long_type)
|
||||
#endif
|
||||
|
||||
#undef BOOST_HASH_SPECIALIZE
|
||||
#undef BOOST_HASH_SPECIALIZE_REF
|
||||
|
||||
// Specializing boost::hash for pointers.
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template <class T>
|
||||
struct hash<T*>
|
||||
: public std::unary_function<T*, std::size_t>
|
||||
{
|
||||
std::size_t operator()(T* v) const
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
|
||||
return boost::hash_value(v);
|
||||
#else
|
||||
std::size_t x = static_cast<std::size_t>(
|
||||
reinterpret_cast<std::ptrdiff_t>(v));
|
||||
|
||||
return x + (x >> 3);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
// For compilers without partial specialization, we define a
|
||||
// boost::hash for all remaining types. But hash_impl is only defined
|
||||
// for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS
|
||||
// is defined there will still be a compile error for types not supported
|
||||
// in the standard.
|
||||
|
||||
namespace hash_detail
|
||||
{
|
||||
template <bool IsPointer>
|
||||
struct hash_impl;
|
||||
|
||||
template <>
|
||||
struct hash_impl<true>
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
: public std::unary_function<T, std::size_t>
|
||||
{
|
||||
std::size_t operator()(T val) const
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590)
|
||||
return boost::hash_value(val);
|
||||
#else
|
||||
std::size_t x = static_cast<std::size_t>(
|
||||
reinterpret_cast<std::ptrdiff_t>(val));
|
||||
|
||||
return x + (x >> 3);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
template <class T> struct hash
|
||||
: public boost::hash_detail::hash_impl<boost::is_pointer<T>::value>
|
||||
::BOOST_NESTED_TEMPLATE inner<T>
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef BOOST_HASH_CHAR_TRAITS
|
||||
|
||||
#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP
|
||||
|
||||
// Include this outside of the include guards in case the file is included
|
||||
// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it
|
||||
// undefined.
|
||||
|
||||
#if !defined(BOOST_HASH_NO_EXTENSIONS) \
|
||||
&& !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
|
||||
#include <boost/functional/hash/extensions.hpp>
|
||||
#endif
|
40
boost/boost/functional/hash/hash_fwd.hpp
Normal file
40
boost/boost/functional/hash/hash_fwd.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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)
|
||||
|
||||
// Based on Peter Dimov's proposal
|
||||
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
||||
// issue 6.18.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP)
|
||||
#define BOOST_FUNCTIONAL_HASH_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class T> struct hash;
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template <class T> void hash_combine(std::size_t& seed, T& v);
|
||||
#else
|
||||
template <class T> void hash_combine(std::size_t& seed, T const& v);
|
||||
#endif
|
||||
|
||||
template <class It> std::size_t hash_range(It, It);
|
||||
template <class It> void hash_range(std::size_t&, It, It);
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template <class T> inline std::size_t hash_range(T*, T*);
|
||||
template <class T> inline void hash_range(std::size_t&, T*, T*);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
7
boost/boost/functional/hash_fwd.hpp
Normal file
7
boost/boost/functional/hash_fwd.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// 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/functional/hash/hash_fwd.hpp>
|
||||
|
@ -48,7 +48,7 @@ namespace boost {
|
||||
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
|
||||
@ -85,7 +85,7 @@ namespace boost {
|
||||
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)
|
||||
|
@ -10,9 +10,9 @@
|
||||
//
|
||||
// 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)
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
# 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
|
||||
|
@ -11,9 +11,9 @@
|
||||
//
|
||||
// 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>
|
||||
@ -49,7 +49,7 @@ template< \
|
||||
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 > \
|
||||
|
@ -10,9 +10,9 @@
|
||||
//
|
||||
// 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>
|
||||
@ -25,8 +25,7 @@
|
||||
|
||||
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
|
||||
@ -39,7 +38,7 @@ struct push_back_impl
|
||||
// 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 )
|
||||
);
|
||||
@ -51,13 +50,13 @@ struct has_push_back_impl
|
||||
{
|
||||
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
|
||||
};
|
||||
|
@ -10,9 +10,9 @@
|
||||
//
|
||||
// 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>
|
||||
@ -25,8 +25,7 @@
|
||||
|
||||
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
|
||||
@ -40,7 +39,7 @@ struct push_front_impl
|
||||
// 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 )
|
||||
);
|
||||
@ -52,13 +51,13 @@ struct has_push_front_impl
|
||||
{
|
||||
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
|
||||
};
|
||||
|
22
boost/boost/mpl/char.hpp
Executable file
22
boost/boost/mpl/char.hpp
Executable file
@ -0,0 +1,22 @@
|
||||
|
||||
#ifndef BOOST_MPL_CHAR_HPP_INCLUDED
|
||||
#define BOOST_MPL_CHAR_HPP_INCLUDED
|
||||
|
||||
// Copyright Eric Niebler 2008
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Source$
|
||||
// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $
|
||||
// $Revision: 24874 $
|
||||
|
||||
#include <boost/mpl/char_fwd.hpp>
|
||||
|
||||
#define AUX_WRAPPER_VALUE_TYPE char
|
||||
#include <boost/mpl/aux_/integral_wrapper.hpp>
|
||||
|
||||
#endif // BOOST_MPL_CHAR_HPP_INCLUDED
|
27
boost/boost/mpl/char_fwd.hpp
Executable file
27
boost/boost/mpl/char_fwd.hpp
Executable file
@ -0,0 +1,27 @@
|
||||
|
||||
#ifndef BOOST_MPL_CHAR_FWD_HPP_INCLUDED
|
||||
#define BOOST_MPL_CHAR_FWD_HPP_INCLUDED
|
||||
|
||||
// Copyright Eric Niebler 2008
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Source$
|
||||
// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $
|
||||
// $Revision: 24874 $
|
||||
|
||||
#include <boost/mpl/aux_/adl_barrier.hpp>
|
||||
#include <boost/mpl/aux_/nttp_decl.hpp>
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
||||
|
||||
template< BOOST_MPL_AUX_NTTP_DECL(char, N) > struct char_;
|
||||
|
||||
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
||||
BOOST_MPL_AUX_ADL_BARRIER_DECL(char_)
|
||||
|
||||
#endif // BOOST_MPL_CHAR_FWD_HPP_INCLUDED
|
@ -10,9 +10,9 @@
|
||||
//
|
||||
// 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>
|
||||
@ -76,7 +76,7 @@ struct for_each_impl<false>
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
@ -98,7 +98,7 @@ void for_each(F f, Sequence* = 0, TransformOp* = 0)
|
||||
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<
|
||||
|
21
boost/boost/mpl/limits/string.hpp
Normal file
21
boost/boost/mpl/limits/string.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
#ifndef BOOST_MPL_LIMITS_STRING_HPP_INCLUDED
|
||||
#define BOOST_MPL_LIMITS_STRING_HPP_INCLUDED
|
||||
|
||||
// Copyright Eric Niebler 2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $
|
||||
// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $
|
||||
// $Revision: 49239 $
|
||||
|
||||
#if !defined(BOOST_MPL_LIMIT_STRING_SIZE)
|
||||
# define BOOST_MPL_LIMIT_STRING_SIZE 32
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MPL_LIMITS_STRING_HPP_INCLUDED
|
@ -11,9 +11,9 @@
|
||||
//
|
||||
// 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>
|
||||
@ -39,7 +39,7 @@ struct map_insert_impl
|
||||
>
|
||||
#else
|
||||
, m_item<
|
||||
next< typename Map::size >::type::value
|
||||
Map::order::value
|
||||
, typename Pair::first
|
||||
, typename Pair::second
|
||||
, Map
|
||||
|
559
boost/boost/mpl/string.hpp
Executable file
559
boost/boost/mpl/string.hpp
Executable file
@ -0,0 +1,559 @@
|
||||
|
||||
#ifndef BOOST_MPL_STRING_HPP_INCLUDED
|
||||
#define BOOST_MPL_STRING_HPP_INCLUDED
|
||||
|
||||
// Copyright Eric Niebler 2009
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $
|
||||
// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $
|
||||
// $Revision: 49239 $
|
||||
//
|
||||
// Thanks to:
|
||||
// Dmitry Goncharov for porting this to the Sun compiler
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/detail/endian.hpp>
|
||||
#include <boost/mpl/limits/string.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/char.hpp>
|
||||
#include <boost/mpl/copy.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mpl/empty.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/size_t.hpp>
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
#include <boost/mpl/joint_view.hpp>
|
||||
#include <boost/mpl/insert_range.hpp>
|
||||
#include <boost/mpl/back_inserter.hpp>
|
||||
#include <boost/mpl/front_inserter.hpp>
|
||||
#include <boost/mpl/iterator_range.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/arithmetic/add.hpp>
|
||||
#include <boost/preprocessor/arithmetic/div.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
|
||||
#include <iterator> // for bidirectional_iterator_tag
|
||||
#include <climits>
|
||||
|
||||
namespace boost { namespace mpl
|
||||
{
|
||||
#define BOOST_MPL_STRING_MAX_PARAMS \
|
||||
BOOST_PP_DIV(BOOST_PP_ADD(BOOST_MPL_LIMIT_STRING_SIZE, 3), 4)
|
||||
|
||||
// Low-level bit-twiddling is done by macros. Any implementation-defined behavior of
|
||||
// multi-character literals should be localized to these macros.
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_LENGTH(c) \
|
||||
(std::size_t)((c<CHAR_MIN) ? 4 : ((c>0xffffff)+(c>0xffff)+(c>0xff)+1))
|
||||
|
||||
#if defined(BOOST_LITTLE_ENDIAN) && defined(__SUNPRO_CC)
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_AT(c,i) \
|
||||
(char)(0xff&((unsigned)(c)>>(8*(std::size_t)(i))))
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \
|
||||
((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c))
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \
|
||||
(((unsigned)(c)<<8)|(unsigned char)(i))
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_POP_BACK(c) \
|
||||
(((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c))
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_POP_FRONT(c) \
|
||||
((unsigned)(c)>>8)
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_AT(c,i) \
|
||||
(char)(0xff&((unsigned)(c)>>(8*(BOOST_MPL_MULTICHAR_LENGTH(c)-(std::size_t)(i)-1))))
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \
|
||||
(((unsigned)(c)<<8)|(unsigned char)(i))
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \
|
||||
((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c))
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_POP_BACK(c) \
|
||||
((unsigned)(c)>>8)
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_POP_FRONT(c) \
|
||||
(((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c))
|
||||
|
||||
#endif
|
||||
|
||||
struct string_tag;
|
||||
struct string_iterator_tag;
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_MPL_STRING_MAX_PARAMS, int C, 0)>
|
||||
struct string;
|
||||
|
||||
template<typename Sequence, int I, int J>
|
||||
struct string_iterator;
|
||||
|
||||
template<typename Sequence>
|
||||
struct sequence_tag;
|
||||
|
||||
template<typename Tag>
|
||||
struct size_impl;
|
||||
|
||||
template<>
|
||||
struct size_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply;
|
||||
|
||||
#define M0(z, n, data) \
|
||||
+ BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C,n))
|
||||
|
||||
#define M1(z, n, data) \
|
||||
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \
|
||||
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \
|
||||
: mpl::size_t<(0 BOOST_PP_REPEAT_ ## z(n, M0, ~))> \
|
||||
{};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M1, ~)
|
||||
#undef M0
|
||||
#undef M1
|
||||
};
|
||||
|
||||
template<>
|
||||
struct size_impl<mpl::string_tag>::apply<mpl::string<> >
|
||||
: mpl::size_t<0>
|
||||
{};
|
||||
|
||||
template<typename Tag>
|
||||
struct begin_impl;
|
||||
|
||||
template<>
|
||||
struct begin_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef mpl::string_iterator<Sequence, 0, 0> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template<>
|
||||
struct end_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply;
|
||||
|
||||
#define M0(z,n,data) \
|
||||
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \
|
||||
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \
|
||||
{ \
|
||||
typedef mpl::string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, n, 0> type; \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~)
|
||||
#undef M0
|
||||
};
|
||||
|
||||
template<>
|
||||
struct end_impl<mpl::string_tag>::apply<mpl::string<> >
|
||||
{
|
||||
typedef mpl::string_iterator<mpl::string<>, 0, 0> type;
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
struct push_back_impl;
|
||||
|
||||
template<>
|
||||
struct push_back_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence, typename Value, bool B = (4==BOOST_MPL_MULTICHAR_LENGTH(Sequence::back_))>
|
||||
struct apply
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value)
|
||||
, PUSH_BACK_FAILED_MPL_STRING_IS_FULL
|
||||
, (Sequence)
|
||||
);
|
||||
// If the above assertion didn't fire, then the string is sparse.
|
||||
// Repack the string and retry the push_back
|
||||
typedef
|
||||
typename mpl::push_back<
|
||||
typename mpl::copy<
|
||||
Sequence
|
||||
, mpl::back_inserter<mpl::string<> >
|
||||
>::type
|
||||
, Value
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template<typename Value>
|
||||
struct apply<mpl::string<>, Value, false>
|
||||
{
|
||||
typedef mpl::string<(char)Value::value> type;
|
||||
};
|
||||
|
||||
#define M0(z,n,data) \
|
||||
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C), typename Value> \
|
||||
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, Value, false> \
|
||||
{ \
|
||||
typedef \
|
||||
mpl::string< \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \
|
||||
BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
|
||||
((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \
|
||||
?BOOST_PP_CAT(C,BOOST_PP_DEC(n)) \
|
||||
:BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n)), Value::value) \
|
||||
, ((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \
|
||||
?(char)Value::value \
|
||||
:0 \
|
||||
> \
|
||||
type; \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~)
|
||||
#undef M0
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), typename Value>
|
||||
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, Value, false>
|
||||
{
|
||||
typedef
|
||||
mpl::string<
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS), C)
|
||||
, BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS)), Value::value)
|
||||
>
|
||||
type;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
struct pop_back_impl;
|
||||
|
||||
template<>
|
||||
struct pop_back_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply;
|
||||
|
||||
#define M0(z,n,data) \
|
||||
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \
|
||||
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \
|
||||
{ \
|
||||
BOOST_MPL_ASSERT_MSG((C0 != 0), POP_BACK_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \
|
||||
typedef \
|
||||
mpl::string< \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \
|
||||
BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
|
||||
BOOST_MPL_MULTICHAR_POP_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n))) \
|
||||
> \
|
||||
type; \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~)
|
||||
#undef M0
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
struct push_front_impl;
|
||||
|
||||
template<>
|
||||
struct push_front_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence, typename Value, bool B = (4==BOOST_MPL_MULTICHAR_LENGTH(Sequence::front_))>
|
||||
struct apply
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
(BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value)
|
||||
, PUSH_FRONT_FAILED_MPL_STRING_IS_FULL
|
||||
, (Sequence)
|
||||
);
|
||||
// If the above assertion didn't fire, then the string is sparse.
|
||||
// Repack the string and retry the push_front.
|
||||
typedef
|
||||
typename mpl::push_front<
|
||||
typename mpl::reverse_copy<
|
||||
Sequence
|
||||
, mpl::front_inserter<string<> >
|
||||
>::type
|
||||
, Value
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
|
||||
template<typename Value>
|
||||
struct apply<mpl::string<>, Value, false>
|
||||
{
|
||||
typedef mpl::string<(char)Value::value> type;
|
||||
};
|
||||
#endif
|
||||
|
||||
#define M0(z,n,data) \
|
||||
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C), typename Value> \
|
||||
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, Value, true> \
|
||||
{ \
|
||||
typedef \
|
||||
mpl::string< \
|
||||
(char)Value::value \
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, C) \
|
||||
> \
|
||||
type; \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~)
|
||||
#undef M0
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), typename Value>
|
||||
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, Value, false>
|
||||
{
|
||||
typedef
|
||||
mpl::string<
|
||||
BOOST_MPL_MULTICHAR_PUSH_FRONT(C0, Value::value)
|
||||
, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)
|
||||
>
|
||||
type0;
|
||||
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
|
||||
typedef
|
||||
typename mpl::if_<
|
||||
mpl::empty<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> >
|
||||
, mpl::string<(char)Value::value>
|
||||
, type0
|
||||
>::type
|
||||
type;
|
||||
#else
|
||||
typedef type0 type;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
struct pop_front_impl;
|
||||
|
||||
template<>
|
||||
struct pop_front_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence, bool B = (1==BOOST_MPL_MULTICHAR_LENGTH(Sequence::front_))>
|
||||
struct apply;
|
||||
|
||||
#define M0(z,n,data) \
|
||||
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \
|
||||
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, true> \
|
||||
{ \
|
||||
BOOST_MPL_ASSERT_MSG((C0 != 0), POP_FRONT_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \
|
||||
typedef \
|
||||
mpl::string<BOOST_PP_ENUM_SHIFTED_PARAMS_Z(z, n, C)> \
|
||||
type; \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~)
|
||||
#undef M0
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)>
|
||||
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, false>
|
||||
{
|
||||
typedef
|
||||
mpl::string<
|
||||
BOOST_MPL_MULTICHAR_POP_FRONT(C0)
|
||||
, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)
|
||||
>
|
||||
type;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
struct insert_range_impl;
|
||||
|
||||
template<>
|
||||
struct insert_range_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence, typename Pos, typename Range>
|
||||
struct apply
|
||||
: mpl::copy<
|
||||
mpl::joint_view<
|
||||
mpl::iterator_range<
|
||||
mpl::string_iterator<Sequence, 0, 0>
|
||||
, Pos
|
||||
>
|
||||
, mpl::joint_view<
|
||||
Range
|
||||
, mpl::iterator_range<
|
||||
Pos
|
||||
, typename mpl::end<Sequence>::type
|
||||
>
|
||||
>
|
||||
>
|
||||
, mpl::back_inserter<mpl::string<> >
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
struct insert_impl;
|
||||
|
||||
template<>
|
||||
struct insert_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence, typename Pos, typename Value>
|
||||
struct apply
|
||||
: mpl::insert_range<Sequence, Pos, mpl::string<(char)Value::value> >
|
||||
{};
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
struct erase_impl;
|
||||
|
||||
template<>
|
||||
struct erase_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename Sequence, typename First, typename Last>
|
||||
struct apply
|
||||
: mpl::copy<
|
||||
mpl::joint_view<
|
||||
mpl::iterator_range<
|
||||
mpl::string_iterator<Sequence, 0, 0>
|
||||
, First
|
||||
>
|
||||
, mpl::iterator_range<
|
||||
typename mpl::if_na<Last, typename mpl::next<First>::type>::type
|
||||
, typename mpl::end<Sequence>::type
|
||||
>
|
||||
>
|
||||
, mpl::back_inserter<mpl::string<> >
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
struct clear_impl;
|
||||
|
||||
template<>
|
||||
struct clear_impl<mpl::string_tag>
|
||||
{
|
||||
template<typename>
|
||||
struct apply
|
||||
{
|
||||
typedef mpl::string<> type;
|
||||
};
|
||||
};
|
||||
|
||||
#define M0(z, n, data) \
|
||||
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), int J> \
|
||||
struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, J> \
|
||||
{ \
|
||||
enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == J + 1) }; \
|
||||
typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \
|
||||
typedef std::bidirectional_iterator_tag category; \
|
||||
typedef \
|
||||
mpl::string_iterator<string, n + eomc_, eomc_ ? 0 : J + 1> \
|
||||
next; \
|
||||
typedef \
|
||||
mpl::string_iterator<string, n, J - 1> \
|
||||
prior; \
|
||||
typedef mpl::char_<BOOST_MPL_MULTICHAR_AT(BOOST_PP_CAT(C, n), J)> type; \
|
||||
}; \
|
||||
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)> \
|
||||
struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, 0> \
|
||||
{ \
|
||||
enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == 1) }; \
|
||||
typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \
|
||||
typedef std::bidirectional_iterator_tag category; \
|
||||
typedef \
|
||||
mpl::string_iterator<string, n + eomc_, !eomc_> \
|
||||
next; \
|
||||
typedef \
|
||||
mpl::string_iterator< \
|
||||
string \
|
||||
, n - 1 \
|
||||
, BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, BOOST_PP_DEC(n))) - 1 \
|
||||
> \
|
||||
prior; \
|
||||
typedef mpl::char_<BOOST_MPL_MULTICHAR_AT(BOOST_PP_CAT(C, n), 0)> type; \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT(BOOST_MPL_STRING_MAX_PARAMS, M0, ~)
|
||||
#undef M0
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)>
|
||||
struct string
|
||||
{
|
||||
/// INTERNAL ONLY
|
||||
enum
|
||||
{
|
||||
front_ = C0
|
||||
, back_ = BOOST_PP_CAT(C, BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS))
|
||||
};
|
||||
|
||||
typedef char value_type;
|
||||
typedef string type;
|
||||
typedef string_tag tag;
|
||||
};
|
||||
|
||||
namespace aux_
|
||||
{
|
||||
template<typename It, typename End>
|
||||
struct next_unless
|
||||
: mpl::next<It>
|
||||
{};
|
||||
|
||||
template<typename End>
|
||||
struct next_unless<End, End>
|
||||
{
|
||||
typedef End type;
|
||||
};
|
||||
|
||||
template<typename It, typename End>
|
||||
struct deref_unless
|
||||
: mpl::deref<It>
|
||||
{};
|
||||
|
||||
template<typename End>
|
||||
struct deref_unless<End, End>
|
||||
{
|
||||
typedef mpl::char_<'\0'> type;
|
||||
};
|
||||
}
|
||||
|
||||
template<typename Sequence>
|
||||
struct c_str
|
||||
{
|
||||
typedef typename mpl::end<Sequence>::type iend;
|
||||
typedef typename mpl::begin<Sequence>::type i0;
|
||||
#define M0(z, n, data) \
|
||||
typedef \
|
||||
typename mpl::aux_::next_unless<BOOST_PP_CAT(i, n), iend>::type \
|
||||
BOOST_PP_CAT(i, BOOST_PP_INC(n));
|
||||
BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~)
|
||||
#undef M0
|
||||
|
||||
typedef c_str type;
|
||||
static typename Sequence::value_type const value[BOOST_MPL_LIMIT_STRING_SIZE+1];
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
typename Sequence::value_type const c_str<Sequence>::value[BOOST_MPL_LIMIT_STRING_SIZE+1] =
|
||||
{
|
||||
#define M0(z, n, data) \
|
||||
mpl::aux_::deref_unless<BOOST_PP_CAT(i, n), iend>::type::value,
|
||||
BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~)
|
||||
#undef M0
|
||||
'\0'
|
||||
};
|
||||
|
||||
}} // namespace boost
|
||||
|
||||
#endif // BOOST_MPL_STRING_HPP_INCLUDED
|
@ -8,6 +8,9 @@
|
||||
// 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
|
||||
@ -124,34 +127,34 @@ namespace boost
|
||||
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".
|
||||
@ -356,7 +359,7 @@ struct equivalent2 : 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);
|
||||
}
|
||||
};
|
||||
|
||||
@ -365,7 +368,7 @@ struct equivalent1 : B
|
||||
{
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
@ -373,17 +376,17 @@ template <class T, class U, class B = ::boost::detail::empty_base<T> >
|
||||
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> >
|
||||
@ -392,9 +395,9 @@ struct partially_ordered1 : B
|
||||
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) ----------------//
|
||||
@ -580,7 +583,35 @@ struct ordered_euclidian_ring_operators1
|
||||
: 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
|
||||
@ -837,6 +868,8 @@ BOOST_OPERATOR_TEMPLATE(field_operators)
|
||||
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)
|
||||
|
@ -1,568 +1,19 @@
|
||||
// (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;
|
||||
};
|
||||
#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
|
||||
#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);
|
||||
}
|
||||
#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>
|
||||
|
@ -1,113 +1,19 @@
|
||||
// (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>
|
||||
|
@ -173,6 +173,12 @@ class unwrap_reference
|
||||
|
||||
# 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();
|
||||
|
@ -844,6 +844,42 @@ struct BoostRegexConcept
|
||||
m_string = m_char + m_sub;
|
||||
ignore_unused_variable_warning(m_string);
|
||||
|
||||
// Named sub-expressions:
|
||||
m_sub = m_cresults[&m_char];
|
||||
ignore_unused_variable_warning(m_sub);
|
||||
m_sub = m_cresults[m_string];
|
||||
ignore_unused_variable_warning(m_sub);
|
||||
m_sub = m_cresults[""];
|
||||
ignore_unused_variable_warning(m_sub);
|
||||
m_sub = m_cresults[std::string("")];
|
||||
ignore_unused_variable_warning(m_sub);
|
||||
m_string = m_cresults.str(&m_char);
|
||||
ignore_unused_variable_warning(m_string);
|
||||
m_string = m_cresults.str(m_string);
|
||||
ignore_unused_variable_warning(m_string);
|
||||
m_string = m_cresults.str("");
|
||||
ignore_unused_variable_warning(m_string);
|
||||
m_string = m_cresults.str(std::string(""));
|
||||
ignore_unused_variable_warning(m_string);
|
||||
|
||||
typename match_results_type::difference_type diff;
|
||||
diff = m_cresults.length(&m_char);
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.length(m_string);
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.length("");
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.length(std::string(""));
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.position(&m_char);
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.position(m_string);
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.position("");
|
||||
ignore_unused_variable_warning(diff);
|
||||
diff = m_cresults.position(std::string(""));
|
||||
ignore_unused_variable_warning(diff);
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
m_stream << m_sub;
|
||||
m_stream << m_cresults;
|
||||
|
@ -164,7 +164,7 @@
|
||||
# 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
|
||||
|
@ -184,7 +184,9 @@ private:
|
||||
offset_underscore = U_CHAR_CATEGORY_COUNT+3,
|
||||
offset_unicode = U_CHAR_CATEGORY_COUNT+4,
|
||||
offset_any = U_CHAR_CATEGORY_COUNT+5,
|
||||
offset_ascii = U_CHAR_CATEGORY_COUNT+6
|
||||
offset_ascii = U_CHAR_CATEGORY_COUNT+6,
|
||||
offset_horizontal = U_CHAR_CATEGORY_COUNT+7,
|
||||
offset_vertical = U_CHAR_CATEGORY_COUNT+8
|
||||
};
|
||||
|
||||
//
|
||||
@ -197,6 +199,8 @@ private:
|
||||
static const char_class_type mask_unicode;
|
||||
static const char_class_type mask_any;
|
||||
static const char_class_type mask_ascii;
|
||||
static const char_class_type mask_horizontal;
|
||||
static const char_class_type mask_vertical;
|
||||
|
||||
static char_class_type lookup_icu_mask(const ::UChar32* p1, const ::UChar32* p2);
|
||||
|
||||
@ -311,12 +315,12 @@ inline u32regex do_make_u32regex(InputIterator i,
|
||||
boost::regex_constants::syntax_option_type opt,
|
||||
const boost::mpl::int_<4>*)
|
||||
{
|
||||
typedef std::vector<UCHAR32> vector_type;
|
||||
typedef std::vector<UChar32> vector_type;
|
||||
vector_type v;
|
||||
while(i != j)
|
||||
{
|
||||
v.push_back((UCHAR32)(*i));
|
||||
++a;
|
||||
v.push_back((UChar32)(*i));
|
||||
++i;
|
||||
}
|
||||
if(v.size())
|
||||
return u32regex(&*v.begin(), v.size(), opt);
|
||||
|
@ -19,6 +19,9 @@
|
||||
#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)
|
||||
@ -44,12 +47,160 @@ namespace re_detail{
|
||||
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;
|
||||
@ -77,6 +228,7 @@ struct regex_data
|
||||
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
|
||||
@ -520,6 +672,10 @@ public:
|
||||
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;
|
||||
|
@ -240,6 +240,7 @@ protected:
|
||||
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
|
||||
@ -250,6 +251,7 @@ private:
|
||||
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);
|
||||
@ -263,7 +265,7 @@ private:
|
||||
|
||||
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;
|
||||
@ -692,6 +694,13 @@ void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT*
|
||||
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:
|
||||
@ -713,6 +722,13 @@ void basic_regex_creator<charT, traits>::fixup_pointers(re_syntax_base* state)
|
||||
{
|
||||
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:
|
||||
@ -738,6 +754,93 @@ void basic_regex_creator<charT, traits>::fixup_pointers(re_syntax_base* state)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -953,6 +1056,7 @@ void basic_regex_creator<charT, traits>::create_startmap(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)
|
||||
|
@ -78,6 +78,8 @@ private:
|
||||
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
|
||||
@ -96,7 +98,7 @@ private:
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
@ -123,8 +125,16 @@ void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2,
|
||||
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;
|
||||
@ -375,11 +385,17 @@ bool basic_regex_parser<charT, traits>::parse_open_paren()
|
||||
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;
|
||||
@ -392,6 +408,11 @@ bool basic_regex_parser<charT, traits>::parse_open_paren()
|
||||
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 ')' :
|
||||
//
|
||||
@ -416,6 +437,10 @@ bool basic_regex_parser<charT, traits>::parse_open_paren()
|
||||
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)
|
||||
@ -424,14 +449,20 @@ bool basic_regex_parser<charT, traits>::parse_open_paren()
|
||||
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:
|
||||
@ -600,6 +631,7 @@ bool basic_regex_parser<charT, traits>::parse_extended_escape()
|
||||
// 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)
|
||||
@ -709,7 +741,104 @@ bool basic_regex_parser<charT, traits>::parse_extended_escape()
|
||||
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;
|
||||
@ -737,6 +866,7 @@ template <class charT, class traits>
|
||||
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:
|
||||
@ -748,12 +878,19 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
|
||||
)
|
||||
)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
@ -822,6 +959,22 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -944,6 +1097,14 @@ bool basic_regex_parser<charT, traits>::parse_alt()
|
||||
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:
|
||||
@ -1462,7 +1623,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
|
||||
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);
|
||||
@ -1568,6 +1729,7 @@ bool basic_regex_parser<charT, traits>::parse_backref()
|
||||
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
|
||||
{
|
||||
@ -1655,6 +1817,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
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;
|
||||
@ -1665,11 +1828,18 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
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:
|
||||
@ -1677,6 +1847,57 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
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;
|
||||
@ -1706,8 +1927,10 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
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)));
|
||||
@ -1736,7 +1959,95 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
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;
|
||||
@ -1784,7 +2095,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
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;
|
||||
@ -1795,10 +2106,93 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
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;
|
||||
@ -1897,9 +2291,20 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
}
|
||||
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);
|
||||
@ -1915,6 +2320,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
//
|
||||
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:
|
||||
@ -1924,6 +2330,31 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,9 @@ enum
|
||||
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
|
||||
@ -413,6 +415,8 @@ public:
|
||||
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;
|
||||
@ -477,6 +481,10 @@ template <class charT>
|
||||
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
|
||||
@ -688,18 +696,20 @@ void cpp_regex_traits_implementation<charT>::init()
|
||||
// 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,
|
||||
@ -713,11 +723,13 @@ void cpp_regex_traits_implementation<charT>::init()
|
||||
::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,
|
||||
@ -744,7 +756,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
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,
|
||||
@ -754,6 +766,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
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,
|
||||
@ -763,12 +776,13 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
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,
|
||||
@ -778,6 +792,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
::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,
|
||||
@ -787,6 +802,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
::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,
|
||||
@ -820,7 +836,9 @@ bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_t
|
||||
|| ((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
|
||||
|
||||
@ -930,6 +948,12 @@ public:
|
||||
&& 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);
|
||||
|
@ -31,10 +31,14 @@ namespace detail{
|
||||
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>
|
||||
|
@ -36,6 +36,13 @@ namespace boost{
|
||||
#pragma warning(disable : 4251 4231 4660)
|
||||
#endif
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
template <class charT>
|
||||
class named_subexpressions;
|
||||
|
||||
}
|
||||
|
||||
template <class BidiIterator, class Allocator>
|
||||
class match_results
|
||||
{
|
||||
@ -62,13 +69,14 @@ public:
|
||||
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) {}
|
||||
@ -95,6 +103,24 @@ public:
|
||||
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;
|
||||
@ -108,6 +134,24 @@ public:
|
||||
}
|
||||
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;
|
||||
@ -122,6 +166,25 @@ public:
|
||||
}
|
||||
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;
|
||||
@ -131,6 +194,75 @@ public:
|
||||
}
|
||||
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
|
||||
{
|
||||
@ -186,6 +318,10 @@ public:
|
||||
::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
|
||||
{
|
||||
@ -230,13 +366,15 @@ public:
|
||||
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);
|
||||
@ -261,6 +399,7 @@ public:
|
||||
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)
|
||||
{
|
||||
@ -284,21 +423,34 @@ public:
|
||||
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>
|
||||
|
@ -285,7 +285,8 @@ public:
|
||||
}
|
||||
~repeater_count()
|
||||
{
|
||||
*stack = next;
|
||||
if(next)
|
||||
*stack = next;
|
||||
}
|
||||
std::size_t get_count() { return count; }
|
||||
int get_id() { return state_id; }
|
||||
@ -325,6 +326,17 @@ enum saved_state_type
|
||||
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)
|
||||
@ -340,6 +352,7 @@ public:
|
||||
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,
|
||||
@ -348,7 +361,7 @@ public:
|
||||
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);
|
||||
}
|
||||
@ -403,12 +416,17 @@ private:
|
||||
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();
|
||||
@ -464,6 +482,9 @@ private:
|
||||
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
|
||||
//
|
||||
@ -487,6 +508,8 @@ private:
|
||||
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();
|
||||
@ -495,7 +518,8 @@ private:
|
||||
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;
|
||||
|
@ -200,12 +200,13 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_imp()
|
||||
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)
|
||||
}
|
||||
@ -261,6 +262,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::find_imp()
|
||||
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
|
||||
@ -343,25 +345,6 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_prefix()
|
||||
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()
|
||||
{
|
||||
@ -462,35 +445,6 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_wild()
|
||||
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()
|
||||
{
|
||||
@ -758,8 +712,32 @@ template <class BidiIterator, class Allocator, class traits>
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -127,10 +127,21 @@ struct saved_single_repeat : public saved_state
|
||||
: 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,
|
||||
@ -154,13 +165,18 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
|
||||
&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();
|
||||
@ -209,7 +225,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::extend_stack()
|
||||
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)
|
||||
@ -312,10 +328,26 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_single_repeat(st
|
||||
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:
|
||||
@ -400,6 +432,13 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
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);
|
||||
@ -848,6 +887,100 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
|
||||
#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
|
||||
@ -858,7 +991,7 @@ unwinding does in the recursive implementation.
|
||||
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,
|
||||
@ -874,6 +1007,8 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind(bool have_match)
|
||||
&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;
|
||||
@ -907,8 +1042,8 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_paren(bool 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
|
||||
//
|
||||
@ -1377,6 +1512,106 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_non_greedy_repeat(boo
|
||||
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
|
||||
|
||||
|
@ -51,8 +51,8 @@ public:
|
||||
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; }
|
||||
};
|
||||
@ -60,7 +60,7 @@ public:
|
||||
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,
|
||||
@ -84,13 +84,18 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
|
||||
&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)
|
||||
@ -113,6 +118,7 @@ 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;
|
||||
bool r = true;
|
||||
switch(index)
|
||||
{
|
||||
@ -205,6 +211,17 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
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);
|
||||
@ -833,6 +850,127 @@ bool perl_matcher<BidiIterator, Allocator, traits>::backtrack_till_match(std::si
|
||||
#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
|
||||
|
@ -107,6 +107,7 @@ private:
|
||||
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.
|
||||
@ -250,6 +251,25 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
|
||||
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;
|
||||
@ -258,14 +278,18 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
|
||||
// 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:
|
||||
@ -276,6 +300,123 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
@ -440,9 +581,35 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional(
|
||||
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:
|
||||
|
@ -159,7 +159,7 @@ struct character_pointer_range
|
||||
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',
|
||||
@ -172,11 +172,12 @@ int get_default_class_id(const charT* p1, const charT* p2)
|
||||
'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
|
||||
@ -185,6 +186,7 @@ int get_default_class_id(const charT* p1, const charT* p2)
|
||||
{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
|
||||
@ -194,9 +196,10 @@ int get_default_class_id(const charT* p1, const charT* p2)
|
||||
{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]));
|
||||
@ -314,6 +317,43 @@ int global_toi(const charT*& p1, const charT* p2, int radix, const traits& t)
|
||||
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
|
||||
|
||||
|
@ -124,7 +124,7 @@ inline void pointer_construct(T* p, const T& t)
|
||||
|
||||
#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
|
||||
|
@ -118,7 +118,9 @@ enum syntax_element_type
|
||||
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
|
||||
@ -156,6 +158,7 @@ struct re_brace : public re_syntax_base
|
||||
// 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 **************************************************
|
||||
|
@ -92,8 +92,11 @@ static const escape_syntax_type escape_type_G = 52; /
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -294,6 +294,8 @@ public:
|
||||
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;
|
||||
@ -510,7 +512,7 @@ template <class charT>
|
||||
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
|
||||
@ -520,6 +522,7 @@ typename w32_regex_traits_implementation<charT>::char_class_type
|
||||
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
|
||||
@ -529,6 +532,7 @@ typename w32_regex_traits_implementation<charT>::char_class_type
|
||||
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
|
||||
@ -628,6 +632,12 @@ public:
|
||||
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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user