mirror of
https://github.com/boostorg/detail.git
synced 2025-12-21 06:22:43 +01:00
Compare commits
77 Commits
svn-branch
...
svn-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f3f021132 | ||
|
|
ab34b61206 | ||
|
|
b0b37ef724 | ||
|
|
69c7068028 | ||
|
|
124be84389 | ||
|
|
0caf4bb53e | ||
|
|
7f668adbcd | ||
|
|
d6fbac9ba7 | ||
|
|
8f71074339 | ||
|
|
1f52127735 | ||
|
|
48507564a9 | ||
|
|
8d549f45fd | ||
|
|
c1f144e5d4 | ||
|
|
53ba30e0c9 | ||
|
|
9aead1823b | ||
|
|
c14ee17601 | ||
|
|
2bca71488b | ||
|
|
1f335d30ba | ||
|
|
a38297a6cc | ||
|
|
72ca3d7d9f | ||
|
|
28432648e0 | ||
|
|
e69140d3f3 | ||
|
|
00f6a9751a | ||
|
|
9663499093 | ||
|
|
d9d6a970cf | ||
|
|
5efbcbea28 | ||
|
|
01448d3373 | ||
|
|
15a5375b14 | ||
|
|
09e0b2e072 | ||
|
|
08e37c5ccc | ||
|
|
19201a4bb9 | ||
|
|
528fb22617 | ||
|
|
71790af7f6 | ||
|
|
59099cadf6 | ||
|
|
695b3059bd | ||
|
|
3a4ed6ef7c | ||
|
|
63b5e51676 | ||
|
|
8c6c8f9604 | ||
|
|
865bc7d803 | ||
|
|
0ea958903a | ||
|
|
e027048eb6 | ||
|
|
75fb29a3b7 | ||
|
|
8f9b1e35bd | ||
|
|
c21dc776d1 | ||
|
|
1ee4d8ac0d | ||
|
|
69dccc47b5 | ||
|
|
cf8fe4f2b1 | ||
|
|
66f30e813e | ||
|
|
863361ded0 | ||
|
|
fe148355a2 | ||
|
|
be12189340 | ||
|
|
01426d35f3 | ||
|
|
a8ae9d9941 | ||
|
|
1b51ce460c | ||
|
|
aab735c64e | ||
|
|
83b8fcefc7 | ||
|
|
6b15777c8f | ||
|
|
7c91125060 | ||
|
|
03b1bb7a1e | ||
|
|
58bff4af87 | ||
|
|
5044712ff6 | ||
|
|
2f6f7af430 | ||
|
|
1e0e965f07 | ||
|
|
7523daa905 | ||
|
|
3cb4fe87a9 | ||
|
|
dc1186e73f | ||
|
|
d0f656c4da | ||
|
|
08a2ab3fe6 | ||
|
|
2947fb7051 | ||
|
|
cd1eecd245 | ||
|
|
9ac4d90d82 | ||
|
|
a7ae27dc5b | ||
|
|
ddccb755f4 | ||
|
|
8ffb174556 | ||
|
|
8b60ca8d0a | ||
|
|
3cbecf5ddd | ||
|
|
82af891892 |
42
include/boost/cstdlib.hpp
Normal file
42
include/boost/cstdlib.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// boost/cstdlib.hpp header ------------------------------------------------//
|
||||
|
||||
// (C) Copyright Beman Dawes 2001. Permission to copy, use, modify, sell
|
||||
// and distribute this software is granted provided this copyright notice
|
||||
// appears in all copies. This software is provided "as is" without express or
|
||||
// implied warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// See http://www.boost.org/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
|
||||
|
||||
@@ -1,206 +0,0 @@
|
||||
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify,
|
||||
// sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
|
||||
// Boost versions of
|
||||
//
|
||||
// std::iterator_traits<>::iterator_category
|
||||
// std::iterator_traits<>::difference_type
|
||||
// std::distance()
|
||||
//
|
||||
// ...for all compilers and iterators
|
||||
|
||||
#ifndef ITERATOR_DWA122600_HPP_
|
||||
# define ITERATOR_DWA122600_HPP_
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/type_traits.hpp>
|
||||
# include <iterator>
|
||||
# include <cstddef>
|
||||
|
||||
// STLPort 4.0 and betas have a bug when debugging is enabled and there is no
|
||||
// partial specialization: instead of an iterator_category typedef, the standard
|
||||
// container iterators have _Iterator_category.
|
||||
//
|
||||
// Also, whether debugging is enabled or not, there is a broken specialization
|
||||
// of std::iterator<output_iterator_tag,void,void,void,void> which has no
|
||||
// typedefs but iterator_category.
|
||||
# if defined(__SGI_STL_PORT) && (__SGI_STL_PORT <= 0x410) && !defined(__STL_CLASS_PARTIAL_SPECIALIZATION)
|
||||
|
||||
# ifdef __STL_DEBUG
|
||||
# define BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
# endif
|
||||
|
||||
# define BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
|
||||
|
||||
# endif // STLPort <= 4.1b4 && no partial specialization
|
||||
|
||||
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
# include <vector>
|
||||
# include <list>
|
||||
# include <set>
|
||||
# include <map>
|
||||
# include <deque>
|
||||
# include <slist>
|
||||
# include <hash_map>
|
||||
# include <hash_set>
|
||||
# include <string>
|
||||
# endif
|
||||
|
||||
namespace boost { namespace detail {
|
||||
# if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
using std::iterator_traits;
|
||||
using std::distance;
|
||||
# else
|
||||
// Workarounds for less-capable implementations
|
||||
template <bool is_ptr> struct iterator_traits_select;
|
||||
template <> struct iterator_traits_select<true>
|
||||
{
|
||||
template <class Ptr>
|
||||
struct traits
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
no_result bad_category_helper(...);
|
||||
template <class C, class T> yes_result bad_category_helper(std::_DBG_iter<C,T>*);
|
||||
|
||||
template <bool has_bad_category_typedef> struct bad_category_select;
|
||||
template <>
|
||||
struct bad_category_select<true>
|
||||
{
|
||||
template <class Iterator>
|
||||
struct category { typedef typename Iterator::_Iterator_category type; };
|
||||
};
|
||||
template <>
|
||||
struct bad_category_select<false>
|
||||
{
|
||||
template <class Iterator>
|
||||
struct category { typedef typename Iterator::iterator_category type; };
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
struct iterator_category_select
|
||||
{
|
||||
private:
|
||||
static Iterator p;
|
||||
enum { has_bad_category
|
||||
= sizeof(bad_category_helper(&p)) == sizeof(yes_result) };
|
||||
typedef bad_category_select<has_bad_category> category_select;
|
||||
public:
|
||||
typedef typename category_select::template category<Iterator>::type type;
|
||||
};
|
||||
|
||||
# endif
|
||||
|
||||
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
|
||||
template <bool is_bad_output_iterator> struct bad_difference_select;
|
||||
template <>
|
||||
struct bad_difference_select<true>
|
||||
{
|
||||
template <class Iterator>
|
||||
struct difference { typedef void type; };
|
||||
};
|
||||
template <>
|
||||
struct bad_difference_select<false>
|
||||
{
|
||||
template <class Iterator>
|
||||
struct difference { typedef typename Iterator::difference_type type; };
|
||||
};
|
||||
yes_result bad_output_iterator_helper(std::iterator<std::output_iterator_tag,void,void,void,void>*);
|
||||
no_result bad_output_iterator_helper(...);
|
||||
# endif
|
||||
|
||||
template <> struct iterator_traits_select<false>
|
||||
{
|
||||
template <class Iterator>
|
||||
struct traits
|
||||
# if defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
{
|
||||
# if defined(BOOST_MSVC) && !defined(__SGI_STL_PORT)
|
||||
typedef typename Iterator::distance_type difference_type;
|
||||
# elif !defined(BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION)
|
||||
typedef typename Iterator::difference_type difference_type;
|
||||
# else
|
||||
private:
|
||||
// static Iterator *p;
|
||||
typedef bad_difference_select<
|
||||
is_convertible<const volatile Iterator*,
|
||||
const volatile std::iterator<std::output_iterator_tag,void,void,void,void>*
|
||||
>::value> difference_type_select;
|
||||
public:
|
||||
typedef typename difference_type_select::template difference<Iterator>::type difference_type;
|
||||
# endif
|
||||
|
||||
# if !defined(BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF)
|
||||
typedef typename Iterator::iterator_category iterator_category;
|
||||
# else
|
||||
typedef typename iterator_category_select<Iterator>::type iterator_category;
|
||||
# endif
|
||||
};
|
||||
# else
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::difference_type difference_type;
|
||||
typedef typename std::iterator_traits<Iterator>::iterator_category iterator_category;
|
||||
};
|
||||
# endif
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
struct iterator_traits
|
||||
{
|
||||
private:
|
||||
typedef iterator_traits_select<is_pointer<remove_cv<Iterator>::type>::value> select;
|
||||
typedef typename select::template traits<Iterator> traits;
|
||||
public:
|
||||
typedef typename traits::difference_type difference_type;
|
||||
typedef typename traits::iterator_category iterator_category;
|
||||
};
|
||||
|
||||
template <class Category>
|
||||
struct distance_select {
|
||||
template <class Iterator>
|
||||
static typename ::boost::detail::iterator_traits<Iterator>::difference_type
|
||||
distance(Iterator i1, const Iterator i2)
|
||||
{
|
||||
typename ::boost::detail::iterator_traits<Iterator>::difference_type result = 0;
|
||||
while (i1 != i2)
|
||||
{
|
||||
++i1;
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct distance_select<std::random_access_iterator_tag> {
|
||||
template <class Iterator>
|
||||
static typename ::boost::detail::iterator_traits<Iterator>::difference_type
|
||||
distance(const Iterator i1, const Iterator i2)
|
||||
{
|
||||
return i2 - i1;
|
||||
}
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
inline typename ::boost::detail::iterator_traits<Iterator>::difference_type
|
||||
distance(const Iterator& first, const Iterator& last)
|
||||
{
|
||||
typedef typename ::boost::detail::iterator_traits<Iterator>::iterator_category iterator_category;
|
||||
return distance_select<iterator_category>::distance(first, last);
|
||||
}
|
||||
# endif // workarounds
|
||||
|
||||
}}
|
||||
|
||||
# undef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
# undef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
|
||||
|
||||
#endif // ITERATOR_DWA122600_HPP_
|
||||
@@ -1,208 +0,0 @@
|
||||
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify,
|
||||
// sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
//
|
||||
// Template class is_signed and its documentation is:
|
||||
// (C) Copyright Howard Hinnant 2001. Permission to copy, use, modify,
|
||||
// sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
//
|
||||
// Template class numeric_traits<Number> --
|
||||
//
|
||||
// Supplies:
|
||||
//
|
||||
// typedef difference_type -- a type used to represent the difference
|
||||
// between any two values of Number.
|
||||
//
|
||||
// Support:
|
||||
// 1. Not all specializations are supplied
|
||||
//
|
||||
// 2. Use of specializations that are not supplied will cause a
|
||||
// compile-time error
|
||||
//
|
||||
// 3. Users are free to specialize numeric_traits for any type.
|
||||
//
|
||||
// 4. Right now, specializations are only supplied for integer types.
|
||||
//
|
||||
// 5. On implementations which do not supply compile-time constants in
|
||||
// std::numeric_limits<>, only specializations for built-in integer types
|
||||
// are supplied.
|
||||
//
|
||||
// 6. Handling of numbers whose range of representation is at least as
|
||||
// great as boost::intmax_t can cause some differences to be
|
||||
// unrepresentable in difference_type:
|
||||
//
|
||||
// Number difference_type
|
||||
// ------ ---------------
|
||||
// signed Number
|
||||
// unsigned intmax_t
|
||||
//
|
||||
// template <class Number> typename numeric_traits<Number>::difference_type
|
||||
// numeric_distance(Number x, Number y)
|
||||
// computes (y - x), attempting to avoid overflows.
|
||||
//
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// Revision History
|
||||
// 23 Jan 2001 - Fixed logic of difference_type selection, which was
|
||||
// completely wack. In the process, added digit_traits<>
|
||||
// to compute the number of digits in intmax_t even when
|
||||
// not supplied by numeric_limits<>.
|
||||
// 21 Jan 2001 - Created
|
||||
|
||||
#ifndef BOOST_NUMERIC_TRAITS_HPP_DWA20001901
|
||||
# define BOOST_NUMERIC_TRAITS_HPP_DWA20001901
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/cstdint.hpp>
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/type_traits.hpp>
|
||||
# ifndef BOOST_NO_LIMITS
|
||||
# include <limits>
|
||||
# endif
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// Template class if_true -- select among 2 types based on a bool constant expression
|
||||
// Usage:
|
||||
// typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
|
||||
template <bool> struct if_true;
|
||||
|
||||
template <>
|
||||
struct if_true<true>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct then { typedef T1 type; };
|
||||
};
|
||||
|
||||
template <>
|
||||
struct if_true<false>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct then { typedef T2 type; };
|
||||
};
|
||||
|
||||
// Template class is_signed -- determine whether a numeric type is signed
|
||||
// Requires that T is constructable from the literals -1 and 0. Compile-time
|
||||
// error results if that requirement is not met (and thus signedness is not
|
||||
// likely to have meaning for that type).
|
||||
template <class Number>
|
||||
struct is_signed
|
||||
{
|
||||
enum { value = (Number(-1) < Number(0)) };
|
||||
};
|
||||
|
||||
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
// digit_traits - compute the number of digits in a built-in integer
|
||||
// type. Needed for implementations on which numeric_limits is not specialized
|
||||
// for intmax_t (e.g. VC6).
|
||||
template <bool is_specialized> struct digit_traits_select;
|
||||
|
||||
// numeric_limits is specialized; just select that version of digits
|
||||
template <> struct digit_traits_select<true>
|
||||
{
|
||||
template <class T> struct traits
|
||||
{
|
||||
enum { digits = std::numeric_limits<T>::digits };
|
||||
};
|
||||
};
|
||||
|
||||
// numeric_limits is not specialized; compute digits from sizeof(T)
|
||||
template <> struct digit_traits_select<false>
|
||||
{
|
||||
template <class T> struct traits
|
||||
{
|
||||
enum { digits = sizeof(T) * std::numeric_limits<unsigned char>::digits
|
||||
- (is_signed<T>::value ? 1 : 0)
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// here's the "usable" template
|
||||
template <class T> struct digit_traits
|
||||
{
|
||||
enum {
|
||||
digits = digit_traits_select<
|
||||
std::numeric_limits<T>::is_specialized
|
||||
>::template traits<T>::digits
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
// Template class integer_traits<Integer> -- traits of various integer types
|
||||
// This should probably be rolled into boost::integer_traits one day, but I
|
||||
// need it to work without <limits>
|
||||
template <class Integer>
|
||||
struct integer_traits
|
||||
{
|
||||
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
private:
|
||||
typedef Integer integer_type;
|
||||
typedef std::numeric_limits<integer_type> x;
|
||||
# ifdef BOOST_MSVC
|
||||
// for some reason, MSVC asserts when it shouldn't unless we make these
|
||||
// local definitions
|
||||
enum {
|
||||
is_integer = x::is_integer,
|
||||
is_specialized = x::is_specialized
|
||||
};
|
||||
BOOST_STATIC_ASSERT(is_integer);
|
||||
BOOST_STATIC_ASSERT(is_specialized);
|
||||
# endif
|
||||
public:
|
||||
typedef typename
|
||||
if_true<(x::is_signed
|
||||
&& (!x::is_bounded
|
||||
// digits is the number of no-sign bits
|
||||
|| (x::digits + 1 >= digit_traits<boost::intmax_t>::digits)))>::template then<
|
||||
Integer,
|
||||
|
||||
typename if_true<(x::digits + 1 < digit_traits<signed int>::digits)>::template then<
|
||||
signed int,
|
||||
|
||||
typename if_true<(x::digits + 1 < digit_traits<signed long>::digits)>::template then<
|
||||
signed long,
|
||||
|
||||
// else
|
||||
intmax_t
|
||||
>::type>::type>::type difference_type;
|
||||
# else
|
||||
BOOST_STATIC_ASSERT(boost::is_integral<Integer>::value);
|
||||
|
||||
typedef typename
|
||||
if_true<(sizeof(Integer) >= sizeof(intmax_t))>::template then<
|
||||
|
||||
typename if_true<is_signed<Integer>::value>::template then<
|
||||
Integer,
|
||||
intmax_t
|
||||
>::type,
|
||||
|
||||
typename if_true<(sizeof(Integer) < sizeof(std::ptrdiff_t))>::template then<
|
||||
std::ptrdiff_t,
|
||||
intmax_t
|
||||
>::type
|
||||
>::type difference_type;
|
||||
# endif
|
||||
};
|
||||
|
||||
// Right now, only supports integers, but should be expanded.
|
||||
template <class Number>
|
||||
struct numeric_traits
|
||||
{
|
||||
typedef typename integer_traits<Number>::difference_type difference_type;
|
||||
};
|
||||
|
||||
template <class Number>
|
||||
typename numeric_traits<Number>::difference_type numeric_distance(Number x, Number y)
|
||||
{
|
||||
typedef typename numeric_traits<Number>::difference_type difference_type;
|
||||
return difference_type(y) - difference_type(x);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif // BOOST_NUMERIC_TRAITS_HPP_DWA20001901
|
||||
24
include/boost/non_type.hpp
Normal file
24
include/boost/non_type.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
// (C) Copyright Gennaro Prota 2003. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
|
||||
|
||||
#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,12 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
|
||||
#ifndef BOOST_CSTDDEF_HPP
|
||||
#define BOOST_CSTDDEF_HPP
|
||||
|
||||
#if defined(__sgi) && !defined(__GNUC__)
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# include <cstddef>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,101 +0,0 @@
|
||||
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
// 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.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
|
||||
struct ct_if_error { };
|
||||
|
||||
struct true_type { enum { value = true }; };
|
||||
struct false_type { enum { value = false }; };
|
||||
|
||||
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
|
||||
|
||||
template <int cond, class A, class B>
|
||||
struct ct_if { typedef ct_if_error type; };
|
||||
template <class A, class B>
|
||||
struct ct_if<1, A, B> { typedef A type; };
|
||||
template <class A, class B>
|
||||
struct ct_if<0, A, B> { typedef B type; };
|
||||
|
||||
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
|
||||
|
||||
35
include/boost/visit_each.hpp
Normal file
35
include/boost/visit_each.hpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// Boost.Signals library
|
||||
//
|
||||
// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
|
||||
//
|
||||
// Permission to copy, use, sell and distribute this software is granted
|
||||
// provided this copyright notice appears in all copies.
|
||||
// Permission to modify the code and to distribute modified code is granted
|
||||
// provided this copyright notice appears in all copies, and a notice
|
||||
// that the code was modified is included with the copyright notice.
|
||||
//
|
||||
// This software is provided "as is" without express or implied warranty,
|
||||
// and with no claim as to its suitability for any purpose.
|
||||
|
||||
// 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