mirror of
https://github.com/boostorg/detail.git
synced 2025-06-28 05:21:08 +02:00
Compare commits
12 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
b5c12a40a9 | |||
5f033da80e | |||
6dd212ccf7 | |||
9d5b0d7c0c | |||
83ada0473d | |||
36be4e716a | |||
3f8f91f7c7 | |||
ae07663830 | |||
d63b0de6f9 | |||
480b611fd2 | |||
c07f135aa9 | |||
0244c5a647 |
@ -1,80 +0,0 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost blank.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2003
|
||||
// Eric Friedman
|
||||
//
|
||||
// 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 BOOST_BLANK_HPP
|
||||
#define BOOST_BLANK_HPP
|
||||
|
||||
#include "boost/blank_fwd.hpp"
|
||||
|
||||
#include <iosfwd> // for std::basic_ostream forward declare
|
||||
|
||||
#include "boost/detail/templated_streams.hpp"
|
||||
#include "boost/mpl/bool.hpp"
|
||||
#include "boost/type_traits/is_empty.hpp"
|
||||
#include "boost/type_traits/is_pod.hpp"
|
||||
#include "boost/type_traits/is_stateless.hpp"
|
||||
|
||||
namespace boost {
|
||||
|
||||
struct blank
|
||||
{
|
||||
};
|
||||
|
||||
// type traits specializations
|
||||
//
|
||||
|
||||
template <>
|
||||
struct is_pod< blank >
|
||||
: mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_empty< blank >
|
||||
: mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_stateless< blank >
|
||||
: mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
// relational operators
|
||||
//
|
||||
|
||||
inline bool operator==(const blank&, const blank&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool operator<(const blank&, const blank&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// streaming support
|
||||
//
|
||||
BOOST_TEMPLATED_STREAM_TEMPLATE(E,T)
|
||||
inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
|
||||
BOOST_TEMPLATED_STREAM(ostream, E,T)& out
|
||||
, const blank&
|
||||
)
|
||||
{
|
||||
// (output nothing)
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_BLANK_HPP
|
@ -1,22 +0,0 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost blank_fwd.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2003
|
||||
// Eric Friedman
|
||||
//
|
||||
// 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 BOOST_BLANK_FWD_HPP
|
||||
#define BOOST_BLANK_FWD_HPP
|
||||
|
||||
namespace boost {
|
||||
|
||||
struct blank;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_BLANK_FWD_HPP
|
@ -1,41 +0,0 @@
|
||||
// boost/cstdlib.hpp header ------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 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)
|
||||
|
||||
// See http://www.boost.org/libs/utility/cstdlib.html for documentation.
|
||||
|
||||
// Revision History
|
||||
// 26 Feb 01 Initial version (Beman Dawes)
|
||||
|
||||
#ifndef BOOST_CSTDLIB_HPP
|
||||
#define BOOST_CSTDLIB_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// The intent is to propose the following for addition to namespace std
|
||||
// in the C++ Standard Library, and to then deprecate EXIT_SUCCESS and
|
||||
// EXIT_FAILURE. As an implementation detail, this header defines the
|
||||
// new constants in terms of EXIT_SUCCESS and EXIT_FAILURE. In a new
|
||||
// standard, the constants would be implementation-defined, although it
|
||||
// might be worthwhile to "suggest" (which a standard is allowed to do)
|
||||
// values of 0 and 1 respectively.
|
||||
|
||||
// Rationale for having multiple failure values: some environments may
|
||||
// wish to distinguish between different classes of errors.
|
||||
// Rationale for choice of values: programs often use values < 100 for
|
||||
// their own error reporting. Values > 255 are sometimes reserved for
|
||||
// system detected errors. 200/201 were suggested to minimize conflict.
|
||||
|
||||
const int exit_success = EXIT_SUCCESS; // implementation-defined value
|
||||
const int exit_failure = EXIT_FAILURE; // implementation-defined value
|
||||
const int exit_exception_failure = 200; // otherwise uncaught exception
|
||||
const int exit_test_failure = 201; // report_error or
|
||||
// report_critical_error called.
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -23,11 +23,12 @@
|
||||
|
||||
# include <windows.h>
|
||||
|
||||
# define BOOST_INTERLOCKED_INCREMENT ::InterlockedIncrement
|
||||
# define BOOST_INTERLOCKED_DECREMENT ::InterlockedDecrement
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::InterlockedCompareExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE ::InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER ::InterlockedCompareExchangePointer
|
||||
# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
|
||||
# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer
|
||||
|
||||
#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
|
||||
|
||||
@ -42,17 +43,22 @@ extern "C" long __cdecl _InterlockedExchange( long volatile *, long);
|
||||
# pragma intrinsic( _InterlockedExchange )
|
||||
# if defined(_M_IA64) || defined(_M_AMD64)
|
||||
extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* );
|
||||
extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
|
||||
# pragma intrinsic( _InterlockedCompareExchangePointer )
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER ::_InterlockedCompareExchangePointer
|
||||
# pragma intrinsic( _InterlockedExchangePointer )
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
|
||||
# else
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
|
||||
# endif
|
||||
|
||||
# define BOOST_INTERLOCKED_INCREMENT ::_InterlockedIncrement
|
||||
# define BOOST_INTERLOCKED_DECREMENT ::_InterlockedDecrement
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::_InterlockedCompareExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE ::_InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
|
||||
# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
|
||||
|
||||
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
|
||||
|
||||
@ -76,6 +82,8 @@ extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volati
|
||||
# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
|
||||
|
||||
#else
|
||||
|
||||
@ -83,8 +91,4 @@ extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volati
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_INTERLOCKED_READ(x) BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,0,0)
|
||||
#define BOOST_INTERLOCKED_READ_POINTER(x) BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(x,0,0)
|
||||
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
|
||||
|
@ -32,8 +32,26 @@ namespace is_incrementable_
|
||||
struct any { template <class T> any(T const&); };
|
||||
|
||||
// This is a last-resort operator++ for when none other is found
|
||||
# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
|
||||
|
||||
}
|
||||
|
||||
namespace is_incrementable_2
|
||||
{
|
||||
is_incrementable_::tag operator++(is_incrementable_::any const&);
|
||||
is_incrementable_::tag operator++(is_incrementable_::any const&,int);
|
||||
}
|
||||
using namespace is_incrementable_2;
|
||||
|
||||
namespace is_incrementable_
|
||||
{
|
||||
|
||||
# else
|
||||
|
||||
tag operator++(any const&);
|
||||
tag operator++(any const&,int);
|
||||
|
||||
# endif
|
||||
|
||||
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|
||||
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
@ -78,7 +96,7 @@ namespace is_incrementable_
|
||||
|
||||
template<typename T>
|
||||
struct is_incrementable
|
||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
{
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
|
||||
@ -86,7 +104,7 @@ struct is_incrementable
|
||||
|
||||
template<typename T>
|
||||
struct is_postfix_incrementable
|
||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
{
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl<T>::value)
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
|
||||
|
61
include/boost/detail/is_xxx.hpp
Executable file
61
include/boost/detail/is_xxx.hpp
Executable file
@ -0,0 +1,61 @@
|
||||
// Copyright David Abrahams 2005. 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 BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
||||
# define BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
|
||||
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
|
||||
template <class X_> \
|
||||
struct is_##name \
|
||||
{ \
|
||||
typedef char yes; \
|
||||
typedef char (&no)[2]; \
|
||||
\
|
||||
static typename add_reference<X_>::type dummy; \
|
||||
\
|
||||
struct helpers \
|
||||
{ \
|
||||
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \
|
||||
static yes test( \
|
||||
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \
|
||||
); \
|
||||
\
|
||||
template <class U> \
|
||||
static no test(U&, ...); \
|
||||
}; \
|
||||
\
|
||||
BOOST_STATIC_CONSTANT( \
|
||||
bool, value \
|
||||
= !is_reference<X_>::value \
|
||||
& (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \
|
||||
\
|
||||
typedef mpl::bool_<value> type; \
|
||||
};
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
|
||||
template <class T> \
|
||||
struct is_##name : mpl::false_ \
|
||||
{ \
|
||||
}; \
|
||||
\
|
||||
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \
|
||||
struct is_##name< \
|
||||
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \
|
||||
> \
|
||||
: mpl::true_ \
|
||||
{ \
|
||||
};
|
||||
|
||||
# endif
|
||||
|
||||
#endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
@ -71,7 +71,15 @@ template<unsigned size, unsigned align_> struct allocator_impl
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
static lightweight_mutex mutex;
|
||||
|
||||
static lightweight_mutex & mutex()
|
||||
{
|
||||
static lightweight_mutex m;
|
||||
return m;
|
||||
}
|
||||
|
||||
static lightweight_mutex * mutex_init;
|
||||
|
||||
#endif
|
||||
|
||||
static block * free;
|
||||
@ -81,7 +89,7 @@ template<unsigned size, unsigned align_> struct allocator_impl
|
||||
static inline void * alloc()
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
lightweight_mutex::scoped_lock lock(mutex);
|
||||
lightweight_mutex::scoped_lock lock( mutex() );
|
||||
#endif
|
||||
if(block * x = free)
|
||||
{
|
||||
@ -111,7 +119,7 @@ template<unsigned size, unsigned align_> struct allocator_impl
|
||||
else
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
lightweight_mutex::scoped_lock lock(mutex);
|
||||
lightweight_mutex::scoped_lock lock( mutex() );
|
||||
#endif
|
||||
if(block * x = free)
|
||||
{
|
||||
@ -136,7 +144,7 @@ template<unsigned size, unsigned align_> struct allocator_impl
|
||||
if(pv != 0) // 18.4.1.1/13
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
lightweight_mutex::scoped_lock lock(mutex);
|
||||
lightweight_mutex::scoped_lock lock( mutex() );
|
||||
#endif
|
||||
block * pb = static_cast<block *>(pv);
|
||||
pb->next = free;
|
||||
@ -153,7 +161,7 @@ template<unsigned size, unsigned align_> struct allocator_impl
|
||||
else if(pv != 0) // 18.4.1.1/13
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
lightweight_mutex::scoped_lock lock(mutex);
|
||||
lightweight_mutex::scoped_lock lock( mutex() );
|
||||
#endif
|
||||
block * pb = static_cast<block *>(pv);
|
||||
pb->next = free;
|
||||
@ -163,8 +171,10 @@ template<unsigned size, unsigned align_> struct allocator_impl
|
||||
};
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
|
||||
template<unsigned size, unsigned align_>
|
||||
lightweight_mutex allocator_impl<size, align_>::mutex;
|
||||
lightweight_mutex * allocator_impl<size, align_>::mutex_init = &allocator_impl<size, align_>::mutex();
|
||||
|
||||
#endif
|
||||
|
||||
template<unsigned size, unsigned align_>
|
||||
|
@ -1,43 +0,0 @@
|
||||
#ifndef INDIRECT_REFERENCE_DWA200415_HPP
|
||||
# define INDIRECT_REFERENCE_DWA200415_HPP
|
||||
|
||||
//
|
||||
// Copyright David Abrahams 2004. Use, modification and distribution is
|
||||
// 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)
|
||||
//
|
||||
// typename indirect_reference<P>::type provides the type of *p.
|
||||
//
|
||||
// http://www.boost.org/libs/iterator/doc/pointee.html
|
||||
//
|
||||
|
||||
# include <boost/detail/is_incrementable.hpp>
|
||||
# include <boost/iterator/iterator_traits.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/pointee.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class P>
|
||||
struct smart_ptr_reference
|
||||
{
|
||||
typedef typename boost::pointee<P>::type& type;
|
||||
};
|
||||
}
|
||||
|
||||
template <class P>
|
||||
struct indirect_reference
|
||||
: mpl::eval_if<
|
||||
detail::is_incrementable<P>
|
||||
, iterator_reference<P>
|
||||
, detail::smart_ptr_reference<P>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // INDIRECT_REFERENCE_DWA200415_HPP
|
@ -1,27 +0,0 @@
|
||||
// -------------------------------------
|
||||
//
|
||||
// (C) Copyright Gennaro Prota 2003.
|
||||
//
|
||||
// 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 BOOST_NON_TYPE_HPP_GP_20030417
|
||||
#define BOOST_NON_TYPE_HPP_GP_20030417
|
||||
|
||||
|
||||
namespace boost {
|
||||
|
||||
// Just a simple "envelope" for non-type template parameters. Useful
|
||||
// to work around some MSVC deficiencies.
|
||||
|
||||
template <typename T, T n>
|
||||
struct non_type { };
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
@ -1,16 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// (C) Copyright Jeremy Siek 2004
|
||||
// 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 BOOST_CSTDDEF_HPP
|
||||
#define BOOST_CSTDDEF_HPP
|
||||
|
||||
#if defined(__sgi) && !defined(__GNUC__)
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# include <cstddef>
|
||||
#endif
|
||||
|
||||
#endif
|
@ -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,113 +0,0 @@
|
||||
// -------------------------------------
|
||||
// integer_log2.hpp
|
||||
//
|
||||
// Gives the integer part of the logarithm, in base 2, of a
|
||||
// given number. Behavior is undefined if the argument is <= 0.
|
||||
//
|
||||
//
|
||||
// (C) Copyright Gennaro Prota 2003 - 2004.
|
||||
//
|
||||
// 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 BOOST_INTEGER_LOG2_HPP_GP_20030301
|
||||
#define BOOST_INTEGER_LOG2_HPP_GP_20030301
|
||||
|
||||
#include <cassert>
|
||||
#include <climits> // actually used for Borland only
|
||||
#include "boost/limits.hpp"
|
||||
#include "boost/config.hpp"
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
int integer_log2_impl(T x, int n) {
|
||||
|
||||
int result = 0;
|
||||
|
||||
while (x != 1) {
|
||||
|
||||
const T t = x >> n;
|
||||
if (t) {
|
||||
result += n;
|
||||
x = t;
|
||||
}
|
||||
n /= 2;
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// helper to find the maximum power of two
|
||||
// less than p (more involved than necessary,
|
||||
// to avoid PTS)
|
||||
//
|
||||
template <int p, int n>
|
||||
struct max_pow2_less {
|
||||
|
||||
enum { c = 2*n < p };
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, value =
|
||||
c ? (max_pow2_less< c*p, 2*c*n>::value) : n);
|
||||
|
||||
};
|
||||
|
||||
template <>
|
||||
struct max_pow2_less<0, 0> {
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
|
||||
// this template is here just for Borland :(
|
||||
// we could simply rely on numeric_limits but sometimes
|
||||
// Borland tries to use numeric_limits<const T>, because
|
||||
// of its usual const-related problems in argument deduction
|
||||
// - gps
|
||||
template <typename T>
|
||||
struct width {
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
BOOST_STATIC_CONSTANT(int, value = sizeof(T) * CHAR_BIT);
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(int, value = (std::numeric_limits<T>::digits));
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
|
||||
// ---------
|
||||
// integer_log2
|
||||
// ---------------
|
||||
//
|
||||
template <typename T>
|
||||
int integer_log2(T x) {
|
||||
|
||||
assert(x > 0);
|
||||
|
||||
const int n = detail::max_pow2_less<
|
||||
detail::width<T> :: value, 4
|
||||
> :: value;
|
||||
|
||||
return detail::integer_log2_impl(x, n);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // include guard
|
@ -1,18 +0,0 @@
|
||||
// (C) Copyright David Abrahams 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)
|
||||
|
||||
#ifndef BOOST_TYPE_DWA20010120_HPP
|
||||
# define BOOST_TYPE_DWA20010120_HPP
|
||||
|
||||
namespace boost {
|
||||
|
||||
// Just a simple "type envelope". Useful in various contexts, mostly to work
|
||||
// around some MSVC deficiencies.
|
||||
template <class T>
|
||||
struct type {};
|
||||
|
||||
}
|
||||
|
||||
#endif // BOOST_TYPE_DWA20010120_HPP
|
@ -1,29 +0,0 @@
|
||||
// Boost.Signals library
|
||||
|
||||
// Copyright Douglas Gregor 2001-2003. Use, modification and
|
||||
// distribution is 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)
|
||||
|
||||
// For more information, see http://www.boost.org/libs/signals
|
||||
|
||||
#ifndef BOOST_VISIT_EACH_HPP
|
||||
#define BOOST_VISIT_EACH_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost {
|
||||
template<typename Visitor, typename T>
|
||||
inline void visit_each(Visitor& visitor, const T& t, long)
|
||||
{
|
||||
visitor(t);
|
||||
}
|
||||
|
||||
template<typename Visitor, typename T>
|
||||
inline void visit_each(Visitor& visitor, const T& t)
|
||||
{
|
||||
visit_each(visitor, t, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_VISIT_EACH_HPP
|
Reference in New Issue
Block a user