Compare commits

..

15 Commits

Author SHA1 Message Date
c533e9e42a This commit was manufactured by cvs2svn to create branch
'compiler_supported_error_messages'.

[SVN r13249]
2002-03-22 12:16:42 +00:00
15a5375b14 Added support for compilers with no exception handling support.
[SVN r12758]
2002-02-08 12:44:43 +00:00
09e0b2e072 inserted: missing typename (EDG 245 diagnostics)
[SVN r12410]
2002-01-22 00:35:37 +00:00
08e37c5ccc initial checkin
[SVN r12388]
2002-01-21 00:49:14 +00:00
19201a4bb9 Cleared out bogus flotsam
[SVN r12350]
2002-01-19 02:21:24 +00:00
528fb22617 * Changed BOOST_RE_THREADS to BOOST_HAS_THREADS,
* Updated allocator code to use SGI node based allocator when available.


[SVN r11829]
2001-11-30 11:58:04 +00:00
71790af7f6 Changed name of "bind" to "select" to avoid problems with MSVC.
[SVN r11338]
2001-10-04 19:56:07 +00:00
59099cadf6 fix parameter name
[SVN r11281]
2001-09-26 18:34:57 +00:00
695b3059bd More fixes resulting from the new config
[SVN r11182]
2001-09-21 11:35:54 +00:00
3a4ed6ef7c Fixed misplaced std:: prefix (typo from last checkin)
[SVN r11166]
2001-09-20 11:46:26 +00:00
63b5e51676 First round of config fixes
[SVN r11146]
2001-09-19 11:48:51 +00:00
8c6c8f9604 commit of split-config, including any changes required to existing libraries (mainly regex).
[SVN r11138]
2001-09-18 11:13:39 +00:00
865bc7d803 fixed inheritance
[SVN r11067]
2001-09-07 20:11:41 +00:00
0ea958903a workaround for Solaris Forte 6
[SVN r11060]
2001-09-07 16:29:29 +00:00
e027048eb6 Added workarounds for MPW C++.
[SVN r10799]
2001-08-07 17:11:24 +00:00
5 changed files with 532 additions and 65 deletions

View File

@ -0,0 +1,276 @@
/*
*
* 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.
*
*/
#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

View 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_

View File

@ -31,6 +31,14 @@
# include <iostream> // workaround GNU missing ostream header
# 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
{
@ -52,10 +60,13 @@ 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
@ -75,15 +86,15 @@ namespace boost
catch ( const std::bad_alloc & ex )
{ 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 )
{ detail::report_exception( out, "std::bad_cast:", ex.what() ); }
catch ( const std::bad_typeid & ex )
{ detail::report_exception( out, "std::bad_typeid:", ex.what() ); }
# else
catch ( const std::bad_cast & ex )
catch ( const 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", "" ); }
# endif
@ -112,6 +123,7 @@ namespace boost
catch ( ... )
{ detail::report_exception( out, "unknown exception", "" ); }
#endif // BOOST_NO_EXCEPTIONS
if ( exception_thrown ) result = boost::exit_exception_failure;

View File

@ -252,42 +252,6 @@ 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>*);
@ -307,15 +271,6 @@ 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,

View File

@ -4,6 +4,11 @@
// "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
@ -20,7 +25,7 @@ namespace boost {
struct dummy_default_gen {
template <class Base, class Traits>
struct bind {
struct select {
typedef default_argument type;
};
};
@ -41,14 +46,14 @@ namespace boost {
struct choose_default {
template <class Arg, class DefaultGen, class Base, class Traits>
struct bind {
struct select {
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 {
template <class Arg, class DefaultGen, class Base, class Traits>
struct bind {
struct select {
typedef Arg type;
};
};
@ -81,7 +86,7 @@ namespace boost {
#endif
public:
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
@ -94,36 +99,38 @@ namespace boost {
};
struct choose_named_params {
template <class Prev> struct bind { typedef Prev type; };
template <class Prev> struct select { typedef Prev type; };
};
struct choose_default_arg {
template <class Prev> struct bind {
template <class Prev> struct select {
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 bind<PreviousArg>::type type;
typedef typename Selector::template select<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 "bind" with two
// have a single member class template named "select" 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 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
// boost/iterator_adaptors.hpp for an example usage. Also,
// applications of this macro must be placed in namespace
@ -132,7 +139,7 @@ namespace boost {
#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \
struct get_##TYPE##_from_named { \
template <class Base, class NamedParams, class Traits> \
struct bind { \
struct select { \
typedef typename NamedParams::traits NamedTraits; \
typedef typename NamedTraits::TYPE TYPE; \
typedef typename resolve_default<TYPE, \
@ -140,7 +147,7 @@ namespace boost {
}; \
}; \
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, \
default_##TYPE, Base, Traits>::type type; \
};\
@ -158,7 +165,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 bind<Base, X, Traits>::type type; \
typedef typename Selector::template select<Base, X, Traits>::type type; \
}; \
template <> struct default_generator<default_##TYPE> { \
typedef default_##TYPE type; \