Compare commits

...

236 Commits

Author SHA1 Message Date
4a1d892184 v2, v3, integration branch
[SVN r62649]
2010-06-09 11:34:33 +00:00
a4eef8ff7d Applied patch from issue #3377
[SVN r62509]
2010-06-07 15:44:32 +00:00
c5dc10b3c4 Add detection of __LITTLE/BIG_ENDIAN__ for GCC versions that define them. I.e. the Apple builds of Xcode/gcc. (fixes #2762)
[SVN r62252]
2010-05-26 21:10:41 +00:00
00e723fba0 Don't foward declare containers when using gcc's parallel library and
add a macro to disable forward declaration. Fixes #3866.

[SVN r59282]
2010-01-27 19:32:39 +00:00
c2192c4caf Fix interlocked.hpp to compile under /clr:pure. Refs #3378.
[SVN r57958]
2009-11-26 21:40:50 +00:00
097a256c16 Removed obsolete file
[SVN r57901]
2009-11-24 19:43:16 +00:00
badf2c8a79 fix for fix in r35591: sometimes __hppa is on PA-RISC but __hpux isn't
Fixes ticket #3537




[SVN r57048]
2009-10-21 18:05:33 +00:00
91672171a6 rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back
[SVN r56942]
2009-10-17 02:07:38 +00:00
812c32a5a1 Fix #3346 boost/detail/scoped_enum_emulation.hpp enum_t conflict with Unix rpc/types.h
[SVN r55604]
2009-08-15 14:20:28 +00:00
7dbb57bc82 Copyrights on CMakeLists.txt to keep them from clogging up the inspect
reports.  This is essentially the same commit as r55095 on the release
branch.



[SVN r55159]
2009-07-26 00:49:56 +00:00
7247d512f8 Move BOOST_HASH_CHAR_TRAITS from container_fwd into the hash headers, and undefine it.
[SVN r54143]
2009-06-21 09:42:20 +00:00
6a458a381b Fix ticket #2986 patch for VC++ 7.1 and earlier; workaround WCHAR_MAX bug
[SVN r54031]
2009-06-17 22:40:14 +00:00
c888037399 Support BOOST_NO_TYPEID and BOOST_NO_IOSTREAM in Boost.Variant. Fixes #3051.
[SVN r53682]
2009-06-06 11:46:24 +00:00
8c3a497ec8 detail/utf8_codecvt_facet.cpp: apply patch from ticket #2986 to quiet warnings when wchar_t is 16-bits.
[SVN r53459]
2009-05-30 14:57:49 +00:00
cad13ace57 Remove unnecessary operator.
Fixes #2166.


[SVN r53435]
2009-05-30 09:44:00 +00:00
3911d7a669 Add acknowledgments
[SVN r52934]
2009-05-12 11:05:39 +00:00
23850d984a Yet another attempt to fix #2687
[SVN r52411]
2009-04-16 02:12:14 +00:00
da8fe765fd suppressed spurious MSVC warning
[SVN r52371]
2009-04-13 15:32:42 +00:00
d425f1e5bf Include <utility> for some versions of gcc's library.
Sometimes gcc's <cstddef> doesn't define the C++ macros, so check for it
and include <utility> in that case. Also remove a workaround from
container_fwd.hpp

Fixes #2924.

[SVN r52246]
2009-04-08 10:56:22 +00:00
3178938f98 Detect gcc stdlib for gcc 4.0.1.
For some reason the normal macros aren't defined for the standard
library that comes with gcc 4.0.1 (although maybe just on BSDs?). So try
to detect the library for that compiler.

[SVN r52245]
2009-04-08 05:51:31 +00:00
de4c1b2e9d Add BOOST_TEST_EQ.
[SVN r51976]
2009-03-26 00:03:45 +00:00
770e33343a System, Filesystem: remove boost/detail/test_framework.hpp; use boost/detail/lightweight_test.hpp instead (Thanks to Peter Dimov for pointing this out)
[SVN r51966]
2009-03-25 12:11:47 +00:00
a63bc49cfb Initial commit
[SVN r51958]
2009-03-24 15:28:27 +00:00
472ca5d636 Initial commit.
[SVN r51715]
2009-03-11 20:19:27 +00:00
1588a4a05f Move smart_ptr into boost/smart_ptr/*.hpp (refs #2239).
[SVN r51509]
2009-03-01 16:00:42 +00:00
aaf3c4ac98 Add missing semicolon
[SVN r50920]
2009-01-31 02:47:48 +00:00
816cad7bd8 Fix BOOST_NO_STDC_NAMESPACE problem; see ticket 2687
[SVN r50844]
2009-01-28 14:38:48 +00:00
d2ce3c5791 Add Blackfin support to fix #2663
[SVN r50675]
2009-01-19 18:52:23 +00:00
120abc637c Add a forwarding header for container_fwd.hpp
[SVN r49662]
2008-11-09 12:11:50 +00:00
34684d4df2 Move hash detail headers out of boost/functional/detail.
[SVN r49661]
2008-11-09 12:03:45 +00:00
20ab8a4e7d Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor
[SVN r49510]
2008-11-01 13:15:41 +00:00
c6024a4ac4 include header which includes "size_t"
[SVN r49298]
2008-10-12 19:49:05 +00:00
da0f568852 added workaround for http://bugs.sun.com/view_bug.do?bug_id=6757317 , also discussed at http://lists.boost.org/boost-users/2008/10/41154.php
[SVN r49289]
2008-10-12 13:06:22 +00:00
18dbae4700 integer_log2.hpp and lowest_bit.hpp, in boost/pending/: little comment cleanup (svn anchors, etc.); added a static_cast<> to silence (harmless) MSVC++ warnings
[SVN r48251]
2008-08-20 11:06:23 +00:00
06946f6607 Boost 1.36 version of Boost.MultiIndex
passim: supressed non-ASCII chars in C++ code
bidir_node_iterator.hpp: deleted unused template parameter
bucket_array.hpp: avoided allocator<void> instantiations
hash_index_iterator.hpp: avoided allocator<void> instantiations
hash_index_node.hpp: avoided allocator<void> instantiations, renamed var
ord_index_node.hpp: avoided allocator<void> instantiations
rnd_index_loader.hpp: avoided allocator<void> instantiations
rnd_index_node.hpp: avoided allocator<void> instantiations
rnd_index_ptr_array.hpp: avoided allocator<void> instantiations
rnd_node_iterator.hpp: deleted unused template parameter
seq_index_node.hpp: avoided allocator<void> instantiations
hashed_index.hpp: rewritten modify_ so that elements with unmodified key do not change position
multi_index_container.hpp: added allocator ctor
acknowledgements.html: added acknowledgements for Boost 1.36
compiler_specifics.html: typo
hash_indices.html: documented updating functions behavior wrt unmodified keys, formatting typos
key_extraction.html: formatting typos
multi_index_container.html: added allocator ctor, formatting typos
ord_indices.html: documented updating functions behavior wrt unmodified keys, formatting typos
rnd_indices.html: formatting typos
seq_indices.html: formatting typos
release_notes.html: added release notes for Boost 1.36
hashed.cpp: blocked Boost inspect tool check for ASCII only chars
non_std_allocator.hpp: removed void specialization to verify that no allocator<void> instantiations are generated
test_copy_assignment.cpp: added test for multi_index_container allocator ctor
test_update.cpp: added test for stability of update functions wrt to unmodified keys

[SVN r46770]
2008-06-27 13:32:24 +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
40a44d6810 cleanup and improved portability
[SVN r23850]
2004-07-20 20:41:19 +00:00
b6dee6532e Fixed postfix increment for incrementable and single-pass iterator facade
[SVN r23456]
2004-07-12 03:18:49 +00:00
700efc2873 initial checkin
[SVN r23434]
2004-07-11 01:26:33 +00:00
ec1d526862 stricter check in is_partial_std_allocator
[SVN r23067]
2004-06-09 13:58:56 +00:00
f20d50a741 renamed to allocator_utilities.hpp
[SVN r23061]
2004-06-09 10:18:28 +00:00
165c7e29fa was allocator.hpp
[SVN r23060]
2004-06-09 10:17:41 +00:00
acea9bf9fa fixed include guard clash with boost/regex/config/allocator.hpp
[SVN r23006]
2004-06-02 15:54:10 +00:00
fc82a4b926 moved from boost/multi_index/detail
[SVN r23004]
2004-06-02 14:35:30 +00:00
fefc312df8 Moved detail/allocator.hpp into regex directory.
[SVN r22967]
2004-05-28 12:21:44 +00:00
42bfb20e4b new license reference
[SVN r22834]
2004-05-16 09:17:55 +00:00
19cd8815b6 added Borland workaround
[SVN r22770]
2004-05-09 08:58:03 +00:00
a00196977f initial commit
[SVN r22759]
2004-05-07 10:44:23 +00:00
5f07eb294f new file (needed by dynamic_bitset)
[SVN r22651]
2004-04-18 09:15:08 +00:00
2fe7fd95d2 Kill off outer cv-stripping of Dereferenceable
[SVN r21696]
2004-01-13 19:18:42 +00:00
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
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
1fbad0fe2c Added missing <assert.h> include.
[SVN r21417]
2003-12-29 13:42:25 +00:00
1fa91744d4 _MSC_VER use clarified.
[SVN r20992]
2003-11-28 15:35:21 +00:00
8715141657 Renamed boost::empty to boost::blank.
[SVN r20676]
2003-11-05 02:35:12 +00:00
d562044910 Handle non-lvalue iterators properly
[SVN r20585]
2003-11-02 05:37:38 +00:00
187c393d0c Updated licence
[SVN r20321]
2003-10-09 10:18:17 +00:00
61ab827c49 Boost.Signals now uses the official Boost license
[SVN r20236]
2003-10-01 04:34:38 +00:00
9223a385a6 Bugfix from Thorsten Ottosen <nesotto-at-cs.auc.dk>
[SVN r20187]
2003-09-25 19:30:53 +00:00
f7d6abb21e Removed unnecessary workaround.
[SVN r20055]
2003-09-14 20:39:21 +00:00
b2de7f6888 Minor fix.
[SVN r20043]
2003-09-13 21:01:44 +00:00
5d116e0057 Change license message to reference Boost Software License
[SVN r20038]
2003-09-12 17:09:29 +00:00
d536934458 Added nested typedefs in iterator_traits<int> for ETI cutoff
[SVN r19920]
2003-09-04 21:14:27 +00:00
4cbe12240a Removed inappropriate has_nothrow_constructor specialization.
[SVN r19895]
2003-09-01 07:52:51 +00:00
190b0bf58b Added type_traits specializations.
[SVN r19894]
2003-09-01 07:51:13 +00:00
463f382482 Moved reference_content to boost/detail from variant/detail.
[SVN r19884]
2003-08-31 01:59:15 +00:00
b3edcaebb3 Remove flotsam #includes
[SVN r19855]
2003-08-29 12:12:08 +00:00
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
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
f980329354 Use BOOST_NO_STD_LOCALE to detect when needed.
[SVN r19331]
2003-07-28 14:22:47 +00:00
ac460707c9 Added BOOST_TEMPLATED_STREAM_* helper macros.
[SVN r19312]
2003-07-26 04:26:58 +00:00
7e4ad9c654 added needed include of <new>
[SVN r18949]
2003-07-06 10:52:06 +00:00
11adf72ff6 -Wundef fixes.
[SVN r18788]
2003-06-12 17:09:24 +00:00
7a092ba5f9 Added tentative fix for sunpro
[SVN r18595]
2003-05-29 11:18:35 +00:00
ab34b61206 removed superfluous spaces
[SVN r18271]
2003-04-16 22:55:23 +00:00
b0b37ef724 "envelope" for non-type template parameters (useful to workaround compiler bugs)
[SVN r18270]
2003-04-16 22:51:39 +00:00
69c7068028 Small changes to support new iterator adaptors in sandbox
[SVN r18212]
2003-04-09 11:57:59 +00:00
124be84389 Fixes for Comeau with Borland as backend.
[SVN r17588]
2003-02-22 13:40:23 +00:00
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
7f668adbcd Added BOOST_QA_PAGE_SIZE.
[SVN r17270]
2003-02-07 18:43:48 +00:00
d6fbac9ba7 Quick_allocator updates.
[SVN r17267]
2003-02-07 15:08:52 +00:00
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
1f52127735 Fixed macro usage
[SVN r16752]
2003-01-05 12:12:39 +00:00
48507564a9 add or update See www.boost.org comments
[SVN r16708]
2002-12-27 16:51:53 +00:00
8d549f45fd Workarounds for broken RogueWave lib that comes with Sun
[SVN r16509]
2002-12-04 15:52:33 +00:00
c1f144e5d4 Major changes to shared_ptr and weak_ptr
[SVN r16314]
2002-11-18 14:37:02 +00:00
53ba30e0c9 add missing #include
[SVN r16171]
2002-11-09 02:39:38 +00:00
9aead1823b More fixes, better error messages, etc.
[SVN r16170]
2002-11-09 02:37:54 +00:00
c14ee17601 Final patches for MSVC6
[SVN r16166]
2002-11-08 17:23:06 +00:00
2bca71488b Works with MSVC and Intel5 now. Thanks, Aleksey!!
[SVN r16165]
2002-11-08 17:08:17 +00:00
1f335d30ba Cleanups on boost::iterator_traits<>
Broke MSVC though :(


[SVN r16157]
2002-11-08 06:57:31 +00:00
a38297a6cc Borland fix
[SVN r15360]
2002-09-16 04:10:29 +00:00
72ca3d7d9f Switched to <boost/detail/lightweight_test.hpp> for testing.
[SVN r14932]
2002-08-16 16:41:16 +00:00
28432648e0 Fix unversioned VC++ checks
[SVN r14436]
2002-07-13 12:26:19 +00:00
e69140d3f3 Workaround BOOST_MSVC_STD_ITERATOR misconfiguration; add MSVC6 specificity
[SVN r14047]
2002-05-28 20:25:51 +00:00
00f6a9751a Fixed buggy variable usage.
[SVN r14019]
2002-05-23 11:41:44 +00:00
9663499093 Added Boost.Signals library
[SVN r13964]
2002-05-17 15:28:22 +00:00
d9d6a970cf add BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE
[SVN r13721]
2002-05-07 15:15:30 +00:00
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
01448d3373 Added missing include guards.
[SVN r13335]
2002-04-01 11:47:54 +00:00
15a5375b14 Added support for compilers with no exception handling support.
[SVN r12758]
2002-02-08 12:44:43 +00:00
09e0b2e072 inserted: missing typename (EDG 245 diagnostics)
[SVN r12410]
2002-01-22 00:35:37 +00:00
08e37c5ccc initial checkin
[SVN r12388]
2002-01-21 00:49:14 +00:00
19201a4bb9 Cleared out bogus flotsam
[SVN r12350]
2002-01-19 02:21:24 +00:00
528fb22617 * Changed BOOST_RE_THREADS to BOOST_HAS_THREADS,
* Updated allocator code to use SGI node based allocator when available.


[SVN r11829]
2001-11-30 11:58:04 +00:00
71790af7f6 Changed name of "bind" to "select" to avoid problems with MSVC.
[SVN r11338]
2001-10-04 19:56:07 +00:00
59099cadf6 fix parameter name
[SVN r11281]
2001-09-26 18:34:57 +00:00
695b3059bd More fixes resulting from the new config
[SVN r11182]
2001-09-21 11:35:54 +00:00
3a4ed6ef7c Fixed misplaced std:: prefix (typo from last checkin)
[SVN r11166]
2001-09-20 11:46:26 +00:00
63b5e51676 First round of config fixes
[SVN r11146]
2001-09-19 11:48:51 +00:00
8c6c8f9604 commit of split-config, including any changes required to existing libraries (mainly regex).
[SVN r11138]
2001-09-18 11:13:39 +00:00
865bc7d803 fixed inheritance
[SVN r11067]
2001-09-07 20:11:41 +00:00
0ea958903a workaround for Solaris Forte 6
[SVN r11060]
2001-09-07 16:29:29 +00:00
e027048eb6 Added workarounds for MPW C++.
[SVN r10799]
2001-08-07 17:11:24 +00:00
75fb29a3b7 fix duplicate typedef
[SVN r10597]
2001-07-12 17:40:38 +00:00
8f9b1e35bd Make report_exception() inline (John Maddock, Jesse Jones)
[SVN r10322]
2001-06-13 14:41:10 +00:00
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
1ee4d8ac0d add HP aCC workaround
[SVN r10019]
2001-05-05 19:57:09 +00:00
69dccc47b5 rolled back changes, value_type can not be an abstract base class
[SVN r9583]
2001-03-19 16:56:32 +00:00
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
66f30e813e changed to use pointer with is_convertible
[SVN r9570]
2001-03-17 21:54:04 +00:00
863361ded0 untabified
[SVN r9514]
2001-03-09 02:37:01 +00:00
fe148355a2 fixed for borland
[SVN r9508]
2001-03-08 21:12:30 +00:00
be12189340 removed use of yes_type/no_type, not needed for borland workaround
[SVN r9507]
2001-03-08 20:58:51 +00:00
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
a8ae9d9941 new file
[SVN r9488]
2001-03-08 16:33:40 +00:00
1b51ce460c More attempted fixes for Intel C++
[SVN r9406]
2001-03-04 15:08:17 +00:00
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
83b8fcefc7 Changed BOOST_MSVC to BOOST_MSVC_STD_ITERATOR in a few places.
[SVN r9383]
2001-03-02 23:45:03 +00:00
6b15777c8f Initial commit
[SVN r9370]
2001-03-01 15:45:41 +00:00
7c91125060 Boost Test Library initial commit
[SVN r9364]
2001-02-28 21:39:56 +00:00
03b1bb7a1e Updated documentation
[SVN r9283]
2001-02-19 22:58:12 +00:00
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
5044712ff6 type_traits: regression failure fixes from type traits changes...
[SVN r9249]
2001-02-18 11:43:01 +00:00
2f6f7af430 Make it work with standard conforming iterators under raw VC6.
[SVN r9197]
2001-02-13 23:30:25 +00:00
1e0e965f07 Clean away code which can never be used
[SVN r9134]
2001-02-11 19:44:54 +00:00
7523daa905 Use BOOST_STATIC_CONSTANT
[SVN r9133]
2001-02-11 19:39:11 +00:00
3cb4fe87a9 Rolled unspecialized template back in
[SVN r9116]
2001-02-11 16:12:13 +00:00
dc1186e73f Rolled back ineffective Borland-specific code
[SVN r9115]
2001-02-11 16:11:24 +00:00
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
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
2947fb7051 Applied John Maddock's Borland patch Moving <true> specialization to unspecialized template
[SVN r9058]
2001-02-09 15:23:55 +00:00
cd1eecd245 Add parens to appease Borland
[SVN r9043]
2001-02-09 03:30:12 +00:00
9ac4d90d82 *** empty log message ***
[SVN r9029]
2001-02-08 04:44:19 +00:00
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
ddccb755f4 Removed useless #includes of standard library headers
[SVN r8993]
2001-02-07 04:52:58 +00:00
8ffb174556 Initial Checkin
[SVN r8992]
2001-02-07 04:51:12 +00:00
8b60ca8d0a Factored if_true out into boost/detail/select_type.hpp
[SVN r8991]
2001-02-07 04:49:32 +00:00
3cbecf5ddd fix bool logic bug introduced by Jeremy's compilation fixes
[SVN r8988]
2001-02-06 22:56:37 +00:00
82af891892 ported to KAI C++
[SVN r8955]
2001-02-06 01:21:11 +00:00
4bfd4da650 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<>.


[SVN r8747]
2001-01-24 01:44:05 +00:00
37d08acea1 Initial checkin
[SVN r8702]
2001-01-22 04:08:29 +00:00
708fd64f4e tweak a comment
[SVN r8680]
2001-01-21 16:18:41 +00:00
5963c3d44d Initial checkin
[SVN r8664]
2001-01-21 05:18:41 +00:00
4d24f82e6e Initial Checkin
[SVN r8661]
2001-01-21 00:16:10 +00:00
de2904c9a1 ported the graph library to borland
[SVN r7965]
2000-10-17 00:16:05 +00:00
9b9d2241a7 removed tabs
[SVN r7835]
2000-09-25 21:19:29 +00:00
35 changed files with 4220 additions and 67 deletions

106
include/boost/blank.hpp Normal file
View File

@ -0,0 +1,106 @@
//-----------------------------------------------------------------------------
// boost blank.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003
// Eric Friedman
//
// 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_BLANK_HPP
#define BOOST_BLANK_HPP
#include "boost/blank_fwd.hpp"
#if !defined(BOOST_NO_IOSTREAM)
#include <iosfwd> // for std::basic_ostream forward declare
#include "boost/detail/templated_streams.hpp"
#endif // BOOST_NO_IOSTREAM
#include "boost/mpl/bool.hpp"
#include "boost/type_traits/is_empty.hpp"
#include "boost/type_traits/is_pod.hpp"
#include "boost/type_traits/is_stateless.hpp"
namespace boost {
struct blank
{
};
// type traits specializations
//
template <>
struct is_pod< blank >
: mpl::true_
{
};
template <>
struct is_empty< blank >
: mpl::true_
{
};
template <>
struct is_stateless< blank >
: mpl::true_
{
};
// relational operators
//
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 true;
}
inline bool operator!=(const blank&, const blank&)
{
return false;
}
inline bool operator<(const blank&, const blank&)
{
return false;
}
inline bool operator>(const blank&, const blank&)
{
return false;
}
// streaming support
//
#if !defined(BOOST_NO_IOSTREAM)
BOOST_TEMPLATED_STREAM_TEMPLATE(E,T)
inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
BOOST_TEMPLATED_STREAM(ostream, E,T)& out
, const blank&
)
{
// (output nothing)
return out;
}
#endif // BOOST_NO_IOSTREAM
} // namespace boost
#endif // BOOST_BLANK_HPP

View File

@ -0,0 +1,22 @@
//-----------------------------------------------------------------------------
// boost blank_fwd.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003
// Eric Friedman
//
// 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_BLANK_FWD_HPP
#define BOOST_BLANK_FWD_HPP
namespace boost {
struct blank;
} // namespace boost
#endif // BOOST_BLANK_FWD_HPP

41
include/boost/cstdlib.hpp Normal file
View File

@ -0,0 +1,41 @@
// boost/cstdlib.hpp header ------------------------------------------------//
// Copyright Beman Dawes 2001. 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 http://www.boost.org/libs/utility/cstdlib.html for documentation.
// Revision History
// 26 Feb 01 Initial version (Beman Dawes)
#ifndef BOOST_CSTDLIB_HPP
#define BOOST_CSTDLIB_HPP
#include <cstdlib>
namespace boost
{
// The intent is to propose the following for addition to namespace std
// in the C++ Standard Library, and to then deprecate EXIT_SUCCESS and
// EXIT_FAILURE. As an implementation detail, this header defines the
// new constants in terms of EXIT_SUCCESS and EXIT_FAILURE. In a new
// standard, the constants would be implementation-defined, although it
// might be worthwhile to "suggest" (which a standard is allowed to do)
// values of 0 and 1 respectively.
// Rationale for having multiple failure values: some environments may
// wish to distinguish between different classes of errors.
// Rationale for choice of values: programs often use values < 100 for
// their own error reporting. Values > 255 are sometimes reserved for
// system detected errors. 200/201 were suggested to minimize conflict.
const int exit_success = EXIT_SUCCESS; // implementation-defined value
const int exit_failure = EXIT_FAILURE; // implementation-defined value
const int exit_exception_failure = 200; // otherwise uncaught exception
const int exit_test_failure = 201; // report_error or
// report_critical_error called.
}
#endif

View File

@ -0,0 +1,212 @@
/* Copyright 2003-2009 Joaquin M Lopez Munoz.
* 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 Boost website at http://www.boost.org/
*/
#ifndef BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP
#define BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/detail/workaround.hpp>
#include <boost/mpl/aux_/msvc_never_true.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <cstddef>
#include <memory>
#include <new>
namespace boost{
namespace detail{
/* Allocator adaption layer. Some stdlibs provide allocators without rebind
* and template ctors. These facilities are simulated with the external
* template class rebind_to and the aid of partial_std_allocator_wrapper.
*/
namespace allocator{
/* partial_std_allocator_wrapper inherits the functionality of a std
* allocator while providing a templatized ctor and other bits missing
* in some stdlib implementation or another.
*/
template<typename Type>
class partial_std_allocator_wrapper:public std::allocator<Type>
{
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(){};
template<typename 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)
/* Dinkumware guys didn't provide a means to call allocate() without
* supplying a hint, in disagreement with the standard.
*/
Type* allocate(std::size_t n,const void* hint=0)
{
std::allocator<Type>& a=*this;
return a.allocate(n,hint);
}
#endif
};
/* Detects whether a given allocator belongs to a defective stdlib not
* having the required member templates.
* Note that it does not suffice to check the Boost.Config stdlib
* macros, as the user might have passed a custom, compliant allocator.
* The checks also considers partial_std_allocator_wrapper to be
* a standard defective allocator.
*/
#if defined(BOOST_NO_STD_ALLOCATOR)&&\
(defined(BOOST_HAS_PARTIAL_STD_ALLOCATOR)||defined(BOOST_DINKUMWARE_STDLIB))
template<typename Allocator>
struct is_partial_std_allocator
{
BOOST_STATIC_CONSTANT(bool,
value=
(is_same<
std::allocator<BOOST_DEDUCED_TYPENAME Allocator::value_type>,
Allocator
>::value)||
(is_same<
partial_std_allocator_wrapper<
BOOST_DEDUCED_TYPENAME Allocator::value_type>,
Allocator
>::value));
};
#else
template<typename Allocator>
struct is_partial_std_allocator
{
BOOST_STATIC_CONSTANT(bool,value=false);
};
#endif
/* rebind operations for defective std allocators */
template<typename Allocator,typename Type>
struct partial_std_allocator_rebind_to
{
typedef partial_std_allocator_wrapper<Type> type;
};
/* rebind operation in all other cases */
#if BOOST_WORKAROUND(BOOST_MSVC,<1300)
/* Workaround for a problem in MSVC with dependent template typedefs
* when doing rebinding of allocators.
* Modeled after <boost/mpl/aux_/msvc_dtw.hpp> (thanks, Aleksey!)
*/
template<typename Allocator>
struct rebinder
{
template<bool> struct fake_allocator:Allocator{};
template<> struct fake_allocator<true>
{
template<typename Type> struct rebind{};
};
template<typename Type>
struct result:
fake_allocator<mpl::aux::msvc_never_true<Allocator>::value>::
template rebind<Type>
{
};
};
#else
template<typename Allocator>
struct rebinder
{
template<typename Type>
struct result
{
typedef typename Allocator::BOOST_NESTED_TEMPLATE
rebind<Type>::other other;
};
};
#endif
template<typename Allocator,typename Type>
struct compliant_allocator_rebind_to
{
typedef typename rebinder<Allocator>::
BOOST_NESTED_TEMPLATE result<Type>::other type;
};
/* rebind front-end */
template<typename Allocator,typename Type>
struct rebind_to:
mpl::eval_if_c<
is_partial_std_allocator<Allocator>::value,
partial_std_allocator_rebind_to<Allocator,Type>,
compliant_allocator_rebind_to<Allocator,Type>
>
{
};
/* allocator-independent versions of construct and destroy */
template<typename Type>
void construct(void* p,const Type& t)
{
new (p) Type(t);
}
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
/* MSVC++ issues spurious warnings about unreferencend formal parameters
* in destroy<Type> when Type is a class with trivial dtor.
*/
#pragma warning(push)
#pragma warning(disable:4100)
#endif
template<typename Type>
void destroy(const Type* p)
{
#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590))
const_cast<Type*>(p)->~Type();
#else
p->~Type();
#endif
}
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
#pragma warning(pop)
#endif
} /* namespace boost::detail::allocator */
} /* namespace boost::detail */
} /* namespace boost */
#endif

