mirror of
https://github.com/boostorg/detail.git
synced 2025-06-27 21:11:07 +02:00
Compare commits
1 Commits
svn-branch
...
boost-1.24
Author | SHA1 | Date | |
---|---|---|---|
dbbc405075 |
@ -1,280 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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
|
@ -1,217 +0,0 @@
|
||||
// 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_
|
@ -60,13 +60,10 @@ namespace boost
|
||||
int result = 0; // quiet compiler warnings
|
||||
bool exception_thrown = true; // avoid setting result for each excptn type
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
result = function_object();
|
||||
exception_thrown = false;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
// As a result of hard experience with strangely interleaved output
|
||||
@ -123,7 +120,6 @@ namespace boost
|
||||
|
||||
catch ( ... )
|
||||
{ detail::report_exception( out, "unknown exception", "" ); }
|
||||
#endif // BOOST_NO_EXCEPTIONS
|
||||
|
||||
if ( exception_thrown ) result = boost::exit_exception_failure;
|
||||
|
||||
@ -135,9 +131,8 @@ namespace boost
|
||||
<< "********** errors detected; see stdout for details ***********"
|
||||
<< std::endl;
|
||||
}
|
||||
#if !defined(BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE)
|
||||
else { out << std::flush << "no errors detected" << std::endl; }
|
||||
#endif
|
||||
|
||||
return result;
|
||||
} // catch_exceptions
|
||||
|
||||
|
@ -62,10 +62,14 @@
|
||||
# include <iterator>
|
||||
# include <cstddef>
|
||||
|
||||
# if defined(BOOST_MSVC_STD_ITERATOR) && !defined(__SGI_STL_PORT)
|
||||
# if defined(BOOST_MSVC_STD_ITERATOR)
|
||||
# include <xtree>
|
||||
# include <deque>
|
||||
# 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
|
||||
|
||||
|
||||
@ -106,7 +110,7 @@ template <> struct iterator_traits_select<true>
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef Ptr pointer;
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
#ifdef BOOST_MSVC
|
||||
// Keeps MSVC happy under certain circumstances. It seems class template default
|
||||
// arguments are partly instantiated even when not used when the class template
|
||||
// is the return type of a function template.
|
||||
@ -179,7 +183,7 @@ struct bad_output_iterator_select<false>
|
||||
};
|
||||
# endif
|
||||
|
||||
# if defined(BOOST_MSVC_STD_ITERATOR) && !defined(__SGI_STL_PORT)
|
||||
# if defined(BOOST_MSVC_STD_ITERATOR)
|
||||
|
||||
// We'll sort iterator types into one of these classifications, from which we
|
||||
// can determine the difference_type, pointer, reference, and value_type
|
||||
@ -248,6 +252,42 @@ no_type is_std_iterator_helper(...);
|
||||
template <class V, class D, class 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?
|
||||
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>*);
|
||||
@ -267,6 +307,15 @@ template<class T, class CharT, class Traits>
|
||||
yes_type is_ostream_iterator_helper(const volatile std::ostream_iterator<T,CharT,Traits>*);
|
||||
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>
|
||||
struct msvc_iterator_classification {
|
||||
BOOST_STATIC_CONSTANT(unsigned,
|
||||
@ -287,7 +336,7 @@ template <> struct iterator_traits_select<false>
|
||||
template <class Iterator>
|
||||
struct traits
|
||||
{
|
||||
# if defined(BOOST_MSVC_STD_ITERATOR) && !defined(__SGI_STL_PORT)
|
||||
# if defined(BOOST_MSVC_STD_ITERATOR)
|
||||
typedef msvc_traits_select<(
|
||||
msvc_iterator_classification<Iterator>::value
|
||||
)>::template traits_<Iterator> inner_traits;
|
||||
|
@ -4,11 +4,6 @@
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// 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
|
||||
#define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
||||
|
||||
@ -25,7 +20,7 @@ namespace boost {
|
||||
|
||||
struct dummy_default_gen {
|
||||
template <class Base, class Traits>
|
||||
struct select {
|
||||
struct bind {
|
||||
typedef default_argument type;
|
||||
};
|
||||
};
|
||||
@ -46,14 +41,14 @@ namespace boost {
|
||||
|
||||
struct choose_default {
|
||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||
struct select {
|
||||
struct bind {
|
||||
typedef typename default_generator<DefaultGen>::type Gen;
|
||||
typedef typename Gen::template select<Base,Traits>::type type;
|
||||
typedef typename Gen::template bind<Base,Traits>::type type;
|
||||
};
|
||||
};
|
||||
struct choose_arg {
|
||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||
struct select {
|
||||
struct bind {
|
||||
typedef Arg type;
|
||||
};
|
||||
};
|
||||
@ -86,7 +81,7 @@ namespace boost {
|
||||
#endif
|
||||
public:
|
||||
typedef typename Selector
|
||||
::template select<Arg, DefaultGen, Base, Traits>::type type;
|
||||
::template bind<Arg, DefaultGen, Base, Traits>::type type;
|
||||
};
|
||||
|
||||
// To differentiate an unnamed parameter from a traits generator
|
||||
@ -99,38 +94,36 @@ namespace boost {
|
||||
};
|
||||
|
||||
struct choose_named_params {
|
||||
template <class Prev> struct select { typedef Prev type; };
|
||||
template <class Prev> struct bind { typedef Prev type; };
|
||||
};
|
||||
struct choose_default_arg {
|
||||
template <class Prev> struct select {
|
||||
template <class Prev> struct bind {
|
||||
typedef detail::default_argument type;
|
||||
};
|
||||
};
|
||||
|
||||
template <bool Named> struct choose_default_dispatch_;
|
||||
template <> struct choose_default_dispatch_<true> {
|
||||
template <bool Named> struct choose_default_dispatch { };
|
||||
template <> struct choose_default_dispatch<true> {
|
||||
typedef choose_named_params type;
|
||||
};
|
||||
template <> struct choose_default_dispatch_<false> {
|
||||
template <> struct choose_default_dispatch<false> {
|
||||
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>
|
||||
struct choose_default_argument {
|
||||
enum { is_named = is_named_param_list<PreviousArg>::value };
|
||||
typedef typename choose_default_dispatch<is_named>::type Selector;
|
||||
typedef typename Selector::template select<PreviousArg>::type type;
|
||||
typedef typename Selector::template bind<PreviousArg>::type type;
|
||||
};
|
||||
|
||||
// This macro assumes that there is a class named default_##TYPE
|
||||
// defined before the application of the macro. This class should
|
||||
// have a single member class template named "select" with two
|
||||
// have a single member class template named "bind" with two
|
||||
// template parameters: the type of the class being created (e.g.,
|
||||
// the iterator_adaptor type when creating iterator adaptors) and
|
||||
// a traits class. The select class should have a single typedef
|
||||
// a traits class. The bind class should have a single typedef
|
||||
// named "type" that produces the default for TYPE. See
|
||||
// boost/iterator_adaptors.hpp for an example usage. Also,
|
||||
// applications of this macro must be placed in namespace
|
||||
@ -139,7 +132,7 @@ namespace boost {
|
||||
#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \
|
||||
struct get_##TYPE##_from_named { \
|
||||
template <class Base, class NamedParams, class Traits> \
|
||||
struct select { \
|
||||
struct bind { \
|
||||
typedef typename NamedParams::traits NamedTraits; \
|
||||
typedef typename NamedTraits::TYPE TYPE; \
|
||||
typedef typename resolve_default<TYPE, \
|
||||
@ -147,7 +140,7 @@ namespace boost {
|
||||
}; \
|
||||
}; \
|
||||
struct pass_thru_##TYPE { \
|
||||
template <class Base, class Arg, class Traits> struct select { \
|
||||
template <class Base, class Arg, class Traits> struct bind { \
|
||||
typedef typename resolve_default<Arg, \
|
||||
default_##TYPE, Base, Traits>::type type; \
|
||||
};\
|
||||
@ -165,7 +158,7 @@ namespace boost {
|
||||
enum { is_named = is_named_param_list<X>::value }; \
|
||||
typedef typename get_##TYPE##_dispatch<is_named>::type Selector; \
|
||||
public: \
|
||||
typedef typename Selector::template select<Base, X, Traits>::type type; \
|
||||
typedef typename Selector::template bind<Base, X, Traits>::type type; \
|
||||
}; \
|
||||
template <> struct default_generator<default_##TYPE> { \
|
||||
typedef default_##TYPE type; \
|
||||
|
@ -70,7 +70,9 @@
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/type_traits.hpp>
|
||||
# include <boost/detail/select_type.hpp>
|
||||
# include <boost/limits.hpp>
|
||||
# ifndef BOOST_NO_LIMITS
|
||||
# include <limits>
|
||||
# endif
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
@ -81,7 +83,7 @@ namespace boost { namespace detail {
|
||||
template <class Number>
|
||||
struct is_signed
|
||||
{
|
||||
#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC)
|
||||
BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0)));
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<Number>::is_signed);
|
||||
@ -135,7 +137,7 @@ namespace boost { namespace detail {
|
||||
private:
|
||||
typedef Integer integer_type;
|
||||
typedef std::numeric_limits<integer_type> x;
|
||||
# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
# ifdef BOOST_MSVC
|
||||
// for some reason, MSVC asserts when it shouldn't unless we make these
|
||||
// local definitions
|
||||
BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer);
|
||||
|
@ -1,35 +0,0 @@
|
||||
// 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