Compare commits

..

81 Commits

Author SHA1 Message Date
5e54c37940 Branch at revision 46530
[SVN r46531]
2008-06-19 18:57:10 +00:00
3c2c779258 simplified namespace issue with mbstate_t
[SVN r46408]
2008-06-15 17:01:43 +00:00
7c911e570f modification to correct error detected on stdxxx tests
[SVN r46392]
2008-06-14 17:46:41 +00:00
96b53f28a8 silenced warning about comma operator (C4913) for VC 8-9 with warning level 4
[SVN r45754]
2008-05-25 23:36:55 +00:00
7e259580c1 Apply NetBSD fix from issue #1922.
[SVN r45608]
2008-05-21 15:39:41 +00:00
3d539b76df Factored out boost/detail/lightweight_thread.hpp.
[SVN r44638]
2008-04-20 15:37:08 +00:00
e4054d843a spinlock_nt.hpp added, Cygwin fixes.
[SVN r44055]
2008-04-05 15:06:31 +00:00
9dcdea9efc Replaced all occurrences of non-ASCII copyright symbol with '(c)' for people using non-ASCII code pages
[SVN r43992]
2008-04-02 01:42:32 +00:00
715c05005f Added changes from David Deakins to enable compilation on Windows CE
[SVN r40679]
2007-11-02 09:17:02 +00:00
6443246b4b Boost 1.35 version of Boost.MultiIndex
allocator_utilities.hpp: added partial_std_allocator_wrapper::value_type
composite_key.hpp: used hash_fwd.hpp
auto_space.hpp: added support for non-standard allocators
bidir_node_iterator.hpp: moved friend-injected operators out of class
copy_map.hpp: added support for non-standard allocators
hash_index_args.hpp: removed deprecated use of <boost/functional/hash/hash.hpp>
hash_index_iterator.hpp: moved friend-injected operators our of class
hash_index_node.hpp: added support for non-standard allocators
header_holder.hpp:added support for non-standard allocators
index_base.hpp: added support for non-standard allocators, added modify_rollback, added small improvement to modify
index_loader.hpp: added support for non-standard allocators
index_matcher.hpp: added support for non-standard allocators
index_node_base.hpp: added support for non-standard allocators
iter_adaptor.hpp: added some out-of-class operators to alleviate a MSVC++ 6.0 problem
modify_key_adaptor.hpp: renamed some vars to accomudate broader usage scope
node_type.hpp: added support for non-standard allocators
ord_index_node.hpp: added support for non-standard allocators
ord_index_ops.hpp: implemented a more efficient equal_range
rnd_index_loader.hpp: added support for non-standard allocators
rnd_index_node.hpp: added support for non-standard allocators
rnd_index_ops.hpp: added support for non-standard allocators
rnd_index_ptr_array.hpp: added support for non-standard allocators
rnd_node_iterator.hpp: moved friend-injected operators out of class
seq_index_node.hpp: added support for non-standard allocators
seq_index_ops.hpp: added support for non-standard allocators
uintptr_type.hpp: added support for __int64
unbounded.hpp: fixed ODR problem
value_compare.hpp: fixed a small unefficiency
global_fun: initial commit
hashed_index.hpp: added support for non-standard allocators, added c[r]{begin|end}, [local_]iterator_to, rollback modify
identity_fwd.hpp: fixed wrong include guard name
key_extractors.hpp: added global_fun
mem_fun.hpp: removed superfluous =0's
ordered_index.hpp: added support for non-standard allocators, added c[r]{begin|end}, iterator_to, rollback modify, improved equal_range and range, added conformance to DR 233
random_access_index.hpp: added support for non-standard allocators, added c[r]{begin|end}, iterator_to, rollback modify, added conformance to 23.1.1/9
sequenced_index.hpp: added support for non-standard allocators, added c[r]{begin|end}, iterator_to, rollback modify, added conformance to 23.1.1/9, improved resize
multi_index_container.hpp: added support for non-standard allocators, improved ctor_args_list, rollback modify
acknowledgements.html: added entry for Boost 1.35
examples.html: renamed example 2, added B.IP example/composite_keys.cpp
future_work.html: removed entry on bimap
hash_indices.html: added c[r]{begin|end}, [local_]iterator_to, rollback modify
reference/index.html: added global_fun
reference/key_extraction.html: added global_fun, added technical correction
multi_index_container.html: added support for non-standard allocators
ord_indices.html: added c[r]{begin|end}, iterator_to, rollback modify
rnd_indices.html: added c[r]{begin|end}, iterator_to, rollback modify
seq_indices.html: added c[r]{begin|end}, iterator_to, rollback modify
release_notes.html: added entry for Boost 1.35
tests.html: added new serialization test file
basics.html: added rollback modify
creation.html: added support for non-standard allocators
tutorial/indices.html: added iterator_to
tutorial/key_extraction.html: added global_fun
composite_keys.cpp: fixed technicality
fun_key.cpp: was memfun_key.cpp, added global_fun
ip_allocator.cpp: initial commit
example/Jamfile.v2: renamed memfun_key, added ip_allocator
test_perf.cpp: fixed technicality
employee.hpp: used a non-standard allocator
test/Jamfile.v2: added new test file
non_std_allocator.hpp: initial commit
pair_of_ints.hpp: added decrement facilities
test_capacity.cpp: added extra check on resize
test_copy_assignment.cpp: added test for 23.1.1/9
test_iterators.cpp: added tests for c[r]{begin|end} and [local_]iterator_to, fixed technicality
test_key_extractors.cpp: added tests for global_fun
test_modifiers.cpp: added tests dor DR 233, fixed technicality
test_range.cpp: added extra checks to secure range refactoring
test_rearrange.cpp: fixed technicality
test_serialization.cpp: added new test file
test_serialization1.cpp: corrected include, used a non-standard allocator
test_serialization2.cpp: corrected include, used a non-standard allocator, split some stuff ro test_serialization3.cpp
test_serialization3.cpp: initial commit
test_serialization3.hpp: initial commit
test_serialization_template.hpp: removed some reliance on ADL
test_update.cpp: addes tests for rollback modify, fixed technicality

[SVN r39922]
2007-10-11 10:57:30 +00:00
82bda71faa Clear compiler warnings
[SVN r39520]
2007-09-25 13:45:52 +00:00
1da5dd89a8 Corrected wrong order in copyright notices.
[SVN r36240]
2006-12-02 10:04:37 +00:00
57fd51f8f4 Added Caleb as copyright owner.
[SVN r36230]
2006-12-01 14:27:03 +00:00
60e5d575c0 Fixed license & copyright issues.
[SVN r36224]
2006-12-01 10:29:49 +00:00
87ff652a07 move to namespace detail
[SVN r36027]
2006-11-13 22:10:57 +00:00
a548ecc968 Replaced the implementation of ct_if with a facade implementation that
defers to Boost.MPL.


[SVN r36022]
2006-11-13 15:35:54 +00:00
4e009de1ec Bring into compliance with N2066, TR2 Diagnostics Enhancements. Tests passing on Win32, Linux, on most modern compilers.
[SVN r35823]
2006-11-03 16:57:30 +00:00
751e863564 Updated patch from Boris Gubenko.
[SVN r35672]
2006-10-20 10:08:21 +00:00
62b7d277f2 Fix for HP-UX on Itanium.
[SVN r35591]
2006-10-13 17:08:47 +00:00
7106b3c8b1 Added 64-bit Intel processor support.
[SVN r35587]
2006-10-13 12:40:40 +00:00
cd03e4d537 Fix typos.
[SVN r35505]
2006-10-06 15:45:41 +00:00
afbb75b3cb Make is_reference_to_pointer work properly with an abstract class
[SVN r35498]
2006-10-05 13:51:07 +00:00
e2bea194a3 use <assert.h>; include <climits> for Borland only
[SVN r34906]
2006-08-19 11:05:56 +00:00
72a38b9137 identification
[SVN r34905]
2006-08-19 11:04:25 +00:00
e71cca99a6 Windows CE patch by Michael Fink
[SVN r33986]
2006-05-17 22:33:47 +00:00
d2e2b59111 *** empty log message ***
[SVN r33878]
2006-04-30 23:56:35 +00:00
7d61e78d56 Keep bool_trait_def.hpp as the last #include; add bool_trait_undef.hpp at the end.
[SVN r33867]
2006-04-30 03:04:18 +00:00
c749e63ff2 Win32 implementation of boost::timed_mutex
[SVN r33272]
2006-03-08 22:24:52 +00:00
bbd4cb3de1 Patch for Borland 2006 compiler, using Dinkumware libraries
[SVN r33094]
2006-02-23 21:04:21 +00:00
3417f92b35 trivial adjustments to enable warning-free compilation with gcc -Wall -W -Werror
[SVN r32364]
2006-01-20 16:53:30 +00:00
5f033da80e Fixed a couple of syntax errors (reported by Juergen Hunold)
[SVN r31946]
2005-12-07 20:41:11 +00:00
6dd212ccf7 Fixed bug #1370716, static shared_ptr instances not working w/ quick_allocator
[SVN r31931]
2005-12-06 12:24:40 +00:00
9d5b0d7c0c Added more relational operators, see Bug #1191356.
[SVN r31783]
2005-11-26 05:50:55 +00:00
83ada0473d GCC 4.0.2 workarounds
[SVN r31295]
2005-10-11 23:43:44 +00:00
36be4e716a Martin Wille pointed out some missing header dependencies; fixed.
Also moved boost/python/detail/is_xxx.hpp functionality into
boost/detail/is_xxx.hpp to decouple library dependencies between
python and parameter.