View File

@ -0,0 +1,216 @@
// Copyright (c) 2000 David Abrahams.
// 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)
//
// Copyright (c) 1994
// Hewlett-Packard Company
//
// Permission to use, copy, modify, distribute and sell this software
// and its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appear in all copies and
// that both that copyright notice and this permission notice appear
// in supporting documentation. Hewlett-Packard Company makes no
// representations about the suitability of this software for any
// purpose. It is provided "as is" without express or implied warranty.
//
// Copyright (c) 1996
// Silicon Graphics Computer Systems, Inc.
//
// Permission to use, copy, modify, distribute and sell this software
// and its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appear in all copies and
// that both that copyright notice and this permission notice appear
// in supporting documentation. Silicon Graphics makes no
// representations about the suitability of this software for any
// purpose. It is provided "as is" without express or implied warranty.
//
#ifndef BINARY_SEARCH_DWA_122600_H_
# define BINARY_SEARCH_DWA_122600_H_
# include <boost/detail/iterator.hpp>
# include <utility>
namespace boost { namespace detail {
template <class ForwardIter, class Tp>
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
const Tp& val)
{
typedef detail::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last);
typename traits::difference_type half;
ForwardIter middle;
while (len > 0) {
half = len >> 1;
middle = first;
std::advance(middle, half);
if (*middle < val) {
first = middle;
++first;
len = len - half - 1;
}
else
len = half;
}
return first;
}
template <class ForwardIter, class Tp, class Compare>
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
const Tp& val, Compare comp)
{
typedef detail::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last);
typename traits::difference_type half;
ForwardIter middle;
while (len > 0) {
half = len >> 1;
middle = first;
std::advance(middle, half);
if (comp(*middle, val)) {
first = middle;
++first;
len = len - half - 1;
}
else
len = half;
}
return first;
}
template <class ForwardIter, class Tp>
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
const Tp& val)
{
typedef detail::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last);
typename traits::difference_type half;
ForwardIter middle;
while (len > 0) {
half = len >> 1;
middle = first;
std::advance(middle, half);
if (val < *middle)
len = half;
else {
first = middle;
++first;
len = len - half - 1;
}
}
return first;
}
template <class ForwardIter, class Tp, class Compare>
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
const Tp& val, Compare comp)
{
typedef detail::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last);
typename traits::difference_type half;
ForwardIter middle;
while (len > 0) {
half = len >> 1;
middle = first;
std::advance(middle, half);
if (comp(val, *middle))
len = half;
else {
first = middle;
++first;
len = len - half - 1;
}
}
return first;
}
template <class ForwardIter, class Tp>
std::pair<ForwardIter, ForwardIter>
equal_range(ForwardIter first, ForwardIter last, const Tp& val)
{
typedef detail::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last);
typename traits::difference_type half;
ForwardIter middle, left, right;
while (len > 0) {
half = len >> 1;
middle = first;
std::advance(middle, half);
if (*middle < val) {
first = middle;
++first;
len = len - half - 1;
}
else if (val < *middle)
len = half;
else {
left = boost::detail::lower_bound(first, middle, val);
std::advance(first, len);
right = boost::detail::upper_bound(++middle, first, val);
return std::pair<ForwardIter, ForwardIter>(left, right);
}
}
return std::pair<ForwardIter, ForwardIter>(first, first);
}
template <class ForwardIter, class Tp, class Compare>
std::pair<ForwardIter, ForwardIter>
equal_range(ForwardIter first, ForwardIter last, const Tp& val,
Compare comp)
{
typedef detail::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last);
typename traits::difference_type half;
ForwardIter middle, left, right;
while (len > 0) {
half = len >> 1;
middle = first;
std::advance(middle, half);
if (comp(*middle, val)) {
first = middle;
++first;
len = len - half - 1;
}
else if (comp(val, *middle))
len = half;
else {
left = boost::detail::lower_bound(first, middle, val, comp);
std::advance(first, len);
right = boost::detail::upper_bound(++middle, first, val, comp);
return std::pair<ForwardIter, ForwardIter>(left, right);
}
}
return std::pair<ForwardIter, ForwardIter>(first, first);
}
template <class ForwardIter, class Tp>
bool binary_search(ForwardIter first, ForwardIter last,
const Tp& val) {
ForwardIter i = boost::detail::lower_bound(first, last, val);
return i != last && !(val < *i);
}
template <class ForwardIter, class Tp, class Compare>
bool binary_search(ForwardIter first, ForwardIter last,
const Tp& val,
Compare comp) {
ForwardIter i = boost::detail::lower_bound(first, last, val, comp);
return i != last && !comp(val, *i);
}
}} // namespace boost::detail
#endif // BINARY_SEARCH_DWA_122600_H_

