Compare commits

..

1 Commits

Author SHA1 Message Date
45dde06401 This commit was manufactured by cvs2svn to create branch 'regex-sub'.
[SVN r7754]
2000-09-21 03:34:33 +00:00
11 changed files with 2 additions and 1574 deletions

View File

@ -1,42 +0,0 @@
// boost/cstdlib.hpp header ------------------------------------------------//
// (C) Copyright Beman Dawes 2001. Permission to copy, use, modify, sell
// and distribute this software is granted provided this copyright notice
// appears in all copies. This software is provided "as is" without express or
// implied warranty, and with no claim as to its suitability for any purpose.
// See http://www.boost.org for updates and documentation.
// Revision History
// 26 Feb 01 Initial version (Beman Dawes)
#ifndef BOOST_CSTDLIB_HPP
#define BOOST_CSTDLIB_HPP
#include <cstdlib>
namespace boost
{
// The intent is to propose the following for addition to namespace std
// in the C++ Standard Library, and to then deprecate EXIT_SUCCESS and
// EXIT_FAILURE. As an implementation detail, this header defines the
// new constants in terms of EXIT_SUCCESS and EXIT_FAILURE. In a new
// standard, the constants would be implementation-defined, although it
// might be worthwhile to "suggest" (which a standard is allowed to do)
// values of 0 and 1 respectively.
// Rationale for having multiple failure values: some environments may
// wish to distinguish between different classes of errors.
// Rationale for choice of values: programs often use values < 100 for
// their own error reporting. Values > 255 are sometimes reserved for
// system detected errors. 200/201 were suggested to minimize conflict.
const int exit_success = EXIT_SUCCESS; // implementation-defined value
const int exit_failure = EXIT_FAILURE; // implementation-defined value
const int exit_exception_failure = 200; // otherwise uncaught exception
const int exit_test_failure = 201; // report_error or
// report_critical_error called.
}
#endif

View File

@ -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

View File

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

View File