[SVN r31290]
2005-10-11 21:20:06 +00:00
3f8f91f7c7 reverted recent changes
[SVN r31255]
2005-10-10 00:18:38 +00:00
ae07663830 first try at fixing is_incrementable for gcc 4.0.2
[SVN r31240]
2005-10-08 16:04:39 +00:00
d63b0de6f9 Moved BOOST_INTERLOCKED_READ stuff into its own header
[SVN r31098]
2005-09-23 17:24:29 +00:00
480b611fd2 Removed :: qualification on _Interlocked functions
[SVN r31097]
2005-09-23 16:56:09 +00:00
c07f135aa9 Added BOOST_INTERLOCKED_EXCHANGE_POINTER in all branches of the #if
[SVN r31012]
2005-09-16 14:05:33 +00:00
0244c5a647 Added InterlockedExchangePointer
[SVN r31010]
2005-09-16 13:57:44 +00:00
33ff8d33be InterlockedCompareExchangePointer is only intrinsic on 64 bit platforms, otherwise it's just a synonym for
InterlockedCompareExchange


[SVN r30951]
2005-09-13 14:19:46 +00:00
ae50e20366 Added interlocked compare/exchange for pointers, and interlocked_read for values and pointers
[SVN r30941]
2005-09-13 09:37:02 +00:00
be9a4c47d4 New version of call_once for win32
[SVN r30847]
2005-09-07 15:02:16 +00:00
eb8fdcdc91 Add detection for macros used by VC:
_M_IX86; little-endian.
_M_IA64; little-endian, as this is the default on I64 and AMD64 is only little endian.
_M_ALPHA; little-endian, as again it's the default and Windows doesn't run on big-endian Alpha anyway AFAIK.


[SVN r30185]
2005-07-19 23:44:52 +00:00
0fee73977c Fix max
[SVN r30051]
2005-07-13 15:39:56 +00:00
2fc38490db Make some of these things into true metafunctions.
[SVN r29776]
2005-06-24 15:04:30 +00:00
09f98c5132 Machine endianness detection taken from <boost/detail/limits.hpp>
[SVN r29573]
2005-06-14 22:19:20 +00:00
e6ddc5ae0f Workarounds for vc6 and 7.
[SVN r28958]
2005-05-16 14:54:12 +00:00
1a9a83f0fb Link to documentation added.
[SVN r27745]
2005-03-20 14:53:58 +00:00
17dcac2940 <intrin.h> appears broken.
[SVN r27737]
2005-03-18 18:23:59 +00:00
17df7b5b7e Split sp_counted_base into no threads (nt), win32 lock-free (w32) and pthreads (pt)
[SVN r27729]
2005-03-18 01:27:11 +00:00
30f03c5423 modifications to accomodate stlport and dinkumware
[SVN r27451]
2005-02-20 22:19:09 +00:00
24b07509e6 use utf8_codecvt_facet.hpp in detail directory
[SVN r27445]
2005-02-20 22:09:16 +00:00
1b622c7926 Previous VC6 fix broke Borland 5.5.1, using fully qualified names fixes the problem.
[SVN r27308]
2005-02-10 12:54:30 +00:00
c986fa4341 fixes for VC6
[SVN r27124]
2005-02-04 22:08:38 +00:00
95b138ec61 Bring type traits into line with TR1
[SVN r26937]
2005-01-30 15:47:46 +00:00
a210e0e5c5 missing partial_std_allocator_wrapper ctor, fix by Daniel James
[SVN r26831]
2005-01-24 07:36:47 +00:00
63a3c4ccf5 Merge the utf8 workaround in program_options and serialization and
put the result to boost/detail and libs/detail.


[SVN r26758]
2005-01-20 08:49:13 +00:00
fa65f4e34c Removed an instance of metafunction forwarding for Borland 5.x
[SVN r26489]
2004-12-13 04:58:28 +00:00
fd06013885 added copyrights
[SVN r25809]
2004-10-20 13:07:46 +00:00
5fcbfdf2f8 Changed files to BSL based on permissions in blanket-permission.txt
[SVN r25451]
2004-09-28 12:55:45 +00:00
4ce66b8475 Move indirect_traits to boost/detail
[SVN r25117]
2004-09-15 15:00:12 +00:00
c2286bbe08 Partial conversion to the BSL
[SVN r25080]
2004-09-14 11:55:22 +00:00
d67afd0e09 Bug fix from Marvin H. Sielenkemper - sielenk-at-sf.net
[SVN r24891]
2004-09-03 15:41:08 +00:00
b2deb5ac68 merge new MPL version from 'mplbook' branch
[SVN r24874]
2004-09-02 15:41:37 +00:00
badda17c31 adjustment for some stlports
[SVN r24715]
2004-08-24 15:12:29 +00:00
d29b455f5f Converted files to the BSL.
[SVN r24614]
2004-08-20 11:10:24 +00:00
63f45069bf fix to accomodate non-standard libraries
[SVN r24485]
2004-08-15 14:57:50 +00:00
aacb844c52 Moved to BSL
[SVN r24446]
2004-08-12 17:13:07 +00:00
7549efc2d2 adjustment for CW
[SVN r24439]
2004-08-12 16:07:34 +00:00
da6391feb5 Name lookup fix for CW
[SVN r24300]
2004-08-05 10:52:25 +00:00
6a549bcd7f Change the signature of codecvt do_length to match standard. This removes hiden virtual warnings.
[SVN r24243]
2004-08-02 03:38:04 +00:00
5f4cc5ca82 Converted to Boost Software License, Version 1.0
[SVN r24055]
2004-07-26 00:32:12 +00:00
3290f6e5fe Remove tabs in file.
[SVN r24043]
2004-07-25 17:12:17 +00:00
c8c6bddd62 Licence update
[SVN r24031]
2004-07-25 12:01:00 +00:00
76670d1ce3 License update
[SVN r24030]
2004-07-25 11:59:12 +00:00
5f27fcac04 Doug Gregor -> Douglas Gregor
[SVN r24016]
2004-07-25 02:29:29 +00:00
7034cf32d1 platform adjustments
[SVN r24003]
2004-07-23 20:53:37 +00:00
3945fb176a tab fix
[SVN r23961]
2004-07-22 15:53:41 +00:00
df9d96054c correct error for intel compiler
[SVN r23960]
2004-07-22 15:50:16 +00:00
31 changed files with 1686 additions and 292 deletions

View File

@ -6,13 +6,9 @@
// Copyright (c) 2003 // Copyright (c) 2003
// Eric Friedman // Eric Friedman
// //
// Permission to use, copy, modify, distribute and sell this software // Distributed under the Boost Software License, Version 1.0. (See
// and its documentation for any purpose is hereby granted without fee, // accompanying file LICENSE_1_0.txt or copy at
// provided that the above copyright notice appears in all copies and // http://www.boost.org/LICENSE_1_0.txt)
// that both the copyright notice and this permission notice appear in
// supporting documentation. No representations are made about the
// suitability of this software for any purpose. It is provided "as is"
// without express or implied warranty.
#ifndef BOOST_BLANK_HPP #ifndef BOOST_BLANK_HPP
#define BOOST_BLANK_HPP #define BOOST_BLANK_HPP
@ -62,11 +58,31 @@ inline bool operator==(const blank&, const blank&)
return true; return true;
} }
inline bool operator<=(const blank&, const blank&)
{
return true;
}
inline bool operator>=(const blank&, const blank&)
{
return true;
}
inline bool operator!=(const blank&, const blank&)
{
return false;
}
inline bool operator<(const blank&, const blank&) inline bool operator<(const blank&, const blank&)
{ {
return false; return false;
} }
inline bool operator>(const blank&, const blank&)
{
return false;
}
// streaming support // streaming support
// //
BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) BOOST_TEMPLATED_STREAM_TEMPLATE(E,T)

View File

@ -6,13 +6,9 @@
// Copyright (c) 2003 // Copyright (c) 2003
// Eric Friedman // Eric Friedman
// //
// Permission to use, copy, modify, distribute and sell this software // Distributed under the Boost Software License, Version 1.0. (See
// and its documentation for any purpose is hereby granted without fee, // accompanying file LICENSE_1_0.txt or copy at
// provided that the above copyright notice appears in all copies and // http://www.boost.org/LICENSE_1_0.txt)
// that both the copyright notice and this permission notice appear in
// supporting documentation. No representations are made about the
// suitability of this software for any purpose. It is provided "as is"
// without express or implied warranty.
#ifndef BOOST_BLANK_FWD_HPP #ifndef BOOST_BLANK_FWD_HPP
#define BOOST_BLANK_FWD_HPP #define BOOST_BLANK_FWD_HPP

View File

@ -1,7 +1,8 @@
// boost/cstdlib.hpp header ------------------------------------------------// // boost/cstdlib.hpp header ------------------------------------------------//
// Copyright Beman Dawes 2001. // Copyright Beman Dawes 2001. Distributed under the Boost
// See accompanying license for terms and conditions of use. // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/utility/cstdlib.html for documentation. // See http://www.boost.org/libs/utility/cstdlib.html for documentation.

View File