View File

@ -0,0 +1,146 @@
// boost/catch_exceptions.hpp -----------------------------------------------//
// Copyright Beman Dawes 1995-2001. 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 http://www.boost.org/libs/test for documentation.
// Revision History
// 13 Jun 01 report_exception() made inline. (John Maddock, Jesse Jones)
// 26 Feb 01 Numerous changes suggested during formal review. (Beman)
// 25 Jan 01 catch_exceptions.hpp code factored out of cpp_main.cpp.
// 22 Jan 01 Remove test_tools dependencies to reduce coupling.
// 5 Nov 00 Initial boost version (Beman Dawes)
#ifndef BOOST_CATCH_EXCEPTIONS_HPP
#define BOOST_CATCH_EXCEPTIONS_HPP
// header dependencies are deliberately restricted to the standard library
// to reduce coupling to other boost libraries.
#include <string> // for string
#include <new> // for bad_alloc
#include <typeinfo> // for bad_cast, bad_typeid
#include <exception> // for exception, bad_exception
#include <stdexcept> // for std exception hierarchy
#include <boost/cstdlib.hpp> // for exit codes
# if __GNUC__ != 2 || __GNUC_MINOR__ > 96
# include <ostream> // for ostream
# else
# include <iostream> // workaround GNU missing ostream header
# endif
# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551)
# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
# endif
#if defined(MPW_CPLUS) && (MPW_CPLUS <= 0x890)
# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
namespace std { class bad_typeid { }; }
# endif
namespace boost
{
namespace detail
{
// A separate reporting function was requested during formal review.
inline void report_exception( std::ostream & os,
const char * name, const char * info )
{ os << "\n** uncaught exception: " << name << " " << info << std::endl; }
}
// catch_exceptions ------------------------------------------------------//
template< class Generator > // Generator is function object returning int
int catch_exceptions( Generator function_object,
std::ostream & out, std::ostream & err )
{
int result = 0; // quiet compiler warnings
bool exception_thrown = true; // avoid setting result for each excptn type
#ifndef BOOST_NO_EXCEPTIONS
try
{
#endif
result = function_object();
exception_thrown = false;
#ifndef BOOST_NO_EXCEPTIONS
}
// As a result of hard experience with strangely interleaved output
// under some compilers, there is a lot of use of endl in the code below
// where a simple '\n' might appear to do.
// The rules for catch & arguments are a bit different from function
// arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't
// required, but it doesn't hurt and some programmers ask for it.
catch ( const char * ex )
{ detail::report_exception( out, "", ex ); }
catch ( const std::string & ex )
{ detail::report_exception( out, "", ex.c_str() ); }
// std:: exceptions
catch ( const std::bad_alloc & ex )
{ detail::report_exception( out, "std::bad_alloc:", ex.what() ); }
# ifndef BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
catch ( const std::bad_cast & ex )
{ detail::report_exception( out, "std::bad_cast:", ex.what() ); }
catch ( const std::bad_typeid & ex )
{ detail::report_exception( out, "std::bad_typeid:", ex.what() ); }
# else
catch ( const std::bad_cast & )
{ detail::report_exception( out, "std::bad_cast", "" ); }
catch ( const std::bad_typeid & )
{ detail::report_exception( out, "std::bad_typeid", "" ); }
# endif
catch ( const std::bad_exception & ex )
{ detail::report_exception( out, "std::bad_exception:", ex.what() ); }
catch ( const std::domain_error & ex )
{ detail::report_exception( out, "std::domain_error:", ex.what() ); }
catch ( const std::invalid_argument & ex )
{ detail::report_exception( out, "std::invalid_argument:", ex.what() ); }
catch ( const std::length_error & ex )
{ detail::report_exception( out, "std::length_error:", ex.what() ); }
catch ( const std::out_of_range & ex )
{ detail::report_exception( out, "std::out_of_range:", ex.what() ); }
catch ( const std::range_error & ex )
{ detail::report_exception( out, "std::range_error:", ex.what() ); }
catch ( const std::overflow_error & ex )
{ detail::report_exception( out, "std::overflow_error:", ex.what() ); }
catch ( const std::underflow_error & ex )
{ detail::report_exception( out, "std::underflow_error:", ex.what() ); }
catch ( const std::logic_error & ex )
{ detail::report_exception( out, "std::logic_error:", ex.what() ); }
catch ( const std::runtime_error & ex )
{ detail::report_exception( out, "std::runtime_error:", ex.what() ); }
catch ( const std::exception & ex )
{ detail::report_exception( out, "std::exception:", ex.what() ); }
catch ( ... )
{ detail::report_exception( out, "unknown exception", "" ); }
#endif // BOOST_NO_EXCEPTIONS
if ( exception_thrown ) result = boost::exit_exception_failure;
if ( result != 0 && result != exit_success )
{
out << std::endl << "**** returning with error code "
<< result << std::endl;
err
<< "********** errors detected; see stdout for details ***********"
<< std::endl;
}
#if !defined(BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE)
else { out << std::flush << "no errors detected" << std::endl; }
#endif
return result;
} // catch_exceptions
} // boost
#endif // BOOST_CATCH_EXCEPTIONS_HPP

