mirror of
https://github.com/boostorg/detail.git
synced 2025-06-28 21:41:07 +02:00
Compare commits
47 Commits
svn-branch
...
boost-1.46
Author | SHA1 | Date | |
---|---|---|---|
0c2e8568b5 | |||
94dcc475a1 | |||
bb233de354 | |||
455d56887e | |||
17d5ed080b | |||
7ce0af2bba | |||
e4ac9a7c8e | |||
d8dc59f6cb | |||
c5eac8e96c | |||
134c915cbf | |||
3c935aaf8f | |||
726c4a7182 | |||
1ede593bc2 | |||
debb7ae2de | |||
4a28e5d5a1 | |||
fc561bdc77 | |||
2438dc56f1 | |||
fbc029e131 | |||
ca7ccbfa77 | |||
65a58553fb | |||
0d006f2718 | |||
1df6d3e0e2 | |||
9d2dd3f219 | |||
c0fb2515b0 | |||
f8ffc48c7e | |||
20c35502cb | |||
4ae97fa5cb | |||
b328080dbb | |||
a6af6ca66f | |||
df8aaff6da | |||
680e819cf3 | |||
22520394e4 | |||
9469ab6c88 | |||
8da5b03c03 | |||
49858c1ac4 | |||
ec6dfefa6e | |||
1df1d181c0 | |||
dc34adabef | |||
8aebcc4fbd | |||
2551c9baf0 | |||
71ec49242e | |||
0dc54e7b18 | |||
4039b44fce | |||
2f7218cdc4 | |||
37cd3c6dd2 | |||
71a268689d | |||
4dda81e93a |
@ -15,9 +15,11 @@
|
|||||||
|
|
||||||
#include "boost/blank_fwd.hpp"
|
#include "boost/blank_fwd.hpp"
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_IOSTREAM)
|
||||||
#include <iosfwd> // for std::basic_ostream forward declare
|
#include <iosfwd> // for std::basic_ostream forward declare
|
||||||
|
|
||||||
#include "boost/detail/templated_streams.hpp"
|
#include "boost/detail/templated_streams.hpp"
|
||||||
|
#endif // BOOST_NO_IOSTREAM
|
||||||
|
|
||||||
#include "boost/mpl/bool.hpp"
|
#include "boost/mpl/bool.hpp"
|
||||||
#include "boost/type_traits/is_empty.hpp"
|
#include "boost/type_traits/is_empty.hpp"
|
||||||
#include "boost/type_traits/is_pod.hpp"
|
#include "boost/type_traits/is_pod.hpp"
|
||||||
@ -85,6 +87,8 @@ inline bool operator>(const blank&, const blank&)
|
|||||||
|
|
||||||
// streaming support
|
// streaming support
|
||||||
//
|
//
|
||||||
|
#if !defined(BOOST_NO_IOSTREAM)
|
||||||
|
|
||||||
BOOST_TEMPLATED_STREAM_TEMPLATE(E,T)
|
BOOST_TEMPLATED_STREAM_TEMPLATE(E,T)
|
||||||
inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
|
inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
|
||||||
BOOST_TEMPLATED_STREAM(ostream, E,T)& out
|
BOOST_TEMPLATED_STREAM(ostream, E,T)& out
|
||||||
@ -95,6 +99,8 @@ inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // BOOST_NO_IOSTREAM
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_BLANK_HPP
|
#endif // BOOST_BLANK_HPP
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2003-2005 Joaqu<EFBFBD>n M L<EFBFBD>pez Mu<EFBFBD>oz.
|
/* Copyright 2003-2009 Joaquin M Lopez Munoz.
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
* http://www.boost.org/LICENSE_1_0.txt)
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
@ -30,13 +30,21 @@ namespace detail{
|
|||||||
namespace allocator{
|
namespace allocator{
|
||||||
|
|
||||||
/* partial_std_allocator_wrapper inherits the functionality of a std
|
/* partial_std_allocator_wrapper inherits the functionality of a std
|
||||||
* allocator while providing a templatized ctor.
|
* allocator while providing a templatized ctor and other bits missing
|
||||||
|
* in some stdlib implementation or another.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
class partial_std_allocator_wrapper:public std::allocator<Type>
|
class partial_std_allocator_wrapper:public std::allocator<Type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/* Oddly enough, STLport does not define std::allocator<void>::value_type
|
||||||
|
* when configured to work without partial template specialization.
|
||||||
|
* No harm in supplying the definition here unconditionally.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef Type value_type;
|
||||||
|
|
||||||
partial_std_allocator_wrapper(){};
|
partial_std_allocator_wrapper(){};
|
||||||
|
|
||||||
template<typename Other>
|
template<typename Other>
|
||||||
@ -170,12 +178,31 @@ void construct(void* p,const Type& t)
|
|||||||
new (p) 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>
|
template<typename Type>
|
||||||
void destroy(const Type* p)
|
void destroy(const Type* p)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590))
|
||||||
|
const_cast<Type*>(p)->~Type();
|
||||||
|
#else
|
||||||
p->~Type();
|
p->~Type();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
} /* namespace boost::detail::allocator */
|
} /* namespace boost::detail::allocator */
|
||||||
|
|
||||||
} /* namespace boost::detail */
|
} /* namespace boost::detail */
|
||||||
|
47
include/boost/detail/bitmask.hpp
Normal file
47
include/boost/detail/bitmask.hpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// boost/detail/bitmask.hpp ------------------------------------------------//
|
||||||
|
|
||||||
|
// Copyright Beman Dawes 2006
|
||||||
|
|
||||||
|
// Distributed under the Boost Software License, Version 1.0
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
// Usage: enum foo { a=1, b=2, c=4 };
|
||||||
|
// BOOST_BITMASK( foo );
|
||||||
|
//
|
||||||
|
// void f( foo arg );
|
||||||
|
// ...
|
||||||
|
// f( a | c );
|
||||||
|
|
||||||
|
#ifndef BOOST_BITMASK_HPP
|
||||||
|
#define BOOST_BITMASK_HPP
|
||||||
|
|
||||||
|
#include <boost/cstdint.hpp>
|
||||||
|
|
||||||
|
#define BOOST_BITMASK(Bitmask) \
|
||||||
|
\
|
||||||
|
inline Bitmask operator| (Bitmask x , Bitmask y ) \
|
||||||
|
{ return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \
|
||||||
|
| static_cast<boost::int_least32_t>(y)); } \
|
||||||
|
\
|
||||||
|
inline Bitmask operator& (Bitmask x , Bitmask y ) \
|
||||||
|
{ return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \
|
||||||
|
& static_cast<boost::int_least32_t>(y)); } \
|
||||||
|
\
|
||||||
|
inline Bitmask operator^ (Bitmask x , Bitmask y ) \
|
||||||
|
{ return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \
|
||||||
|
^ static_cast<boost::int_least32_t>(y)); } \
|
||||||
|
\
|
||||||
|
inline Bitmask operator~ (Bitmask x ) \
|
||||||
|
{ return static_cast<Bitmask>(~static_cast<boost::int_least32_t>(x)); } \
|
||||||
|
\
|
||||||
|
inline Bitmask & operator&=(Bitmask & x , Bitmask y) \
|
||||||
|
{ x = x & y ; return x ; } \
|
||||||
|
\
|
||||||
|
inline Bitmask & operator|=(Bitmask & x , Bitmask y) \
|
||||||
|
{ x = x | y ; return x ; } \
|
||||||
|
\
|
||||||
|
inline Bitmask & operator^=(Bitmask & x , Bitmask y) \
|
||||||
|
{ x = x ^ y ; return x ; }
|
||||||
|
|
||||||
|
#endif // BOOST_BITMASK_HPP
|
||||||
|
|
105
include/boost/detail/container_fwd.hpp
Normal file
105
include/boost/detail/container_fwd.hpp
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
|
||||||
|
// 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)
|
||||||
|
|
||||||
|
#if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP)
|
||||||
|
#define BOOST_DETAIL_CONTAINER_FWD_HPP
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) \
|
||||||
|
|| ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) \
|
||||||
|
&& (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL))) \
|
||||||
|
|| BOOST_WORKAROUND(__BORLANDC__, > 0x551) \
|
||||||
|
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \
|
||||||
|
|| (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
#include <list>
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
#include <bitset>
|
||||||
|
#include <string>
|
||||||
|
#include <complex>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && \
|
||||||
|
defined(__STL_CONFIG_H)
|
||||||
|
|
||||||
|
#define BOOST_CONTAINER_FWD_BAD_BITSET
|
||||||
|
|
||||||
|
#if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG)
|
||||||
|
#define BOOST_CONTAINER_FWD_BAD_DEQUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
|
||||||
|
#include <deque>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BOOST_CONTAINER_FWD_BAD_BITSET)
|
||||||
|
#include <bitset>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4099) // struct/class mismatch in fwd declarations
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
template <class T> class allocator;
|
||||||
|
template <class charT, class traits, class Allocator> class basic_string;
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
#if BOOST_CLANG
|
||||||
|
template <class T> struct complex;
|
||||||
|
#else
|
||||||
|
template <class T> class complex;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// gcc 3.4 and greater
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
#if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
|
||||||
|
template <class T, class Allocator> class deque;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <class T, class Allocator> class list;
|
||||||
|
template <class T, class Allocator> class vector;
|
||||||
|
template <class Key, class T, class Compare, class Allocator> class map;
|
||||||
|
template <class Key, class T, class Compare, class Allocator>
|
||||||
|
class multimap;
|
||||||
|
template <class Key, class Compare, class Allocator> class set;
|
||||||
|
template <class Key, class Compare, class Allocator> class multiset;
|
||||||
|
|
||||||
|
#if !defined(BOOST_CONTAINER_FWD_BAD_BITSET)
|
||||||
|
template <size_t N> class bitset;
|
||||||
|
#endif
|
||||||
|
template <class T1, class T2> struct pair;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -1,3 +1,9 @@
|
|||||||
|
// Copyright 2005 Caleb Epstein
|
||||||
|
// Copyright 2006 John Maddock
|
||||||
|
// Copyright 2010 Rene Rivera
|
||||||
|
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||||
|
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997
|
* Copyright (c) 1997
|
||||||
* Silicon Graphics Computer Systems, Inc.
|
* Silicon Graphics Computer Systems, Inc.
|
||||||
@ -37,9 +43,19 @@
|
|||||||
# error Unknown machine endianness detected.
|
# error Unknown machine endianness detected.
|
||||||
# endif
|
# endif
|
||||||
# define BOOST_BYTE_ORDER __BYTE_ORDER
|
# define BOOST_BYTE_ORDER __BYTE_ORDER
|
||||||
|
#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) || \
|
||||||
|
defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) || \
|
||||||
|
defined(_STLP_BIG_ENDIAN) && !defined(_STLP_LITTLE_ENDIAN)
|
||||||
|
# define BOOST_BIG_ENDIAN
|
||||||
|
# define BOOST_BYTE_ORDER 4321
|
||||||
|
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) || \
|
||||||
|
defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) || \
|
||||||
|
defined(_STLP_LITTLE_ENDIAN) && !defined(_STLP_BIG_ENDIAN)
|
||||||
|
# define BOOST_LITTLE_ENDIAN
|
||||||
|
# define BOOST_BYTE_ORDER 1234
|
||||||
#elif defined(__sparc) || defined(__sparc__) \
|
#elif defined(__sparc) || defined(__sparc__) \
|
||||||
|| defined(_POWER) || defined(__powerpc__) \
|
|| defined(_POWER) || defined(__powerpc__) \
|
||||||
|| defined(__ppc__) || defined(__hppa) \
|
|| defined(__ppc__) || defined(__hpux) || defined(__hppa) \
|
||||||
|| defined(_MIPSEB) || defined(_POWER) \
|
|| defined(_MIPSEB) || defined(_POWER) \
|
||||||
|| defined(__s390__)
|
|| defined(__s390__)
|
||||||
# define BOOST_BIG_ENDIAN
|
# define BOOST_BIG_ENDIAN
|
||||||
@ -47,7 +63,11 @@
|
|||||||
#elif defined(__i386__) || defined(__alpha__) \
|
#elif defined(__i386__) || defined(__alpha__) \
|
||||||
|| defined(__ia64) || defined(__ia64__) \
|
|| defined(__ia64) || defined(__ia64__) \
|
||||||
|| defined(_M_IX86) || defined(_M_IA64) \
|
|| defined(_M_IX86) || defined(_M_IA64) \
|
||||||
|| defined(_M_ALPHA)
|
|| defined(_M_ALPHA) || defined(__amd64) \
|
||||||
|
|| defined(__amd64__) || defined(_M_AMD64) \
|
||||||
|
|| defined(__x86_64) || defined(__x86_64__) \
|
||||||
|
|| defined(_M_X64) || defined(__bfin__)
|
||||||
|
|
||||||
# define BOOST_LITTLE_ENDIAN
|
# define BOOST_LITTLE_ENDIAN
|
||||||
# define BOOST_BYTE_ORDER 1234
|
# define BOOST_BYTE_ORDER 1234
|
||||||
#else
|
#else
|
||||||
|
73
include/boost/detail/fenv.hpp
Normal file
73
include/boost/detail/fenv.hpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2010 Bryce Lelbach
|
||||||
|
|
||||||
|
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>
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_FENV_H)
|
||||||
|
#error This platform does not have a floating point environment
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BOOST_DETAIL_FENV_HPP)
|
||||||
|
#define BOOST_DETAIL_FENV_HPP
|
||||||
|
|
||||||
|
/* If we're using clang + glibc, we have to get hacky.
|
||||||
|
* See http://llvm.org/bugs/show_bug.cgi?id=6907 */
|
||||||
|
#if defined(__clang__) && \
|
||||||
|
defined(__GNU_LIBRARY__) && /* up to version 5 */ \
|
||||||
|
defined(__GLIBC__) /* version 6 + */
|
||||||
|
#define _FENV_H
|
||||||
|
|
||||||
|
#include <features.h>
|
||||||
|
#include <bits/fenv.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
extern int fegetexceptflag (fexcept_t*, int) __THROW;
|
||||||
|
extern int fesetexceptflag (__const fexcept_t*, int) __THROW;
|
||||||
|
extern int feclearexcept (int) __THROW;
|
||||||
|
extern int feraiseexcept (int) __THROW;
|
||||||
|
extern int fetestexcept (int) __THROW;
|
||||||
|
extern int fegetround (void) __THROW;
|
||||||
|
extern int fesetround (int) __THROW;
|
||||||
|
extern int fegetenv (fenv_t*) __THROW;
|
||||||
|
extern int fesetenv (__const fenv_t*) __THROW;
|
||||||
|
extern int feupdateenv (__const fenv_t*) __THROW;
|
||||||
|
extern int feholdexcept (fenv_t*) __THROW;
|
||||||
|
|
||||||
|
#ifdef __USE_GNU
|
||||||
|
extern int feenableexcept (int) __THROW;
|
||||||
|
extern int fedisableexcept (int) __THROW;
|
||||||
|
extern int fegetexcept (void) __THROW;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace std { namespace tr1 {
|
||||||
|
using ::fenv_t;
|
||||||
|
using ::fexcept_t;
|
||||||
|
using ::fegetexceptflag;
|
||||||
|
using ::fesetexceptflag;
|
||||||
|
using ::feclearexcept;
|
||||||
|
using ::feraiseexcept;
|
||||||
|
using ::fetestexcept;
|
||||||
|
using ::fegetround;
|
||||||
|
using ::fesetround;
|
||||||
|
using ::fegetenv;
|
||||||
|
using ::fesetenv;
|
||||||
|
using ::feupdateenv;
|
||||||
|
using ::feholdexcept;
|
||||||
|
} }
|
||||||
|
|
||||||
|
#else /* if we're not using GNU's C stdlib, fenv.h should work with clang */
|
||||||
|
#if defined(__SUNPRO_CC) /* lol suncc */
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <fenv.h>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* BOOST_DETAIL_FENV_HPP */
|
||||||
|
|
29
include/boost/detail/has_default_constructor.hpp
Normal file
29
include/boost/detail/has_default_constructor.hpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
// (C) Copyright Matthias Troyerk 2006.
|
||||||
|
// 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/libs/type_traits for most recent version including documentation.
|
||||||
|
|
||||||
|
#ifndef BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
|
||||||
|
#define BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include <boost/type_traits/has_trivial_constructor.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace detail {
|
||||||
|
|
||||||
|
/// type trait to check for a default constructor
|
||||||
|
///
|
||||||
|
/// The default implementation just checks for a trivial constructor.
|
||||||
|
/// Using some compiler magic it might be possible to provide a better default
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct has_default_constructor
|
||||||
|
: public has_trivial_constructor<T>
|
||||||
|
{};
|
||||||
|
|
||||||
|
} } // namespace boost::detail
|
||||||
|
|
||||||
|
|
||||||
|
#endif // BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
|
89
include/boost/detail/identifier.hpp
Normal file
89
include/boost/detail/identifier.hpp
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
// boost/identifier.hpp ----------------------------------------------------//
|
||||||
|
|
||||||
|
// Copyright Beman Dawes 2006
|
||||||
|
|
||||||
|
// 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 documentation at http://www.boost.org/libs/utility
|
||||||
|
|
||||||
|
#ifndef BOOST_IDENTIFIER_HPP
|
||||||
|
#define BOOST_IDENTIFIER_HPP
|
||||||
|
|
||||||
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
#include <boost/type_traits/is_base_of.hpp>
|
||||||
|
#include <iosfwd>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
// class template identifier ---------------------------------------------//
|
||||||
|
|
||||||
|
// Always used as a base class so that different instantiations result in
|
||||||
|
// different class types even if instantiated with the same value type T.
|
||||||
|
|
||||||
|
// Expected usage is that T is often an integer type, best passed by
|
||||||
|
// value. There is no reason why T can't be a possibly larger class such as
|
||||||
|
// std::string, best passed by const reference.
|
||||||
|
|
||||||
|
// This implementation uses pass by value, based on expected common uses.
|
||||||
|
|
||||||
|
template <typename T, typename D>
|
||||||
|
class identifier
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef T value_type;
|
||||||
|
|
||||||
|
const value_type value() const { return m_value; }
|
||||||
|
void assign( value_type v ) { m_value = v; }
|
||||||
|
|
||||||
|
bool operator==( const D & rhs ) const { return m_value == rhs.m_value; }
|
||||||
|
bool operator!=( const D & rhs ) const { return m_value != rhs.m_value; }
|
||||||
|
bool operator< ( const D & rhs ) const { return m_value < rhs.m_value; }
|
||||||
|
bool operator<=( const D & rhs ) const { return m_value <= rhs.m_value; }
|
||||||
|
bool operator> ( const D & rhs ) const { return m_value > rhs.m_value; }
|
||||||
|
bool operator>=( const D & rhs ) const { return m_value >= rhs.m_value; }
|
||||||
|
|
||||||
|
typedef void (*unspecified_bool_type)(D); // without the D, unspecified_bool_type
|
||||||
|
static void unspecified_bool_true(D){} // conversion allows relational operators
|
||||||
|
// between different identifier types
|
||||||
|
|
||||||
|
operator unspecified_bool_type() const { return m_value == value_type() ? 0 : unspecified_bool_true; }
|
||||||
|
bool operator!() const { return m_value == value_type(); }
|
||||||
|
|
||||||
|
// constructors are protected so that class can only be used as a base class
|
||||||
|
protected:
|
||||||
|
identifier() {}
|
||||||
|
explicit identifier( value_type v ) : m_value(v) {}
|
||||||
|
|
||||||
|
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 1300 == VC++ 7.0 bug workaround
|
||||||
|
private:
|
||||||
|
#endif
|
||||||
|
T m_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
//#ifndef BOOST_NO_SFINAE
|
||||||
|
|
||||||
|
// template <class Ostream, class Id>
|
||||||
|
// typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >,
|
||||||
|
// Ostream & >::type operator<<( Ostream & os, const Id & id )
|
||||||
|
// {
|
||||||
|
// return os << id.value();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// template <class Istream, class Id>
|
||||||
|
// typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >,
|
||||||
|
// Istream & >::type operator>>( Istream & is, Id & id )
|
||||||
|
// {
|
||||||
|
// typename Id::value_type v;
|
||||||
|
// is >> v;
|
||||||
|
// id.value( v );
|
||||||
|
// return is;
|
||||||
|
// }
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // BOOST_IDENTIFIER_HPP
|
16
include/boost/detail/indirect_traits.hpp
Executable file → Normal file
16
include/boost/detail/indirect_traits.hpp
Executable file → Normal file
@ -388,27 +388,27 @@ typename is_pointer_help<V>::type reference_to_pointer_helper(V&);
|
|||||||
outer_no_type reference_to_pointer_helper(...);
|
outer_no_type reference_to_pointer_helper(...);
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct is_reference_to_pointer
|
struct reference_to_pointer_impl
|
||||||
{
|
{
|
||||||
static T t;
|
static T t;
|
||||||
BOOST_STATIC_CONSTANT(
|
BOOST_STATIC_CONSTANT(
|
||||||
bool, value
|
bool, value
|
||||||
= (is_reference<T>::value
|
= (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type))
|
||||||
&& sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef mpl::bool_<value> type;
|
typedef mpl::bool_<value> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct is_reference_to_pointer
|
||||||
|
: mpl::eval_if<is_reference<T>, reference_to_pointer_impl<T>, mpl::false_>::type
|
||||||
|
{
|
||||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T))
|
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T))
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct is_reference_to_function_pointer
|
struct is_reference_to_function_pointer
|
||||||
: mpl::if_<
|
: mpl::eval_if<is_reference<T>, is_pointer_to_function_aux<T>, mpl::false_>::type
|
||||||
is_reference<T>
|
|
||||||
, is_pointer_to_function_aux<T>
|
|
||||||
, mpl::bool_<false>
|
|
||||||
>::type
|
|
||||||
{
|
{
|
||||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T))
|
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T))
|
||||||
};
|
};
|
||||||
|
@ -31,31 +31,71 @@
|
|||||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer
|
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer
|
||||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer
|
# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer
|
||||||
|
|
||||||
|
#elif defined(_WIN32_WCE)
|
||||||
|
|
||||||
|
// under Windows CE we still have old-style Interlocked* functions
|
||||||
|
|
||||||
|
extern "C" long __cdecl InterlockedIncrement( long* );
|
||||||
|
extern "C" long __cdecl InterlockedDecrement( long* );
|
||||||
|
extern "C" long __cdecl InterlockedCompareExchange( long*, long, long );
|
||||||
|
extern "C" long __cdecl InterlockedExchange( long*, long );
|
||||||
|
extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
|
||||||
|
|
||||||
|
# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
|
||||||
|
# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
|
||||||
|
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
|
||||||
|
# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
|
||||||
|
# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
|
||||||
|
|
||||||
|
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||||
|
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare)))
|
||||||
|
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||||
|
((void*)BOOST_INTERLOCKED_EXCHANGE((long*)(dest),(long)(exchange)))
|
||||||
|
|
||||||
#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
|
#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
|
||||||
|
|
||||||
|
#if defined( __CLRCALL_PURE_OR_CDECL )
|
||||||
|
|
||||||
|
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * );
|
||||||
|
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * );
|
||||||
|
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long );
|
||||||
|
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long );
|
||||||
|
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
extern "C" long __cdecl _InterlockedIncrement( long volatile * );
|
extern "C" long __cdecl _InterlockedIncrement( long volatile * );
|
||||||
extern "C" long __cdecl _InterlockedDecrement( long volatile * );
|
extern "C" long __cdecl _InterlockedDecrement( long volatile * );
|
||||||
extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
|
extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
|
||||||
extern "C" long __cdecl _InterlockedExchange( long volatile *, long);
|
extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
|
||||||
extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long);
|
extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
# pragma intrinsic( _InterlockedIncrement )
|
# pragma intrinsic( _InterlockedIncrement )
|
||||||
# pragma intrinsic( _InterlockedDecrement )
|
# pragma intrinsic( _InterlockedDecrement )
|
||||||
# pragma intrinsic( _InterlockedCompareExchange )
|
# pragma intrinsic( _InterlockedCompareExchange )
|
||||||
# pragma intrinsic( _InterlockedExchange )
|
# pragma intrinsic( _InterlockedExchange )
|
||||||
# pragma intrinsic( _InterlockedExchangeAdd )
|
# pragma intrinsic( _InterlockedExchangeAdd )
|
||||||
|
|
||||||
# if defined(_M_IA64) || defined(_M_AMD64)
|
# if defined(_M_IA64) || defined(_M_AMD64)
|
||||||
|
|
||||||
extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* );
|
extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* );
|
||||||
extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
|
extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
|
||||||
|
|
||||||
# pragma intrinsic( _InterlockedCompareExchangePointer )
|
# pragma intrinsic( _InterlockedCompareExchangePointer )
|
||||||
# pragma intrinsic( _InterlockedExchangePointer )
|
# pragma intrinsic( _InterlockedExchangePointer )
|
||||||
|
|
||||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
|
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
|
||||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
|
# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
|
||||||
|
|
||||||
# else
|
# else
|
||||||
|
|
||||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||||
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
||||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||||
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
|
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
|
# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
|
||||||
@ -64,7 +104,7 @@ extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
|
|||||||
# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
|
# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
|
||||||
# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
|
# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
|
||||||
|
|
||||||
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
|
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
@ -77,6 +117,7 @@ extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volat
|
|||||||
extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long );
|
extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long );
|
||||||
extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long );
|
extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long );
|
||||||
extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long );
|
extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long );
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
@ -86,6 +127,7 @@ extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long vol
|
|||||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange
|
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange
|
||||||
# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange
|
# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange
|
||||||
# define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd
|
# define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd
|
||||||
|
|
||||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||||
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
||||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||||
|
0
include/boost/detail/is_function_ref_tester.hpp
Executable file → Normal file
0
include/boost/detail/is_function_ref_tester.hpp
Executable file → Normal file
25
include/boost/detail/is_incrementable.hpp
Executable file → Normal file
25
include/boost/detail/is_incrementable.hpp
Executable file → Normal file
@ -4,13 +4,15 @@
|
|||||||
#ifndef IS_INCREMENTABLE_DWA200415_HPP
|
#ifndef IS_INCREMENTABLE_DWA200415_HPP
|
||||||
# define IS_INCREMENTABLE_DWA200415_HPP
|
# define IS_INCREMENTABLE_DWA200415_HPP
|
||||||
|
|
||||||
# include <boost/type_traits/detail/bool_trait_def.hpp>
|
|
||||||
# include <boost/type_traits/detail/template_arity_spec.hpp>
|
# include <boost/type_traits/detail/template_arity_spec.hpp>
|
||||||
# include <boost/type_traits/remove_cv.hpp>
|
# include <boost/type_traits/remove_cv.hpp>
|
||||||
# include <boost/mpl/aux_/lambda_support.hpp>
|
# include <boost/mpl/aux_/lambda_support.hpp>
|
||||||
# include <boost/mpl/bool.hpp>
|
# include <boost/mpl/bool.hpp>
|
||||||
# include <boost/detail/workaround.hpp>
|
# include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
|
// Must be the last include
|
||||||
|
# include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||||
|
|
||||||
namespace boost { namespace detail {
|
namespace boost { namespace detail {
|
||||||
|
|
||||||
// is_incrementable<T> metafunction
|
// is_incrementable<T> metafunction
|
||||||
@ -61,12 +63,17 @@ namespace is_incrementable_
|
|||||||
tag operator,(tag,int);
|
tag operator,(tag,int);
|
||||||
# define BOOST_comma(a,b) (a,b)
|
# define BOOST_comma(a,b) (a,b)
|
||||||
# endif
|
# 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
|
// two check overloads help us identify which operator++ was picked
|
||||||
char (& check(tag) )[2];
|
char (& check_(tag) )[2];
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
char check(T const&);
|
char check_(T const&);
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -76,7 +83,7 @@ namespace is_incrementable_
|
|||||||
|
|
||||||
BOOST_STATIC_CONSTANT(
|
BOOST_STATIC_CONSTANT(
|
||||||
bool
|
bool
|
||||||
, value = sizeof(is_incrementable_::check(BOOST_comma(++x,0))) == 1
|
, value = sizeof(is_incrementable_::check_(BOOST_comma(++x,0))) == 1
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,9 +94,14 @@ namespace is_incrementable_
|
|||||||
|
|
||||||
BOOST_STATIC_CONSTANT(
|
BOOST_STATIC_CONSTANT(
|
||||||
bool
|
bool
|
||||||
, value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
|
, value = sizeof(is_incrementable_::check_(BOOST_comma(x++,0))) == 1
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# if defined(BOOST_MSVC)
|
||||||
|
# pragma warning(pop)
|
||||||
|
# endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# undef BOOST_comma
|
# undef BOOST_comma
|
||||||
@ -117,5 +129,6 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable)
|
|||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
# include <boost/type_traits/detail/bool_trait_undef.hpp>
|
||||||
|
|
||||||
#endif // IS_INCREMENTABLE_DWA200415_HPP
|
#endif // IS_INCREMENTABLE_DWA200415_HPP
|
||||||
|
0
include/boost/detail/is_xxx.hpp
Executable file → Normal file
0
include/boost/detail/is_xxx.hpp
Executable file → Normal file
36
include/boost/detail/lightweight_main.hpp
Normal file
36
include/boost/detail/lightweight_main.hpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// boost/detail/lightweight_main.hpp -------------------------------------------------//
|
||||||
|
|
||||||
|
// Copyright Beman Dawes 2010
|
||||||
|
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// See http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------//
|
||||||
|
// //
|
||||||
|
// exception reporting main() that calls cpp_main() //
|
||||||
|
// //
|
||||||
|
//--------------------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
int cpp_main(int argc, char* argv[]);
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return cpp_main(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (const std::exception& ex)
|
||||||
|
{
|
||||||
|
std::cout
|
||||||
|
<< "\nERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR\n"
|
||||||
|
<< "\n****************************** std::exception *****************************\n"
|
||||||
|
<< ex.what()
|
||||||
|
<< "\n***************************************************************************\n"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
@ -10,19 +10,21 @@
|
|||||||
//
|
//
|
||||||
// boost/detail/lightweight_test.hpp - lightweight test library
|
// boost/detail/lightweight_test.hpp - lightweight test library
|
||||||
//
|
//
|
||||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2002, 2009 Peter Dimov
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
//
|
//
|
||||||
// BOOST_TEST(expression)
|
// BOOST_TEST(expression)
|
||||||
// BOOST_ERROR(message)
|
// BOOST_ERROR(message)
|
||||||
|
// BOOST_TEST_EQ(expr1, expr2)
|
||||||
//
|
//
|
||||||
// int boost::report_errors()
|
// int boost::report_errors()
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/current_function.hpp>
|
#include <boost/current_function.hpp>
|
||||||
|
#include <boost/assert.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@ -31,9 +33,26 @@ namespace boost
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct report_errors_reminder
|
||||||
|
{
|
||||||
|
bool called_report_errors_function;
|
||||||
|
report_errors_reminder() : called_report_errors_function(false) {}
|
||||||
|
~report_errors_reminder()
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(called_report_errors_function); // verify report_errors() was called
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline report_errors_reminder& report_errors_remind()
|
||||||
|
{
|
||||||
|
static report_errors_reminder r;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
inline int & test_errors()
|
inline int & test_errors()
|
||||||
{
|
{
|
||||||
static int x = 0;
|
static int x = 0;
|
||||||
|
report_errors_remind();
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,13 +68,29 @@ inline void error_impl(char const * msg, char const * file, int line, char const
|
|||||||
++test_errors();
|
++test_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, T const & t, U const & u )
|
||||||
|
{
|
||||||
|
if( t == u )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||||
|
<< "' failed in function '" << function << "': "
|
||||||
|
<< "'" << t << "' != '" << u << "'" << std::endl;
|
||||||
|
++test_errors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
inline int report_errors()
|
inline int report_errors()
|
||||||
{
|
{
|
||||||
|
detail::report_errors_remind().called_report_errors_function = true;
|
||||||
|
|
||||||
int errors = detail::test_errors();
|
int errors = detail::test_errors();
|
||||||
|
|
||||||
if(errors == 0)
|
if( errors == 0 )
|
||||||
{
|
{
|
||||||
std::cerr << "No errors detected." << std::endl;
|
std::cerr << "No errors detected." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
@ -71,5 +106,6 @@ inline int report_errors()
|
|||||||
|
|
||||||
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
|
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
|
||||||
#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
|
#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
|
||||||
|
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||||
|
|
||||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
||||||
|
135
include/boost/detail/lightweight_thread.hpp
Normal file
135
include/boost/detail/lightweight_thread.hpp
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
#ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
|
||||||
|
#define BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// boost/detail/lightweight_thread.hpp
|
||||||
|
//
|
||||||
|
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||||
|
// Copyright (c) 2008 Peter Dimov
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <memory>
|
||||||
|
#include <cerrno>
|
||||||
|
|
||||||
|
// pthread_create, pthread_join
|
||||||
|
|
||||||
|
#if defined( BOOST_HAS_PTHREADS )
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <process.h>
|
||||||
|
|
||||||
|
typedef HANDLE pthread_t;
|
||||||
|
|
||||||
|
int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg )
|
||||||
|
{
|
||||||
|
HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 );
|
||||||
|
|
||||||
|
if( h != 0 )
|
||||||
|
{
|
||||||
|
*thread = h;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return EAGAIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_join( pthread_t thread, void ** /*value_ptr*/ )
|
||||||
|
{
|
||||||
|
::WaitForSingleObject( thread, INFINITE );
|
||||||
|
::CloseHandle( thread );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// template<class F> int lw_thread_create( pthread_t & pt, F f );
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
class lw_abstract_thread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual ~lw_abstract_thread() {}
|
||||||
|
virtual void run() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined( BOOST_HAS_PTHREADS )
|
||||||
|
|
||||||
|
extern "C" void * lw_thread_routine( void * pv )
|
||||||
|
{
|
||||||
|
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
|
||||||
|
|
||||||
|
pt->run();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
unsigned __stdcall lw_thread_routine( void * pv )
|
||||||
|
{
|
||||||
|
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
|
||||||
|
|
||||||
|
pt->run();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<class F> class lw_thread_impl: public lw_abstract_thread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit lw_thread_impl( F f ): f_( f )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void run()
|
||||||
|
{
|
||||||
|
f_();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
F f_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class F> int lw_thread_create( pthread_t & pt, F f )
|
||||||
|
{
|
||||||
|
std::auto_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) );
|
||||||
|
|
||||||
|
int r = pthread_create( &pt, 0, lw_thread_routine, p.get() );
|
||||||
|
|
||||||
|
if( r == 0 )
|
||||||
|
{
|
||||||
|
p.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
|
@ -13,186 +13,11 @@
|
|||||||
// Copyright (c) 2003 David Abrahams
|
// Copyright (c) 2003 David Abrahams
|
||||||
// Copyright (c) 2003 Peter Dimov
|
// Copyright (c) 2003 Peter Dimov
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/smart_ptr/detail/quick_allocator.hpp>
|
||||||
|
|
||||||
#include <boost/detail/lightweight_mutex.hpp>
|
|
||||||
#include <boost/type_traits/type_with_alignment.hpp>
|
|
||||||
#include <boost/type_traits/alignment_of.hpp>
|
|
||||||
|
|
||||||
#include <new> // ::operator new, ::operator delete
|
|
||||||
#include <cstddef> // std::size_t
|
|
||||||
|
|
||||||
namespace boost
|
|
||||||
{
|
|
||||||
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
|
|
||||||
template<unsigned size, unsigned align_> union freeblock
|
|
||||||
{
|
|
||||||
typedef typename boost::type_with_alignment<align_>::type aligner_type;
|
|
||||||
aligner_type aligner;
|
|
||||||
char bytes[size];
|
|
||||||
freeblock * next;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<unsigned size, unsigned align_> struct allocator_impl
|
|
||||||
{
|
|
||||||
typedef freeblock<size, align_> block;
|
|
||||||
|
|
||||||
// It may seem odd to use such small pages.
|
|
||||||
//
|
|
||||||
// However, on a typical Windows implementation that uses
|
|
||||||
// the OS allocator, "normal size" pages interact with the
|
|
||||||
// "ordinary" operator new, slowing it down dramatically.
|
|
||||||
//
|
|
||||||
// 512 byte pages are handled by the small object allocator,
|
|
||||||
// and don't interfere with ::new.
|
|
||||||
//
|
|
||||||
// The other alternative is to use much bigger pages (1M.)
|
|
||||||
//
|
|
||||||
// It is surprisingly easy to hit pathological behavior by
|
|
||||||
// varying the page size. g++ 2.96 on Red Hat Linux 7.2,
|
|
||||||
// for example, passionately dislikes 496. 512 seems OK.
|
|
||||||
|
|
||||||
#if defined(BOOST_QA_PAGE_SIZE)
|
|
||||||
|
|
||||||
enum { items_per_page = BOOST_QA_PAGE_SIZE / size };
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
enum { items_per_page = 512 / size }; // 1048560 / size
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_THREADS
|
|
||||||
|
|
||||||
static lightweight_mutex & mutex()
|
|
||||||
{
|
|
||||||
static lightweight_mutex m;
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
|
|
||||||
static lightweight_mutex * mutex_init;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static block * free;
|
|
||||||
static block * page;
|
|
||||||
static unsigned last;
|
|
||||||
|
|
||||||
static inline void * alloc()
|
|
||||||
{
|
|
||||||
#ifdef BOOST_HAS_THREADS
|
|
||||||
lightweight_mutex::scoped_lock lock( mutex() );
|
|
||||||
#endif
|
|
||||||
if(block * x = free)
|
|
||||||
{
|
|
||||||
free = x->next;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(last == items_per_page)
|
|
||||||
{
|
|
||||||
// "Listen to me carefully: there is no memory leak"
|
|
||||||
// -- Scott Meyers, Eff C++ 2nd Ed Item 10
|
|
||||||
page = ::new block[items_per_page];
|
|
||||||
last = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return &page[last++];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void * alloc(std::size_t n)
|
|
||||||
{
|
|
||||||
if(n != size) // class-specific new called for a derived object
|
|
||||||
{
|
|
||||||
return ::operator new(n);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef BOOST_HAS_THREADS
|
|
||||||
lightweight_mutex::scoped_lock lock( mutex() );
|
|
||||||
#endif
|
|
||||||
if(block * x = free)
|
|
||||||
{
|
|
||||||
free = x->next;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(last == items_per_page)
|
|
||||||
{
|
|
||||||
page = ::new block[items_per_page];
|
|
||||||
last = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return &page[last++];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dealloc(void * pv)
|
|
||||||
{
|
|
||||||
if(pv != 0) // 18.4.1.1/13
|
|
||||||
{
|
|
||||||
#ifdef BOOST_HAS_THREADS
|
|
||||||
lightweight_mutex::scoped_lock lock( mutex() );
|
|
||||||
#endif
|
|
||||||
block * pb = static_cast<block *>(pv);
|
|
||||||
pb->next = free;
|
|
||||||
free = pb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dealloc(void * pv, std::size_t n)
|
|
||||||
{
|
|
||||||
if(n != size) // class-specific delete called for a derived object
|
|
||||||
{
|
|
||||||
::operator delete(pv);
|
|
||||||
}
|
|
||||||
else if(pv != 0) // 18.4.1.1/13
|
|
||||||
{
|
|
||||||
#ifdef BOOST_HAS_THREADS
|
|
||||||
lightweight_mutex::scoped_lock lock( mutex() );
|
|
||||||
#endif
|
|
||||||
block * pb = static_cast<block *>(pv);
|
|
||||||
pb->next = free;
|
|
||||||
free = pb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_THREADS
|
|
||||||
|
|
||||||
template<unsigned size, unsigned align_>
|
|
||||||
lightweight_mutex * allocator_impl<size, align_>::mutex_init = &allocator_impl<size, align_>::mutex();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<unsigned size, unsigned align_>
|
|
||||||
freeblock<size, align_> * allocator_impl<size, align_>::free = 0;
|
|
||||||
|
|
||||||
template<unsigned size, unsigned align_>
|
|
||||||
freeblock<size, align_> * allocator_impl<size, align_>::page = 0;
|
|
||||||
|
|
||||||
template<unsigned size, unsigned align_>
|
|
||||||
unsigned allocator_impl<size, align_>::last = allocator_impl<size, align_>::items_per_page;
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of<T>::value >
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace detail
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
|
#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
|
||||||
|
56
include/boost/detail/scoped_enum_emulation.hpp
Normal file
56
include/boost/detail/scoped_enum_emulation.hpp
Normal 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_type
|
||||||
|
# define BOOST_SCOPED_ENUM_END };
|
||||||
|
# define BOOST_SCOPED_ENUM(name) name::enum_type
|
||||||
|
|
||||||
|
#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
|
@ -1,9 +1,7 @@
|
|||||||
// Copyright <EFBFBD> 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
|
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
|
||||||
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). Permission to copy,
|
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
|
||||||
// use, modify, sell and distribute this software is granted provided this
|
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||||
// copyright notice appears in all copies. This software is provided "as is"
|
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// without express or implied warranty, and with no claim as to its suitability
|
|
||||||
// for any purpose.
|
|
||||||
|
|
||||||
#ifndef BOOST_UTF8_CODECVT_FACET_HPP
|
#ifndef BOOST_UTF8_CODECVT_FACET_HPP
|
||||||
#define BOOST_UTF8_CODECVT_FACET_HPP
|
#define BOOST_UTF8_CODECVT_FACET_HPP
|
||||||
@ -81,25 +79,18 @@
|
|||||||
// specialized on those types for this to work.
|
// specialized on those types for this to work.
|
||||||
|
|
||||||
#include <locale>
|
#include <locale>
|
||||||
// for mbstate_t
|
#include <cwchar> // for mbstate_t
|
||||||
#include <wchar.h>
|
#include <cstddef> // for std::size_t
|
||||||
// for std::size_t
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||||
namespace std {
|
namespace std {
|
||||||
#if defined(__LIBCOMO__)
|
using ::mbstate_t;
|
||||||
using ::mbstate_t;
|
using ::size_t;
|
||||||
#elif defined(BOOST_DINKUMWARE_STDLIB) && !defined(__BORLANDC__)
|
}
|
||||||
using ::mbstate_t;
|
#endif
|
||||||
#elif defined(__SGI_STL_PORT)
|
|
||||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
|
||||||
using ::mbstate_t;
|
|
||||||
using ::codecvt;
|
|
||||||
#endif
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
|
#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
|
||||||
#define BOOST_CODECVT_DO_LENGTH_CONST const
|
#define BOOST_CODECVT_DO_LENGTH_CONST const
|
||||||
|
0
include/boost/indirect_reference.hpp
Executable file → Normal file
0
include/boost/indirect_reference.hpp
Executable file → Normal file
@ -1,111 +0,0 @@
|
|||||||
// (C) Copyright Jeremy Siek 2000.
|
|
||||||
// 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)
|
|
||||||
|
|
||||||
// The ct_if implementation that avoids partial specialization is
|
|
||||||
// based on the IF class by Ulrich W. Eisenecker and Krzysztof
|
|
||||||
// Czarnecki.
|
|
||||||
|
|
||||||
#ifndef BOOST_CT_IF_HPP
|
|
||||||
#define BOOST_CT_IF_HPP
|
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
|
||||||
|
|
||||||
/*
|
|
||||||
There is a bug in the Borland compiler with regards to using
|
|
||||||
integers to specialize templates. This made it hard to use ct_if in
|
|
||||||
the graph library. Changing from 'ct_if' to 'ct_if_t' fixed the
|
|
||||||
problem.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <boost/type_traits/integral_constant.hpp> // true_type and false_type
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
|
|
||||||
struct ct_if_error { };
|
|
||||||
|
|
||||||
template <class A, class B>
|
|
||||||
struct ct_and { typedef false_type type; };
|
|
||||||
template <> struct ct_and<true_type,true_type> { typedef true_type type; };
|
|
||||||
|
|
||||||
template <class A> struct ct_not { typedef ct_if_error type; };
|
|
||||||
template <> struct ct_not<true_type> { typedef false_type type; };
|
|
||||||
template <> struct ct_not<false_type> { typedef true_type type; };
|
|
||||||
|
|
||||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
|
|
||||||
// agurt, 15/sep/02: in certain cases Borland has problems with
|
|
||||||
// choosing the right 'ct_if' specialization even though 'cond'
|
|
||||||
// _does_ equal '1'; the easiest way to fix it is to make first
|
|
||||||
// 'ct_if' non-type template parameter boolean.
|
|
||||||
#if !defined(__BORLANDC__)
|
|
||||||
template <bool cond, class A, class B>
|
|
||||||
struct ct_if { typedef ct_if_error type; };
|
|
||||||
template <class A, class B>
|
|
||||||
struct ct_if<true, A, B> { typedef A type; };
|
|
||||||
template <class A, class B>
|
|
||||||
struct ct_if<false, A, B> { typedef B type; };
|
|
||||||
#else
|
|
||||||
template <bool cond, class A, class B>
|
|
||||||
struct ct_if { typedef A type; };
|
|
||||||
template <class A, class B>
|
|
||||||
struct ct_if<false, A, B> { typedef B type; };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class cond, class A, class B>
|
|
||||||
struct ct_if_t { typedef ct_if_error type; };
|
|
||||||
template <class A, class B>
|
|
||||||
struct ct_if_t<true_type, A, B> { typedef A type; };
|
|
||||||
template <class A, class B>
|
|
||||||
struct ct_if_t<false_type, A, B> { typedef B type; };
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
template <int condition, class A, class B> struct IF;
|
|
||||||
template <int condition> struct SlectSelector;
|
|
||||||
struct SelectFirstType;
|
|
||||||
struct SelectSecondType;
|
|
||||||
|
|
||||||
struct SelectFirstType {
|
|
||||||
template<class A, class B>
|
|
||||||
struct Template { typedef A type; };
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SelectSecondType {
|
|
||||||
template<class A, class B>
|
|
||||||
struct Template { typedef B type; };
|
|
||||||
};
|
|
||||||
|
|
||||||
template<int condition>
|
|
||||||
struct SlectSelector {
|
|
||||||
typedef SelectFirstType type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct SlectSelector<0> {
|
|
||||||
typedef SelectSecondType type;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace detail
|
|
||||||
|
|
||||||
template<int condition, class A, class B>
|
|
||||||
struct ct_if
|
|
||||||
{
|
|
||||||
typedef typename detail::SlectSelector<condition>::type Selector;
|
|
||||||
typedef typename Selector::template Template<A, B>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class cond, class A, class B>
|
|
||||||
struct ct_if_t {
|
|
||||||
typedef typename ct_if<cond::value, A, B>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
#endif // BOOST_CT_IF_HPP
|
|
||||||
|
|
@ -1,25 +1,24 @@
|
|||||||
// -------------------------------------
|
// -----------------------------------------------------------
|
||||||
// integer_log2.hpp
|
// integer_log2.hpp
|
||||||
//
|
//
|
||||||
// Gives the integer part of the logarithm, in base 2, of a
|
// Gives the integer part of the logarithm, in base 2, of a
|
||||||
// given number. Behavior is undefined if the argument is <= 0.
|
// given number. Behavior is undefined if the argument is <= 0.
|
||||||
//
|
//
|
||||||
//
|
// Copyright (c) 2003-2004, 2008 Gennaro Prota
|
||||||
// (C) Copyright Gennaro Prota 2003 - 2004.
|
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301
|
#ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301
|
||||||
#define BOOST_INTEGER_LOG2_HPP_GP_20030301
|
#define BOOST_INTEGER_LOG2_HPP_GP_20030301
|
||||||
|
|
||||||
#include <cassert>
|
#include <assert.h>
|
||||||
#include <climits> // actually used for Borland only
|
#ifdef __BORLANDC__
|
||||||
|
#include <climits>
|
||||||
|
#endif
|
||||||
#include "boost/limits.hpp"
|
#include "boost/limits.hpp"
|
||||||
#include "boost/config.hpp"
|
#include "boost/config.hpp"
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ namespace boost {
|
|||||||
|
|
||||||
while (x != 1) {
|
while (x != 1) {
|
||||||
|
|
||||||
const T t = x >> n;
|
const T t = static_cast<T>(x >> n);
|
||||||
if (t) {
|
if (t) {
|
||||||
result += n;
|
result += n;
|
||||||
x = t;
|
x = t;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||||
// utf8_codecvt_facet.cpp
|
// utf8_codecvt_facet.cpp
|
||||||
|
|
||||||
// Copyright <EFBFBD> 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
|
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
|
||||||
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
|
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
|
||||||
// Use, modification and distribution is subject to the Boost Software
|
// Use, modification and distribution is subject to the Boost Software
|
||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -139,8 +139,8 @@ std::codecvt_base::result utf8_codecvt_facet::do_out(
|
|||||||
int shift_exponent = (cont_octet_count) * 6;
|
int shift_exponent = (cont_octet_count) * 6;
|
||||||
|
|
||||||
// Process the first character
|
// Process the first character
|
||||||
*to++ = octet1_modifier_table[cont_octet_count] +
|
*to++ = static_cast<char>(octet1_modifier_table[cont_octet_count] +
|
||||||
(unsigned char)(*from / (1 << shift_exponent));
|
(unsigned char)(*from / (1 << shift_exponent)));
|
||||||
|
|
||||||
// Process the continuation characters
|
// Process the continuation characters
|
||||||
// Invariants: At the start of the loop:
|
// Invariants: At the start of the loop:
|
||||||
@ -150,7 +150,7 @@ std::codecvt_base::result utf8_codecvt_facet::do_out(
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (i != cont_octet_count && to != to_end) {
|
while (i != cont_octet_count && to != to_end) {
|
||||||
shift_exponent -= 6;
|
shift_exponent -= 6;
|
||||||
*to++ = 0x80 + ((*from / (1 << shift_exponent)) % (1 << 6));
|
*to++ = static_cast<char>(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6)));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
// If we filled up the out buffer before encoding the character
|
// If we filled up the out buffer before encoding the character
|
||||||
@ -159,7 +159,7 @@ std::codecvt_base::result utf8_codecvt_facet::do_out(
|
|||||||
to_next = to - (i+1);
|
to_next = to - (i+1);
|
||||||
return std::codecvt_base::partial;
|
return std::codecvt_base::partial;
|
||||||
}
|
}
|
||||||
*from++;
|
++from;
|
||||||
}
|
}
|
||||||
from_next = from;
|
from_next = from;
|
||||||
to_next = to;
|
to_next = to;
|
||||||
@ -199,7 +199,7 @@ int utf8_codecvt_facet::do_length(
|
|||||||
last_octet_count = (get_octet_count(*from_next));
|
last_octet_count = (get_octet_count(*from_next));
|
||||||
++char_count;
|
++char_count;
|
||||||
}
|
}
|
||||||
return from_next-from_end;
|
return static_cast<int>(from_next-from_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int utf8_codecvt_facet::get_octet_count(
|
unsigned int utf8_codecvt_facet::get_octet_count(
|
||||||
@ -231,9 +231,6 @@ int get_cont_octet_out_count_impl(wchar_t word){
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// note the following code will generate on some platforms where
|
|
||||||
// wchar_t is defined as UCS2. The warnings are superfluous as
|
|
||||||
// the specialization is never instantitiated with such compilers.
|
|
||||||
template<>
|
template<>
|
||||||
int get_cont_octet_out_count_impl<4>(wchar_t word){
|
int get_cont_octet_out_count_impl<4>(wchar_t word){
|
||||||
if (word < 0x80) {
|
if (word < 0x80) {
|
||||||
@ -242,7 +239,22 @@ int get_cont_octet_out_count_impl<4>(wchar_t word){
|
|||||||
if (word < 0x800) {
|
if (word < 0x800) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (word < 0x10000) {
|
|
||||||
|
// Note that the following code will generate warnings on some platforms
|
||||||
|
// where wchar_t is defined as UCS2. The warnings are superfluous as the
|
||||||
|
// specialization is never instantitiated with such compilers, but this
|
||||||
|
// can cause problems if warnings are being treated as errors, so we guard
|
||||||
|
// against that. Including <boost/detail/utf8_codecvt_facet.hpp> as we do
|
||||||
|
// should be enough to get WCHAR_MAX defined.
|
||||||
|
#if !defined(WCHAR_MAX)
|
||||||
|
# error WCHAR_MAX not defined!
|
||||||
|
#endif
|
||||||
|
// cope with VC++ 7.1 or earlier having invalid WCHAR_MAX
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier
|
||||||
|
return 2;
|
||||||
|
#elif WCHAR_MAX > 0x10000
|
||||||
|
|
||||||
|
if (word < 0x10000) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (word < 0x200000) {
|
if (word < 0x200000) {
|
||||||
@ -252,6 +264,10 @@ int get_cont_octet_out_count_impl<4>(wchar_t word){
|
|||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
return 5;
|
return 5;
|
||||||
|
|
||||||
|
#else
|
||||||
|
return 2;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace anonymous
|
} // namespace anonymous
|
||||||
|
Reference in New Issue
Block a user