@ -1,147 +0,0 @@
// boost/catch_exceptions.hpp -----------------------------------------------//
// (C) Copyright Beman Dawes 1995-2001. Permission to copy, use, modify, sell
// and distribute this software is granted provided this copyright notice
// appears in all copies. This software is provided "as is" without express or
// implied warranty, and with no claim as to its suitability for any purpose.
// See http://www.boost.org for updates, documentation, and 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)
// 25 Jan 01 catch_exceptions.hpp code factored out of cpp_main.cpp.
// 22 Jan 01 Remove test_tools dependencies to reduce coupling.
// 5 Nov 00 Initial boost version (Beman Dawes)
#ifndef BOOST_CATCH_EXCEPTIONS_HPP
#define BOOST_CATCH_EXCEPTIONS_HPP
// header dependencies are deliberately restricted to the standard library
// to reduce coupling to other boost libraries.
#include <string> // for string
#include <new> // for bad_alloc
#include <typeinfo> // for bad_cast, bad_typeid
#include <exception> // for exception, bad_exception
#include <stdexcept> // for std exception hierarchy
#include <boost/cstdlib.hpp> // for exit codes
# if __GNUC__ != 2 || __GNUC_MINOR__ > 96
# include <ostream> // for ostream
# else
# 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
{
namespace detail
{
// A separate reporting function was requested during formal review.
inline void report_exception( std::ostream & os,
const char * name, const char * info )
{ os << "\n** uncaught exception: " << name << " " << info << std::endl; }
}
// catch_exceptions ------------------------------------------------------//
template< class Generator > // Generator is function object returning int
int catch_exceptions( Generator function_object,
std::ostream & out, std::ostream & err )
{
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
// under some compilers, there is a lot of use of endl in the code below
// where a simple '\n' might appear to do.
// The rules for catch & arguments are a bit different from function
// arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't
// required, but it doesn't hurt and some programmers ask for it.
catch ( const char * ex )
{ detail::report_exception( out, "", ex ); }
catch ( const std::string & ex )
{ detail::report_exception( out, "", ex.c_str() ); }
// std:: exceptions
catch ( const std::bad_alloc & ex )
{ detail::report_exception( out, "std::bad_alloc:", ex.what() ); }
# 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 & )
{ detail::report_exception( out, "std::bad_cast", "" ); }
catch ( const std::bad_typeid & )
{ detail::report_exception( out, "std::bad_typeid", "" ); }
# endif
catch ( const std::bad_exception & ex )
{ detail::report_exception( out, "std::bad_exception:", ex.what() ); }
catch ( const std::domain_error & ex )
{ detail::report_exception( out, "std::domain_error:", ex.what() ); }
catch ( const std::invalid_argument & ex )
{ detail::report_exception( out, "std::invalid_argument:", ex.what() ); }
catch ( const std::length_error & ex )
{ detail::report_exception( out, "std::length_error:", ex.what() ); }
catch ( const std::out_of_range & ex )
{ detail::report_exception( out, "std::out_of_range:", ex.what() ); }
catch ( const std::range_error & ex )
{ detail::report_exception( out, "std::range_error:", ex.what() ); }
catch ( const std::overflow_error & ex )
{ detail::report_exception( out, "std::overflow_error:", ex.what() ); }
catch ( const std::underflow_error & ex )
{ detail::report_exception( out, "std::underflow_error:", ex.what() ); }
catch ( const std::logic_error & ex )
{ detail::report_exception( out, "std::logic_error:", ex.what() ); }
catch ( const std::runtime_error & ex )
{ detail::report_exception( out, "std::runtime_error:", ex.what() ); }
catch ( const std::exception & ex )
{ detail::report_exception( out, "std::exception:", ex.what() ); }
catch ( ... )
{ detail::report_exception( out, "unknown exception", "" ); }
#endif // BOOST_NO_EXCEPTIONS
if ( exception_thrown ) result = boost::exit_exception_failure;
if ( result != 0 && result != exit_success )
{
out << std::endl << "**** returning with error code "
<< result << std::endl;
err
<< "********** 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
} // boost
#endif // BOOST_CATCH_EXCEPTIONS_HPP

View File

@ -1,385 +0,0 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// Boost versions of
//
// std::iterator_traits<>::iterator_category
// std::iterator_traits<>::difference_type
// std::distance()
//
// ...for all compilers and iterators
//
// Additionally, if X is a pointer
// std::iterator_traits<X>::pointer
// Otherwise, if partial specialization is supported or X is not a pointer
// std::iterator_traits<X>::value_type
// std::iterator_traits<X>::pointer
// std::iterator_traits<X>::reference
//
// CAVEAT: When using the VC6 standard library, an iterator derived from
// std::iterator but not boost::iterator or from one supplied by the standard
// will always have pointer == const value_type* and reference == const
// value_type&, whether that's correct or not.
// See http://www.boost.org for most recent version including documentation.
// Revision History
// 04 Mar 2001 - More attempted fixes for Intel C++ (David Abrahams)
// 03 Mar 2001 - Put all implementation into namespace
// boost::detail::iterator_traits_. Some progress made on fixes
// for Intel compiler. (David Abrahams)
// 02 Mar 2001 - Changed BOOST_MSVC to BOOST_MSVC_STD_ITERATOR in a few
// places. (Jeremy Siek)
// 19 Feb 2001 - Improved workarounds for stock MSVC6; use yes_type and
// no_type from type_traits.hpp; stopped trying to remove_cv
// before detecting is_pointer, in honor of the new type_traits
// semantics. (David Abrahams)
// 13 Feb 2001 - Make it work with nearly all standard-conforming iterators
// under raw VC6. The one category remaining which will fail is
// that of iterators derived from std::iterator but not
// boost::iterator and which redefine difference_type.
// 11 Feb 2001 - Clean away code which can never be used (David Abrahams)
// 09 Feb 2001 - Always have a definition for each traits member, even if it
// can't be properly deduced. These will be incomplete types in
// some cases (undefined<void>), but it helps suppress MSVC errors
// elsewhere (David Abrahams)
// 07 Feb 2001 - Support for more of the traits members where possible, making
// this useful as a replacement for std::iterator_traits<T> when
// used as a default template parameter.
// 06 Feb 2001 - Removed useless #includes of standard library headers
// (David Abrahams)
#ifndef ITERATOR_DWA122600_HPP_
# define ITERATOR_DWA122600_HPP_
# include <boost/config.hpp>
# include <boost/type_traits.hpp>
# include <boost/iterator.hpp>
# include <iterator>
# include <cstddef>
# if defined(BOOST_MSVC_STD_ITERATOR) && !defined(__SGI_STL_PORT)
# include <xtree>
# include <deque>
# include <list>
# endif
// STLPort 4.0 and betas have a bug when debugging is enabled and there is no
// partial specialization: instead of an iterator_category typedef, the standard
// container iterators have _Iterator_category.
//
// Also, whether debugging is enabled or not, there is a broken specialization
// of std::iterator<output_iterator_tag,void,void,void,void> which has no
// typedefs but iterator_category.
# if defined(__SGI_STL_PORT) && (__SGI_STL_PORT <= 0x410) && !defined(__STL_CLASS_PARTIAL_SPECIALIZATION)
# ifdef __STL_DEBUG
# define BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
# endif
# define BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
# endif // STLPort <= 4.1b4 && no partial specialization
namespace boost { namespace detail {
# if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
using std::iterator_traits;
using std::distance;
# else
namespace iterator_traits_ {
// Workarounds for less-capable implementations
template <bool is_ptr> struct iterator_traits_select;
template <class T> struct undefined;
template <> struct iterator_traits_select<true>
{
template <class Ptr>
struct traits
{
typedef std::ptrdiff_t difference_type;
typedef std::random_access_iterator_tag iterator_category;
typedef Ptr pointer;
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// 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.
typedef undefined<void> value_type;
typedef undefined<void> reference;
#endif
};
};
typedef char yes_type;
typedef double no_type;
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
no_type bad_category_helper(...);
template <class C, class T> yes_type bad_category_helper(std::_DBG_iter<C,T>*);
template <bool has_bad_category_typedef> struct bad_category_select;
template <>
struct bad_category_select<true>
{
template <class Iterator>
struct category { typedef typename Iterator::_Iterator_category type; };
};
template <>
struct bad_category_select<false>
{
template <class Iterator>
struct category { typedef typename Iterator::iterator_category type; };
};
template <class Iterator>
struct iterator_category_select
{
private:
static Iterator p;
enum { has_bad_category
= sizeof(bad_category_helper(&p)) == sizeof(yes_type) };
typedef bad_category_select<has_bad_category> category_select;
public:
typedef typename category_select::template category<Iterator>::type type;
};
# endif
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
template <bool is_bad_output_iterator> struct bad_output_iterator_select;
template <>
struct bad_output_iterator_select<true>
{
template <class Iterator>
struct non_category_traits {
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
};
};
template <>
struct bad_output_iterator_select<false>
{
template <class Iterator>
struct non_category_traits {
typedef typename Iterator::value_type value_type;
typedef typename Iterator::difference_type difference_type;
typedef typename Iterator::pointer pointer;
typedef typename Iterator::reference reference;
};
};
# endif
# if defined(BOOST_MSVC_STD_ITERATOR) && !defined(__SGI_STL_PORT)
// We'll sort iterator types into one of these classifications, from which we
// can determine the difference_type, pointer, reference, and value_type
enum {
not_msvc_stdlib_iterator,
msvc_stdlib_const_iterator,
msvc_stdlib_mutable_iterator,
msvc_stdlib_ostream_iterator
};
template <unsigned> struct msvc_traits_select;
template <> struct msvc_traits_select<not_msvc_stdlib_iterator>
{
template <class Iterator>
struct traits_ // calling this "traits" will confuse VC.
{
typedef typename Iterator::difference_type difference_type;
typedef typename Iterator::value_type value_type;
typedef typename Iterator::pointer pointer;
typedef typename Iterator::reference reference;
};
};
template <> struct msvc_traits_select<msvc_stdlib_mutable_iterator>
{
template <class Iterator>
struct traits_
{
typedef typename Iterator::distance_type difference_type;
typedef typename Iterator::value_type value_type;
typedef value_type* pointer;
typedef value_type& reference;
};
};
template <> struct msvc_traits_select<msvc_stdlib_const_iterator>
{
template <class Iterator>
struct traits_
{
typedef typename Iterator::distance_type difference_type;
typedef typename Iterator::value_type value_type;
typedef const value_type* pointer;
typedef const value_type& reference;
};
};
template <> struct msvc_traits_select<msvc_stdlib_ostream_iterator>
{
template <class Iterator>
struct traits_
{
typedef typename Iterator::distance_type difference_type;
typedef typename Iterator::value_type value_type;
typedef void pointer;
typedef void reference;
};
};
// These functions allow us to detect which classification a given iterator type
// falls into.
// Is the iterator derived from std::iterator?
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>*);
// 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>*);
no_type is_boost_iterator_helper(...);
// Is the iterator one of the known mutable container iterators?
template<class K, class Ty, class Kfn, class Pr, class A>
yes_type is_mutable_iterator_helper(const volatile typename std::_Tree<K,Ty,Kfn,Pr,A>::iterator*);
template<class Ty, class A>
yes_type is_mutable_iterator_helper(const volatile typename std::list<Ty,A>::iterator*);
template<class Ty, class A>
yes_type is_mutable_iterator_helper(const volatile typename std::deque<Ty,A>::iterator*);
no_type is_mutable_iterator_helper(...);
// Is the iterator an ostream_iterator?
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(...);
template <class T>
struct msvc_iterator_classification {
BOOST_STATIC_CONSTANT(unsigned,
value = (sizeof(is_ostream_iterator_helper((T*)0)) == sizeof(yes_type))
? msvc_stdlib_ostream_iterator
: (sizeof(is_mutable_iterator_helper((T*)0)) == sizeof(yes_type))
? msvc_stdlib_mutable_iterator
: (sizeof(is_std_iterator_helper((T*)0)) == sizeof(yes_type)
&& sizeof(is_boost_iterator_helper((T*)0)) == sizeof(no_type))
? msvc_stdlib_const_iterator
: not_msvc_stdlib_iterator
);
};
# endif
template <> struct iterator_traits_select<false>
{
template <class Iterator>
struct traits
{
# if defined(BOOST_MSVC_STD_ITERATOR) && !defined(__SGI_STL_PORT)
typedef msvc_traits_select<(
msvc_iterator_classification<Iterator>::value
)>::template traits_<Iterator> inner_traits;
typedef typename inner_traits::difference_type difference_type;
typedef typename inner_traits::value_type value_type;
typedef typename inner_traits::pointer pointer;
typedef typename inner_traits::reference reference;
# elif !defined(BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION)
typedef typename Iterator::difference_type difference_type;
typedef typename Iterator::value_type value_type;
typedef typename Iterator::pointer pointer;
typedef typename Iterator::reference reference;
# else
typedef bad_output_iterator_select<
is_convertible<const volatile Iterator*,
const volatile std::iterator<std::output_iterator_tag,void,void,void,void>*
>::value> non_category_traits_select;
typedef non_category_traits_select::template non_category_traits<Iterator> non_category_traits;
public:
typedef typename non_category_traits::value_type value_type;
typedef typename non_category_traits::difference_type difference_type;
typedef typename non_category_traits::pointer pointer;
typedef typename non_category_traits::reference reference;
# endif
# if !defined(BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF)
typedef typename Iterator::iterator_category iterator_category;
# else
typedef typename iterator_category_select<Iterator>::type iterator_category;
# endif
};
};
} // namespace boost::detail::iterator_traits_
template <class Iterator>
struct iterator_traits
: iterator_traits_::iterator_traits_select<is_pointer<Iterator>::value>::template traits<Iterator>
{
private:
typedef typename iterator_traits_::iterator_traits_select<
is_pointer<remove_cv<Iterator>::type>::value>::template traits<Iterator> traits;
public:
// Why do I need to define these typedefs? It keeps MSVC happy somehow.
// Why don't I need to define the other typedefs? Who knows?!?
typedef typename traits::difference_type difference_type;
typedef typename traits::iterator_category iterator_category;
};
namespace iterator_traits_ {
template <class Category>
struct distance_select {
template <class Iterator>
static typename ::boost::detail::iterator_traits<Iterator>::difference_type
distance(Iterator i1, const Iterator i2)
{
typename ::boost::detail::iterator_traits<Iterator>::difference_type result = 0;
while (i1 != i2)
{
++i1;
++result;
}
return result;
}
};
template <>
struct distance_select<std::random_access_iterator_tag> {
template <class Iterator>
static typename ::boost::detail::iterator_traits<Iterator>::difference_type
distance(const Iterator i1, const Iterator i2)
{
return i2 - i1;
}
};
} // namespace boost::detail::iterator_traits_
template <class Iterator>
inline typename ::boost::detail::iterator_traits<Iterator>::difference_type
distance(const Iterator& first, const Iterator& last)
{
typedef typename ::boost::detail::iterator_traits<Iterator>::iterator_category iterator_category;
return iterator_traits_::distance_select<iterator_category>::distance(first, last);
}
# endif // workarounds
}} // namespace boost::detail
# undef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
# undef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
#endif // ITERATOR_DWA122600_HPP_

View File

@ -1,178 +0,0 @@
// (C) Copyright Jeremy Siek 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// 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
#include <boost/type_traits/conversion_traits.hpp>
#include <boost/type_traits/composite_traits.hpp> // for is_reference
#if defined(__BORLANDC__)
#include <boost/type_traits/ice.hpp>
#endif
namespace boost {
namespace detail {
struct default_argument { };
struct dummy_default_gen {
template <class Base, class Traits>
struct select {
typedef default_argument type;
};
};
// This class template is a workaround for MSVC.
template <class Gen> struct default_generator {
typedef detail::dummy_default_gen type;
};
template <class T> struct is_default {
enum { value = false };
typedef type_traits::no_type type;
};
template <> struct is_default<default_argument> {
enum { value = true };
typedef type_traits::yes_type type;
};
struct choose_default {
template <class Arg, class DefaultGen, class Base, class Traits>
struct select {
typedef typename default_generator<DefaultGen>::type Gen;
typedef typename Gen::template select<Base,Traits>::type type;
};
};
struct choose_arg {
template <class Arg, class DefaultGen, class Base, class Traits>
struct select {
typedef Arg type;
};
};
#if defined(__BORLANDC__)
template <class UseDefault>
struct choose_arg_or_default { typedef choose_arg type; };
template <>
struct choose_arg_or_default<type_traits::yes_type> {
typedef choose_default type;
};
#else
template <bool UseDefault>
struct choose_arg_or_default { typedef choose_arg type; };
template <>
struct choose_arg_or_default<true> {
typedef choose_default type;
};
#endif
template <class Arg, class DefaultGen, class Base, class Traits>
class resolve_default {
#if defined(__BORLANDC__)
typedef typename choose_arg_or_default<typename is_default<Arg>::type>::type Selector;
#else
// This usually works for Borland, but I'm seeing weird errors in
// iterator_adaptor_test.cpp when using this method.
enum { is_def = is_default<Arg>::value };
typedef typename choose_arg_or_default<is_def>::type Selector;
#endif
public:
typedef typename Selector
::template select<Arg, DefaultGen, Base, Traits>::type type;
};
// To differentiate an unnamed parameter from a traits generator
// we use is_convertible<X, iter_traits_gen_base>.
struct named_template_param_base { };
template <class X>
struct is_named_param_list {
enum { value = is_convertible<X, named_template_param_base>::value };
};
struct choose_named_params {
template <class Prev> struct select { typedef Prev type; };
};
struct choose_default_arg {
template <class Prev> struct select {
typedef detail::default_argument type;
};
};
template <bool Named> struct choose_default_dispatch_;
template <> struct choose_default_dispatch_<true> {
typedef choose_named_params type;
};
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;
};
// 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
// 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
// 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
// boost::detail.
#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \
struct get_##TYPE##_from_named { \
template <class Base, class NamedParams, class Traits> \
struct select { \
typedef typename NamedParams::traits NamedTraits; \
typedef typename NamedTraits::TYPE TYPE; \
typedef typename resolve_default<TYPE, \
default_##TYPE, Base, NamedTraits>::type type; \
}; \
}; \
struct pass_thru_##TYPE { \
template <class Base, class Arg, class Traits> struct select { \
typedef typename resolve_default<Arg, \
default_##TYPE, Base, Traits>::type type; \
};\
}; \
template <int NamedParam> \
struct get_##TYPE##_dispatch { }; \
template <> struct get_##TYPE##_dispatch<1> { \
typedef get_##TYPE##_from_named type; \
}; \
template <> struct get_##TYPE##_dispatch<0> { \
typedef pass_thru_##TYPE type; \
}; \
template <class Base, class X, class Traits> \
class get_##TYPE { \
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; \
}; \
template <> struct default_generator<default_##TYPE> { \
typedef default_##TYPE type; \
}
} // namespace detail
} // namespace boost
#endif // BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP

View File

@ -1,198 +0,0 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
//
// Template class is_signed and its documentation is:
// (C) Copyright Howard Hinnant 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
//
// Template class numeric_traits<Number> --
//
// Supplies:
//
// typedef difference_type -- a type used to represent the difference
// between any two values of Number.
//
// Support:
// 1. Not all specializations are supplied
//
// 2. Use of specializations that are not supplied will cause a
// compile-time error
//
// 3. Users are free to specialize numeric_traits for any type.
//
// 4. Right now, specializations are only supplied for integer types.
//
// 5. On implementations which do not supply compile-time constants in
// std::numeric_limits<>, only specializations for built-in integer types
// are supplied.
//
// 6. Handling of numbers whose range of representation is at least as
// great as boost::intmax_t can cause some differences to be
// unrepresentable in difference_type:
//
// Number difference_type
// ------ ---------------
// signed Number
// unsigned intmax_t
//
// template <class Number> typename numeric_traits<Number>::difference_type
// numeric_distance(Number x, Number y)
// computes (y - x), attempting to avoid overflows.
//
// See http://www.boost.org for most recent version including documentation.
// Revision History
// 11 Feb 2001 - Use BOOST_STATIC_CONSTANT (David Abrahams)
// 11 Feb 2001 - Rolled back ineffective Borland-specific code
// (David Abrahams)
// 10 Feb 2001 - Rolled in supposed Borland fixes from John Maddock, but
// not seeing any improvement yet (David Abrahams)
// 06 Feb 2001 - Factored if_true out into boost/detail/select_type.hpp
// (David Abrahams)
// 23 Jan 2001 - Fixed logic of difference_type selection, which was
// completely wack. In the process, added digit_traits<>
// to compute the number of digits in intmax_t even when
// not supplied by numeric_limits<>. (David Abrahams)
// 21 Jan 2001 - Created (David Abrahams)
#ifndef BOOST_NUMERIC_TRAITS_HPP_DWA20001901
# define BOOST_NUMERIC_TRAITS_HPP_DWA20001901
# include <boost/config.hpp>
# include <boost/cstdint.hpp>
# include <boost/static_assert.hpp>
# include <boost/type_traits.hpp>
# include <boost/detail/select_type.hpp>
# include <boost/limits.hpp>
namespace boost { namespace detail {
// Template class is_signed -- determine whether a numeric type is signed
// Requires that T is constructable from the literals -1 and 0. Compile-time
// error results if that requirement is not met (and thus signedness is not
// likely to have meaning for that type).
template <class Number>
struct is_signed
{
#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300
BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0)));
#else
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<Number>::is_signed);
#endif
};
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
// digit_traits - compute the number of digits in a built-in integer
// type. Needed for implementations on which numeric_limits is not specialized
// for intmax_t (e.g. VC6).
template <bool is_specialized> struct digit_traits_select;
// numeric_limits is specialized; just select that version of digits
template <> struct digit_traits_select<true>
{
template <class T> struct traits
{
BOOST_STATIC_CONSTANT(int, digits = std::numeric_limits<T>::digits);
};
};
// numeric_limits is not specialized; compute digits from sizeof(T)
template <> struct digit_traits_select<false>
{
template <class T> struct traits
{
BOOST_STATIC_CONSTANT(int, digits = (
sizeof(T) * std::numeric_limits<unsigned char>::digits
- (is_signed<T>::value ? 1 : 0))
);
};
};
// here's the "usable" template
template <class T> struct digit_traits
{
typedef digit_traits_select<
::std::numeric_limits<T>::is_specialized> selector;
typedef typename selector::template traits<T> traits;
BOOST_STATIC_CONSTANT(int, digits = traits::digits);
};
#endif
// Template class integer_traits<Integer> -- traits of various integer types
// This should probably be rolled into boost::integer_traits one day, but I
// need it to work without <limits>
template <class Integer>
struct integer_traits
{
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
private:
typedef Integer integer_type;
typedef std::numeric_limits<integer_type> x;
# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// for some reason, MSVC asserts when it shouldn't unless we make these
// local definitions
BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer);
BOOST_STATIC_CONSTANT(bool, is_specialized = x::is_specialized);
BOOST_STATIC_ASSERT(is_integer);
BOOST_STATIC_ASSERT(is_specialized);
# endif
public:
typedef typename
if_true<(int(x::is_signed)
&& (!int(x::is_bounded)
// digits is the number of no-sign bits
|| (int(x::digits) + 1 >= digit_traits<boost::intmax_t>::digits)))>::template then<
Integer,
typename if_true<(int(x::digits) + 1 < digit_traits<signed int>::digits)>::template then<
signed int,
typename if_true<(int(x::digits) + 1 < digit_traits<signed long>::digits)>::template then<
signed long,
// else
intmax_t
>::type>::type>::type difference_type;
#else
BOOST_STATIC_ASSERT(boost::is_integral<Integer>::value);
typedef typename
if_true<(sizeof(Integer) >= sizeof(intmax_t))>::template then<
typename if_true<(is_signed<Integer>::value)>::template then<
Integer,
intmax_t
>::type,
typename if_true<(sizeof(Integer) < sizeof(std::ptrdiff_t))>::template then<
std::ptrdiff_t,
intmax_t
>::type
>::type difference_type;
# endif
};
// Right now, only supports integers, but should be expanded.
template <class Number>
struct numeric_traits
{
typedef typename integer_traits<Number>::difference_type difference_type;
};
template <class Number>
typename numeric_traits<Number>::difference_type numeric_distance(Number x, Number y)
{
typedef typename numeric_traits<Number>::difference_type difference_type;
return difference_type(y) - difference_type(x);
}
}}
#endif // BOOST_NUMERIC_TRAITS_HPP_DWA20001901