View File

@ -0,0 +1,101 @@
// Copyright 2005-2008 Daniel James.
// 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_DETAIL_CONTAINER_FWD_HPP)
#define BOOST_DETAIL_CONTAINER_FWD_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) \
|| ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) \
&& (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL))) \
|| BOOST_WORKAROUND(__BORLANDC__, > 0x551) \
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \
|| (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
#include <deque>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <complex>
#else
#include <cstddef>
#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && \
defined(__STL_CONFIG_H)
#define BOOST_CONTAINER_FWD_BAD_BITSET
#if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG)
#define BOOST_CONTAINER_FWD_BAD_DEQUE
#endif
#endif
#if defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
#include <deque>
#endif
#if defined(BOOST_CONTAINER_FWD_BAD_BITSET)
#include <bitset>
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4099) // struct/class mismatch in fwd declarations
#endif
namespace std
{
template <class T> class allocator;
template <class charT, class traits, class Allocator> class basic_string;
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
template <class charT> struct string_char_traits;
#else
template <class charT> struct char_traits;
#endif
template <class T> class complex;
}
// gcc 3.4 and greater
namespace std
{
#if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
template <class T, class Allocator> class deque;
#endif
template <class T, class Allocator> class list;
template <class T, class Allocator> class vector;
template <class Key, class T, class Compare, class Allocator> class map;
template <class Key, class T, class Compare, class Allocator>
class multimap;
template <class Key, class Compare, class Allocator> class set;
template <class Key, class Compare, class Allocator> class multiset;
#if !defined(BOOST_CONTAINER_FWD_BAD_BITSET)
template <size_t N> class bitset;
#endif
template <class T1, class T2> struct pair;
}
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#endif
#endif

View File

