Compare commits

...

102 Commits

Author SHA1 Message Date
nobody
706d654ebc This commit was manufactured by cvs2svn to create branch 'mplbook'.
[SVN r21831]
2004-01-19 20:45:34 +00:00
Dave Abrahams
2fe7fd95d2 Kill off outer cv-stripping of Dereferenceable
[SVN r21696]
2004-01-13 19:18:42 +00:00
Dave Abrahams
0096bf2291 Updated pointee and indirect_reference so that pointee represents the
immutability of the pointed-to type via const qualification.  The
pointee of a proxy-based iterator will be const qualified unless a
mutable reference to the value_type can be bound to the returned
proxy.

Added a test for pointee

Fixed iterator_facade so operator[] result type computation didn't
cause a problem with abstract types.

Updated iterator_facade operator[] docs for accuracy.

Allowed Borland to simply fail the indirect_iterator_member_types test
because of its lame const-dropping, instead of trying to work around
it.


[SVN r21579]
2004-01-11 00:03:09 +00:00
Dave Abrahams
9ab05a600a Added traits:
is_incrementable.hpp: checks whether ++x is well-formed

   pointee.hpp: value_type of iterators or smart pointers

   indirect_reference.hpp: reference type of iterators or smart pointers

indirect_iterator.hpp
indirect_iterator_member_types.cpp

   Use pointee/indirect_reference to select value/reference type.

iterator_concepts.hpp: Fixed interoperable test.  Hardly tests enough, but it's a start

minimum_category.hpp: Better error messages for vc6

indirect_iterator_test.cpp: Workarounds for compilers without SFINAE

static_assert_same.hpp: Informative error reports; added a macro.

zip_iterator_test.hpp: Added missing #include

Jamfile: made zip_iterator test pass with vc6/stlport


[SVN r21514]
2004-01-06 17:35:36 +00:00
John Maddock
1fbad0fe2c Added missing <assert.h> include.
[SVN r21417]
2003-12-29 13:42:25 +00:00
Peter Dimov
1fa91744d4 _MSC_VER use clarified.
[SVN r20992]
2003-11-28 15:35:21 +00:00
Eric Friedman
8715141657 Renamed boost::empty to boost::blank.
[SVN r20676]
2003-11-05 02:35:12 +00:00
Dave Abrahams
d562044910 Handle non-lvalue iterators properly
[SVN r20585]
2003-11-02 05:37:38 +00:00
John Maddock
187c393d0c Updated licence
[SVN r20321]
2003-10-09 10:18:17 +00:00
Douglas Gregor
61ab827c49 Boost.Signals now uses the official Boost license
[SVN r20236]
2003-10-01 04:34:38 +00:00
Dave Abrahams
9223a385a6 Bugfix from Thorsten Ottosen <nesotto-at-cs.auc.dk>
[SVN r20187]
2003-09-25 19:30:53 +00:00
Eric Friedman
f7d6abb21e Removed unnecessary workaround.
[SVN r20055]
2003-09-14 20:39:21 +00:00
Eric Friedman
b2de7f6888 Minor fix.
[SVN r20043]
2003-09-13 21:01:44 +00:00
Beman Dawes
5d116e0057 Change license message to reference Boost Software License
[SVN r20038]
2003-09-12 17:09:29 +00:00
Dave Abrahams
d536934458 Added nested typedefs in iterator_traits<int> for ETI cutoff
[SVN r19920]
2003-09-04 21:14:27 +00:00
Eric Friedman
4cbe12240a Removed inappropriate has_nothrow_constructor specialization.
[SVN r19895]
2003-09-01 07:52:51 +00:00
Eric Friedman
190b0bf58b Added type_traits specializations.
[SVN r19894]
2003-09-01 07:51:13 +00:00
Eric Friedman
463f382482 Moved reference_content to boost/detail from variant/detail.
[SVN r19884]
2003-08-31 01:59:15 +00:00
Dave Abrahams
b3edcaebb3 Remove flotsam #includes
[SVN r19855]
2003-08-29 12:12:08 +00:00
Dave Abrahams
665f18d2b7 Removed code-breaking change from boost/detail/iterator.hpp and
corresponding workarounds from tests.

Added permutation_iterator_test to the suite after fixing it up -- it
was riddled with bugs!