View File

@ -1,37 +0,0 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
//
// See http://www.boost.org for most recent version including documentation.
// Revision History
// 09 Feb 01 Applied John Maddock's Borland patch Moving <true>
// specialization to unspecialized template (David Abrahams)
// 06 Feb 01 Created (David Abrahams)
#ifndef SELECT_TYPE_DWA20010206_HPP
# define SELECT_TYPE_DWA20010206_HPP
namespace boost { namespace detail {
// Template class if_true -- select among 2 types based on a bool constant expression
// Usage:
// typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
// HP aCC cannot deal with missing names for template value parameters
template <bool b> struct if_true
{
template <class T, class F>
struct then { typedef T type; };
};
template <>
struct if_true<false>
{
template <class T, class F>
struct then { typedef F type; };
};
}}
#endif // SELECT_TYPE_DWA20010206_HPP

View File

@ -12,44 +12,15 @@
#include <boost/config.hpp>
/*
There is a bug in the Borland compiler with regards to using
integers to specialize templates. This made it hard to use ct_if in
the graph library. Changing from 'ct_if' to 'ct_if_t' fixed the
problem.
*/
namespace boost {
struct ct_if_error { };
struct true_type { enum { value = true }; };
struct false_type { enum { value = false }; };
template <class A, class B>
struct ct_and { typedef false_type type; };
template <> struct ct_and<true_type,true_type> { typedef true_type type; };
template <class A> struct ct_not { typedef ct_if_error type; };
template <> struct ct_not<true_type> { typedef false_type type; };
template <> struct ct_not<false_type> { typedef true_type type; };
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <int cond, class A, class B>
struct ct_if { typedef ct_if_error type; };
template <class A, class B>
struct ct_if<1, A, B> { typedef A type; };
struct ct_if { typedef A type; };
template <class A, class B>
struct ct_if<0, A, B> { typedef B type; };
template <class cond, class A, class B>
struct ct_if_t { typedef ct_if_error type; };
template <class A, class B>
struct ct_if_t<true_type, A, B> { typedef A type; };
template <class A, class B>
struct ct_if_t<false_type, A, B> { typedef B type; };
#else
namespace detail {
@ -61,7 +32,7 @@ namespace boost {
struct SelectFirstType {
template<class A, class B>
struct Template { typedef A type; };
struct Template { typedef A type; };
};
struct SelectSecondType {
@ -88,11 +59,6 @@ namespace boost {
typedef typename Selector::template Template<A, B>::type type;
};
template <class cond, class A, class B>
struct ct_if_t {
typedef typename ct_if<cond::value, A, B>::type type;
};
#endif
} // namespace boost

View File

@ -1,19 +0,0 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use,
// modify, sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#ifndef BOOST_TYPE_DWA20010120_HPP
# define BOOST_TYPE_DWA20010120_HPP
namespace boost {
// Just a simple "type envelope". Useful in various contexts, mostly to work
// around some MSVC deficiencies.
template <class T>
struct type {};
}
#endif // BOOST_TYPE_DWA20010120_HPP

View File

@ -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