@ -0,0 +1,76 @@
// Copyright 2005 Caleb Epstein
// Copyright 2006 John Maddock
// Copyright 2010 Rene Rivera
// 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) || \
defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
# define BOOST_BIG_ENDIAN
# define BOOST_BYTE_ORDER 4321
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) || \
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(__hppa) \
|| 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) || defined(__bfin__)
# 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,152 @@
#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 )
#if defined( __CLRCALL_PURE_OR_CDECL )
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * );
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * );
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long );
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long );
extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long );
#else
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 );
#endif
# 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 );
# if defined(_M_IA64) || defined(_M_AMD64)
extern "C" __declspec(dllimport) void* __stdcall InterlockedCompareExchangePointer( void* volatile *, void*, void* );
extern "C" __declspec(dllimport) void* __stdcall InterlockedExchangePointer( void* volatile *, void* );
# endif
} // 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
# if defined(_M_IA64) || defined(_M_AMD64)
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER ::boost::detail::InterlockedCompareExchangePointer
# define BOOST_INTERLOCKED_EXCHANGE_POINTER ::boost::detail::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
#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

View File

@ -0,0 +1,134 @@
// 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 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/mpl/aux_/lambda_support.hpp>
# include <boost/mpl/bool.hpp>
# include <boost/detail/workaround.hpp>
// Must be the last include
# include <boost/type_traits/detail/bool_trait_def.hpp>
namespace boost { namespace detail {
// is_incrementable<T> metafunction
//
// Requires: Given x of type T&, if the expression ++x is well-formed
// it must have complete type; otherwise, it must neither be ambiguous
// nor violate access.
// This namespace ensures that ADL doesn't mess things up.
namespace is_incrementable_
{
// a type returned from operator++ when no increment is found in the
// type's own namespace
struct tag {};
// any soaks up implicit conversions and makes the following
// operator++ less-preferred than any other such operator that
// might be found via ADL.
struct any { template <class T> any(T const&); };
// 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&,int);
# endif
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# define BOOST_comma(a,b) (a)
# else
// In case an operator++ is found that returns void, we'll use ++x,0
tag operator,(tag,int);
# define BOOST_comma(a,b) (a,b)
# 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
char (& check(tag) )[2];
template <class T>
char check(T const&);
template <class T>
struct impl
{
static typename boost::remove_cv<T>::type& x;
BOOST_STATIC_CONSTANT(
bool
, value = sizeof(is_incrementable_::check(BOOST_comma(++x,0))) == 1
);
};
template <class T>
struct postfix_impl
{
static typename boost::remove_cv<T>::type& x;
BOOST_STATIC_CONSTANT(
bool
, value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
);
};
# if defined(BOOST_MSVC)
# pragma warning(pop)
# endif
}
# undef BOOST_comma
template<typename T>
struct is_incrementable
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<typename T>
struct is_postfix_incrementable
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 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

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

@ -0,0 +1,494 @@
// (C) 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)
// Boost versions of
//
// std::iterator_traits<>::iterator_category
// std::iterator_traits<>::difference_type
// std::distance()
//
// ...for all compilers and iterators
//
// Additionally, if X is a pointer
// std::iterator_traits<X>::pointer
// Otherwise, if partial specialization is supported or X is not a pointer
// std::iterator_traits<X>::value_type
// std::iterator_traits<X>::pointer
// std::iterator_traits<X>::reference
//
// See http://www.boost.org for most recent version including documentation.
// Revision History
// 04 Mar 2001 - More attempted fixes for Intel C++ (David Abrahams)
// 03 Mar 2001 - Put all implementation into namespace
// boost::detail::iterator_traits_. Some progress made on fixes
// for Intel compiler. (David Abrahams)
// 02 Mar 2001 - Changed BOOST_MSVC to BOOST_MSVC_STD_ITERATOR in a few
// places. (Jeremy Siek)
// 19 Feb 2001 - Improved workarounds for stock MSVC6; use yes_type and
// no_type from type_traits.hpp; stopped trying to remove_cv
// before detecting is_pointer, in honor of the new type_traits
// semantics. (David Abrahams)
// 13 Feb 2001 - Make it work with nearly all standard-conforming iterators
// under raw VC6. The one category remaining which will fail is
// that of iterators derived from std::iterator but not
// boost::iterator and which redefine difference_type.
// 11 Feb 2001 - Clean away code which can never be used (David Abrahams)
// 09 Feb 2001 - Always have a definition for each traits member, even if it
// can't be properly deduced. These will be incomplete types in
// some cases (undefined<void>), but it helps suppress MSVC errors
// elsewhere (David Abrahams)
// 07 Feb 2001 - Support for more of the traits members where possible, making
// this useful as a replacement for std::iterator_traits<T> when
// used as a default template parameter.
// 06 Feb 2001 - Removed useless #includes of standard library headers
// (David Abrahams)
#ifndef ITERATOR_DWA122600_HPP_
# define ITERATOR_DWA122600_HPP_
# include <boost/config.hpp>
# include <iterator>
// 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)
# if (__SGI_STL_PORT <= 0x410) && !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && defined(__STL_DEBUG)
# define BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
# endif
# define BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
# endif // STLPort <= 4.1b4 && no partial specialization
# if !defined(BOOST_NO_STD_ITERATOR_TRAITS) \
&& !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
&& !defined(BOOST_MSVC_STD_ITERATOR)
namespace boost { namespace detail {
// Define a new template so it can be specialized
template <class Iterator>
struct iterator_traits
: std::iterator_traits<Iterator>
{};
using std::distance;
}} // namespace boost::detail
# else
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
&& !defined(BOOST_MSVC_STD_ITERATOR)
// This is the case where everything conforms except BOOST_NO_STD_ITERATOR_TRAITS
namespace boost { namespace detail {
// Rogue Wave Standard Library fools itself into thinking partial
// specialization is missing on some platforms (e.g. Sun), so fails to
// supply iterator_traits!
template <class Iterator>
struct iterator_traits
{
typedef typename Iterator::value_type value_type;
typedef typename Iterator::reference reference;
typedef typename Iterator::pointer pointer;
typedef typename Iterator::difference_type difference_type;
typedef typename Iterator::iterator_category iterator_category;
};
template <class T>
struct iterator_traits<T*>
{
typedef T value_type;
typedef T& reference;
typedef T* pointer;
typedef std::ptrdiff_t difference_type;
typedef std::random_access_iterator_tag iterator_category;
};
template <class T>
struct iterator_traits<T const*>
{
typedef T value_type;
typedef T const& reference;
typedef T const* pointer;
typedef std::ptrdiff_t difference_type;
typedef std::random_access_iterator_tag iterator_category;
};
}} // namespace boost::detail
# else
# include <boost/type_traits/remove_const.hpp>
# include <boost/type_traits/detail/yes_no_type.hpp>
# include <boost/type_traits/is_pointer.hpp>
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# include <boost/type_traits/is_same.hpp>
# include <boost/type_traits/remove_pointer.hpp>
# endif
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
# include <boost/type_traits/is_base_and_derived.hpp>
# endif
# include <boost/mpl/if.hpp>
# include <boost/mpl/has_xxx.hpp>
# include <cstddef>
// should be the last #include
# include "boost/type_traits/detail/bool_trait_def.hpp"
namespace boost { namespace detail {
BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
BOOST_MPL_HAS_XXX_TRAIT_DEF(reference)
BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer)
BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type)
BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category)
// is_mutable_iterator --
//
// A metafunction returning true iff T is a mutable iterator type
// with a nested value_type. Will only work portably with iterators
// whose operator* returns a reference, but that seems to be OK for
// the iterators supplied by Dinkumware. Some input iterators may
// compile-time if they arrive here, and if the compiler is strict
// about not taking the address of an rvalue.
// This one detects ordinary mutable iterators - the result of
// operator* is convertible to the value_type.
template <class T>
type_traits::yes_type is_mutable_iterator_helper(T const*, BOOST_DEDUCED_TYPENAME T::value_type*);
// Since you can't take the address of an rvalue, the guts of
// is_mutable_iterator_impl will fail if we use &*t directly. This
// makes sure we can still work with non-lvalue iterators.
template <class T> T* mutable_iterator_lvalue_helper(T& x);
int mutable_iterator_lvalue_helper(...);
// This one detects output iterators such as ostream_iterator which
// return references to themselves.
template <class T>
type_traits::yes_type is_mutable_iterator_helper(T const*, T const*);
type_traits::no_type is_mutable_iterator_helper(...);
template <class T>
struct is_mutable_iterator_impl
{
static T t;
BOOST_STATIC_CONSTANT(
bool, value = sizeof(
detail::is_mutable_iterator_helper(
(T*)0
, mutable_iterator_lvalue_helper(*t) // like &*t
))
== sizeof(type_traits::yes_type)
);
};
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
is_mutable_iterator,T,::boost::detail::is_mutable_iterator_impl<T>::value)
// is_full_iterator_traits --
//
// A metafunction returning true iff T has all the requisite nested
// types to satisfy the requirements for a fully-conforming
// iterator_traits implementation.
template <class T>
struct is_full_iterator_traits_impl
{
enum { value =
has_value_type<T>::value
& has_reference<T>::value
& has_pointer<T>::value
& has_difference_type<T>::value
& has_iterator_category<T>::value
};
};
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
is_full_iterator_traits,T,::boost::detail::is_full_iterator_traits_impl<T>::value)
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
BOOST_MPL_HAS_XXX_TRAIT_DEF(_Iterator_category)
// is_stlport_40_debug_iterator --
//
// A metafunction returning true iff T has all the requisite nested
// types to satisfy the requirements of an STLPort 4.0 debug iterator
// iterator_traits implementation.
template <class T>
struct is_stlport_40_debug_iterator_impl
{
enum { value =
has_value_type<T>::value
& has_reference<T>::value
& has_pointer<T>::value
& has_difference_type<T>::value
& has__Iterator_category<T>::value
};
};
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
is_stlport_40_debug_iterator,T,::boost::detail::is_stlport_40_debug_iterator_impl<T>::value)
template <class T>
struct stlport_40_debug_iterator_traits
{
typedef typename T::value_type value_type;
typedef typename T::reference reference;
typedef typename T::pointer pointer;
typedef typename T::difference_type difference_type;
typedef typename T::_Iterator_category iterator_category;
};
# endif // BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
template <class T> struct pointer_iterator_traits;
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T>
struct pointer_iterator_traits<T*>
{
typedef typename remove_const<T>::type value_type;
typedef T* pointer;
typedef T& reference;
typedef std::random_access_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
};
# else
// In case of no template partial specialization, and if T is a
// pointer, iterator_traits<T>::value_type can still be computed. For
// some basic types, remove_pointer is manually defined in
// type_traits/broken_compiler_spec.hpp. For others, do it yourself.
template<class P> class please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee;
template<class P>
struct pointer_value_type
: mpl::if_<
is_same<P, typename remove_pointer<P>::type>
, please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee<P>
, typename remove_const<
typename remove_pointer<P>::type
>::type
>
{
};
template<class P>
struct pointer_reference
: mpl::if_<
is_same<P, typename remove_pointer<P>::type>
, please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee<P>
, typename remove_pointer<P>::type&
>
{
};
template <class T>
struct pointer_iterator_traits
{
typedef T pointer;
typedef std::random_access_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
typedef typename pointer_value_type<T>::type value_type;
typedef typename pointer_reference<T>::type reference;
};
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// We'll sort iterator types into one of these classifications, from which we
// can determine the difference_type, pointer, reference, and value_type
template <class Iterator>
struct standard_iterator_traits
{
typedef typename Iterator::difference_type difference_type;
typedef typename Iterator::value_type value_type;
typedef typename Iterator::pointer pointer;
typedef typename Iterator::reference reference;
typedef typename Iterator::iterator_category iterator_category;
};
template <class Iterator>
struct msvc_stdlib_mutable_traits
: std::iterator_traits<Iterator>
{
typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
typedef typename std::iterator_traits<Iterator>::value_type* pointer;
typedef typename std::iterator_traits<Iterator>::value_type& reference;
};
template <class Iterator>
struct msvc_stdlib_const_traits
: std::iterator_traits<Iterator>
{
typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
typedef const typename std::iterator_traits<Iterator>::value_type* pointer;
typedef const typename std::iterator_traits<Iterator>::value_type& reference;
};
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
template <class Iterator>
struct is_bad_output_iterator
: is_base_and_derived<
std::iterator<std::output_iterator_tag,void,void,void,void>
, Iterator>
{
};
struct bad_output_iterator_traits
{
typedef void value_type;
typedef void difference_type;
typedef std::output_iterator_tag iterator_category;
typedef void pointer;
typedef void reference;
};
# endif
// If we're looking at an MSVC6 (old Dinkumware) ``standard''
// iterator, this will generate an appropriate traits class.
template <class Iterator>
struct msvc_stdlib_iterator_traits
: mpl::if_<
is_mutable_iterator<Iterator>
, msvc_stdlib_mutable_traits<Iterator>
, msvc_stdlib_const_traits<Iterator>
>::type
{};
template <class Iterator>
struct non_pointer_iterator_traits
: mpl::if_<
// if the iterator contains all the right nested types...
is_full_iterator_traits<Iterator>
// Use a standard iterator_traits implementation
, standard_iterator_traits<Iterator>
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
// Check for STLPort 4.0 broken _Iterator_category type
, mpl::if_<
is_stlport_40_debug_iterator<Iterator>
, stlport_40_debug_iterator_traits<Iterator>
# endif
// Otherwise, assume it's a Dinkum iterator
, msvc_stdlib_iterator_traits<Iterator>
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
>::type
# endif
>::type
{
};
template <class Iterator>
struct iterator_traits_aux
: mpl::if_<
is_pointer<Iterator>
, pointer_iterator_traits<Iterator>
, non_pointer_iterator_traits<Iterator>
>::type
{
};
template <class Iterator>
struct iterator_traits
{
// Explicit forwarding from base class needed to keep MSVC6 happy
// under some circumstances.
private:
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
typedef
typename mpl::if_<
is_bad_output_iterator<Iterator>
, bad_output_iterator_traits
, iterator_traits_aux<Iterator>
>::type base;
# else
typedef iterator_traits_aux<Iterator> base;
# endif
public:
typedef typename base::value_type value_type;
typedef typename base::pointer pointer;
typedef typename base::reference reference;
typedef typename base::difference_type difference_type;
typedef typename base::iterator_category iterator_category;
};
// This specialization cuts off ETI (Early Template Instantiation) for MSVC.
template <> struct iterator_traits<int>
{
typedef int value_type;
typedef int pointer;
typedef int reference;
typedef int difference_type;
typedef int iterator_category;
};
}} // namespace boost::detail
# endif // workarounds
namespace boost { namespace detail {
namespace iterator_traits_
{
template <class Iterator, class Difference>
struct distance_select
{
static Difference execute(Iterator i1, const Iterator i2, ...)
{
Difference result = 0;
while (i1 != i2)
{
++i1;
++result;
}
return result;
}
static Difference execute(Iterator i1, const Iterator i2, std::random_access_iterator_tag*)
{
return i2 - i1;
}
};
} // namespace boost::detail::iterator_traits_
template <class Iterator>
inline typename iterator_traits<Iterator>::difference_type
distance(Iterator first, Iterator last)
{
typedef typename iterator_traits<Iterator>::difference_type diff_t;
typedef typename ::boost::detail::iterator_traits<Iterator>::iterator_category iterator_category;
return iterator_traits_::distance_select<Iterator,diff_t>::execute(
first, last, (iterator_category*)0);
}
}}
# endif
# undef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
# undef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
#endif // ITERATOR_DWA122600_HPP_

