mirror of
https://github.com/boostorg/detail.git
synced 2025-06-28 21:41:07 +02:00
Compare commits
29 Commits
boost-1.21
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
2ed4dafddc | |||
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 |
280
include/boost/detail/allocator.hpp
Normal file
280
include/boost/detail/allocator.hpp
Normal file
@ -0,0 +1,280 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2001
|
||||||
|
* Dr John Maddock
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute and sell this software
|
||||||
|
* and its documentation for any purpose is hereby granted without fee,
|
||||||
|
* provided that the above copyright notice appear in all copies and
|
||||||
|
* that both that copyright notice and this permission notice appear
|
||||||
|
* in supporting documentation. Dr John Maddock makes no representations
|
||||||
|
* about the suitability of this software for any purpose.
|
||||||
|
* It is provided "as is" without express or implied warranty.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOOST_DETAIL_ALLOCATOR_HPP
|
||||||
|
#define BOOST_DETAIL_ALLOCATOR_HPP
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <cstdlib>
|
||||||
|
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||||
|
namespace std{
|
||||||
|
using ::ptrdiff_t;
|
||||||
|
using ::size_t;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// see if we have SGI alloc class:
|
||||||
|
#if defined(BOOST_NO_STD_ALLOCATOR) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__GLIBCPP__) || defined(__STL_CONFIG_H))
|
||||||
|
# define BOOST_HAVE_SGI_ALLOCATOR
|
||||||
|
# include <memory>
|
||||||
|
# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||||
|
namespace boost{ namespace detail{
|
||||||
|
typedef std::__sgi_alloc alloc_type;
|
||||||
|
}}
|
||||||
|
# else
|
||||||
|
namespace boost{ namespace detail{
|
||||||
|
typedef std::alloc alloc_type;
|
||||||
|
}}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace boost{ namespace detail{
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void allocator_construct(T* p, const T& t)
|
||||||
|
{ new (p) T(t); }
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void allocator_destroy(T* p)
|
||||||
|
{ p->~T(); }
|
||||||
|
|
||||||
|
} }
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_STD_ALLOCATOR)
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#define BOOST_DEFAULT_ALLOCATOR(T) std::allocator<T>
|
||||||
|
|
||||||
|
namespace boost{ namespace detail{
|
||||||
|
|
||||||
|
template <class T, class A>
|
||||||
|
struct rebind_allocator
|
||||||
|
{
|
||||||
|
typedef typename A::template rebind<T> binder;
|
||||||
|
typedef typename binder::other type;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#elif !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||||
|
|
||||||
|
// no std::allocator, but the compiler supports the necessary syntax,
|
||||||
|
// write our own allocator instead:
|
||||||
|
|
||||||
|
#define BOOST_DEFAULT_ALLOCATOR(T) ::boost::detail::allocator<T>
|
||||||
|
|
||||||
|
namespace boost{ namespace detail{
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class allocator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef T value_type;
|
||||||
|
typedef value_type * pointer;
|
||||||
|
typedef const T* const_pointer;
|
||||||
|
typedef T& reference;
|
||||||
|
typedef const T& const_reference;
|
||||||
|
typedef std::size_t size_type;
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
|
||||||
|
template <class U>
|
||||||
|
struct rebind
|
||||||
|
{
|
||||||
|
typedef allocator<U> other;
|
||||||
|
};
|
||||||
|
|
||||||
|
allocator(){}
|
||||||
|
|
||||||
|
template <class U>
|
||||||
|
allocator(const allocator<U>&){}
|
||||||
|
|
||||||
|
allocator(const allocator&){}
|
||||||
|
|
||||||
|
template <class U>
|
||||||
|
allocator& operator=(const allocator<U>&)
|
||||||
|
{ return *this; }
|
||||||
|
|
||||||
|
~allocator(){}
|
||||||
|
|
||||||
|
pointer address(reference x) { return &x; }
|
||||||
|
|
||||||
|
const_pointer address(const_reference x) const { return &x; }
|
||||||
|
|
||||||
|
pointer allocate(size_type n, const void* = 0)
|
||||||
|
{
|
||||||
|
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||||
|
return n != 0 ?
|
||||||
|
reinterpret_cast<pointer>(alloc_type::allocate(n * sizeof(value_type)))
|
||||||
|
: 0;
|
||||||
|
#else
|
||||||
|
return n != 0 ?
|
||||||
|
reinterpret_cast<pointer>(::operator new(n * sizeof(value_type)))
|
||||||
|
: 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void deallocate(pointer p, size_type n)
|
||||||
|
{
|
||||||
|
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||||
|
assert( (p == 0) == (n == 0) );
|
||||||
|
if (p != 0)
|
||||||
|
alloc_type::deallocate((void*)p, n);
|
||||||
|
#else
|
||||||
|
assert( (p == 0) == (n == 0) );
|
||||||
|
if (p != 0)
|
||||||
|
::operator delete((void*)p);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
size_type max_size() const
|
||||||
|
{ return size_t(-1) / sizeof(value_type); }
|
||||||
|
|
||||||
|
void construct(pointer p, const T& val) const
|
||||||
|
{ allocator_construct(p, val); }
|
||||||
|
|
||||||
|
void destroy(pointer p) const
|
||||||
|
{ allocator_destroy(p); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T, class A>
|
||||||
|
struct rebind_allocator
|
||||||
|
{
|
||||||
|
typedef typename A::template rebind<T> binder;
|
||||||
|
typedef typename binder::other type;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// no std::allocator, use workaround version instead,
|
||||||
|
// each allocator class must derive from a base class
|
||||||
|
// that allocates blocks of bytes:
|
||||||
|
|
||||||
|
#define BOOST_DEFAULT_ALLOCATOR(T) ::boost::detail::allocator_adapter<T, ::boost::detail::simple_alloc>
|
||||||
|
|
||||||
|
namespace boost{ namespace detail{
|
||||||
|
|
||||||
|
class simple_alloc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef void value_type;
|
||||||
|
typedef value_type * pointer;
|
||||||
|
typedef const void* const_pointer;
|
||||||
|
typedef std::size_t size_type;
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
|
||||||
|
simple_alloc(){}
|
||||||
|
simple_alloc(const simple_alloc&){}
|
||||||
|
|
||||||
|
~simple_alloc(){}
|
||||||
|
|
||||||
|
pointer allocate(size_type n, const void* = 0)
|
||||||
|
{
|
||||||
|
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||||
|
return n != 0 ?
|
||||||
|
reinterpret_cast<pointer>(alloc_type::allocate(n))
|
||||||
|
: 0;
|
||||||
|
#else
|
||||||
|
return n != 0 ?
|
||||||
|
reinterpret_cast<pointer>(::operator new(n))
|
||||||
|
: 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void deallocate(pointer p, size_type n)
|
||||||
|
{
|
||||||
|
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||||
|
assert( (p == 0) == (n == 0) );
|
||||||
|
if (p != 0)
|
||||||
|
alloc_type::deallocate((void*)p, n);
|
||||||
|
#else
|
||||||
|
assert( (p == 0) == (n == 0) );
|
||||||
|
if (p != 0)
|
||||||
|
::operator delete((void*)p);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T, class Base>
|
||||||
|
class allocator_adapter : public Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef T value_type;
|
||||||
|
typedef value_type * pointer;
|
||||||
|
typedef const T* const_pointer;
|
||||||
|
typedef T& reference;
|
||||||
|
typedef const T& const_reference;
|
||||||
|
typedef size_t size_type;
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
typedef Base base_type;
|
||||||
|
|
||||||
|
allocator_adapter(){}
|
||||||
|
allocator_adapter(const base_type& x) : Base(x){}
|
||||||
|
allocator_adapter& operator=(const base_type& x)
|
||||||
|
{
|
||||||
|
*(static_cast<base_type*>(this)) = x;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~allocator_adapter(){}
|
||||||
|
|
||||||
|
pointer address(reference x) { return &x; }
|
||||||
|
|
||||||
|
const_pointer address(const_reference x) const { return &x; }
|
||||||
|
|
||||||
|
pointer allocate(size_type n, const void* = 0)
|
||||||
|
{
|
||||||
|
return n != 0 ?
|
||||||
|
reinterpret_cast<pointer>(base_type::allocate(n * sizeof(value_type)))
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void deallocate(pointer p, size_type n)
|
||||||
|
{
|
||||||
|
assert( (p == 0) == (n == 0) );
|
||||||
|
if (p != 0)
|
||||||
|
static_cast<base_type*>(this)->deallocate((void*)p, n * sizeof(value_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
size_type max_size() const
|
||||||
|
{ return size_t(-1) / sizeof(value_type); }
|
||||||
|
|
||||||
|
void construct(pointer p, const T& val) const
|
||||||
|
{ allocator_construct(p, val); }
|
||||||
|
|
||||||
|
void destroy(pointer p) const
|
||||||
|
{ allocator_destroy(p); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T, class A>
|
||||||
|
struct rebind_allocator
|
||||||
|
{
|
||||||
|
typedef allocator_adapter<T, typename A::base_type> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // include guard
|
217
include/boost/detail/binary_search.hpp
Normal file
217
include/boost/detail/binary_search.hpp
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
// Copyright (c) 2000 David Abrahams. 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.
|
||||||
|
//
|
||||||
|
// Copyright (c) 1994
|
||||||
|
// Hewlett-Packard Company
|
||||||
|
//
|
||||||
|
// Permission to use, copy, modify, distribute and sell this software
|
||||||
|
// and its documentation for any purpose is hereby granted without fee,
|
||||||
|
// provided that the above copyright notice appear in all copies and
|
||||||
|
// that both that copyright notice and this permission notice appear
|
||||||
|
// in supporting documentation. Hewlett-Packard Company makes no
|
||||||
|
// representations about the suitability of this software for any
|
||||||
|
// purpose. It is provided "as is" without express or implied warranty.
|
||||||
|
//
|
||||||
|
// Copyright (c) 1996
|
||||||
|
// Silicon Graphics Computer Systems, Inc.
|
||||||
|
//
|
||||||
|
// Permission to use, copy, modify, distribute and sell this software
|
||||||
|
// and its documentation for any purpose is hereby granted without fee,
|
||||||
|
// provided that the above copyright notice appear in all copies and
|
||||||
|
// that both that copyright notice and this permission notice appear
|
||||||
|
// in supporting documentation. Silicon Graphics makes no
|
||||||
|
// representations about the suitability of this software for any
|
||||||
|
// purpose. It is provided "as is" without express or implied warranty.
|
||||||
|
//
|
||||||
|
#ifndef BINARY_SEARCH_DWA_122600_H_
|
||||||
|
# define BINARY_SEARCH_DWA_122600_H_
|
||||||
|
|
||||||
|
# include <boost/detail/iterator.hpp>
|
||||||
|
# include <utility>
|
||||||
|
|
||||||
|
namespace boost { namespace detail {
|
||||||
|
|
||||||
|
template <class ForwardIter, class Tp>
|
||||||
|
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
|
||||||
|
const Tp& val)
|
||||||
|
{
|
||||||
|
typedef detail::iterator_traits<ForwardIter> traits;
|
||||||
|
|
||||||
|
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||||
|
typename traits::difference_type half;
|
||||||
|
ForwardIter middle;
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
half = len >> 1;
|
||||||
|
middle = first;
|
||||||
|
std::advance(middle, half);
|
||||||
|
if (*middle < val) {
|
||||||
|
first = middle;
|
||||||
|
++first;
|
||||||
|
len = len - half - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
len = half;
|
||||||
|
}
|
||||||
|
return first;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ForwardIter, class Tp, class Compare>
|
||||||
|
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
|
||||||
|
const Tp& val, Compare comp)
|
||||||
|
{
|
||||||
|
typedef detail::iterator_traits<ForwardIter> traits;
|
||||||
|
|
||||||
|
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||||
|
typename traits::difference_type half;
|
||||||
|
ForwardIter middle;
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
half = len >> 1;
|
||||||
|
middle = first;
|
||||||
|
std::advance(middle, half);
|
||||||
|
if (comp(*middle, val)) {
|
||||||
|
first = middle;
|
||||||
|
++first;
|
||||||
|
len = len - half - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
len = half;
|
||||||
|
}
|
||||||
|
return first;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ForwardIter, class Tp>
|
||||||
|
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
|
||||||
|
const Tp& val)
|
||||||
|
{
|
||||||
|
typedef detail::iterator_traits<ForwardIter> traits;
|
||||||
|
|
||||||
|
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||||
|
typename traits::difference_type half;
|
||||||
|
ForwardIter middle;
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
half = len >> 1;
|
||||||
|
middle = first;
|
||||||
|
std::advance(middle, half);
|
||||||
|
if (val < *middle)
|
||||||
|
len = half;
|
||||||
|
else {
|
||||||
|
first = middle;
|
||||||
|
++first;
|
||||||
|
len = len - half - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return first;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ForwardIter, class Tp, class Compare>
|
||||||
|
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
|
||||||
|
const Tp& val, Compare comp)
|
||||||
|
{
|
||||||
|
typedef detail::iterator_traits<ForwardIter> traits;
|
||||||
|
|
||||||
|
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||||
|
typename traits::difference_type half;
|
||||||
|
ForwardIter middle;
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
half = len >> 1;
|
||||||
|
middle = first;
|
||||||
|
std::advance(middle, half);
|
||||||
|
if (comp(val, *middle))
|
||||||
|
len = half;
|
||||||
|
else {
|
||||||
|
first = middle;
|
||||||
|
++first;
|
||||||
|
len = len - half - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return first;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ForwardIter, class Tp>
|
||||||
|
std::pair<ForwardIter, ForwardIter>
|
||||||
|
equal_range(ForwardIter first, ForwardIter last, const Tp& val)
|
||||||
|
{
|
||||||
|
typedef detail::iterator_traits<ForwardIter> traits;
|
||||||
|
|
||||||
|
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||||
|
typename traits::difference_type half;
|
||||||
|
ForwardIter middle, left, right;
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
half = len >> 1;
|
||||||
|
middle = first;
|
||||||
|
std::advance(middle, half);
|
||||||
|
if (*middle < val) {
|
||||||
|
first = middle;
|
||||||
|
++first;
|
||||||
|
len = len - half - 1;
|
||||||
|
}
|
||||||
|
else if (val < *middle)
|
||||||
|
len = half;
|
||||||
|
else {
|
||||||
|
left = boost::detail::lower_bound(first, middle, val);
|
||||||
|
std::advance(first, len);
|
||||||
|
right = boost::detail::upper_bound(++middle, first, val);
|
||||||
|
return std::pair<ForwardIter, ForwardIter>(left, right);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return std::pair<ForwardIter, ForwardIter>(first, first);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ForwardIter, class Tp, class Compare>
|
||||||
|
std::pair<ForwardIter, ForwardIter>
|
||||||
|
equal_range(ForwardIter first, ForwardIter last, const Tp& val,
|
||||||
|
Compare comp)
|
||||||
|
{
|
||||||
|
typedef detail::iterator_traits<ForwardIter> traits;
|
||||||
|
|
||||||
|
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||||
|
typename traits::difference_type half;
|
||||||
|
ForwardIter middle, left, right;
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
half = len >> 1;
|
||||||
|
middle = first;
|
||||||
|
std::advance(middle, half);
|
||||||
|
if (comp(*middle, val)) {
|
||||||
|
first = middle;
|
||||||
|
++first;
|
||||||
|
len = len - half - 1;
|
||||||
|
}
|
||||||
|
else if (comp(val, *middle))
|
||||||
|
len = half;
|
||||||
|
else {
|
||||||
|
left = boost::detail::lower_bound(first, middle, val, comp);
|
||||||
|
std::advance(first, len);
|
||||||
|
right = boost::detail::upper_bound(++middle, first, val, comp);
|
||||||
|
return std::pair<ForwardIter, ForwardIter>(left, right);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return std::pair<ForwardIter, ForwardIter>(first, first);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ForwardIter, class Tp>
|
||||||
|
bool binary_search(ForwardIter first, ForwardIter last,
|
||||||
|
const Tp& val) {
|
||||||
|
ForwardIter i = boost::detail::lower_bound(first, last, val);
|
||||||
|
return i != last && !(val < *i);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ForwardIter, class Tp, class Compare>
|
||||||
|
bool binary_search(ForwardIter first, ForwardIter last,
|
||||||
|
const Tp& val,
|
||||||
|
Compare comp) {
|
||||||
|
ForwardIter i = boost::detail::lower_bound(first, last, val, comp);
|
||||||
|
return i != last && !comp(val, *i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}} // namespace boost::detail
|
||||||
|
|
||||||
|
#endif // BINARY_SEARCH_DWA_122600_H_
|
@ -8,6 +8,7 @@
|
|||||||
// See http://www.boost.org for updates, documentation, and revision history.
|
// See http://www.boost.org for updates, documentation, and revision history.
|
||||||
|
|
||||||
// Revision History
|
// Revision History
|
||||||
|
// 13 Jun 01 report_exception() made inline. (John Maddock, Jesse Jones)
|
||||||
// 26 Feb 01 Numerous changes suggested during formal review. (Beman)
|
// 26 Feb 01 Numerous changes suggested during formal review. (Beman)
|
||||||
// 25 Jan 01 catch_exceptions.hpp code factored out of cpp_main.cpp.
|
// 25 Jan 01 catch_exceptions.hpp code factored out of cpp_main.cpp.
|
||||||
// 22 Jan 01 Remove test_tools dependencies to reduce coupling.
|
// 22 Jan 01 Remove test_tools dependencies to reduce coupling.
|
||||||
@ -24,12 +25,20 @@
|
|||||||
#include <exception> // for exception, bad_exception
|
#include <exception> // for exception, bad_exception
|
||||||
#include <stdexcept> // for std exception hierarchy
|
#include <stdexcept> // for std exception hierarchy
|
||||||
#include <boost/cstdlib.hpp> // for exit codes
|
#include <boost/cstdlib.hpp> // for exit codes
|
||||||
# if __GNUC__ != 2 || __GNUC_MINOR__ > 95
|
# if __GNUC__ != 2 || __GNUC_MINOR__ > 96
|
||||||
# include <ostream> // for ostream
|
# include <ostream> // for ostream
|
||||||
# else
|
# else
|
||||||
# include <iostream> // workaround GNU missing ostream header
|
# include <iostream> // workaround GNU missing ostream header
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551)
|
||||||
|
# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#if defined(MPW_CPLUS) && (MPW_CPLUS <= 0x890)
|
||||||
|
# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
|
||||||
|
namespace std { class bad_typeid { }; }
|
||||||
|
# endif
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
@ -37,7 +46,7 @@ namespace boost
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
// A separate reporting function was requested during formal review.
|
// A separate reporting function was requested during formal review.
|
||||||
void report_exception( std::ostream & os,
|
inline void report_exception( std::ostream & os,
|
||||||
const char * name, const char * info )
|
const char * name, const char * info )
|
||||||
{ os << "\n** uncaught exception: " << name << " " << info << std::endl; }
|
{ os << "\n** uncaught exception: " << name << " " << info << std::endl; }
|
||||||
}
|
}
|
||||||
@ -51,10 +60,13 @@ namespace boost
|
|||||||
int result = 0; // quiet compiler warnings
|
int result = 0; // quiet compiler warnings
|
||||||
bool exception_thrown = true; // avoid setting result for each excptn type
|
bool exception_thrown = true; // avoid setting result for each excptn type
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
result = function_object();
|
result = function_object();
|
||||||
exception_thrown = false;
|
exception_thrown = false;
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
// As a result of hard experience with strangely interleaved output
|
// As a result of hard experience with strangely interleaved output
|
||||||
@ -74,15 +86,15 @@ namespace boost
|
|||||||
catch ( const std::bad_alloc & ex )
|
catch ( const std::bad_alloc & ex )
|
||||||
{ detail::report_exception( out, "std::bad_alloc:", ex.what() ); }
|
{ detail::report_exception( out, "std::bad_alloc:", ex.what() ); }
|
||||||
|
|
||||||
# if !defined(__BORLANDC__) || __BORLANDC__ > 0x0551
|
# ifndef BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
|
||||||
catch ( const std::bad_cast & ex )
|
catch ( const std::bad_cast & ex )
|
||||||
{ detail::report_exception( out, "std::bad_cast:", ex.what() ); }
|
{ detail::report_exception( out, "std::bad_cast:", ex.what() ); }
|
||||||
catch ( const std::bad_typeid & ex )
|
catch ( const std::bad_typeid & ex )
|
||||||
{ detail::report_exception( out, "std::bad_typeid:", ex.what() ); }
|
{ detail::report_exception( out, "std::bad_typeid:", ex.what() ); }
|
||||||
# else
|
# else
|
||||||
catch ( const std::bad_cast & ex )
|
catch ( const std::bad_cast & )
|
||||||
{ detail::report_exception( out, "std::bad_cast", "" ); }
|
{ detail::report_exception( out, "std::bad_cast", "" ); }
|
||||||
catch ( const std::bad_typeid & ex )
|
catch ( const std::bad_typeid & )
|
||||||
{ detail::report_exception( out, "std::bad_typeid", "" ); }
|
{ detail::report_exception( out, "std::bad_typeid", "" ); }
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@ -111,6 +123,7 @@ namespace boost
|
|||||||
|
|
||||||
catch ( ... )
|
catch ( ... )
|
||||||
{ detail::report_exception( out, "unknown exception", "" ); }
|
{ detail::report_exception( out, "unknown exception", "" ); }
|
||||||
|
#endif // BOOST_NO_EXCEPTIONS
|
||||||
|
|
||||||
if ( exception_thrown ) result = boost::exit_exception_failure;
|
if ( exception_thrown ) result = boost::exit_exception_failure;
|
||||||
|
|
||||||
@ -122,8 +135,9 @@ namespace boost
|
|||||||
<< "********** errors detected; see stdout for details ***********"
|
<< "********** errors detected; see stdout for details ***********"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
#if !defined(BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE)
|
||||||
else { out << std::flush << "no errors detected" << std::endl; }
|
else { out << std::flush << "no errors detected" << std::endl; }
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
} // catch_exceptions
|
} // catch_exceptions
|
||||||
|
|
||||||
|
@ -62,14 +62,10 @@
|
|||||||
# include <iterator>
|
# include <iterator>
|
||||||
# include <cstddef>
|
# include <cstddef>
|
||||||
|
|
||||||
# if defined(BOOST_MSVC_STD_ITERATOR)
|
# if defined(BOOST_MSVC_STD_ITERATOR) && !defined(__SGI_STL_PORT)
|
||||||
# include <xtree>
|
# include <xtree>
|
||||||
# include <deque>
|
# include <deque>
|
||||||
# include <list>
|
# include <list>
|
||||||
# if 0 && defined(__ICL) // Re-enable this to pick up the Intel fixes where they left off
|
|
||||||
# include <iosfwd>
|
|
||||||
# include <memory>
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
||||||
@ -110,7 +106,7 @@ template <> struct iterator_traits_select<true>
|
|||||||
typedef std::ptrdiff_t difference_type;
|
typedef std::ptrdiff_t difference_type;
|
||||||
typedef std::random_access_iterator_tag iterator_category;
|
typedef std::random_access_iterator_tag iterator_category;
|
||||||
typedef Ptr pointer;
|
typedef Ptr pointer;
|
||||||
#ifdef BOOST_MSVC
|
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||||
// Keeps MSVC happy under certain circumstances. It seems class template default
|
// Keeps MSVC happy under certain circumstances. It seems class template default
|
||||||
// arguments are partly instantiated even when not used when the class template
|
// arguments are partly instantiated even when not used when the class template
|
||||||
// is the return type of a function template.
|
// is the return type of a function template.
|
||||||
@ -183,7 +179,7 @@ struct bad_output_iterator_select<false>
|
|||||||
};
|
};
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(BOOST_MSVC_STD_ITERATOR)
|
# if defined(BOOST_MSVC_STD_ITERATOR) && !defined(__SGI_STL_PORT)
|
||||||
|
|
||||||
// We'll sort iterator types into one of these classifications, from which we
|
// We'll sort iterator types into one of these classifications, from which we
|
||||||
// can determine the difference_type, pointer, reference, and value_type
|
// can determine the difference_type, pointer, reference, and value_type
|
||||||
@ -252,42 +248,6 @@ no_type is_std_iterator_helper(...);
|
|||||||
template <class V, class D, class C>
|
template <class V, class D, class C>
|
||||||
yes_type is_std_iterator_helper(const volatile std::iterator<V,D,C>*);
|
yes_type is_std_iterator_helper(const volatile std::iterator<V,D,C>*);
|
||||||
|
|
||||||
#if 0 && defined(__ICL) // re-enable this to pick up with the Intel C++ fixes where they left off
|
|
||||||
// for some reason, it's unable to make the deduction of derivation :(
|
|
||||||
template<class K, class Ty, class Kfn, class Pr, class A>
|
|
||||||
yes_type is_std_iterator_helper(const volatile typename std::_Tree<K,Ty,Kfn,Pr,A>::iterator*);
|
|
||||||
template<class Ty, class A>
|
|
||||||
yes_type is_std_iterator_helper(const volatile typename std::list<Ty,A>::iterator*);
|
|
||||||
template<class Ty, class A>
|
|
||||||
yes_type is_std_iterator_helper(const volatile typename std::deque<Ty,A>::iterator*);
|
|
||||||
|
|
||||||
template<class K, class Ty, class Kfn, class Pr, class A>
|
|
||||||
yes_type is_std_iterator_helper(const volatile typename std::_Tree<K,Ty,Kfn,Pr,A>::const_iterator*);
|
|
||||||
template<class Ty, class A>
|
|
||||||
yes_type is_std_iterator_helper(const volatile typename std::list<Ty,A>::const_iterator*);
|
|
||||||
template<class Ty, class A>
|
|
||||||
yes_type is_std_iterator_helper(const volatile typename std::deque<Ty,A>::const_iterator*);
|
|
||||||
|
|
||||||
template<class RI, class Ty, class Rt, class Pt, class D>
|
|
||||||
yes_type is_std_iterator_helper(const volatile std::reverse_iterator<RI,Ty,Rt,Pt,D>*);
|
|
||||||
template<class BI, class Ty, class Rt, class Pt, class D>
|
|
||||||
yes_type is_std_iterator_helper(const volatile std::reverse_bidirectional_iterator<BI,Ty,Rt,Pt,D>*);
|
|
||||||
template<class C>
|
|
||||||
yes_type is_std_iterator_helper(const volatile std::back_insert_iterator<C>*);
|
|
||||||
template<class C>
|
|
||||||
yes_type is_std_iterator_helper(const volatile std::front_insert_iterator<C>*);
|
|
||||||
template<class C>
|
|
||||||
yes_type is_std_iterator_helper(const volatile std::insert_iterator<C>*);
|
|
||||||
template<class U, class E, class Tr>
|
|
||||||
yes_type is_std_iterator_helper(const volatile std::istream_iterator<U,E,Tr>*);
|
|
||||||
template<class E, class Tr>
|
|
||||||
yes_type is_std_iterator_helper(const volatile std::istreambuf_iterator<E,Tr>*);
|
|
||||||
template<class E, class Tr>
|
|
||||||
yes_type is_std_iterator_helper(const volatile std::ostreambuf_iterator<E,Tr>*);
|
|
||||||
template<class Oi, class Ty>
|
|
||||||
yes_type is_std_iterator_helper(const volatile std::raw_storage_iterator<Oi,Ty>*);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Is the iterator derived from boost::iterator?
|
// Is the iterator derived from boost::iterator?
|
||||||
template <class C, class T, class D, class P, class R>
|
template <class C, class T, class D, class P, class R>
|
||||||
yes_type is_boost_iterator_helper(const volatile boost::iterator<C,T,D,P,R>*);
|
yes_type is_boost_iterator_helper(const volatile boost::iterator<C,T,D,P,R>*);
|
||||||
@ -307,15 +267,6 @@ template<class T, class CharT, class Traits>
|
|||||||
yes_type is_ostream_iterator_helper(const volatile std::ostream_iterator<T,CharT,Traits>*);
|
yes_type is_ostream_iterator_helper(const volatile std::ostream_iterator<T,CharT,Traits>*);
|
||||||
no_type is_ostream_iterator_helper(...);
|
no_type is_ostream_iterator_helper(...);
|
||||||
|
|
||||||
#if 0 && defined(__ICL)
|
|
||||||
// this static assertion highlights the first of a few problems getting this to
|
|
||||||
// work with the Intel compiler. We can get past it with the many definitions
|
|
||||||
// for is_std_iterator_helper above, but there are other failures.
|
|
||||||
template <bool> struct check;
|
|
||||||
template <> struct check<true> {};
|
|
||||||
check<(sizeof(is_std_iterator_helper((std::istream_iterator<int>*)0)) == sizeof(yes_type))> assertion;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct msvc_iterator_classification {
|
struct msvc_iterator_classification {
|
||||||
BOOST_STATIC_CONSTANT(unsigned,
|
BOOST_STATIC_CONSTANT(unsigned,
|
||||||
@ -336,7 +287,7 @@ template <> struct iterator_traits_select<false>
|
|||||||
template <class Iterator>
|
template <class Iterator>
|
||||||
struct traits
|
struct traits
|
||||||
{
|
{
|
||||||
# if defined(BOOST_MSVC_STD_ITERATOR)
|
# if defined(BOOST_MSVC_STD_ITERATOR) && !defined(__SGI_STL_PORT)
|
||||||
typedef msvc_traits_select<(
|
typedef msvc_traits_select<(
|
||||||
msvc_iterator_classification<Iterator>::value
|
msvc_iterator_classification<Iterator>::value
|
||||||
)>::template traits_<Iterator> inner_traits;
|
)>::template traits_<Iterator> inner_traits;
|
||||||
@ -348,7 +299,6 @@ template <> struct iterator_traits_select<false>
|
|||||||
# elif !defined(BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION)
|
# elif !defined(BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION)
|
||||||
typedef typename Iterator::difference_type difference_type;
|
typedef typename Iterator::difference_type difference_type;
|
||||||
typedef typename Iterator::value_type value_type;
|
typedef typename Iterator::value_type value_type;
|
||||||
typedef typename Iterator::difference_type difference_type;
|
|
||||||
typedef typename Iterator::pointer pointer;
|
typedef typename Iterator::pointer pointer;
|
||||||
typedef typename Iterator::reference reference;
|
typedef typename Iterator::reference reference;
|
||||||
# else
|
# else
|
||||||
|
@ -4,10 +4,16 @@
|
|||||||
// "as is" without express or implied warranty, and with no claim as
|
// "as is" without express or implied warranty, and with no claim as
|
||||||
// to its suitability for any purpose.
|
// to its suitability for any purpose.
|
||||||
|
|
||||||
|
// Revision History:
|
||||||
|
|
||||||
|
// 04 Oct 2001 David Abrahams
|
||||||
|
// Changed name of "bind" to "select" to avoid problems with MSVC.
|
||||||
|
|
||||||
#ifndef BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
#ifndef BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
||||||
#define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
#define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
||||||
|
|
||||||
#include <boost/type_traits/conversion_traits.hpp>
|
#include <boost/type_traits/conversion_traits.hpp>
|
||||||
|
#include <boost/type_traits/composite_traits.hpp> // for is_reference
|
||||||
#if defined(__BORLANDC__)
|
#if defined(__BORLANDC__)
|
||||||
#include <boost/type_traits/ice.hpp>
|
#include <boost/type_traits/ice.hpp>
|
||||||
#endif
|
#endif
|
||||||
@ -19,7 +25,7 @@ namespace boost {
|
|||||||
|
|
||||||
struct dummy_default_gen {
|
struct dummy_default_gen {
|
||||||
template <class Base, class Traits>
|
template <class Base, class Traits>
|
||||||
struct bind {
|
struct select {
|
||||||
typedef default_argument type;
|
typedef default_argument type;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -40,14 +46,14 @@ namespace boost {
|
|||||||
|
|
||||||
struct choose_default {
|
struct choose_default {
|
||||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||||
struct bind {
|
struct select {
|
||||||
typedef typename default_generator<DefaultGen>::type Gen;
|
typedef typename default_generator<DefaultGen>::type Gen;
|
||||||
typedef typename Gen::template bind<Base,Traits>::type type;
|
typedef typename Gen::template select<Base,Traits>::type type;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
struct choose_arg {
|
struct choose_arg {
|
||||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||||
struct bind {
|
struct select {
|
||||||
typedef Arg type;
|
typedef Arg type;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -80,7 +86,7 @@ namespace boost {
|
|||||||
#endif
|
#endif
|
||||||
public:
|
public:
|
||||||
typedef typename Selector
|
typedef typename Selector
|
||||||
::template bind<Arg, DefaultGen, Base, Traits>::type type;
|
::template select<Arg, DefaultGen, Base, Traits>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// To differentiate an unnamed parameter from a traits generator
|
// To differentiate an unnamed parameter from a traits generator
|
||||||
@ -93,36 +99,38 @@ namespace boost {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct choose_named_params {
|
struct choose_named_params {
|
||||||
template <class Prev> struct bind { typedef Prev type; };
|
template <class Prev> struct select { typedef Prev type; };
|
||||||
};
|
};
|
||||||
struct choose_default_arg {
|
struct choose_default_arg {
|
||||||
template <class Prev> struct bind {
|
template <class Prev> struct select {
|
||||||
typedef detail::default_argument type;
|
typedef detail::default_argument type;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <bool Named> struct choose_default_dispatch { };
|
template <bool Named> struct choose_default_dispatch_;
|
||||||
template <> struct choose_default_dispatch<true> {
|
template <> struct choose_default_dispatch_<true> {
|
||||||
typedef choose_named_params type;
|
typedef choose_named_params type;
|
||||||
};
|
};
|
||||||
template <> struct choose_default_dispatch<false> {
|
template <> struct choose_default_dispatch_<false> {
|
||||||
typedef choose_default_arg type;
|
typedef choose_default_arg type;
|
||||||
};
|
};
|
||||||
|
// The use of inheritance here is a Solaris Forte 6 workaround.
|
||||||
|
template <bool Named> struct choose_default_dispatch
|
||||||
|
: public choose_default_dispatch_<Named> { };
|
||||||
|
|
||||||
template <class PreviousArg>
|
template <class PreviousArg>
|
||||||
struct choose_default_argument {
|
struct choose_default_argument {
|
||||||
enum { is_named = is_named_param_list<PreviousArg>::value };
|
enum { is_named = is_named_param_list<PreviousArg>::value };
|
||||||
typedef typename choose_default_dispatch<is_named>::type Selector;
|
typedef typename choose_default_dispatch<is_named>::type Selector;
|
||||||
typedef typename Selector::template bind<PreviousArg>::type type;
|
typedef typename Selector::template select<PreviousArg>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This macro assumes that there is a class named default_##TYPE
|
// This macro assumes that there is a class named default_##TYPE
|
||||||
// defined before the application of the macro. This class should
|
// defined before the application of the macro. This class should
|
||||||
// have a single member class template named "bind" with two
|
// have a single member class template named "select" with two
|
||||||
// template parameters: the type of the class being created (e.g.,
|
// template parameters: the type of the class being created (e.g.,
|
||||||
// the iterator_adaptor type when creating iterator adaptors) and
|
// the iterator_adaptor type when creating iterator adaptors) and
|
||||||
// a traits class. The bind class should have a single typedef
|
// a traits class. The select class should have a single typedef
|
||||||
// named "type" that produces the default for TYPE. See
|
// named "type" that produces the default for TYPE. See
|
||||||
// boost/iterator_adaptors.hpp for an example usage. Also,
|
// boost/iterator_adaptors.hpp for an example usage. Also,
|
||||||
// applications of this macro must be placed in namespace
|
// applications of this macro must be placed in namespace
|
||||||
@ -131,7 +139,7 @@ namespace boost {
|
|||||||
#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \
|
#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \
|
||||||
struct get_##TYPE##_from_named { \
|
struct get_##TYPE##_from_named { \
|
||||||
template <class Base, class NamedParams, class Traits> \
|
template <class Base, class NamedParams, class Traits> \
|
||||||
struct bind { \
|
struct select { \
|
||||||
typedef typename NamedParams::traits NamedTraits; \
|
typedef typename NamedParams::traits NamedTraits; \
|
||||||
typedef typename NamedTraits::TYPE TYPE; \
|
typedef typename NamedTraits::TYPE TYPE; \
|
||||||
typedef typename resolve_default<TYPE, \
|
typedef typename resolve_default<TYPE, \
|
||||||
@ -139,7 +147,7 @@ namespace boost {
|
|||||||
}; \
|
}; \
|
||||||
}; \
|
}; \
|
||||||
struct pass_thru_##TYPE { \
|
struct pass_thru_##TYPE { \
|
||||||
template <class Base, class Arg, class Traits> struct bind { \
|
template <class Base, class Arg, class Traits> struct select { \
|
||||||
typedef typename resolve_default<Arg, \
|
typedef typename resolve_default<Arg, \
|
||||||
default_##TYPE, Base, Traits>::type type; \
|
default_##TYPE, Base, Traits>::type type; \
|
||||||
};\
|
};\
|
||||||
@ -157,7 +165,7 @@ namespace boost {
|
|||||||
enum { is_named = is_named_param_list<X>::value }; \
|
enum { is_named = is_named_param_list<X>::value }; \
|
||||||
typedef typename get_##TYPE##_dispatch<is_named>::type Selector; \
|
typedef typename get_##TYPE##_dispatch<is_named>::type Selector; \
|
||||||
public: \
|
public: \
|
||||||
typedef typename Selector::template bind<Base, X, Traits>::type type; \
|
typedef typename Selector::template select<Base, X, Traits>::type type; \
|
||||||
}; \
|
}; \
|
||||||
template <> struct default_generator<default_##TYPE> { \
|
template <> struct default_generator<default_##TYPE> { \
|
||||||
typedef default_##TYPE type; \
|
typedef default_##TYPE type; \
|
||||||
|
@ -70,9 +70,7 @@
|
|||||||
# include <boost/static_assert.hpp>
|
# include <boost/static_assert.hpp>
|
||||||
# include <boost/type_traits.hpp>
|
# include <boost/type_traits.hpp>
|
||||||
# include <boost/detail/select_type.hpp>
|
# include <boost/detail/select_type.hpp>
|
||||||
# ifndef BOOST_NO_LIMITS
|
# include <boost/limits.hpp>
|
||||||
# include <limits>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
namespace boost { namespace detail {
|
namespace boost { namespace detail {
|
||||||
|
|
||||||
@ -83,7 +81,7 @@ namespace boost { namespace detail {
|
|||||||
template <class Number>
|
template <class Number>
|
||||||
struct is_signed
|
struct is_signed
|
||||||
{
|
{
|
||||||
#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC)
|
#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||||
BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0)));
|
BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0)));
|
||||||
#else
|
#else
|
||||||
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<Number>::is_signed);
|
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<Number>::is_signed);
|
||||||
@ -137,7 +135,7 @@ namespace boost { namespace detail {
|
|||||||
private:
|
private:
|
||||||
typedef Integer integer_type;
|
typedef Integer integer_type;
|
||||||
typedef std::numeric_limits<integer_type> x;
|
typedef std::numeric_limits<integer_type> x;
|
||||||
# ifdef BOOST_MSVC
|
# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||||
// for some reason, MSVC asserts when it shouldn't unless we make these
|
// for some reason, MSVC asserts when it shouldn't unless we make these
|
||||||
// local definitions
|
// local definitions
|
||||||
BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer);
|
BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer);
|
||||||
|
@ -19,7 +19,9 @@ namespace boost { namespace detail {
|
|||||||
// Template class if_true -- select among 2 types based on a bool constant expression
|
// Template class if_true -- select among 2 types based on a bool constant expression
|
||||||
// Usage:
|
// Usage:
|
||||||
// typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
|
// typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
|
||||||
template <bool> struct if_true
|
|
||||||
|
// HP aCC cannot deal with missing names for template value parameters
|
||||||
|
template <bool b> struct if_true
|
||||||
{
|
{
|
||||||
template <class T, class F>
|
template <class T, class F>
|
||||||
struct then { typedef T type; };
|
struct then { typedef T type; };
|
||||||
|
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
|
||||||
|
|
||||||
|
#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