@ -1,4 +1,4 @@
/* Copyright 2003-2004 Joaqu<71>n M L<>pez Mu<4D>oz. /* Copyright 2003-2007 Joaqu<71>n M L<>pez Mu<4D>oz.
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt) * http://www.boost.org/LICENSE_1_0.txt)
@ -12,7 +12,7 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#include <boost/mpl/aux_/msvc_never_true.hpp> #include <boost/mpl/aux_/msvc_never_true.hpp>
#include <boost/mpl/apply_if.hpp> #include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
@ -30,18 +30,31 @@ namespace detail{
namespace allocator{ namespace allocator{
/* partial_std_allocator_wrapper inherits the functionality of a std /* partial_std_allocator_wrapper inherits the functionality of a std
* allocator while providing a templatized ctor. * allocator while providing a templatized ctor and other bits missing
* in some stdlib implementation or another.
*/ */
template<typename Type> template<typename Type>
class partial_std_allocator_wrapper:public std::allocator<Type> class partial_std_allocator_wrapper:public std::allocator<Type>
{ {
public: public:
/* Oddly enough, STLport does not define std::allocator<void>::value_type
* when configured to work without partial template specialization.
* No harm in supplying the definition here unconditionally.
*/
typedef Type value_type;
partial_std_allocator_wrapper(){}; partial_std_allocator_wrapper(){};
template<typename Other> template<typename Other>
partial_std_allocator_wrapper(const partial_std_allocator_wrapper<Other>&){} partial_std_allocator_wrapper(const partial_std_allocator_wrapper<Other>&){}
partial_std_allocator_wrapper(const std::allocator<Type>& x):
std::allocator<Type>(x)
{
};
#if defined(BOOST_DINKUMWARE_STDLIB) #if defined(BOOST_DINKUMWARE_STDLIB)
/* Dinkumware guys didn't provide a means to call allocate() without /* Dinkumware guys didn't provide a means to call allocate() without
* supplying a hint, in disagreement with the standard. * supplying a hint, in disagreement with the standard.
@ -130,8 +143,10 @@ template<typename Allocator>
struct rebinder struct rebinder
{ {
template<typename Type> template<typename Type>
struct result:Allocator::BOOST_NESTED_TEMPLATE rebind<Type> struct result
{ {
typedef typename Allocator::BOOST_NESTED_TEMPLATE
rebind<Type>::other other;
}; };
}; };
#endif #endif
@ -147,7 +162,7 @@ struct compliant_allocator_rebind_to
template<typename Allocator,typename Type> template<typename Allocator,typename Type>
struct rebind_to: struct rebind_to:
mpl::apply_if_c< mpl::eval_if_c<
is_partial_std_allocator<Allocator>::value, is_partial_std_allocator<Allocator>::value,
partial_std_allocator_rebind_to<Allocator,Type>, partial_std_allocator_rebind_to<Allocator,Type>,
compliant_allocator_rebind_to<Allocator,Type> compliant_allocator_rebind_to<Allocator,Type>

View File

@ -1,8 +1,7 @@
// Copyright (c) 2000 David Abrahams. Permission to copy, use, modify, // Copyright (c) 2000 David Abrahams.
// sell and distribute this software is granted provided this // Distributed under the Boost Software License, Version 1.0.
// copyright notice appears in all copies. This software is provided // (See accompanying file LICENSE_1_0.txt or copy at
// "as is" without express or implied warranty, and with no claim as // http://www.boost.org/LICENSE_1_0.txt)
// to its suitability for any purpose.
// //
// Copyright (c) 1994 // Copyright (c) 1994
// Hewlett-Packard Company // Hewlett-Packard Company

View File

@ -1,7 +1,8 @@
// boost/catch_exceptions.hpp -----------------------------------------------// // boost/catch_exceptions.hpp -----------------------------------------------//
// Copyright Beman Dawes 1995-2001. // Copyright Beman Dawes 1995-2001. Distributed under the Boost
// See accompanying license for terms and conditions of use. // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for documentation. // See http://www.boost.org/libs/test for documentation.

View File

@ -0,0 +1,73 @@
// Copyright 2005 Caleb Epstein
// Copyright 2006 John Maddock
// Distributed under the Boost Software License, Version 1.0. (See accompany-
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/*
* Copyright (c) 1997
* 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.
*/
/*
* Copyright notice reproduced from <boost/detail/limits.hpp>, from
* which this code was originally taken.
*
* Modified by Caleb Epstein to use <endian.h> with GNU libc and to
* defined the BOOST_ENDIAN macro.
*/
#ifndef BOOST_DETAIL_ENDIAN_HPP
#define BOOST_DETAIL_ENDIAN_HPP
// GNU libc offers the helpful header <endian.h> which defines
// __BYTE_ORDER
#if defined (__GLIBC__)
# include <endian.h>
# if (__BYTE_ORDER == __LITTLE_ENDIAN)
# define BOOST_LITTLE_ENDIAN
# elif (__BYTE_ORDER == __BIG_ENDIAN)
# define BOOST_BIG_ENDIAN
# elif (__BYTE_ORDER == __PDP_ENDIAN)
# define BOOST_PDP_ENDIAN
# else
# error Unknown machine endianness detected.
# endif
# define BOOST_BYTE_ORDER __BYTE_ORDER
#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
# define BOOST_BIG_ENDIAN
# define BOOST_BYTE_ORDER 4321
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
# define BOOST_LITTLE_ENDIAN
# define BOOST_BYTE_ORDER 1234
#elif defined(__sparc) || defined(__sparc__) \
|| defined(_POWER) || defined(__powerpc__) \
|| defined(__ppc__) || defined(__hpux) \
|| defined(_MIPSEB) || defined(_POWER) \
|| defined(__s390__)
# define BOOST_BIG_ENDIAN
# define BOOST_BYTE_ORDER 4321
#elif defined(__i386__) || defined(__alpha__) \
|| defined(__ia64) || defined(__ia64__) \
|| defined(_M_IX86) || defined(_M_IA64) \
|| defined(_M_ALPHA) || defined(__amd64) \
|| defined(__amd64__) || defined(_M_AMD64) \
|| defined(__x86_64) || defined(__x86_64__) \
|| defined(_M_X64)
# define BOOST_LITTLE_ENDIAN
# define BOOST_BYTE_ORDER 1234
#else
# error The file boost/detail/endian.hpp needs to be set up for your CPU type.
#endif
#endif

View File

@ -0,0 +1,29 @@
// (C) Copyright Matthias Troyerk 2006.
// Use, modification and distribution are 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).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
#ifndef BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
#define BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
#include <boost/type_traits/has_trivial_constructor.hpp>
namespace boost { namespace detail {
/// type trait to check for a default constructor
///
/// The default implementation just checks for a trivial constructor.
/// Using some compiler magic it might be possible to provide a better default
template <class T>
struct has_default_constructor
: public has_trivial_constructor<T>
{};
} } // namespace boost::detail
#endif // BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED

View File

@ -0,0 +1,89 @@
// boost/identifier.hpp ----------------------------------------------------//
// Copyright Beman Dawes 2006
// Distributed under 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)
// See documentation at http://www.boost.org/libs/utility
#ifndef BOOST_IDENTIFIER_HPP
#define BOOST_IDENTIFIER_HPP
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <iosfwd>
namespace boost
{
namespace detail
{
// class template identifier ---------------------------------------------//
// Always used as a base class so that different instantiations result in
// different class types even if instantiated with the same value type T.
// Expected usage is that T is often an integer type, best passed by
// value. There is no reason why T can't be a possibly larger class such as
// std::string, best passed by const reference.
// This implementation uses pass by value, based on expected common uses.
template <typename T, typename D>
class identifier
{
public:
typedef T value_type;
const value_type value() const { return m_value; }
void assign( value_type v ) { m_value = v; }
bool operator==( const D & rhs ) const { return m_value == rhs.m_value; }
bool operator!=( const D & rhs ) const { return m_value != rhs.m_value; }
bool operator< ( const D & rhs ) const { return m_value < rhs.m_value; }
bool operator<=( const D & rhs ) const { return m_value <= rhs.m_value; }
bool operator> ( const D & rhs ) const { return m_value > rhs.m_value; }
bool operator>=( const D & rhs ) const { return m_value >= rhs.m_value; }
typedef void (*unspecified_bool_type)(D); // without the D, unspecified_bool_type
static void unspecified_bool_true(D){} // conversion allows relational operators
// between different identifier types
operator unspecified_bool_type() const { return m_value == value_type() ? 0 : unspecified_bool_true; }
bool operator!() const { return m_value == value_type(); }
// constructors are protected so that class can only be used as a base class
protected:
identifier() {}
explicit identifier( value_type v ) : m_value(v) {}
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 1300 == VC++ 7.0 bug workaround
private:
#endif
T m_value;
};
//#ifndef BOOST_NO_SFINAE
// template <class Ostream, class Id>
// typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >,
// Ostream & >::type operator<<( Ostream & os, const Id & id )
// {
// return os << id.value();
// }
// template <class Istream, class Id>
// typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >,
// Istream & >::type operator>>( Istream & is, Id & id )
// {
// typename Id::value_type v;
// is >> v;
// id.value( v );
// return is;
// }
//#endif
} // namespace detail
} // namespace boost
#endif // BOOST_IDENTIFIER_HPP

View File

@ -0,0 +1,487 @@
// Copyright David Abrahams 2002.
// Distributed under 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_TRAITS_DWA2002131_HPP
# define INDIRECT_TRAITS_DWA2002131_HPP
# include <boost/type_traits/is_function.hpp>
# include <boost/type_traits/is_reference.hpp>
# include <boost/type_traits/is_pointer.hpp>
# include <boost/type_traits/is_class.hpp>
# include <boost/type_traits/is_const.hpp>
# include <boost/type_traits/is_volatile.hpp>
# include <boost/type_traits/is_member_function_pointer.hpp>
# include <boost/type_traits/is_member_pointer.hpp>
# include <boost/type_traits/remove_cv.hpp>
# include <boost/type_traits/remove_reference.hpp>
# include <boost/type_traits/remove_pointer.hpp>
# include <boost/type_traits/detail/ice_and.hpp>
# include <boost/detail/workaround.hpp>
# include <boost/mpl/eval_if.hpp>
# include <boost/mpl/if.hpp>
# include <boost/mpl/bool.hpp>
# include <boost/mpl/and.hpp>
# include <boost/mpl/not.hpp>
# include <boost/mpl/aux_/lambda_support.hpp>
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# include <boost/detail/is_function_ref_tester.hpp>
# endif
namespace boost { namespace detail {
namespace indirect_traits {
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T>
struct is_reference_to_const : mpl::false_
{
};
template <class T>
struct is_reference_to_const<T const&> : mpl::true_
{
};
# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
template<class T>
struct is_reference_to_const<T const volatile&> : mpl::true_
{
};
# endif
template <class T>
struct is_reference_to_function : mpl::false_
{
};
template <class T>
struct is_reference_to_function<T&> : is_function<T>
{
};
template <class T>
struct is_pointer_to_function : mpl::false_
{
};
// There's no such thing as a pointer-to-cv-function, so we don't need
// specializations for those
template <class T>
struct is_pointer_to_function<T*> : is_function<T>
{
};
template <class T>
struct is_reference_to_member_function_pointer_impl : mpl::false_
{
};
template <class T>
struct is_reference_to_member_function_pointer_impl<T&>
: is_member_function_pointer<typename remove_cv<T>::type>
{
};
template <class T>
struct is_reference_to_member_function_pointer
: is_reference_to_member_function_pointer_impl<T>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T))
};
template <class T>
struct is_reference_to_function_pointer_aux
: mpl::and_<
is_reference<T>
, is_pointer_to_function<
typename remove_cv<
typename remove_reference<T>::type
>::type
>
>
{
// There's no such thing as a pointer-to-cv-function, so we don't need specializations for those
};
template <class T>
struct is_reference_to_function_pointer
: mpl::if_<
is_reference_to_function<T>
, mpl::false_
, is_reference_to_function_pointer_aux<T>
>::type
{
};
template <class T>
struct is_reference_to_non_const
: mpl::and_<
is_reference<T>
, mpl::not_<
is_reference_to_const<T>
>
>
{
};
template <class T>
struct is_reference_to_volatile : mpl::false_
{
};
template <class T>
struct is_reference_to_volatile<T volatile&> : mpl::true_
{
};
# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
template <class T>
struct is_reference_to_volatile<T const volatile&> : mpl::true_
{
};
# endif
template <class T>
struct is_reference_to_pointer : mpl::false_
{
};
template <class T>
struct is_reference_to_pointer<T*&> : mpl::true_
{
};
template <class T>
struct is_reference_to_pointer<T* const&> : mpl::true_
{
};
template <class T>
struct is_reference_to_pointer<T* volatile&> : mpl::true_
{
};
template <class T>
struct is_reference_to_pointer<T* const volatile&> : mpl::true_
{
};
template <class T>
struct is_reference_to_class
: mpl::and_<
is_reference<T>
, is_class<
typename remove_cv<
typename remove_reference<T>::type
>::type
>
>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T))
};
template <class T>
struct is_pointer_to_class
: mpl::and_<
is_pointer<T>
, is_class<
typename remove_cv<
typename remove_pointer<T>::type
>::type
>
>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T))
};
# else
using namespace boost::detail::is_function_ref_tester_;
typedef char (&inner_yes_type)[3];
typedef char (&inner_no_type)[2];
typedef char (&outer_no_type)[1];
template <typename V>
struct is_const_help
{
typedef typename mpl::if_<
is_const<V>
, inner_yes_type
, inner_no_type
>::type type;
};
template <typename V>
struct is_volatile_help
{
typedef typename mpl::if_<
is_volatile<V>
, inner_yes_type
, inner_no_type
>::type type;
};
template <typename V>
struct is_pointer_help
{
typedef typename mpl::if_<
is_pointer<V>
, inner_yes_type
, inner_no_type
>::type type;
};
template <typename V>
struct is_class_help
{
typedef typename mpl::if_<
is_class<V>
, inner_yes_type
, inner_no_type
>::type type;
};
template <class T>
struct is_reference_to_function_aux
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value = sizeof(detail::is_function_ref_tester(t,0)) == sizeof(::boost::type_traits::yes_type));
typedef mpl::bool_<value> type;
};
template <class T>
struct is_reference_to_function
: mpl::if_<is_reference<T>, is_reference_to_function_aux<T>, mpl::bool_<false> >::type
{
};
template <class T>
struct is_pointer_to_function_aux
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value
= sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type));
typedef mpl::bool_<value> type;
};
template <class T>
struct is_pointer_to_function
: mpl::if_<is_pointer<T>, is_pointer_to_function_aux<T>, mpl::bool_<false> >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_function,(T))
};
struct false_helper1
{
template <class T>
struct apply : mpl::false_
{
};
};
template <typename V>
typename is_const_help<V>::type reference_to_const_helper(V&);
outer_no_type
reference_to_const_helper(...);
struct true_helper1
{
template <class T>
struct apply
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value
= sizeof(reference_to_const_helper(t)) == sizeof(inner_yes_type));
typedef mpl::bool_<value> type;
};
};
template <bool ref = true>
struct is_reference_to_const_helper1 : true_helper1
{
};
template <>
struct is_reference_to_const_helper1<false> : false_helper1
{
};
template <class T>
struct is_reference_to_const
: is_reference_to_const_helper1<is_reference<T>::value>::template apply<T>
{
};
template <bool ref = true>
struct is_reference_to_non_const_helper1
{
template <class T>
struct apply
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value
= sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type));
typedef mpl::bool_<value> type;
};
};
template <>
struct is_reference_to_non_const_helper1<false> : false_helper1
{
};
template <class T>
struct is_reference_to_non_const
: is_reference_to_non_const_helper1<is_reference<T>::value>::template apply<T>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_non_const,(T))
};
template <typename V>
typename is_volatile_help<V>::type reference_to_volatile_helper(V&);
outer_no_type
reference_to_volatile_helper(...);
template <bool ref = true>
struct is_reference_to_volatile_helper1
{
template <class T>
struct apply
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value
= sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type));
typedef mpl::bool_<value> type;
};
};
template <>
struct is_reference_to_volatile_helper1<false> : false_helper1
{
};
template <class T>
struct is_reference_to_volatile
: is_reference_to_volatile_helper1<is_reference<T>::value>::template apply<T>
{
};
template <typename V>
typename is_pointer_help<V>::type reference_to_pointer_helper(V&);
outer_no_type reference_to_pointer_helper(...);
template <class T>
struct reference_to_pointer_impl
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value
= (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type))
);
typedef mpl::bool_<value> type;
};
template <class T>
struct is_reference_to_pointer
: mpl::eval_if<is_reference<T>, reference_to_pointer_impl<T>, mpl::false_>::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T))
};
template <class T>
struct is_reference_to_function_pointer
: mpl::eval_if<is_reference<T>, is_pointer_to_function_aux<T>, mpl::false_>::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T))
};
template <class T>
struct is_member_function_pointer_help
: mpl::if_<is_member_function_pointer<T>, inner_yes_type, inner_no_type>
{};
template <typename V>
typename is_member_function_pointer_help<V>::type member_function_pointer_helper(V&);
outer_no_type member_function_pointer_helper(...);
template <class T>
struct is_pointer_to_member_function_aux
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value
= sizeof((member_function_pointer_helper)(t)) == sizeof(inner_yes_type));
typedef mpl::bool_<value> type;
};
template <class T>
struct is_reference_to_member_function_pointer
: mpl::if_<
is_reference<T>
, is_pointer_to_member_function_aux<T>
, mpl::bool_<false>
>::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T))
};
template <typename V>
typename is_class_help<V>::type reference_to_class_helper(V const volatile&);
outer_no_type reference_to_class_helper(...);
template <class T>
struct is_reference_to_class
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value
= (is_reference<T>::value
& (sizeof(reference_to_class_helper(t)) == sizeof(inner_yes_type)))
);
typedef mpl::bool_<value> type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T))
};
template <typename V>
typename is_class_help<V>::type pointer_to_class_helper(V const volatile*);
outer_no_type pointer_to_class_helper(...);
template <class T>
struct is_pointer_to_class
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value
= (is_pointer<T>::value
&& sizeof(pointer_to_class_helper(t)) == sizeof(inner_yes_type))
);
typedef mpl::bool_<value> type;
};
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
}
using namespace indirect_traits;
}} // namespace boost::python::detail
#endif // INDIRECT_TRAITS_DWA2002131_HPP