View File

@ -0,0 +1,91 @@
#ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
#define BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// boost/detail/lightweight_test.hpp - lightweight test library
//
// Copyright (c) 2002, 2009 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
//
// BOOST_TEST(expression)
// BOOST_ERROR(message)
// BOOST_TEST_EQ(expr1, expr2)
//
// int boost::report_errors()
//
#include <boost/current_function.hpp>
#include <iostream>
namespace boost
{
namespace detail
{
inline int & test_errors()
{
static int x = 0;
return x;
}
inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
{
std::cerr << file << "(" << line << "): test '" << expr << "' failed in function '" << function << "'" << std::endl;
++test_errors();
}
inline void error_impl(char const * msg, char const * file, int line, char const * function)
{
std::cerr << file << "(" << line << "): " << msg << " in function '" << function << "'" << std::endl;
++test_errors();
}
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, T const & t, U const & u )
{
if( t == u )
{
}
else
{
std::cerr << file << "(" << line << "): test '" << expr1 << " == " << expr2
<< "' failed in function '" << function << "': "
<< "'" << t << "' != '" << u << "'" << std::endl;
++test_errors();
}
}
} // namespace detail
inline int report_errors()
{
int errors = detail::test_errors();
if( errors == 0 )
{
std::cerr << "No errors detected." << std::endl;
return 0;
}
else
{
std::cerr << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
return 1;
}
}
} // namespace boost
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED

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

@ -0,0 +1,177 @@
// (C) Copyright Jeremy Siek 2001.
// 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)
// Revision History:
// 04 Oct 2001 David Abrahams
// Changed name of "bind" to "select" to avoid problems with MSVC.
#ifndef BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
#define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
#include <boost/type_traits/conversion_traits.hpp>
#include <boost/type_traits/composite_traits.hpp> // for is_reference
#if defined(__BORLANDC__)
#include <boost/type_traits/ice.hpp>
#endif
namespace boost {
namespace detail {
struct default_argument { };
struct dummy_default_gen {
template <class Base, class Traits>
struct select {
typedef default_argument type;
};
};
// This class template is a workaround for MSVC.
template <class Gen> struct default_generator {
typedef detail::dummy_default_gen type;
};
template <class T> struct is_default {
enum { value = false };
typedef type_traits::no_type type;
};
template <> struct is_default<default_argument> {
enum { value = true };
typedef type_traits::yes_type type;
};
struct choose_default {
template <class Arg, class DefaultGen, class Base, class Traits>
struct select {
typedef typename default_generator<DefaultGen>::type Gen;
typedef typename Gen::template select<Base,Traits>::type type;
};
};
struct choose_arg {
template <class Arg, class DefaultGen, class Base, class Traits>
struct select {
typedef Arg type;
};
};
#if defined(__BORLANDC__)
template <class UseDefault>
struct choose_arg_or_default { typedef choose_arg type; };
template <>
struct choose_arg_or_default<type_traits::yes_type> {
typedef choose_default type;
};
#else
template <bool UseDefault>
struct choose_arg_or_default { typedef choose_arg type; };
template <>
struct choose_arg_or_default<true> {
typedef choose_default type;
};
#endif
template <class Arg, class DefaultGen, class Base, class Traits>
class resolve_default {
#if defined(__BORLANDC__)
typedef typename choose_arg_or_default<typename is_default<Arg>::type>::type Selector;
#else
// This usually works for Borland, but I'm seeing weird errors in
// iterator_adaptor_test.cpp when using this method.
enum { is_def = is_default<Arg>::value };
typedef typename choose_arg_or_default<is_def>::type Selector;
#endif
public:
typedef typename Selector
::template select<Arg, DefaultGen, Base, Traits>::type type;
};
// To differentiate an unnamed parameter from a traits generator
// we use is_convertible<X, iter_traits_gen_base>.
struct named_template_param_base { };
template <class X>
struct is_named_param_list {
enum { value = is_convertible<X, named_template_param_base>::value };
};
struct choose_named_params {
template <class Prev> struct select { typedef Prev type; };
};
struct choose_default_arg {
template <class Prev> struct select {
typedef detail::default_argument type;
};
};
template <bool Named> struct choose_default_dispatch_;
template <> struct choose_default_dispatch_<true> {
typedef choose_named_params type;
};
template <> struct choose_default_dispatch_<false> {
typedef choose_default_arg type;
};
// The use of inheritance here is a Solaris Forte 6 workaround.
template <bool Named> struct choose_default_dispatch
: public choose_default_dispatch_<Named> { };
template <class PreviousArg>
struct choose_default_argument {
enum { is_named = is_named_param_list<PreviousArg>::value };
typedef typename choose_default_dispatch<is_named>::type Selector;
typedef typename Selector::template select<PreviousArg>::type type;
};
// This macro assumes that there is a class named default_##TYPE
// defined before the application of the macro. This class should
// have a single member class template named "select" with two
// template parameters: the type of the class being created (e.g.,
// the iterator_adaptor type when creating iterator adaptors) and
// a traits class. The select class should have a single typedef
// named "type" that produces the default for TYPE. See
// boost/iterator_adaptors.hpp for an example usage. Also,
// applications of this macro must be placed in namespace
// boost::detail.
#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \
struct get_##TYPE##_from_named { \
template <class Base, class NamedParams, class Traits> \
struct select { \
typedef typename NamedParams::traits NamedTraits; \
typedef typename NamedTraits::TYPE TYPE; \
typedef typename resolve_default<TYPE, \
default_##TYPE, Base, NamedTraits>::type type; \
}; \
}; \
struct pass_thru_##TYPE { \
template <class Base, class Arg, class Traits> struct select { \
typedef typename resolve_default<Arg, \
default_##TYPE, Base, Traits>::type type; \
};\
}; \
template <int NamedParam> \
struct get_##TYPE##_dispatch { }; \
template <> struct get_##TYPE##_dispatch<1> { \
typedef get_##TYPE##_from_named type; \
}; \
template <> struct get_##TYPE##_dispatch<0> { \
typedef pass_thru_##TYPE type; \
}; \
template <class Base, class X, class Traits> \
class get_##TYPE { \
enum { is_named = is_named_param_list<X>::value }; \
typedef typename get_##TYPE##_dispatch<is_named>::type Selector; \
public: \
typedef typename Selector::template select<Base, X, Traits>::type type; \
}; \
template <> struct default_generator<default_##TYPE> { \
typedef default_##TYPE type; \
}
} // namespace detail
} // namespace boost
#endif // BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP

View File

@ -0,0 +1,87 @@
#ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
#define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
#if (defined _MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif
//----------------------------------------------------------------------
// (C) Copyright 2004 Pavel Vozenilek.
// 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)
//
//
// This file contains helper macros used when exception support may be
// disabled (as indicated by macro BOOST_NO_EXCEPTIONS).
//
// Before picking up these macros you may consider using RAII techniques
// to deal with exceptions - their syntax can be always the same with
// or without exception support enabled.
//
/* Example of use:
void foo() {
BOOST_TRY {
...
} BOOST_CATCH(const std::bad_alloc&) {
...
BOOST_RETHROW
} BOOST_CATCH(const std::exception& e) {
...
}
BOOST_CATCH_END
}
With exception support enabled it will expand into:
void foo() {
{ try {
...
} catch (const std::bad_alloc&) {
...
throw;
} catch (const std::exception& e) {
...
}
}
}
With exception support disabled it will expand into:
void foo() {
{ if(true) {
...
} else if (false) {
...
} else if (false) {
...
}
}
}
*/
//----------------------------------------------------------------------
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#if !(defined BOOST_NO_EXCEPTIONS)
# define BOOST_TRY { try
# define BOOST_CATCH(x) catch(x)
# define BOOST_RETHROW throw;
# define BOOST_CATCH_END }
#else
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# define BOOST_TRY { if ("")
# define BOOST_CATCH(x) else if (!"")
# else
# define BOOST_TRY { if (true)
# define BOOST_CATCH(x) else if (false)
# endif
# define BOOST_RETHROW
# define BOOST_CATCH_END }
#endif
#endif

View File

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

View File

@ -0,0 +1,23 @@
#ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
#define BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// detail/quick_allocator.hpp
//
// Copyright (c) 2003 David Abrahams
// Copyright (c) 2003 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/smart_ptr/detail/quick_allocator.hpp>
#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED

View File

@ -0,0 +1,141 @@
//-----------------------------------------------------------------------------
// boost detail/reference_content.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003
// Eric Friedman
//
// 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_REFERENCE_CONTENT_HPP
#define BOOST_DETAIL_REFERENCE_CONTENT_HPP
#include "boost/config.hpp"
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
# include "boost/mpl/bool.hpp"
# include "boost/type_traits/has_nothrow_copy.hpp"
#else
# include "boost/mpl/if.hpp"
# include "boost/type_traits/is_reference.hpp"
#endif
#include "boost/mpl/void.hpp"
namespace boost {
namespace detail {
///////////////////////////////////////////////////////////////////////////////
// (detail) class template reference_content
//
// Non-Assignable wrapper for references.
//
template <typename RefT>
class reference_content
{
private: // representation
RefT content_;
public: // structors
~reference_content()
{
}
reference_content(RefT r)
: content_( r )
{
}
reference_content(const reference_content& operand)
: content_( operand.content_ )
{
}
private: // non-Assignable
reference_content& operator=(const reference_content&);
public: // queries
RefT get() const
{
return content_;
}
};
///////////////////////////////////////////////////////////////////////////////
// (detail) metafunction make_reference_content
//
// Wraps with reference_content if specified type is reference.
//
template <typename T = mpl::void_> struct make_reference_content;
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template <typename T>
struct make_reference_content
{
typedef T type;
};
template <typename T>
struct make_reference_content< T& >
{
typedef reference_content<T&> type;
};
#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template <typename T>
struct make_reference_content
: mpl::if_<
is_reference<T>
, reference_content<T>
, T
>
{
};
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
template <>
struct make_reference_content< mpl::void_ >
{
template <typename T>
struct apply
: make_reference_content<T>
{
};
typedef mpl::void_ type;
};
} // namespace detail
///////////////////////////////////////////////////////////////////////////////
// reference_content<T&> type traits specializations
//
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template <typename T>
struct has_nothrow_copy<
::boost::detail::reference_content< T& >
>
: mpl::true_
{
};
#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
} // namespace boost
#endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP

View File

@ -0,0 +1,56 @@
// scoped_enum_emulation.hpp ---------------------------------------------------------//
// Copyright Beman Dawes, 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
// scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS
// macro is used to detect feature support.
//
// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
// description of the scoped enum feature. Note that the committee changed the name
// from strongly typed enum to scoped enum.
//
// Caution: only the syntax is emulated; the semantics are not emulated and
// the syntax emulation doesn't include being able to specify the underlying
// representation type.
//
// The emulation is via struct rather than namespace to allow use within classes.
// Thanks to Andrey Semashev for pointing that out.
//
// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,
// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente
// Botet, and Daniel James.
//
// Sample usage:
//
// BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END
// ...
// BOOST_SCOPED_ENUM(algae) sample( algae::red );
// void foo( BOOST_SCOPED_ENUM(algae) color );
// ...
// sample = algae::green;
// foo( algae::cyan );
#ifndef BOOST_SCOPED_ENUM_EMULATION_HPP
#define BOOST_SCOPED_ENUM_EMULATION_HPP
#include <boost/config.hpp>
#ifdef BOOST_NO_SCOPED_ENUMS
# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type
# define BOOST_SCOPED_ENUM_END };
# define BOOST_SCOPED_ENUM(name) name::enum_type
#else
# define BOOST_SCOPED_ENUM_START(name) enum class name
# define BOOST_SCOPED_ENUM_END
# define BOOST_SCOPED_ENUM(name) name
#endif
#endif // BOOST_SCOPED_ENUM_EMULATION_HPP

View File

@ -0,0 +1,36 @@
// (C) Copyright David Abrahams 2001.
// 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 http://www.boost.org for most recent version including documentation.
// Revision History
// 09 Feb 01 Applied John Maddock's Borland patch Moving <true>
// specialization to unspecialized template (David Abrahams)
// 06 Feb 01 Created (David Abrahams)
#ifndef SELECT_TYPE_DWA20010206_HPP
# define SELECT_TYPE_DWA20010206_HPP
namespace boost { namespace detail {
// Template class if_true -- select among 2 types based on a bool constant expression
// Usage:
// typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
// HP aCC cannot deal with missing names for template value parameters
template <bool b> struct if_true
{
template <class T, class F>
struct then { typedef T type; };
};
template <>
struct if_true<false>
{
template <class T, class F>
struct then { typedef F type; };
};
}}
#endif // SELECT_TYPE_DWA20010206_HPP

View File

@ -0,0 +1,74 @@
//-----------------------------------------------------------------------------
// boost detail/templated_streams.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003
// Eric Friedman
//
// 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_TEMPLATED_STREAMS_HPP
#define BOOST_DETAIL_TEMPLATED_STREAMS_HPP
#include "boost/config.hpp"
///////////////////////////////////////////////////////////////////////////////
// (detail) BOOST_TEMPLATED_STREAM_* macros
//
// Provides workaround platforms without stream class templates.
//
#if !defined(BOOST_NO_STD_LOCALE)
#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) \
template < typename E , typename T >
#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) \
template < typename E , typename T , typename A >
#define BOOST_TEMPLATED_STREAM_ARGS(E,T) \
typename E , typename T
#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) \
typename E , typename T , typename A
#define BOOST_TEMPLATED_STREAM_COMMA ,
#define BOOST_TEMPLATED_STREAM_ELEM(E) E
#define BOOST_TEMPLATED_STREAM_TRAITS(T) T
#define BOOST_TEMPLATED_STREAM_ALLOC(A) A
#define BOOST_TEMPLATED_STREAM(X,E,T) \
BOOST_JOIN(std::basic_,X)< E , T >
#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
BOOST_JOIN(std::basic_,X)< E , T , A >
#else // defined(BOOST_NO_STD_LOCALE)
#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) /**/
#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) /**/
#define BOOST_TEMPLATED_STREAM_ARGS(E,T) /**/
#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) /**/
#define BOOST_TEMPLATED_STREAM_COMMA /**/
#define BOOST_TEMPLATED_STREAM_ELEM(E) char
#define BOOST_TEMPLATED_STREAM_TRAITS(T) std::char_traits<char>
#define BOOST_TEMPLATED_STREAM_ALLOC(A) std::allocator<char>
#define BOOST_TEMPLATED_STREAM(X,E,T) \
std::X
#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
std::X
#endif // BOOST_NO_STD_LOCALE
#endif // BOOST_DETAIL_TEMPLATED_STREAMS_HPP