[SVN r19841]
2003-08-28 20:18:51 +00:00
Dave Abrahams
092c5f5b52 Moved to much cleaner system of using BOOST_TT_BROKEN_COMPILER_SPEC
for handling vc6/7 deficiencies with iterator_traits.

Fixed a bug in iterator_facade which was causing incomplete types to
be passed through is_convertible.

Reinstated libs/utility/iterator_traits_test.cpp


[SVN r19840]
2003-08-28 16:52:02 +00:00
Eric Friedman
f980329354 Use BOOST_NO_STD_LOCALE to detect when needed.
[SVN r19331]
2003-07-28 14:22:47 +00:00
Eric Friedman
ac460707c9 Added BOOST_TEMPLATED_STREAM_* helper macros.
[SVN r19312]
2003-07-26 04:26:58 +00:00
John Maddock
7e4ad9c654 added needed include of <new>
[SVN r18949]
2003-07-06 10:52:06 +00:00
Peter Dimov
11adf72ff6 -Wundef fixes.
[SVN r18788]
2003-06-12 17:09:24 +00:00
John Maddock
7a092ba5f9 Added tentative fix for sunpro
[SVN r18595]
2003-05-29 11:18:35 +00:00
Gennaro Prota
ab34b61206 removed superfluous spaces
[SVN r18271]
2003-04-16 22:55:23 +00:00
Gennaro Prota
b0b37ef724 "envelope" for non-type template parameters (useful to workaround compiler bugs)
[SVN r18270]
2003-04-16 22:51:39 +00:00
Dave Abrahams
69c7068028 Small changes to support new iterator adaptors in sandbox
[SVN r18212]
2003-04-09 11:57:59 +00:00
Peter Dimov
124be84389 Fixes for Comeau with Borland as backend.
[SVN r17588]
2003-02-22 13:40:23 +00:00
Peter Dimov
0caf4bb53e Made the default page size 512 (g++ 2.96 on Red Hat 7.2 dislikes 496.)
[SVN r17272]
2003-02-07 19:06:28 +00:00
Peter Dimov
7f668adbcd Added BOOST_QA_PAGE_SIZE.
[SVN r17270]
2003-02-07 18:43:48 +00:00
Peter Dimov
d6fbac9ba7 Quick_allocator updates.
[SVN r17267]
2003-02-07 15:08:52 +00:00
Peter Dimov
8f71074339 Dave's quick_allocator added, #define BOOST_SP_USE_QUICK_ALLOCATOR to make shared_ptr use it.
[SVN r17087]
2003-01-30 14:20:22 +00:00
John Maddock
1f52127735 Fixed macro usage
[SVN r16752]
2003-01-05 12:12:39 +00:00
Beman Dawes
48507564a9 add or update See www.boost.org comments
[SVN r16708]
2002-12-27 16:51:53 +00:00
Dave Abrahams
8d549f45fd Workarounds for broken RogueWave lib that comes with Sun
[SVN r16509]
2002-12-04 15:52:33 +00:00
Peter Dimov
c1f144e5d4 Major changes to shared_ptr and weak_ptr
[SVN r16314]
2002-11-18 14:37:02 +00:00
Dave Abrahams
53ba30e0c9 add missing #include
[SVN r16171]
2002-11-09 02:39:38 +00:00
Dave Abrahams
9aead1823b More fixes, better error messages, etc.
[SVN r16170]
2002-11-09 02:37:54 +00:00
Dave Abrahams
c14ee17601 Final patches for MSVC6
[SVN r16166]
2002-11-08 17:23:06 +00:00
Dave Abrahams
2bca71488b Works with MSVC and Intel5 now. Thanks, Aleksey!!
[SVN r16165]
2002-11-08 17:08:17 +00:00
Dave Abrahams
1f335d30ba Cleanups on boost::iterator_traits<>
Broke MSVC though :(


[SVN r16157]
2002-11-08 06:57:31 +00:00
Aleksey Gurtovoy
a38297a6cc Borland fix
[SVN r15360]
2002-09-16 04:10:29 +00:00
Peter Dimov
72ca3d7d9f Switched to <boost/detail/lightweight_test.hpp> for testing.
[SVN r14932]
2002-08-16 16:41:16 +00:00
Dave Abrahams
28432648e0 Fix unversioned VC++ checks
[SVN r14436]
2002-07-13 12:26:19 +00:00
Dave Abrahams
e69140d3f3 Workaround BOOST_MSVC_STD_ITERATOR misconfiguration; add MSVC6 specificity
[SVN r14047]
2002-05-28 20:25:51 +00:00
John Maddock
00f6a9751a Fixed buggy variable usage.
[SVN r14019]
2002-05-23 11:41:44 +00:00
Douglas Gregor
9663499093 Added Boost.Signals library
[SVN r13964]
2002-05-17 15:28:22 +00:00
Beman Dawes
d9d6a970cf add BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE
[SVN r13721]
2002-05-07 15:15:30 +00:00
Jens Maurer
5efbcbea28 BOOST_NO_LIMITS should not be used by user code; use <boost/limits.hpp> instead
BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS should not be defined when
BOOST_NO_LIMITS is defined


[SVN r13340]
2002-04-01 18:57:43 +00:00
John Maddock
01448d3373 Added missing include guards.
[SVN r13335]
2002-04-01 11:47:54 +00:00
John Maddock
15a5375b14 Added support for compilers with no exception handling support.
[SVN r12758]
2002-02-08 12:44:43 +00:00
Ralf W. Grosse-Kunstleve
09e0b2e072 inserted: missing typename (EDG 245 diagnostics)
[SVN r12410]
2002-01-22 00:35:37 +00:00
Dave Abrahams
08e37c5ccc initial checkin
[SVN r12388]
2002-01-21 00:49:14 +00:00
Dave Abrahams
19201a4bb9 Cleared out bogus flotsam
[SVN r12350]
2002-01-19 02:21:24 +00:00
John Maddock
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
Dave Abrahams
71790af7f6 Changed name of "bind" to "select" to avoid problems with MSVC.
[SVN r11338]
2001-10-04 19:56:07 +00:00
Jens Maurer
59099cadf6 fix parameter name
[SVN r11281]
2001-09-26 18:34:57 +00:00
John Maddock
695b3059bd More fixes resulting from the new config
[SVN r11182]
2001-09-21 11:35:54 +00:00
John Maddock
3a4ed6ef7c Fixed misplaced std:: prefix (typo from last checkin)
[SVN r11166]
2001-09-20 11:46:26 +00:00
John Maddock
63b5e51676 First round of config fixes
[SVN r11146]
2001-09-19 11:48:51 +00:00
John Maddock
8c6c8f9604 commit of split-config, including any changes required to existing libraries (mainly regex).
[SVN r11138]
2001-09-18 11:13:39 +00:00
Jeremy Siek
865bc7d803 fixed inheritance
[SVN r11067]
2001-09-07 20:11:41 +00:00
Jeremy Siek
0ea958903a workaround for Solaris Forte 6
[SVN r11060]
2001-09-07 16:29:29 +00:00
Darin Adler
e027048eb6 Added workarounds for MPW C++.
[SVN r10799]
2001-08-07 17:11:24 +00:00
Jens Maurer
75fb29a3b7 fix duplicate typedef
[SVN r10597]
2001-07-12 17:40:38 +00:00
Beman Dawes
8f9b1e35bd Make report_exception() inline (John Maddock, Jesse Jones)
[SVN r10322]
2001-06-13 14:41:10 +00:00
Jeremy Siek
c21dc776d1 changed include guard for missing ostream to include g++ 2.96 (had been
set for 2.95 and lower)


[SVN r10298]
2001-06-08 17:47:29 +00:00
Jens Maurer
1ee4d8ac0d add HP aCC workaround
[SVN r10019]
2001-05-05 19:57:09 +00:00
Jeremy Siek
69dccc47b5 rolled back changes, value_type can not be an abstract base class
[SVN r9583]
2001-03-19 16:56:32 +00:00
Jeremy Siek
cf8fe4f2b1 fixed is_named_param_list to handle case when X is a reference type
[SVN r9572]
2001-03-18 02:17:22 +00:00
Jeremy Siek
66f30e813e changed to use pointer with is_convertible
[SVN r9570]
2001-03-17 21:54:04 +00:00
Dave Abrahams
863361ded0 untabified
[SVN r9514]
2001-03-09 02:37:01 +00:00
Jeremy Siek
fe148355a2 fixed for borland
[SVN r9508]
2001-03-08 21:12:30 +00:00
Jeremy Siek
be12189340 removed use of yes_type/no_type, not needed for borland workaround
[SVN r9507]
2001-03-08 20:58:51 +00:00
Jeremy Siek
01426d35f3 fixed bug in named template parameters, params following a named
template must get their values from the named template


[SVN r9495]
2001-03-08 19:03:08 +00:00
Jeremy Siek
a8ae9d9941 new file
[SVN r9488]
2001-03-08 16:33:40 +00:00
Dave Abrahams
1b51ce460c More attempted fixes for Intel C++
[SVN r9406]
2001-03-04 15:08:17 +00:00
Dave Abrahams
aab735c64e Put all implementation into namespace boost::detail::iterator_traits_. Some
progress made on fixes for Intel compiler.


[SVN r9389]
2001-03-03 05:11:06 +00:00
Jeremy Siek
83b8fcefc7 Changed BOOST_MSVC to BOOST_MSVC_STD_ITERATOR in a few places.
[SVN r9383]
2001-03-02 23:45:03 +00:00
Beman Dawes
6b15777c8f Initial commit
[SVN r9370]
2001-03-01 15:45:41 +00:00
Beman Dawes
7c91125060 Boost Test Library initial commit
[SVN r9364]
2001-02-28 21:39:56 +00:00
Dave Abrahams
03b1bb7a1e Updated documentation
[SVN r9283]
2001-02-19 22:58:12 +00:00
Dave Abrahams
58bff4af87 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.
[SVN r9282]
2001-02-19 22:51:32 +00:00
John Maddock
5044712ff6 type_traits: regression failure fixes from type traits changes...
[SVN r9249]
2001-02-18 11:43:01 +00:00
Dave Abrahams
2f6f7af430 Make it work with standard conforming iterators under raw VC6.
[SVN r9197]
2001-02-13 23:30:25 +00:00
Dave Abrahams
1e0e965f07 Clean away code which can never be used
[SVN r9134]
2001-02-11 19:44:54 +00:00
Dave Abrahams
7523daa905 Use BOOST_STATIC_CONSTANT
[SVN r9133]
2001-02-11 19:39:11 +00:00
Dave Abrahams
3cb4fe87a9 Rolled unspecialized template back in
[SVN r9116]
2001-02-11 16:12:13 +00:00
Dave Abrahams
dc1186e73f Rolled back ineffective Borland-specific code
[SVN r9115]
2001-02-11 16:11:24 +00:00
Dave Abrahams
d0f656c4da Rolled in supposed Borland fixes from John Maddock, but not seeing any
improvement yet


[SVN r9091]
2001-02-10 20:14:20 +00:00
Dave Abrahams
08a2ab3fe6 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


[SVN r9064]
2001-02-10 00:05:17 +00:00
Dave Abrahams
2947fb7051 Applied John Maddock's Borland patch Moving <true> specialization to unspecialized template
[SVN r9058]
2001-02-09 15:23:55 +00:00
Dave Abrahams
cd1eecd245 Add parens to appease Borland
[SVN r9043]
2001-02-09 03:30:12 +00:00
Dave Abrahams
9ac4d90d82 *** empty log message ***
[SVN r9029]
2001-02-08 04:44:19 +00:00
Dave Abrahams
a7ae27dc5b Added 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.


[SVN r9002]
2001-02-07 16:43:57 +00:00
Dave Abrahams
ddccb755f4 Removed useless #includes of standard library headers
[SVN r8993]
2001-02-07 04:52:58 +00:00
Dave Abrahams
8ffb174556 Initial Checkin
[SVN r8992]
2001-02-07 04:51:12 +00:00
Dave Abrahams
8b60ca8d0a Factored if_true out into boost/detail/select_type.hpp
[SVN r8991]
2001-02-07 04:49:32 +00:00
Jens Maurer
3cbecf5ddd fix bool logic bug introduced by Jeremy's compilation fixes
[SVN r8988]
2001-02-06 22:56:37 +00:00
Jeremy Siek
82af891892 ported to KAI C++
[SVN r8955]
2001-02-06 01:21:11 +00:00
6 changed files with 39 additions and 546 deletions

View File

@@ -1,206 +0,0 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// Boost versions of
//
// std::iterator_traits<>::iterator_category
// std::iterator_traits<>::difference_type
// std::distance()
//
// ...for all compilers and iterators
#ifndef ITERATOR_DWA122600_HPP_
# define ITERATOR_DWA122600_HPP_
# include <boost/config.hpp>
# include <boost/type_traits.hpp>
# include <iterator>
# include <cstddef>
// STLPort 4.0 and betas have a bug when debugging is enabled and there is no
// partial specialization: instead of an iterator_category typedef, the standard
// container iterators have _Iterator_category.
//
// Also, whether debugging is enabled or not, there is a broken specialization
// of std::iterator<output_iterator_tag,void,void,void,void> which has no
// typedefs but iterator_category.
# if defined(__SGI_STL_PORT) && (__SGI_STL_PORT <= 0x410) && !defined(__STL_CLASS_PARTIAL_SPECIALIZATION)
# ifdef __STL_DEBUG
# define BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
# endif
# define BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
# endif // STLPort <= 4.1b4 && no partial specialization
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
# include <vector>
# include <list>
# include <set>
# include <map>
# include <deque>
# include <slist>
# include <hash_map>
# include <hash_set>
# include <string>
# endif
namespace boost { namespace detail {
# if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
using std::iterator_traits;
using std::distance;
# else
// Workarounds for less-capable implementations
template <bool is_ptr> struct iterator_traits_select;
template <> struct iterator_traits_select<true>
{
template <class Ptr>
struct traits
{
typedef std::ptrdiff_t difference_type;
typedef std::random_access_iterator_tag iterator_category;
};
};
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
no_result bad_category_helper(...);
template <class C, class T> yes_result bad_category_helper(std::_DBG_iter<C,T>*);
template <bool has_bad_category_typedef> struct bad_category_select;
template <>
struct bad_category_select<true>
{
template <class Iterator>
struct category { typedef typename Iterator::_Iterator_category type; };
};
template <>
struct bad_category_select<false>
{
template <class Iterator>
struct category { typedef typename Iterator::iterator_category type; };
};
template <class Iterator>
struct iterator_category_select
{
private:
static Iterator p;
enum { has_bad_category
= sizeof(bad_category_helper(&p)) == sizeof(yes_result) };
typedef bad_category_select<has_bad_category> category_select;
public:
typedef typename category_select::template category<Iterator>::type type;
};
# endif
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
template <bool is_bad_output_iterator> struct bad_difference_select;
template <>
struct bad_difference_select<true>
{
template <class Iterator>
struct difference { typedef void type; };
};
template <>
struct bad_difference_select<false>
{
template <class Iterator>
struct difference { typedef typename Iterator::difference_type type; };
};
yes_result bad_output_iterator_helper(std::iterator<std::output_iterator_tag,void,void,void,void>*);
no_result bad_output_iterator_helper(...);
# endif
template <> struct iterator_traits_select<false>
{
template <class Iterator>
struct traits
# if defined(BOOST_NO_STD_ITERATOR_TRAITS)
{
# if defined(BOOST_MSVC) && !defined(__SGI_STL_PORT)
typedef typename Iterator::distance_type difference_type;
# elif !defined(BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION)
typedef typename Iterator::difference_type difference_type;
# else
private:
// static Iterator *p;
typedef bad_difference_select<
is_convertible<const volatile Iterator*,
const volatile std::iterator<std::output_iterator_tag,void,void,void,void>*
>::value> difference_type_select;
public:
typedef typename difference_type_select::template difference<Iterator>::type difference_type;
# endif
# if !defined(BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF)
typedef typename Iterator::iterator_category iterator_category;
# else
typedef typename iterator_category_select<Iterator>::type iterator_category;
# endif
};
# else
{
typedef typename std::iterator_traits<Iterator>::difference_type difference_type;
typedef typename std::iterator_traits<Iterator>::iterator_category iterator_category;
};
# endif
};
template <class Iterator>
struct iterator_traits
{
private:
typedef iterator_traits_select<is_pointer<remove_cv<Iterator>::type>::value> select;
typedef typename select::template traits<Iterator> traits;
public:
typedef typename traits::difference_type difference_type;
typedef typename traits::iterator_category iterator_category;
};
template <class Category>
struct distance_select {
template <class Iterator>
static typename ::boost::detail::iterator_traits<Iterator>::difference_type
distance(Iterator i1, const Iterator i2)
{
typename ::boost::detail::iterator_traits<Iterator>::difference_type result = 0;
while (i1 != i2)
{
++i1;
++result;
}
return result;
}
};
template <>
struct distance_select<std::random_access_iterator_tag> {
template <class Iterator>
static typename ::boost::detail::iterator_traits<Iterator>::difference_type
distance(const Iterator i1, const Iterator i2)
{
return i2 - i1;
}
};
template <class Iterator>
inline typename ::boost::detail::iterator_traits<Iterator>::difference_type
distance(const Iterator& first, const Iterator& last)
{
typedef typename ::boost::detail::iterator_traits<Iterator>::iterator_category iterator_category;
return distance_select<iterator_category>::distance(first, last);
}
# endif // workarounds
}}
# undef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
# undef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
#endif // ITERATOR_DWA122600_HPP_

View File

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

View File

@@ -0,0 +1,39 @@
// Copyright David Abrahams 2004. Use, modification and distribution is
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef INDIRECT_REFERENCE_DWA200415_HPP
# define INDIRECT_REFERENCE_DWA200415_HPP
// dereferenceable_traits provides access to the value_type and
// reference of a Dereferenceable type.
# include <boost/detail/is_incrementable.hpp>
# include <boost/iterator/iterator_traits.hpp>
# include <boost/type_traits/remove_cv.hpp>
# include <boost/mpl/apply_if.hpp>
# include <boost/pointee.hpp>
namespace boost {
namespace detail
{
template <class P>
struct smart_ptr_reference
{
typedef typename boost::pointee<P>::type& type;
};
}
template <class P>
struct indirect_reference
: mpl::apply_if<
detail::is_incrementable<P>
, iterator_reference<P>
, detail::smart_ptr_reference<P>
>
{
};
} // namespace boost
#endif // INDIRECT_REFERENCE_DWA200415_HPP

View File

@@ -1,12 +0,0 @@
// -*- C++ -*- forwarding header.
#ifndef BOOST_CSTDDEF_HPP
#define BOOST_CSTDDEF_HPP
#if defined(__sgi) && !defined(__GNUC__)
# include <stddef.h>
#else
# include <cstddef>
#endif
#endif

View File

@@ -1,101 +0,0 @@
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// The ct_if implementation that avoids partial specialization is
// based on the IF class by Ulrich W. Eisenecker and Krzysztof
// Czarnecki.
#ifndef BOOST_CT_IF_HPP
#define BOOST_CT_IF_HPP
#include <boost/config.hpp>
/*
There is a bug in the Borland compiler with regards to using
integers to specialize templates. This made it hard to use ct_if in
the graph library. Changing from 'ct_if' to 'ct_if_t' fixed the
problem.
*/
namespace boost {
struct ct_if_error { };
struct true_type { enum { value = true }; };
struct false_type { enum { value = false }; };
template <class A, class B>
struct ct_and { typedef false_type type; };
template <> struct ct_and<true_type,true_type> { typedef true_type type; };
template <class A> struct ct_not { typedef ct_if_error type; };
template <> struct ct_not<true_type> { typedef false_type type; };
template <> struct ct_not<false_type> { typedef true_type type; };
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <int cond, class A, class B>
struct ct_if { typedef ct_if_error type; };
template <class A, class B>
struct ct_if<1, A, B> { typedef A type; };
template <class A, class B>
struct ct_if<0, A, B> { typedef B type; };
template <class cond, class A, class B>
struct ct_if_t { typedef ct_if_error type; };
template <class A, class B>
struct ct_if_t<true_type, A, B> { typedef A type; };
template <class A, class B>
struct ct_if_t<false_type, A, B> { typedef B type; };
#else
namespace detail {
template <int condition, class A, class B> struct IF;
template <int condition> struct SlectSelector;
struct SelectFirstType;
struct SelectSecondType;
struct SelectFirstType {
template<class A, class B>
struct Template { typedef A type; };
};
struct SelectSecondType {
template<class A, class B>
struct Template { typedef B type; };
};
template<int condition>
struct SlectSelector {
typedef SelectFirstType type;
};
template <>
struct SlectSelector<0> {
typedef SelectSecondType type;
};
} // namespace detail
template<int condition, class A, class B>
struct ct_if
{
typedef typename detail::SlectSelector<condition>::type Selector;
typedef typename Selector::template Template<A, B>::type type;
};
template <class cond, class A, class B>
struct ct_if_t {
typedef typename ct_if<cond::value, A, B>::type type;
};
#endif
} // namespace boost
#endif // BOOST_CT_IF_HPP

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