View File

@ -0,0 +1,130 @@
#ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
#define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// boost/detail/interlocked.hpp
//
// Copyright 2005 Peter Dimov
//
// Distributed under 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)
//
#include <boost/config.hpp>
#if defined( BOOST_USE_WINDOWS_H )
# include <windows.h>
# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer
# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer
#elif defined(_WIN32_WCE)
// under Windows CE we still have old-style Interlocked* functions
extern "C" long __cdecl InterlockedIncrement( long* );
extern "C" long __cdecl InterlockedDecrement( long* );
extern "C" long __cdecl InterlockedCompareExchange( long*, long, long );
extern "C" long __cdecl InterlockedExchange( long*, long );
extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare)))
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
((void*)BOOST_INTERLOCKED_EXCHANGE((long*)(dest),(long)(exchange)))
#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
extern "C" long __cdecl _InterlockedIncrement( long volatile * );
extern "C" long __cdecl _InterlockedDecrement( long volatile * );
extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
extern "C" long __cdecl _InterlockedExchange( long volatile *, long);
extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long);
# pragma intrinsic( _InterlockedIncrement )
# pragma intrinsic( _InterlockedDecrement )
# pragma intrinsic( _InterlockedCompareExchange )
# pragma intrinsic( _InterlockedExchange )
# pragma intrinsic( _InterlockedExchangeAdd )
# if defined(_M_IA64) || defined(_M_AMD64)
extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* );
extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
# pragma intrinsic( _InterlockedCompareExchangePointer )
# pragma intrinsic( _InterlockedExchangePointer )
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
# else
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
# endif
# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
namespace boost
{
namespace detail
{
extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * );
extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * );
extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long );
extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long );
extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long );
} // namespace detail
} // namespace boost
# define BOOST_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement
# define BOOST_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange
# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange
# define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
#else
# error "Interlocked intrinsics not available"
#endif
#endif // #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED

View File

@ -0,0 +1,135 @@
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes,
// Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000.
// Distributed under 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)
#if !defined(BOOST_PP_IS_ITERATING)
///// header body
#ifndef BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED
#define BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED
#include "boost/type_traits/detail/yes_no_type.hpp"
#include "boost/type_traits/config.hpp"
#if defined(BOOST_TT_PREPROCESSING_MODE)
# include "boost/preprocessor/iterate.hpp"
# include "boost/preprocessor/enum_params.hpp"
# include "boost/preprocessor/comma_if.hpp"
#endif
namespace boost {
namespace detail {
namespace is_function_ref_tester_ {
template <class T>
boost::type_traits::no_type BOOST_TT_DECL is_function_ref_tester(T& ...);
#if !defined(BOOST_TT_PREPROCESSING_MODE)
// preprocessor-generated part, don't edit by hand!
template <class R>
boost::type_traits::yes_type is_function_ref_tester(R (&)(), int);
template <class R,class T0 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0), int);
template <class R,class T0,class T1 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1), int);
template <class R,class T0,class T1,class T2 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2), int);
template <class R,class T0,class T1,class T2,class T3 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3), int);
template <class R,class T0,class T1,class T2,class T3,class T4 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23), int);
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23,class T24 >
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24), int);
#else
#define BOOST_PP_ITERATION_PARAMS_1 \
(3, (0, 25, "boost/type_traits/detail/is_function_ref_tester.hpp"))
#include BOOST_PP_ITERATE()
#endif // BOOST_TT_PREPROCESSING_MODE
} // namespace detail
} // namespace python
} // namespace boost
#endif // BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED
///// iteration
#else
#define i BOOST_PP_FRAME_ITERATION(1)
template <class R BOOST_PP_COMMA_IF(i) BOOST_PP_ENUM_PARAMS(i,class T) >
boost::type_traits::yes_type is_function_ref_tester(R (&)(BOOST_PP_ENUM_PARAMS(i,T)), int);
#undef i
#endif // BOOST_PP_IS_ITERATING

68
include/boost/detail/is_incrementable.hpp Executable file → Normal file
View File

@ -4,10 +4,15 @@
#ifndef IS_INCREMENTABLE_DWA200415_HPP #ifndef IS_INCREMENTABLE_DWA200415_HPP
# define IS_INCREMENTABLE_DWA200415_HPP # define IS_INCREMENTABLE_DWA200415_HPP
# include <boost/type_traits/detail/template_arity_spec.hpp>
# include <boost/type_traits/remove_cv.hpp> # include <boost/type_traits/remove_cv.hpp>
# include <boost/mpl/aux_/lambda_support.hpp>
# include <boost/mpl/bool.hpp> # include <boost/mpl/bool.hpp>
# include <boost/detail/workaround.hpp> # include <boost/detail/workaround.hpp>
// Must be the last include
# include <boost/type_traits/detail/bool_trait_def.hpp>
namespace boost { namespace detail { namespace boost { namespace detail {
// is_incrementable<T> metafunction // is_incrementable<T> metafunction
@ -29,8 +34,26 @@ namespace is_incrementable_
struct any { template <class T> any(T const&); }; struct any { template <class T> any(T const&); };
// This is a last-resort operator++ for when none other is found // This is a last-resort operator++ for when none other is found
# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
}
namespace is_incrementable_2
{
is_incrementable_::tag operator++(is_incrementable_::any const&);
is_incrementable_::tag operator++(is_incrementable_::any const&,int);
}
using namespace is_incrementable_2;
namespace is_incrementable_
{
# else
tag operator++(any const&); tag operator++(any const&);
tag operator++(any const&,int); tag operator++(any const&,int);
# endif
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ # if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
@ -40,7 +63,12 @@ namespace is_incrementable_
tag operator,(tag,int); tag operator,(tag,int);
# define BOOST_comma(a,b) (a,b) # define BOOST_comma(a,b) (a,b)
# endif # endif
# if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable:4913) // Warning about operator,
# endif
// two check overloads help us identify which operator++ was picked // two check overloads help us identify which operator++ was picked
char (& check(tag) )[2]; char (& check(tag) )[2];
@ -51,7 +79,7 @@ namespace is_incrementable_
template <class T> template <class T>
struct impl struct impl
{ {
static typename remove_cv<T>::type& x; static typename boost::remove_cv<T>::type& x;
BOOST_STATIC_CONSTANT( BOOST_STATIC_CONSTANT(
bool bool
@ -62,29 +90,45 @@ namespace is_incrementable_
template <class T> template <class T>
struct postfix_impl struct postfix_impl
{ {
static typename remove_cv<T>::type& x; static typename boost::remove_cv<T>::type& x;
BOOST_STATIC_CONSTANT( BOOST_STATIC_CONSTANT(
bool bool
, value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1 , value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
); );
}; };
# if defined(BOOST_MSVC)
# pragma warning(pop)
# endif
} }
# undef BOOST_comma # undef BOOST_comma
template <class T> template<typename T>
struct is_incrementable struct is_incrementable
: mpl::bool_< ::boost::detail::is_incrementable_::impl<T>::value> BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
{ {
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl<T>::value)
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
}; };
template <class T> template<typename T>
struct is_postfix_incrementable struct is_postfix_incrementable
: mpl::bool_< ::boost::detail::is_incrementable_::postfix_impl<T>::value> BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
{ {
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl<T>::value)
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
}; };
}} // namespace boost::detail } // namespace detail
BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_incrementable)
BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable)
} // namespace boost
# include <boost/type_traits/detail/bool_trait_undef.hpp>
#endif // IS_INCREMENTABLE_DWA200415_HPP #endif // IS_INCREMENTABLE_DWA200415_HPP

View File

@ -0,0 +1,61 @@
// Copyright David Abrahams 2005. Distributed under 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 BOOST_DETAIL_IS_XXX_DWA20051011_HPP
# define BOOST_DETAIL_IS_XXX_DWA20051011_HPP
# include <boost/config.hpp>
# include <boost/mpl/bool.hpp>
# include <boost/preprocessor/enum_params.hpp>
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
# include <boost/type_traits/is_reference.hpp>
# include <boost/type_traits/add_reference.hpp>
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
template <class X_> \
struct is_##name \
{ \
typedef char yes; \
typedef char (&no)[2]; \
\
static typename add_reference<X_>::type dummy; \
\
struct helpers \
{ \
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \
static yes test( \
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \
); \
\
template <class U> \
static no test(U&, ...); \
}; \
\
BOOST_STATIC_CONSTANT( \
bool, value \
= !is_reference<X_>::value \
& (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \
\
typedef mpl::bool_<value> type; \
};
# else
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
template <class T> \
struct is_##name : mpl::false_ \
{ \
}; \
\
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \
struct is_##name< \
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \
> \
: mpl::true_ \
{ \
};
# endif
#endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP

View File

@ -1,8 +1,7 @@
// (C) Copyright David Abrahams 2002. Permission to copy, use, modify, // (C) Copyright David Abrahams 2002.
// sell and distribute this software is granted provided this // Distributed under the Boost Software License, Version 1.0. (See
// copyright notice appears in all copies. This software is provided // accompanying file LICENSE_1_0.txt or copy at
// "as is" without express or implied warranty, and with no claim as // http://www.boost.org/LICENSE_1_0.txt)
// to its suitability for any purpose.
// Boost versions of // Boost versions of
// //
@ -145,7 +144,7 @@ struct iterator_traits<T const*>
# endif # endif
# include <boost/mpl/if.hpp> # include <boost/mpl/if.hpp>
# include <boost/mpl/aux_/has_xxx.hpp> # include <boost/mpl/has_xxx.hpp>
# include <cstddef> # include <cstddef>
// should be the last #include // should be the last #include
@ -267,7 +266,7 @@ template <class T> struct pointer_iterator_traits;
template <class T> template <class T>
struct pointer_iterator_traits<T*> struct pointer_iterator_traits<T*>
{ {
typedef remove_const<T>::type value_type; typedef typename remove_const<T>::type value_type;
typedef T* pointer; typedef T* pointer;
typedef T& reference; typedef T& reference;
typedef std::random_access_iterator_tag iterator_category; typedef std::random_access_iterator_tag iterator_category;
@ -335,8 +334,8 @@ struct msvc_stdlib_mutable_traits
: std::iterator_traits<Iterator> : std::iterator_traits<Iterator>
{ {
typedef typename std::iterator_traits<Iterator>::distance_type difference_type; typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
typedef value_type* pointer; typedef typename std::iterator_traits<Iterator>::value_type* pointer;
typedef value_type& reference; typedef typename std::iterator_traits<Iterator>::value_type& reference;
}; };
template <class Iterator> template <class Iterator>
@ -344,8 +343,8 @@ struct msvc_stdlib_const_traits
: std::iterator_traits<Iterator> : std::iterator_traits<Iterator>
{ {
typedef typename std::iterator_traits<Iterator>::distance_type difference_type; typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
typedef const value_type* pointer; typedef const typename std::iterator_traits<Iterator>::value_type* pointer;
typedef const value_type& reference; typedef const typename std::iterator_traits<Iterator>::value_type& reference;
}; };
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION # ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION

View File

@ -12,10 +12,9 @@
// //
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. // Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
// //
// Permission to copy, use, modify, sell and distribute this software // Distributed under the Boost Software License, Version 1.0. (See
// is granted provided this copyright notice appears in all copies. // accompanying file LICENSE_1_0.txt or copy at
// This software is provided "as is" without express or implied // http://www.boost.org/LICENSE_1_0.txt)
// warranty, and with no claim as to its suitability for any purpose.
// //
// BOOST_TEST(expression) // BOOST_TEST(expression)
// BOOST_ERROR(message) // BOOST_ERROR(message)

View File

@ -0,0 +1,135 @@
#ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
#define BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// boost/detail/lightweight_thread.hpp
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2008 Peter Dimov
//
// Distributed under 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
#include <boost/config.hpp>
#include <memory>
#include <cerrno>
// pthread_create, pthread_join
#if defined( BOOST_HAS_PTHREADS )
#include <pthread.h>
#else
#include <windows.h>
#include <process.h>
typedef HANDLE pthread_t;
int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg )
{
HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 );
if( h != 0 )
{
*thread = h;
return 0;
}
else
{
return EAGAIN;
}
}
int pthread_join( pthread_t thread, void ** /*value_ptr*/ )
{
::WaitForSingleObject( thread, INFINITE );
::CloseHandle( thread );
return 0;
}
#endif
// template<class F> int lw_thread_create( pthread_t & pt, F f );
namespace boost
{
namespace detail
{
class lw_abstract_thread
{
public:
virtual ~lw_abstract_thread() {}
virtual void run() = 0;
};
#if defined( BOOST_HAS_PTHREADS )
extern "C" void * lw_thread_routine( void * pv )
{
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
pt->run();
return 0;
}
#else
unsigned __stdcall lw_thread_routine( void * pv )
{
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
pt->run();
return 0;
}
#endif
template<class F> class lw_thread_impl: public lw_abstract_thread
{
public:
explicit lw_thread_impl( F f ): f_( f )
{
}
void run()
{
f_();
}
private:
F f_;
};
template<class F> int lw_thread_create( pthread_t & pt, F f )
{
std::auto_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) );
int r = pthread_create( &pt, 0, lw_thread_routine, p.get() );
if( r == 0 )
{
p.release();
}
return r;
}
} // namespace detail
} // namespace boost
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED

View File

@ -1,8 +1,7 @@
// (C) Copyright Jeremy Siek 2001. Permission to copy, use, modify, // (C) Copyright Jeremy Siek 2001.
// sell and distribute this software is granted provided this // Distributed under the Boost Software License, Version 1.0. (See
// copyright notice appears in all copies. This software is provided // accompanying file LICENSE_1_0.txt or copy at
// "as is" without express or implied warranty, and with no claim as // http://www.boost.org/LICENSE_1_0.txt)
// to its suitability for any purpose.
// Revision History: // Revision History:

View File

@ -1,15 +1,8 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify, // (C) Copyright David Abrahams 2001, Howard Hinnant 2001.
// 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: // Distributed under the Boost Software License, Version 1.0. (See
// (C) Copyright Howard Hinnant 2001. Permission to copy, use, modify, // accompanying file LICENSE_1_0.txt or copy at
// sell and distribute this software is granted provided this // http://www.boost.org/LICENSE_1_0.txt)
// 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> -- // Template class numeric_traits<Number> --
// //

View File

@ -13,10 +13,9 @@
// Copyright (c) 2003 David Abrahams // Copyright (c) 2003 David Abrahams
// Copyright (c) 2003 Peter Dimov // Copyright (c) 2003 Peter Dimov
// //
// Permission to copy, use, modify, sell and distribute this software // Distributed under the Boost Software License, Version 1.0. (See
// is granted provided this copyright notice appears in all copies. // accompanying file LICENSE_1_0.txt or copy at
// This software is provided "as is" without express or implied // http://www.boost.org/LICENSE_1_0.txt)
// warranty, and with no claim as to its suitability for any purpose.
// //
#include <boost/config.hpp> #include <boost/config.hpp>
@ -72,7 +71,15 @@ template<unsigned size, unsigned align_> struct allocator_impl
#endif #endif
#ifdef BOOST_HAS_THREADS #ifdef BOOST_HAS_THREADS
static lightweight_mutex mutex;
static lightweight_mutex & mutex()
{
static lightweight_mutex m;
return m;
}
static lightweight_mutex * mutex_init;
#endif #endif
static block * free; static block * free;
@ -82,7 +89,7 @@ template<unsigned size, unsigned align_> struct allocator_impl
static inline void * alloc() static inline void * alloc()
{ {
#ifdef BOOST_HAS_THREADS #ifdef BOOST_HAS_THREADS
lightweight_mutex::scoped_lock lock(mutex); lightweight_mutex::scoped_lock lock( mutex() );
#endif #endif
if(block * x = free) if(block * x = free)
{ {
@ -112,7 +119,7 @@ template<unsigned size, unsigned align_> struct allocator_impl
else else
{ {
#ifdef BOOST_HAS_THREADS #ifdef BOOST_HAS_THREADS
lightweight_mutex::scoped_lock lock(mutex); lightweight_mutex::scoped_lock lock( mutex() );
#endif #endif
if(block * x = free) if(block * x = free)
{ {
@ -137,7 +144,7 @@ template<unsigned size, unsigned align_> struct allocator_impl
if(pv != 0) // 18.4.1.1/13 if(pv != 0) // 18.4.1.1/13
{ {
#ifdef BOOST_HAS_THREADS #ifdef BOOST_HAS_THREADS
lightweight_mutex::scoped_lock lock(mutex); lightweight_mutex::scoped_lock lock( mutex() );
#endif #endif
block * pb = static_cast<block *>(pv); block * pb = static_cast<block *>(pv);
pb->next = free; pb->next = free;
@ -154,7 +161,7 @@ template<unsigned size, unsigned align_> struct allocator_impl
else if(pv != 0) // 18.4.1.1/13 else if(pv != 0) // 18.4.1.1/13
{ {
#ifdef BOOST_HAS_THREADS #ifdef BOOST_HAS_THREADS
lightweight_mutex::scoped_lock lock(mutex); lightweight_mutex::scoped_lock lock( mutex() );
#endif #endif
block * pb = static_cast<block *>(pv); block * pb = static_cast<block *>(pv);
pb->next = free; pb->next = free;
@ -164,8 +171,10 @@ template<unsigned size, unsigned align_> struct allocator_impl
}; };
#ifdef BOOST_HAS_THREADS #ifdef BOOST_HAS_THREADS
template<unsigned size, unsigned align_> template<unsigned size, unsigned align_>
lightweight_mutex allocator_impl<size, align_>::mutex; lightweight_mutex * allocator_impl<size, align_>::mutex_init = &allocator_impl<size, align_>::mutex();
#endif #endif
template<unsigned size, unsigned align_> template<unsigned size, unsigned align_>

View File

@ -6,13 +6,9 @@
// Copyright (c) 2003 // Copyright (c) 2003
// Eric Friedman // Eric Friedman
// //
// Permission to use, copy, modify, distribute and sell this software // Distributed under the Boost Software License, Version 1.0. (See
// and its documentation for any purpose is hereby granted without fee, // accompanying file LICENSE_1_0.txt or copy at
// provided that the above copyright notice appears in all copies and // http://www.boost.org/LICENSE_1_0.txt)
// that both the copyright notice and this permission notice appear in
// supporting documentation. No representations are made about the
// suitability of this software for any purpose. It is provided "as is"
// without express or implied warranty.
#ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP #ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
#define BOOST_DETAIL_REFERENCE_CONTENT_HPP #define BOOST_DETAIL_REFERENCE_CONTENT_HPP

View File

@ -1,8 +1,7 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify, // (C) Copyright David Abrahams 2001.
// sell and distribute this software is granted provided this // Distributed under the Boost Software License, Version 1.0. (See
// copyright notice appears in all copies. This software is provided // accompanying file LICENSE_1_0.txt or copy at
// "as is" without express or implied warranty, and with no claim as // http://www.boost.org/LICENSE_1_0.txt)
// to its suitability for any purpose.
// //
// See http://www.boost.org for most recent version including documentation. // See http://www.boost.org for most recent version including documentation.

View File

@ -6,13 +6,9 @@
// Copyright (c) 2003 // Copyright (c) 2003
// Eric Friedman // Eric Friedman
// //
// Permission to use, copy, modify, distribute and sell this software // Distributed under the Boost Software License, Version 1.0. (See
// and its documentation for any purpose is hereby granted without fee, // accompanying file LICENSE_1_0.txt or copy at
// provided that the above copyright notice appears in all copies and // http://www.boost.org/LICENSE_1_0.txt)
// that both the copyright notice and this permission notice appear in
// supporting documentation. No representations are made about the
// suitability of this software for any purpose. It is provided "as is"
// without express or implied warranty.
#ifndef BOOST_DETAIL_TEMPLATED_STREAMS_HPP #ifndef BOOST_DETAIL_TEMPLATED_STREAMS_HPP
#define BOOST_DETAIL_TEMPLATED_STREAMS_HPP #define BOOST_DETAIL_TEMPLATED_STREAMS_HPP

View File

@ -1,3 +1,8 @@
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
// Distributed under the Boost Software License, Version 1.0. (See accompany-
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_UTF8_CODECVT_FACET_HPP #ifndef BOOST_UTF8_CODECVT_FACET_HPP
#define BOOST_UTF8_CODECVT_FACET_HPP #define BOOST_UTF8_CODECVT_FACET_HPP
@ -9,12 +14,38 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// utf8_codecvt_facet.hpp // utf8_codecvt_facet.hpp
// Copyright © 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) // This header defines class utf8_codecvt_facet, derived fro
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). Permission to copy, // std::codecvt<wchar_t, char>, which can be used to convert utf8 data in
// use, modify, sell and distribute this software is granted provided this // files into wchar_t strings in the application.
// 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 // The header is NOT STANDALONE, and is not to be included by the USER.
// for any purpose. // There are at least two libraries which want to use this functionality, and
// we want to avoid code duplication. It would be possible to create utf8
// library, but:
// - this requires review process first
// - in the case, when linking the a library which uses utf8
// (say 'program_options'), user should also link to the utf8 library.
// This seems inconvenient, and asking a user to link to an unrevieved
// library is strange.
// Until the above points are fixed, a library which wants to use utf8 must:
// - include this header from one of it's headers or sources
// - include the corresponding .cpp file from one of the sources
// - before including either file, the library must define
// - BOOST_UTF8_BEGIN_NAMESPACE to the namespace declaration that must be used
// - BOOST_UTF8_END_NAMESPACE to the code to close the previous namespace
// - declaration.
// - BOOST_UTF8_DECL -- to the code which must be used for all 'exportable'
// symbols.
//
// For example, program_options library might contain:
// #define BOOST_UTF8_BEGIN_NAMESPACE <backslash character>
// namespace boost { namespace program_options {
// #define BOOST_UTF8_END_NAMESPACE }}
// #define BOOST_UTF8_DECL BOOST_PROGRAM_OPTIONS_DECL
// #include "../../detail/utf8/utf8_codecvt.cpp"
//
// Essentially, each library will have its own copy of utf8 code, in
// different namespaces.
// Note:(Robert Ramey). I have made the following alterations in the original // Note:(Robert Ramey). I have made the following alterations in the original
// code. // code.
@ -48,30 +79,33 @@
// specialized on those types for this to work. // specialized on those types for this to work.
#include <locale> #include <locale>
#include <cwchar> // for mbstate_t
#include <cstddef> // for std::size_t
#if defined(__COMO__) #include <boost/config.hpp>
namespace std{ #include <boost/detail/workaround.hpp>
using ::mbstate_t;
} // namespace std #if defined(BOOST_NO_STDC_NAMESPACE)
#elif (defined(BOOST_MSVC) && (_MSC_VER <= 1300)) using ::codecvt;
namespace std{ using ::mbstate_t;
using ::mbstate_t; #endif
} // namespace std
#elif defined(BOOST_NO_STDC_NAMESPACE) #if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
namespace std{ #define BOOST_CODECVT_DO_LENGTH_CONST const
using ::codecvt; #else
using ::mbstate_t; #define BOOST_CODECVT_DO_LENGTH_CONST
} // namespace std
#endif #endif
// maximum lenght of a multibyte string // maximum lenght of a multibyte string
#define MB_LENGTH_MAX 8 #define MB_LENGTH_MAX 8
struct utf8_codecvt_facet_wchar_t : BOOST_UTF8_BEGIN_NAMESPACE
public std::codecvt<wchar_t, char, std::mbstate_t>
struct BOOST_UTF8_DECL utf8_codecvt_facet :
public std::codecvt<wchar_t, char, std::mbstate_t>
{ {
public: public:
explicit utf8_codecvt_facet_wchar_t(size_t no_locale_manage = 0) explicit utf8_codecvt_facet(std::size_t no_locale_manage=0)
: std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage) : std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
{} {}
protected: protected:
@ -117,9 +151,10 @@ protected:
virtual std::codecvt_base::result do_unshift( virtual std::codecvt_base::result do_unshift(
std::mbstate_t&, std::mbstate_t&,
char * from, char * from,
char * to, char * /*to*/,
char * & next char * & next
) const{ ) const
{
next = from; next = from;
return ok; return ok;
} }
@ -132,11 +167,15 @@ protected:
// How many char objects can I process to get <= max_limit // How many char objects can I process to get <= max_limit
// wchar_t objects? // wchar_t objects?
virtual int do_length( virtual int do_length(
const std::mbstate_t &, BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
const char * from, const char * from,
const char * from_end, const char * from_end,
size_t max_limit std::size_t max_limit
) const throw(); #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
) const throw();
#else
) const;
#endif
// Largest possible value do_length(state,from,from_end,1) could return. // Largest possible value do_length(state,from,from_end,1) could return.
virtual int do_max_length() const throw () { virtual int do_max_length() const throw () {
@ -144,62 +183,6 @@ protected:
} }
}; };
#if 0 // not used - incorrect in any case BOOST_UTF8_END_NAMESPACE
// Robert Ramey - use the above to make a code converter from multi-byte
// char strings to utf8 encoding
struct utf8_codecvt_facet_char : public utf8_codecvt_facet_wchar_t
{
typedef utf8_codecvt_facet_wchar_t base_class;
public:
explicit utf8_codecvt_facet_char(size_t no_locale_manage=0)
: base_class(no_locale_manage)
{}
protected:
virtual std::codecvt_base::result do_in(
std::mbstate_t & state,
const char * from,
const char * from_end,
const char * & from_next,
char * to,
char * to_end,
char * & to_next
) const;
virtual std::codecvt_base::result do_out(
std::mbstate_t & state,
const char * from,
const char * from_end,
const char* & from_next,
char * to,
char * to_end,
char * & to_next
) const;
// How many char objects can I process to get <= max_limit
// char objects?
virtual int do_length(
const std::mbstate_t&,
const char * from,
const char * from_end,
size_t max_limit
) const;
};
#endif
template<class Internal, class External>
struct utf8_codecvt_facet
{};
template<>
struct utf8_codecvt_facet<wchar_t, char>
: public utf8_codecvt_facet_wchar_t
{};
#if 0
template<>
struct utf8_codecvt_facet<char, char>
: public utf8_codecvt_facet_char
{};
#endif
#endif // BOOST_UTF8_CODECVT_FACET_HPP #endif // BOOST_UTF8_CODECVT_FACET_HPP

18
include/boost/indirect_reference.hpp Executable file → Normal file
View File

@ -1,16 +1,20 @@
// 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 #ifndef INDIRECT_REFERENCE_DWA200415_HPP
# define INDIRECT_REFERENCE_DWA200415_HPP # define INDIRECT_REFERENCE_DWA200415_HPP
// dereferenceable_traits provides access to the value_type and //
// reference of a Dereferenceable type. // 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)
//
// typename indirect_reference<P>::type provides the type of *p.
//
// http://www.boost.org/libs/iterator/doc/pointee.html
//
# include <boost/detail/is_incrementable.hpp> # include <boost/detail/is_incrementable.hpp>
# include <boost/iterator/iterator_traits.hpp> # include <boost/iterator/iterator_traits.hpp>
# include <boost/type_traits/remove_cv.hpp> # include <boost/type_traits/remove_cv.hpp>
# include <boost/mpl/apply_if.hpp> # include <boost/mpl/eval_if.hpp>
# include <boost/pointee.hpp> # include <boost/pointee.hpp>
namespace boost { namespace boost {
@ -26,7 +30,7 @@ namespace detail
template <class P> template <class P>
struct indirect_reference struct indirect_reference
: mpl::apply_if< : mpl::eval_if<
detail::is_incrementable<P> detail::is_incrementable<P>
, iterator_reference<P> , iterator_reference<P>
, detail::smart_ptr_reference<P> , detail::smart_ptr_reference<P>

View File

@ -1,4 +1,8 @@
// -*- C++ -*- forwarding header. // -*- C++ -*- forwarding header.
// (C) Copyright Jeremy Siek 2004
// Distributed under 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 BOOST_CSTDDEF_HPP #ifndef BOOST_CSTDDEF_HPP
#define BOOST_CSTDDEF_HPP #define BOOST_CSTDDEF_HPP

View File

@ -1,110 +1,41 @@
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, sell and // (C) Copyright Jeremy Siek 2000.
// distribute this software is granted provided this copyright notice appears // Distributed under the Boost Software License, Version 1.0. (See
// in all copies. This software is provided "as is" without express or implied // accompanying file LICENSE_1_0.txt or copy at
// warranty, and with no claim as to its suitability for any purpose. // http://www.boost.org/LICENSE_1_0.txt)
// This header replaces the implementation of ct_if that preceded the
// introduction of Boost.MPL with a facade that defers to that reviewed and
// accepted library.
// Author: Ronald Garcia
// Date: 20 October, 2006
// 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 #ifndef BOOST_CT_IF_HPP
#define BOOST_CT_IF_HPP #define BOOST_CT_IF_HPP
#include <boost/config.hpp>
/* // A stub implementation in terms of Boost.MPL
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 #include <boost/mpl/if.hpp>
the graph library. Changing from 'ct_if' to 'ct_if_t' fixed the #include <boost/mpl/not.hpp>
problem. #include <boost/mpl/and.hpp>
*/ // true_type and false_type are used by applications of ct_if
#include <boost/type_traits/integral_constant.hpp>
namespace boost { namespace boost {
struct ct_if_error { };
struct true_type { enum { value = true }; };
struct false_type { enum { value = false }; };
template <class A, class B> template <class A, class B>
struct ct_and { typedef false_type type; }; struct ct_and : boost::mpl::and_<A,B> {};
template <> struct ct_and<true_type,true_type> { typedef true_type type; };
template <class A> struct ct_not { typedef ct_if_error type; }; template <class A>
template <> struct ct_not<true_type> { typedef false_type type; }; struct ct_not : mpl::not_<A> {};
template <> struct ct_not<false_type> { typedef true_type type; };
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// agurt, 15/sep/02: in certain cases Borland has problems with
// choosing the right 'ct_if' specialization even though 'cond'
// _does_ equal '1'; the easiest way to fix it is to make first
// 'ct_if' non-type template parameter boolean.
#if !defined(__BORLANDC__)
template <bool cond, class A, class B> template <bool cond, class A, class B>
struct ct_if { typedef ct_if_error type; }; struct ct_if : mpl::if_c<cond,A,B> {};
template <class A, class B>
struct ct_if<true, A, B> { typedef A type; };
template <class A, class B>
struct ct_if<false, A, B> { typedef B type; };
#else
template <bool cond, class A, class B>
struct ct_if { typedef A type; };
template <class A, class B>
struct ct_if<false, A, B> { typedef B type; };
#endif
template <class cond, class A, class B> template <class cond, class A, class B>
struct ct_if_t { typedef ct_if_error type; }; struct ct_if_t : mpl::if_<cond,A,B> {};
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 } // namespace boost

View File

@ -12,14 +12,17 @@
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
// ------------------------------------------------------ // ------------------------------------------------------
//
// $Id$
#ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301 #ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301
#define BOOST_INTEGER_LOG2_HPP_GP_20030301 #define BOOST_INTEGER_LOG2_HPP_GP_20030301
#include <cassert> #include <assert.h>
#include <climits> // actually used for Borland only #ifdef __BORLANDC__
#include <climits>
#endif
#include "boost/limits.hpp" #include "boost/limits.hpp"
#include "boost/config.hpp" #include "boost/config.hpp"

View File

@ -1,8 +1,7 @@
// (C) Copyright David Abrahams 2001. Permission to copy, use, // (C) Copyright David Abrahams 2001.
// modify, sell and distribute this software is granted provided this // Distributed under the Boost Software License, Version 1.0. (See
// copyright notice appears in all copies. This software is provided // accompanying file LICENSE_1_0.txt or copy at
// "as is" without express or implied warranty, and with no claim as // http://www.boost.org/LICENSE_1_0.txt)
// to its suitability for any purpose.
#ifndef BOOST_TYPE_DWA20010120_HPP #ifndef BOOST_TYPE_DWA20010120_HPP
# define BOOST_TYPE_DWA20010120_HPP # define BOOST_TYPE_DWA20010120_HPP

View File

@ -1,6 +1,6 @@
// Boost.Signals library // Boost.Signals library
// Copyright Doug Gregor 2001-2003. Use, modification and // Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version // distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)

269
utf8_codecvt_facet.cpp Normal file
View File

@ -0,0 +1,269 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// utf8_codecvt_facet.cpp
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
// 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)
// Please see the comments in <boost/detail/utf8_codecvt_facet.hpp> to
// learn how this file should be used.
#include <boost/detail/utf8_codecvt_facet.hpp>
#include <cstdlib> // for multi-byte converson routines
#include <cassert>
#include <boost/limits.hpp>
#include <boost/config.hpp>
// If we don't have wstring, then Unicode support
// is not available anyway, so we don't need to even
// compiler this file. This also fixes the problem
// with mingw, which can compile this file, but will
// generate link error when building DLL.
#ifndef BOOST_NO_STD_WSTRING
BOOST_UTF8_BEGIN_NAMESPACE
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// implementation for wchar_t
// Translate incoming UTF-8 into UCS-4
std::codecvt_base::result utf8_codecvt_facet::do_in(
std::mbstate_t& /*state*/,
const char * from,
const char * from_end,
const char * & from_next,
wchar_t * to,
wchar_t * to_end,
wchar_t * & to_next
) const {
// Basic algorithm: The first octet determines how many
// octets total make up the UCS-4 character. The remaining
// "continuing octets" all begin with "10". To convert, subtract
// the amount that specifies the number of octets from the first
// octet. Subtract 0x80 (1000 0000) from each continuing octet,
// then mash the whole lot together. Note that each continuing
// octet only uses 6 bits as unique values, so only shift by
// multiples of 6 to combine.
while (from != from_end && to != to_end) {
// Error checking on the first octet
if (invalid_leading_octet(*from)){
from_next = from;
to_next = to;
return std::codecvt_base::error;
}
// The first octet is adjusted by a value dependent upon
// the number of "continuing octets" encoding the character
const int cont_octet_count = get_cont_octet_count(*from);
const wchar_t octet1_modifier_table[] = {
0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
};
// The unsigned char conversion is necessary in case char is
// signed (I learned this the hard way)
wchar_t ucs_result =
(unsigned char)(*from++) - octet1_modifier_table[cont_octet_count];
// Invariants :
// 1) At the start of the loop, 'i' continuing characters have been
// processed
// 2) *from points to the next continuing character to be processed.
int i = 0;
while(i != cont_octet_count && from != from_end) {
// Error checking on continuing characters
if (invalid_continuing_octet(*from)) {
from_next = from;
to_next = to;
return std::codecvt_base::error;
}
ucs_result *= (1 << 6);
// each continuing character has an extra (10xxxxxx)b attached to
// it that must be removed.
ucs_result += (unsigned char)(*from++) - 0x80;
++i;
}
// If the buffer ends with an incomplete unicode character...
if (from == from_end && i != cont_octet_count) {
// rewind "from" to before the current character translation
from_next = from - (i+1);
to_next = to;
return std::codecvt_base::partial;
}
*to++ = ucs_result;
}
from_next = from;
to_next = to;
// Were we done converting or did we run out of destination space?
if(from == from_end) return std::codecvt_base::ok;
else return std::codecvt_base::partial;
}
std::codecvt_base::result utf8_codecvt_facet::do_out(
std::mbstate_t& /*state*/,
const wchar_t * from,
const wchar_t * from_end,
const wchar_t * & from_next,
char * to,
char * to_end,
char * & to_next
) const
{
// RG - consider merging this table with the other one
const wchar_t octet1_modifier_table[] = {
0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
};
wchar_t max_wchar = (std::numeric_limits<wchar_t>::max)();
while (from != from_end && to != to_end) {
// Check for invalid UCS-4 character
if (*from > max_wchar) {
from_next = from;
to_next = to;
return std::codecvt_base::error;
}
int cont_octet_count = get_cont_octet_out_count(*from);
// RG - comment this formula better
int shift_exponent = (cont_octet_count) * 6;
// Process the first character
*to++ = static_cast<char>(octet1_modifier_table[cont_octet_count] +
(unsigned char)(*from / (1 << shift_exponent)));
// Process the continuation characters
// Invariants: At the start of the loop:
// 1) 'i' continuing octets have been generated
// 2) '*to' points to the next location to place an octet
// 3) shift_exponent is 6 more than needed for the next octet
int i = 0;
while (i != cont_octet_count && to != to_end) {
shift_exponent -= 6;
*to++ = static_cast<char>(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6)));
++i;
}
// If we filled up the out buffer before encoding the character
if(to == to_end && i != cont_octet_count) {
from_next = from;
to_next = to - (i+1);
return std::codecvt_base::partial;
}
*from++;
}
from_next = from;
to_next = to;
// Were we done or did we run out of destination space
if(from == from_end) return std::codecvt_base::ok;
else return std::codecvt_base::partial;
}
// How many char objects can I process to get <= max_limit
// wchar_t objects?
int utf8_codecvt_facet::do_length(
BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
const char * from,
const char * from_end,
std::size_t max_limit
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
) const throw()
#else
) const
#endif
{
// RG - this code is confusing! I need a better way to express it.
// and test cases.
// Invariants:
// 1) last_octet_count has the size of the last measured character
// 2) char_count holds the number of characters shown to fit
// within the bounds so far (no greater than max_limit)
// 3) from_next points to the octet 'last_octet_count' before the
// last measured character.
int last_octet_count=0;
std::size_t char_count = 0;
const char* from_next = from;
// Use "<" because the buffer may represent incomplete characters
while (from_next+last_octet_count <= from_end && char_count <= max_limit) {
from_next += last_octet_count;
last_octet_count = (get_octet_count(*from_next));
++char_count;
}
return static_cast<int>(from_next-from_end);
}
unsigned int utf8_codecvt_facet::get_octet_count(
unsigned char lead_octet
){
// if the 0-bit (MSB) is 0, then 1 character
if (lead_octet <= 0x7f) return 1;
// Otherwise the count number of consecutive 1 bits starting at MSB
// assert(0xc0 <= lead_octet && lead_octet <= 0xfd);
if (0xc0 <= lead_octet && lead_octet <= 0xdf) return 2;
else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3;
else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4;
else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5;
else return 6;
}
BOOST_UTF8_END_NAMESPACE
namespace {
template<std::size_t s>
int get_cont_octet_out_count_impl(wchar_t word){
if (word < 0x80) {
return 0;
}
if (word < 0x800) {
return 1;
}
return 2;
}
// note the following code will generate on some platforms where
// wchar_t is defined as UCS2. The warnings are superfluous as
// the specialization is never instantitiated with such compilers.
template<>
int get_cont_octet_out_count_impl<4>(wchar_t word){
if (word < 0x80) {
return 0;
}
if (word < 0x800) {
return 1;
}
if (word < 0x10000) {
return 2;
}
if (word < 0x200000) {
return 3;
}
if (word < 0x4000000) {
return 4;
}
return 5;
}
} // namespace anonymous
BOOST_UTF8_BEGIN_NAMESPACE
// How many "continuing octets" will be needed for this word
// == total octets - 1.
int utf8_codecvt_facet::get_cont_octet_out_count(
wchar_t word
) const {
return get_cont_octet_out_count_impl<sizeof(wchar_t)>(word);
}
BOOST_UTF8_END_NAMESPACE
#endif