View File

@ -0,0 +1,190 @@
// 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
#define BOOST_UTF8_CODECVT_FACET_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// utf8_codecvt_facet.hpp
// This header defines class utf8_codecvt_facet, derived fro
// std::codecvt<wchar_t, char>, which can be used to convert utf8 data in
// files into wchar_t strings in the application.
//
// The header is NOT STANDALONE, and is not to be included by the USER.
// 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
// code.
// a) Rendered utf8_codecvt<wchar_t, char> with using templates
// b) Move longer functions outside class definition to prevent inlining
// and make code smaller
// c) added on a derived class to permit translation to/from current
// locale to utf8
// See http://www.boost.org for updates, documentation, and revision history.
// archives stored as text - note these ar templated on the basic
// stream templates to accommodate wide (and other?) kind of characters
//
// note the fact that on libraries without wide characters, ostream is
// is not a specialization of basic_ostream which in fact is not defined
// in such cases. So we can't use basic_ostream<OStream::char_type> but rather
// use two template parameters
//
// utf8_codecvt_facet
// This is an implementation of a std::codecvt facet for translating
// from UTF-8 externally to UCS-4. Note that this is not tied to
// any specific types in order to allow customization on platforms
// where wchar_t is not big enough.
//
// NOTES: The current implementation jumps through some unpleasant hoops in
// order to deal with signed character types. As a std::codecvt_base::result,
// it is necessary for the ExternType to be convertible to unsigned char.
// I chose not to tie the extern_type explicitly to char. But if any combination
// of types other than <wchar_t,char_t> is used, then std::codecvt must be
// specialized on those types for this to work.
#include <locale>
#include <cwchar> // for mbstate_t
#include <cstddef> // for std::size_t
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std {
using ::mbstate_t;
using ::size_t;
}
#endif
#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
#define BOOST_CODECVT_DO_LENGTH_CONST const
#else
#define BOOST_CODECVT_DO_LENGTH_CONST
#endif
// maximum lenght of a multibyte string
#define MB_LENGTH_MAX 8
BOOST_UTF8_BEGIN_NAMESPACE
struct BOOST_UTF8_DECL utf8_codecvt_facet :
public std::codecvt<wchar_t, char, std::mbstate_t>
{
public:
explicit utf8_codecvt_facet(std::size_t no_locale_manage=0)
: std::codecvt<wchar_t, char, std::mbstate_t>(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,
wchar_t * to,
wchar_t * to_end,
wchar_t*& to_next
) const;
virtual std::codecvt_base::result 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;
bool invalid_continuing_octet(unsigned char octet_1) const {
return (octet_1 < 0x80|| 0xbf< octet_1);
}
bool invalid_leading_octet(unsigned char octet_1) const {
return (0x7f < octet_1 && octet_1 < 0xc0) ||
(octet_1 > 0xfd);
}
// continuing octets = octets except for the leading octet
static unsigned int get_cont_octet_count(unsigned char lead_octet) {
return get_octet_count(lead_octet) - 1;
}
static unsigned int get_octet_count(unsigned char lead_octet);
// How many "continuing octets" will be needed for this word
// == total octets - 1.
int get_cont_octet_out_count(wchar_t word) const ;
virtual bool do_always_noconv() const throw() { return false; }
// UTF-8 isn't really stateful since we rewind on partial conversions
virtual std::codecvt_base::result do_unshift(
std::mbstate_t&,
char * from,
char * /*to*/,
char * & next
) const
{
next = from;
return ok;
}
virtual int do_encoding() const throw() {
const int variable_byte_external_encoding=0;
return variable_byte_external_encoding;
}
// How many char objects can I process to get <= max_limit
// wchar_t objects?
virtual int 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
// Largest possible value do_length(state,from,from_end,1) could return.
virtual int do_max_length() const throw () {
return 6; // largest UTF-8 encoding of a UCS-4 character
}
};
BOOST_UTF8_END_NAMESPACE
#endif // BOOST_UTF8_CODECVT_FACET_HPP

View File

@ -0,0 +1,43 @@
#ifndef INDIRECT_REFERENCE_DWA200415_HPP
# define INDIRECT_REFERENCE_DWA200415_HPP
//
// 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/iterator/iterator_traits.hpp>
# include <boost/type_traits/remove_cv.hpp>
# include <boost/mpl/eval_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::eval_if<
detail::is_incrementable<P>
, iterator_reference<P>
, detail::smart_ptr_reference<P>
>
{
};
} // namespace boost
#endif // INDIRECT_REFERENCE_DWA200415_HPP

View File

@ -0,0 +1,27 @@
// -------------------------------------
//
// (C) Copyright Gennaro Prota 2003.
//
// 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_NON_TYPE_HPP_GP_20030417
#define BOOST_NON_TYPE_HPP_GP_20030417
namespace boost {
// Just a simple "envelope" for non-type template parameters. Useful
// to work around some MSVC deficiencies.
template <typename T, T n>
struct non_type { };
}
#endif // include guard

View File

@ -1,4 +1,8 @@
// -*- 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
#define BOOST_CSTDDEF_HPP

View File

@ -1,67 +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>
namespace boost {
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <int cond, class A, class B>
struct ct_if { typedef A type; };
template <class A, class B>
struct ct_if<0, 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;
};
#endif
} // namespace boost
#endif // BOOST_CT_IF_HPP

View File

@ -0,0 +1,112 @@
// -----------------------------------------------------------
// integer_log2.hpp
//
// Gives the integer part of the logarithm, in base 2, of a
// given number. Behavior is undefined if the argument is <= 0.
//
// Copyright (c) 2003-2004, 2008 Gennaro Prota
//
// 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_INTEGER_LOG2_HPP_GP_20030301
#define BOOST_INTEGER_LOG2_HPP_GP_20030301
#include <assert.h>
#ifdef __BORLANDC__
#include <climits>
#endif
#include "boost/limits.hpp"
#include "boost/config.hpp"
namespace boost {
namespace detail {
template <typename T>
int integer_log2_impl(T x, int n) {
int result = 0;
while (x != 1) {
const T t = static_cast<T>(x >> n);
if (t) {
result += n;
x = t;
}
n /= 2;
}
return result;
}
// helper to find the maximum power of two
// less than p (more involved than necessary,
// to avoid PTS)
//
template <int p, int n>
struct max_pow2_less {
enum { c = 2*n < p };
BOOST_STATIC_CONSTANT(int, value =
c ? (max_pow2_less< c*p, 2*c*n>::value) : n);
};
template <>
struct max_pow2_less<0, 0> {
BOOST_STATIC_CONSTANT(int, value = 0);
};
// this template is here just for Borland :(
// we could simply rely on numeric_limits but sometimes
// Borland tries to use numeric_limits<const T>, because
// of its usual const-related problems in argument deduction
// - gps
template <typename T>
struct width {
#ifdef __BORLANDC__
BOOST_STATIC_CONSTANT(int, value = sizeof(T) * CHAR_BIT);
#else
BOOST_STATIC_CONSTANT(int, value = (std::numeric_limits<T>::digits));
#endif
};
} // detail
// ---------
// integer_log2
// ---------------
//
template <typename T>
int integer_log2(T x) {
assert(x > 0);
const int n = detail::max_pow2_less<
detail::width<T> :: value, 4
> :: value;
return detail::integer_log2_impl(x, n);
}
}
#endif // include guard

18
include/boost/type.hpp Normal file
View File

@ -0,0 +1,18 @@
// (C) Copyright David Abrahams 2001.
// 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_TYPE_DWA20010120_HPP
# define BOOST_TYPE_DWA20010120_HPP
namespace boost {
// Just a simple "type envelope". Useful in various contexts, mostly to work
// around some MSVC deficiencies.
template <class T>
struct type {};
}
#endif // BOOST_TYPE_DWA20010120_HPP

View File

@ -0,0 +1,29 @@
// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. 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)
// For more information, see http://www.boost.org/libs/signals
#ifndef BOOST_VISIT_EACH_HPP
#define BOOST_VISIT_EACH_HPP
#include <boost/config.hpp>
namespace boost {
template<typename Visitor, typename T>
inline void visit_each(Visitor& visitor, const T& t, long)
{
visitor(t);
}
template<typename Visitor, typename T>
inline void visit_each(Visitor& visitor, const T& t)
{
visit_each(visitor, t, 0);
}
}
#endif // BOOST_VISIT_EACH_HPP

285
utf8_codecvt_facet.cpp Normal file
View File

@ -0,0 +1,285 @@
/////////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;
}
template<>
int get_cont_octet_out_count_impl<4>(wchar_t word){
if (word < 0x80) {
return 0;
}
if (word < 0x800) {
return 1;
}
// Note that the following code will generate warnings on some platforms
// where wchar_t is defined as UCS2. The warnings are superfluous as the
// specialization is never instantitiated with such compilers, but this
// can cause problems if warnings are being treated as errors, so we guard
// against that. Including <boost/detail/utf8_codecvt_facet.hpp> as we do
// should be enough to get WCHAR_MAX defined.
#if !defined(WCHAR_MAX)
# error WCHAR_MAX not defined!
#endif
// cope with VC++ 7.1 or earlier having invalid WCHAR_MAX
#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier
return 2;
#elif WCHAR_MAX > 0x10000
if (word < 0x10000) {
return 2;
}
if (word < 0x200000) {
return 3;
}
if (word < 0x4000000) {
return 4;
}
return 5;
#else
return 2;
#endif
}
} // 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