1
0
forked from boostorg/core

Compare commits

...

801 Commits

Author SHA1 Message Date
Peter Dimov
e3a2e88e4c Update .drone.jsonnet 2024-08-21 10:50:28 +03:00
Peter Dimov
5e451b6c84 Add VERBATIM to add_custom_target 2024-08-21 04:14:05 +03:00
Peter Dimov
88a957b21c test/Jamfile: add cxx11_ref_qualifiers (GCC 4.8+) to Serialization tests because of Optional 2024-08-21 03:02:31 +03:00
Peter Dimov
1bac0ccfd1 Update build.jam 2024-08-21 02:32:32 +03:00
Rene Rivera
602961e526 Update build deps. 2024-08-01 21:30:37 -05:00
Rene Rivera
366802b43c Adjust doc build to avoid boost-root references. 2024-07-28 10:42:22 -05:00
Rene Rivera
9dd0a8e1e4 Sync from upstream. 2024-07-27 11:09:51 -05:00
Andrey Semashev
622476533c Added a release notes entry for the empty_value fix. 2024-07-27 10:35:28 +03:00
Rene Rivera
a09ee19e3e Sync from upstream. 2024-07-25 17:19:14 -05:00
Rene Rivera
040b018ce0 Restore warnings-as-errors-off that got accidentally removed in a merge. 2024-07-24 23:55:54 -05:00
Rene Rivera
42d0c5954a Move inter-lib dependencies to a project variable and into the build targets. 2024-07-23 22:34:24 -05:00
Andrey Semashev
76d0f22d3b Added 1.86.0 release notes. 2024-07-24 03:02:00 +03:00
Rene Rivera
243eec26fe Update copyright dates. 2024-07-20 22:52:05 -05:00
Rene Rivera
44c32d7691 Change all <source> references to <library>. 2024-07-20 19:37:53 -05:00
Rene Rivera
0ee7dc5910 Sync from upstream. 2024-07-18 09:29:32 -05:00
Glen Fernandes
9e9e6e3898 Rename base type again 2024-07-16 23:53:47 -04:00
Glen Fernandes
242b14bb69 Rename base typedef 2024-07-14 07:14:38 -04:00
Glen Fernandes
76061d91d4 Move compile test to separate source file 2024-07-14 07:04:23 -04:00
Peter Dimov
bda05a7812 Update .drone.jsonnet 2024-07-13 15:41:26 +03:00
Peter Dimov
d66b8c1c13 Update ci.yml 2024-07-13 13:32:29 +03:00
Andrey Semashev
bd29e0dd15 Merge pull request #177 from ashtum/rename-base-typedef
Rename typedef `base` to `core_ev_base`
2024-07-13 13:21:00 +03:00
Mohammad Nejati
72761e34e0 Rename typedef base to core_ev_base
Using typedef `base` poses a high risk of name conflict, given that
`empty_value` is inherited in user types.
2024-07-13 09:14:58 +00:00
Rene Rivera
983234baee Sync from upstream. 2024-07-12 08:54:55 -05:00
Glen Fernandes
83a3a51bee Merge pull request #175 from k3DW/feature/empty-value-inherit-public
Fix `empty_value` MSVC bug
2024-07-12 08:53:53 -04:00
Braden Ganetsky
acbeaae181 Add link to Visual Studio bug report 2024-07-11 17:02:24 -05:00
Braden Ganetsky
d01b4e94cc Write test for empty_value private inheritance 2024-07-11 17:02:23 -05:00
Braden Ganetsky
e22bd49fa7 Fix MSVC issue with deriving from empty_value 2024-07-11 17:02:21 -05:00
Braden Ganetsky
c056f3dfc9 Write failing test in MSVC for deriving from empty_value 2024-06-23 22:50:52 -05:00
Rene Rivera
8b8944dd6e Bump B2 require to 5.2 2024-06-14 11:33:55 -05:00
Rene Rivera
278d3f0060 Sync from upstream. 2024-05-30 11:21:22 -05:00
Peter Dimov
3f36d507f2 Disable the tn_holder<wchar_t> specialization when BOOST_NO_INTRINSIC_WCHAR_T. Refs #173. 2024-05-28 19:32:36 +03:00
Andrey Semashev
a77338b1cd Use macos-14 image instead of macos-11 as the latter is being removed. 2024-05-21 01:06:02 +03:00
Rene Rivera
a8c757ddf2 Add requires-b2 check to top-level build file. 2024-05-05 09:00:01 -05:00
Rene Rivera
98a055cf34 Add missing lib reference. 2024-04-25 22:20:12 -05:00
Rene Rivera
074a467d9d Sync from upstream. 2024-04-24 20:30:49 -05:00
Peter Dimov
965508d9e1 Fix type_name for abstract classes. Fixes #172. 2024-04-24 21:46:32 +03:00
Rene Rivera
0a238bb30d Sync from upstream. 2024-04-20 15:33:40 -05:00
Glen Fernandes
d03e58b77e Correct parameter type in documentation 2024-04-18 13:16:12 -04:00
Peter Dimov
f774295cdb Add boost/core/detail/minstd_rand.hpp 2024-04-14 04:40:44 +03:00
Rene Rivera
b18495fe35 Sync from upstream. 2024-04-12 22:40:43 -05:00
Peter Dimov
c928c844da Merge branch 'feature/sign-conversion' into develop 2024-04-11 13:43:49 +03:00
Glen Fernandes
0a42ddabef Update pointer_in_range documentation 2024-04-11 02:25:05 -04:00
Glen Fernandes
04cc766db3 Address C++17 redeclaration of constexpr static 2024-04-11 00:52:26 -04:00
Peter Dimov
aa01ad8bf0 Avoid another -Wconversion in sv_find_{first,last}_not_of_test 2024-04-11 05:57:32 +03:00
Peter Dimov
442e36f652 Avoid -Wconversion in sv_find_{first,last}_not_of_test 2024-04-11 04:33:29 +03:00
Peter Dimov
03040c7f5c Avoid -Wsign-conversion warnings in string_view.hpp. Fixes #170. 2024-04-11 04:09:29 +03:00
Peter Dimov
8b31acf9a4 Disable -Wsign-conversion in lightweight_test.hpp for GCC 6/7 2024-04-10 22:25:11 +03:00
Peter Dimov
fd01cf788c Add -Wsign-conversion to pedantic-errors 2024-04-10 21:51:56 +03:00
Rene Rivera
151d0c4143 Sync from upstream. 2024-04-10 07:57:45 -05:00
Glen Fernandes
31117ef800 Implement pointer_in_range 2024-04-08 09:56:16 -04:00
Rene Rivera
25b0defdeb Switch to library requirements instead of source. As source puts extra source in install targets. 2024-03-29 21:15:58 -05:00
Rene Rivera
541745ea24 Sync from upstream. 2024-03-23 07:57:20 -05:00
Andrey Semashev
083b41c17e Merge pull request #169 from k3DW/feature/168
Fix deprecated warning ignores in allocator_access.hpp
2024-03-19 18:10:04 +03:00
Braden Ganetsky
a973490f53 Fix deprecated warning ignores in allocator_access.hpp, and add compile test for pmr allocator 2024-03-17 20:12:06 -05:00
Rene Rivera
5f825106c7 Make the library modular usable. 2024-03-11 08:32:21 -05:00
Andrey Semashev
8cc2fdad76 Updated comments. 2024-02-08 18:39:47 +03:00
Andrey Semashev
0fb4d92d83 Moved checked deleters into internal namespace to block unintended ADL.
This prevents adding namespace boost to ADL when the deleters are used
in template parameters, e.g. in std::unique_ptr.
2024-02-07 15:12:36 +03:00
Peter Dimov
76401063a6 Remove constexpr test from sv_construct_test 2024-02-07 06:34:06 +02:00
Peter Dimov
c4bb59617c Disable sv_construct_test_cx2 for libstdc++ 7.2 and earlier 2024-02-07 04:55:07 +02:00
Peter Dimov
2d7e036416 Add sv_construct_test_cx, _cx2 2024-02-07 03:28:41 +02:00
Peter Dimov
4a0df827c1 Merge pull request #164 from anarthal/develop
Constructor from std::string_view is now constexpr
2024-02-07 03:03:42 +02:00
Ruben Perez
59c0fb69f0 Constructor from std::string_view is now constexpr
close #163
2024-02-06 23:15:26 +01:00
Peter Dimov
2f092c62fe Disable std::pmr use under AppleClang. Refs #162. 2024-02-06 19:12:11 +02:00
Andrey Semashev
ccfee3f638 Switch posix-cmake-test to use Ninja instead of Makefiles.
This is yet another workaround for hanging posix-cmake-test on Mac OS.
This enables parallel builds again, but uses Ninja build system instead
of Makefiles. Enabling parallel builds speeds up the build process and
releases Mac OS builders for other jobs sooner.

Additionally, fix incorrect apt invocations in CMake-related jobs. apt
is supposed to be used in interactive shells, and in scripts apt-get is
recommended. Also, apt-get update is needed before apt install, and
matrix.install must be transformed to a space-separated list. Also added
retries on network errors.
2024-02-06 14:16:34 +03:00
Andrey Semashev
45e7e1a91a Reduced CMake-related job timeouts. 2024-02-06 06:07:30 +03:00
Andrey Semashev
ce20d15048 Fix posix-cmake-test failures on Mac OS.
Properly set BUILD_JOBS environment variable in CMake-related jobs as
it is used in build and run steps. Without the variable being set, -j
without a number means "no limit on the number of jobs", which may
hit system resource limits and cause the job to fail.

Also, Mac OS seem to sometimes hang on too many parallel build jobs,
even if BUILD_JOBS is specified correctly. So disable parallel builds
for now.

Additionally, use GIT_FETCH_JOBS universally.
2024-02-06 06:06:49 +03:00
Andrey Semashev
b077925d77 Reduced CI job timeouts. 2024-02-06 01:55:42 +03:00
Andrey Semashev
61191fc0a1 Replaced actions/checkout usage with manual download commands.
This fixes the deprecation warnings for actions/checkout@v3. actions/checkout@v4
is not functional because of the upstream bug:

https://github.com/actions/checkout/issues/1590
2024-02-05 23:34:59 +03:00
Andrey Semashev
0a35bb6a20 Move functor to its own namespace to block bringing boost::core to ADL. 2024-02-02 05:23:00 +03:00
Andrey Semashev
95f0b35c36 Move fclose_deleter and null_deleter to their own namespaces to block ADL.
This prevents bringing namespace boost into ADL when the deleters are used
in template parameters, e.g. in std::unique_ptr.
2024-02-02 05:17:19 +03:00
Andrey Semashev
7b1d3718c1 Merge pull request #161 from boostorg/feature/functor
Add `functor`
2024-01-27 19:34:21 +03:00
Andrey Semashev
80e12e1116 Added a new boost/core/functor.hpp header.
The feader defines a new functor class template that can be used to wrap
raw functions into a function object class. This is useful, for example,
for integrating std::unique_ptr and unique_resource with custom deleters
implemented as raw functions (e.g. in C libraries).
2024-01-26 20:51:02 +03:00
Peter Dimov
6f70ee87a3 Disable Serialization tests for C++03 2024-01-23 18:25:32 +02:00
Peter Dimov
db20a49e48 Increase GHA timeouts 2024-01-07 01:41:30 +02:00
Peter Dimov
a57c78221b Add timeouts to all jobs 2024-01-04 14:21:44 +02:00
Peter Dimov
e4adc769aa Disable use of std::launder under msvc-14.1. Fixes #160. 2024-01-04 04:07:34 +02:00
Peter Dimov
8af04d101c Update .drone.jsonnet 2024-01-04 02:45:24 +02:00
Peter Dimov
cece8ca5b4 Update .drone.jsonnet 2023-11-30 11:39:42 +02:00
Peter Dimov
6c95750f37 Use BOOST_GCC instead of BOOST_GCC_VERSION 2023-11-30 10:33:08 +02:00
Andrey Semashev
a9f1407d84 Added a sanity check to prevent duplicate definition of BOOST_CORE_HAS_BUILTIN_BIT_CAST. 2023-11-25 16:04:12 +03:00
Andrey Semashev
db0fd77af1 Added support for __builtin_bswap16. 2023-11-25 16:04:12 +03:00
Andrey Semashev
7cbbb08e7b Use libstdc++11 for clang prior to 16.
Clang prior to version 16 does not support libstdc++13 that is installed
by default in GHA image ubuntu 22.04 in C++20 mode.
2023-11-25 16:04:12 +03:00
Peter Dimov
ba6360e8ed Update test/Jamfile 2023-10-06 11:30:51 +03:00
Peter Dimov
2a70a0f239 Update ci.yml 2023-10-06 11:20:05 +03:00
Peter Dimov
31a2f7fb6b Merge pull request #158 from iskunk/feature/fix-intel-build
Fix Intel compiler build
2023-10-06 04:21:16 +03:00
Daniel Richard G
0120dbfe65 Fix Intel compiler build 2023-10-05 20:26:24 -04:00
Andrey Semashev
5f6fe65eb2 Merge pull request #149 from boostorg/feature/invoke_swap
Rename `boost::swap` to `boost::core::invoke_swap`, deprecate `boost::swap`
2023-08-25 14:50:06 +03:00
Peter Dimov
c7134904e2 Android doesn't support pthread_setcancelstate. Fixes #150. 2023-07-25 18:03:51 +03:00
Andrey Semashev
9fc2a2f1ac Renamed boost::swap to boost::core::invoke_swap, deprecated boost::swap.
The rename allows to avoid forming an infinite recursion in compile time
(because of noexcept specification that needs to resolve the unqualified call
to swap) or run time (in case if the boost::swap function is the only one
suitable for the passed arguments).

To avoid the compile-time recursion, removed noexcept specification from
boost::swap. The specification is still present in boost::core::invoke_swap.

Deprecated boost::swap and associated headers. boost::core::invoke_swap
is defined in a new boost/core/invoke_swap.hpp header.

Updated docs and tests. Removed tests that check inclusion of deprecated
headers.

Fixes https://github.com/boostorg/core/issues/148.
2023-07-12 12:17:07 +03:00
Peter Dimov
216999e552 Avoid -Wsign-conversion warning in checked_delete.hpp 2023-06-25 13:46:53 +03:00
Peter Dimov
66890c3f3d Use SwitchToThread instead of Sleep(0) is sp_thread_yield; the general consensus is that it's newer and 'smarter' 2023-06-18 21:54:13 +03:00
Andrey Semashev
8d6d20059a Switch CI to clang-15 from stock Ubuntu repos. 2023-06-05 03:13:05 +03:00
Peter Dimov
ee596e3d37 Update documentation 2023-06-02 20:39:42 +03:00
Peter Dimov
de8fe4fad7 Fix libc++16 failures 2023-06-02 19:32:28 +03:00
Peter Dimov
d4db3eccec Add Clang 16 to CI 2023-06-02 18:07:06 +03:00
Peter Dimov
3b96d237c0 Update test/CMakeLists.txt 2023-06-02 04:32:42 +03:00
Peter Dimov
0e71b6158d Add noexcept to yield primitives 2023-06-02 04:27:12 +03:00
Peter Dimov
23ef6d3531 Disable cancelation around nanosleep in sp_thread_sleep 2023-06-02 03:57:38 +03:00
Peter Dimov
e088fb8929 Add yield_prim_pthread_cancel_test 2023-06-02 03:27:29 +03:00
Peter Dimov
57151ab82e Update sp_thread_pause.hpp 2023-06-02 02:05:36 +03:00
Peter Dimov
992326b1c8 Decrease loop count of sp_thread_sleep_test 2023-06-02 02:04:46 +03:00
Peter Dimov
4e769d1cdd Add boost/core/yield_primitives.hpp 2023-06-01 23:08:32 +03:00
Peter Dimov
bf17035a2d Disable bit_cast_test_cx when __builtin_bit_cast is not available 2023-06-01 03:20:22 +03:00
Peter Dimov
5a3b4df5de Use __builtin_bit_cast when available 2023-06-01 02:38:57 +03:00
Peter Dimov
85527c4045 More -Wconversion fixes 2023-05-31 20:22:15 +03:00
Peter Dimov
7ab05d5de0 More -Wconversion fixes for GCC 10 and below 2023-05-31 19:54:43 +03:00
Peter Dimov
266fbe6449 Fix -Wconversion warnings 2023-05-31 18:53:35 +03:00
Peter Dimov
fd0de5f538 Add -Wconversion to pedantic-errors 2023-05-31 18:28:33 +03:00
Peter Dimov
350526f7c7 Update documentation 2023-05-31 02:29:32 +03:00
Peter Dimov
06fef712c9 Use MS _byteswap intrinsics 2023-05-30 21:12:25 +03:00
Peter Dimov
b7f7eb4f90 Avoid -Wlong-long under C++03 2023-05-30 19:27:42 +03:00
Peter Dimov
f41b8f38c4 Use __builtin_bswap under GCC and Clang 2023-05-30 19:22:00 +03:00
Peter Dimov
b591214103 Add byteswap to bit.hpp 2023-05-30 19:09:09 +03:00
Peter Dimov
6b9f0cbf57 Update revision history 2023-05-30 06:24:43 +03:00
Peter Dimov
ecee9257d5 Update revision history 2023-05-30 06:20:44 +03:00
Peter Dimov
6c7edac9b1 Fix 32 bit constexpr failures 2023-05-30 04:32:23 +03:00
Peter Dimov
049d3447ca Test 32 bit Windows on Drone 2023-05-30 04:24:28 +03:00
Peter Dimov
b2fe98edf8 Make bit manipulation functions constexpr on MSVC 19.25+. Closes #109. 2023-05-30 02:56:37 +03:00
Peter Dimov
42c8898d24 Add constexpr tests for bit.hpp. Refs #109. 2023-05-29 21:59:37 +03:00
Peter Dimov
f2eab6d6ff Update ci.yml 2023-05-21 15:26:47 +03:00
Peter Dimov
36fa78f53c Add support for incomplete classes to type_name<>. Refs #145. 2023-05-21 05:52:33 +03:00
Peter Dimov
97606908b7 Add type_name<> tests for incomplete types. Refs #145. 2023-05-21 05:40:24 +03:00
Peter Dimov
5eb54d1d36 Fix type_name<> for cv-qualified member pointers without variadic templates. Refs #145. 2023-05-21 05:33:21 +03:00
Peter Dimov
c91f8fabff Test whether type_name<> compiles for member pointers even without variadic templates. Refs #145. 2023-05-21 05:16:30 +03:00
Peter Dimov
5904fb5636 Disable call to ::_seterrormode when WINAPI_FAMILY is defined to something other than WINAPI_FAMILY_DESKTOP_APP. Refs #143. 2023-04-15 19:36:12 +03:00
Glen Fernandes
39978bde2b Add note about identity being moved from functional 2023-02-24 00:19:13 -05:00
Glen Fernandes
d5fa9ae50f Fix and update documentation and release notes 2023-02-24 00:16:56 -05:00
Peter Dimov
2814b4ca1c Update documentation 2023-02-22 20:18:01 +02:00
Glen Fernandes
c4e420f69d Use boost::data in boost::span 2023-02-22 09:40:54 -05:00
Peter Dimov
94628cb2f9 Use undefined-sanitizer=norecover instead of cxxflags 2023-02-21 17:47:38 +02:00
Peter Dimov
19f9aa93e1 Merge branch 'feature/drone' into develop 2023-02-21 07:58:29 +02:00
Peter Dimov
2691efd1ca Re-disable serialization_nvp_test under UBSan; link=static doesn't help there 2023-02-21 06:29:10 +02:00
Peter Dimov
b6b1498275 Use link=static instead of visibility=global (which doesn't help) 2023-02-21 06:11:44 +02:00
Glen Fernandes
379899ef15 Move identity from functional to core 2023-02-20 23:02:30 -05:00
Peter Dimov
3ab949d321 Only use visibility=global in UBSan builds 2023-02-21 05:32:28 +02:00
Peter Dimov
dbf0ea98b9 Add visibility=global to serialization tests because of UBSan; disable serialization_nvp_test for GCC/UBSan as well 2023-02-21 05:25:20 +02:00
Peter Dimov
5afc91d52d Change _EQ(max_align, alignof(std::max_align_t)) to _GE unconditionally, because macOS 12.4/M1 also fails (16 > 8) 2023-02-21 05:23:43 +02:00
Peter Dimov
f2a1532105 Add macOS 12.4 (M1) to Drone 2023-02-21 04:55:39 +02:00
Peter Dimov
64e59db1f6 Update serialization_construct_data_test 2023-02-21 02:39:49 +02:00
Peter Dimov
ceb4fff8fc Avoid missing braces warning in serialization_construct_data_test 2023-02-21 02:23:52 +02:00
Peter Dimov
0be25e19cc Add load_construct_data_adl, save_construct_data_adl 2023-02-21 02:04:39 +02:00
Peter Dimov
6debbeb377 Disable serialization_nvp_test under Clang/UBSan 2023-02-21 01:34:35 +02:00
Peter Dimov
4b859e3d39 Use friend class, omission of class is C++11 2023-02-20 21:17:55 +02:00
Peter Dimov
38037b45f1 Add boost::core::split_member 2023-02-20 21:00:26 +02:00
Peter Dimov
7664d7ab7e Disable -Wdeprecated-copy in serialization_*_test 2023-02-20 20:39:03 +02:00
Peter Dimov
20d89b69db Add missing initializers to avoid warnings from GCC 4.x 2023-02-20 20:19:59 +02:00
Peter Dimov
89c5a78129 Add boost/core/serialization.hpp, serialization_nvp_test, serialization_split_free_test 2023-02-20 20:06:19 +02:00
Glen Fernandes
249c5bece2 Implement data and size functions 2023-02-17 15:27:36 -05:00
Glen Fernandes
8977da6f50 Update documentation 2023-01-30 16:19:31 -05:00
Glen Fernandes
edc0d935c0 Implement make_span 2023-01-28 13:07:33 -05:00
Glen Fernandes
7736b0b8ce span support for initializer_list 2023-01-28 12:20:59 -05:00
Peter Dimov
90231ed7e0 Document boost::core::memory_resource 2023-01-27 02:42:10 +02:00
Peter Dimov
1aa287e413 Avoid the inclusion of <new> 2023-01-26 19:37:46 +02:00
Peter Dimov
8c65a5b0e8 Work around g++ 4.6 failure 2023-01-26 19:18:44 +02:00
Peter Dimov
99515c341e Add boost::core::memory_resource 2023-01-26 18:09:35 +02:00
Peter Dimov
42b3a3f111 Use BOOST_CORE_ALIGNOF in boost/core/max_align.hpp 2023-01-26 03:17:05 +02:00
Peter Dimov
c092532a71 Merge branch 'develop' into feature/max-align 2023-01-26 03:06:45 +02:00
Peter Dimov
f6193acbdf Document BOOST_CORE_ALIGNOF 2023-01-26 03:01:01 +02:00
Peter Dimov
a504b356d4 Merge branch 'develop' into feature/alignof 2023-01-26 02:02:00 +02:00
Peter Dimov
bd1835f92f Avoid memory leak in alloc_construct_cxx11_test.cpp, because ASan diagnoses it 2023-01-26 01:10:00 +02:00
Peter Dimov
bfad92e307 Add Drone support 2023-01-25 22:00:41 +02:00
Peter Dimov
ce93055f03 Disable failing tests under g++ -m32 2023-01-25 21:37:26 +02:00
Peter Dimov
39cf1e65a3 Add BOOST_CORE_ALIGNOF 2023-01-25 20:10:31 +02:00
Peter Dimov
3edd3aa982 Define and use BOOST_CORE_HAS_FLOAT128 2023-01-25 19:38:20 +02:00
Peter Dimov
c704d8b630 Document boost/core/max_align.hpp 2023-01-25 19:02:03 +02:00
Peter Dimov
579a658129 Update max_align_test.cpp 2023-01-25 18:56:37 +02:00
Peter Dimov
4c7f35613e Merge branch 'develop' into feature/max-align 2023-01-25 04:39:27 +02:00
Peter Dimov
642a0cf70e Update ci.yml 2023-01-25 01:56:57 +02:00
Peter Dimov
ece7a9ad9c Update max_align_test.cpp 2023-01-25 01:52:18 +02:00
Peter Dimov
5632ee0367 Test __SIZEOF_FLOAT128__ as well, for g++ -m32 2023-01-25 01:41:01 +02:00
Peter Dimov
8052abb15c Add boost::core::max_align(_t) 2023-01-24 21:06:07 +02:00
Peter Dimov
d3ed836f75 Document boost::core::launder 2023-01-24 19:40:30 +02:00
Peter Dimov
c4777c309e Avoid including <new> in core/launder.hpp when not C++17 2023-01-24 18:54:45 +02:00
Peter Dimov
2b3b97c633 Add boost::core::launder 2023-01-24 17:50:45 +02:00
Peter Dimov
ab455ab2f8 Disable -Wdeprecated-declarations for early clang-cl 2023-01-23 05:24:28 +02:00
Peter Dimov
116c6830e0 Add VS2017 clang-cl to Appveyor 2023-01-23 04:13:05 +02:00
Peter Dimov
d8cfc71073 lwt_unattended: disable WER dialog box on crash 2023-01-19 02:35:15 +02:00
Peter Dimov
dd85ed565e Update CMakeLists.txt 2023-01-12 20:53:52 +02:00
Peter Dimov
58fd395c51 Merge branch 'develop' of https://github.com/vinniefalco/boost-core into feature/pr-122 2023-01-12 20:51:58 +02:00
Peter Dimov
992824c50b Update appveyor.yml 2023-01-12 19:55:57 +02:00
Peter Dimov
9d443cb094 Update appveyor.yml 2023-01-12 18:44:30 +02:00
Peter Dimov
7d67301bba Add CMake tests to Appveyor 2023-01-12 15:25:51 +02:00
Peter Dimov
e487fec094 Merge branch 'develop' into feature/appveyor 2023-01-12 15:23:02 +02:00
Andrey Semashev
0890785fec Added #pragma once in swap.hpp. 2023-01-07 03:52:46 +03:00
Andrey Semashev
eda68d4086 Trim trailing spaces in boost::swap tests. 2023-01-07 03:42:31 +03:00
Andrey Semashev
8a8738a981 Propagate noexcept specification in boost::swap.
Mark boost::swap noexcept if the type supports non-throwing swap
implementation.
2023-01-07 03:42:15 +03:00
Andrey Semashev
99f9654f18 Fixed incorrect preprocessor condition for ref_empty definition.
Closes https://github.com/boostorg/core/pull/137.
2023-01-07 01:06:41 +03:00
Andrey Semashev
1e84baeea3 Use defaulted template arguments to restrict boost::ref converting ctor. 2023-01-06 19:38:55 +03:00
Andrey Semashev
1825265014 Marked boost::ref methods and associated functions with noexcept. 2023-01-06 19:12:47 +03:00
Peter Dimov
8caca51c4d Do not run lightweight_test_fail16.cpp under CMake, as CTest doesn't like std::abort 2022-12-30 22:03:06 +02:00
Peter Dimov
2d302c1666 Document boost::core::lwt_init 2022-12-30 21:57:12 +02:00
Peter Dimov
6299da9273 Add boost::core::lwt_init() 2022-12-30 21:17:58 +02:00
Peter Dimov
843e0f7bb0 Add boost::core::detail::lwt_unattended() 2022-12-28 17:49:01 +02:00
Andrey Semashev
ddc6cc25a9 Actualized includes of ref.hpp. 2022-12-22 18:59:27 +03:00
Andrey Semashev
86bf1d4aec Deprecated boost::core::is_same and the associated header.
Moved is_same implementation to detail (both directory and namespace)
to use in the public headers and avoid introducing new dependencies.
The documentation now recommends users to use Boost.TypeTraits or
C++ standard library instead.

Also, removed unnecessary includes and added missing ones in a few
places.
2022-12-22 17:55:47 +03:00
Andrey Semashev
75c765cc13 Removed suppression of -Wno-deprecated-builtins on clang-15.
Boost.TypeTraits was updated to not use the deprecated builtins, so
suppressing the warning should no longer be necessary.
2022-12-18 01:03:39 +03:00
Glen Fernandes
2286749f97 Change order of restoration of warning disables in allocator access 2022-12-15 01:08:51 -05:00
Peter Dimov
23fa5d30f3 Merge pull request #133 from boostorg/feature/lwt_remove_snprintf
Remove the use of snprintf for trivial formatting in lightweight_test
2022-12-09 18:55:14 +02:00
Andrey Semashev
d428335758 Remove the use of snprintf for trivial formatting.
This implements in-place formatting for small hex numbers instead of
using snprintf with the associated portability scaffolding. This also
removes the need for #include <cstdio>.
2022-12-09 04:15:02 +03:00
Andrey Semashev
be8790115c Added portable snprintf/vsnprintf definition.
This definitions is mostly a workaround for older MSVC versions that only
provided non-portable _snprintf etc. that are not fully conforming to
the standard snprintf. This implementation fixes its issues wrt. null
termination and returned values in case of buffer overflows.

On platforms that support the standard snprintf, the definitions in
the header are equivalent to the standard functions.
2022-12-09 03:53:01 +03:00
Peter Dimov
2778c5cca6 Rename BOOST_CORE_SNPRINTF to BOOST_CORE_DETAIL_SNPRINTF 2022-12-07 22:33:17 +02:00
Matt Borland
d5b7c3c0dc Add snprintf macro 2022-12-06 08:11:22 -08:00
Matt Borland
db916e4673 Correct test macro and add undef 2022-12-06 08:10:14 -08:00
Matt Borland
3eaba7afc0 Fix for sprintf deprecation warning 2022-12-05 20:34:46 -08:00
Andrey Semashev
ad20fadde7 Added missing release notes for Boost 1.80.0. 2022-12-04 03:52:31 +03:00
Andrey Semashev
a67ec1f75c Corrected Boost release version, added links in changelog. 2022-12-04 02:02:40 +03:00
Peter Dimov
5e95d28eb6 Update revision history 2022-12-01 13:59:53 +02:00
Andrey Semashev
65377a2e13 Updated to GHA checkout@v3 to avoid deprecation warnings. 2022-10-18 17:55:59 +03:00
Peter Dimov
b407b5d87d Change bit_width to return int, LWG3656 has been applied as a DR to C++20 2022-09-22 01:31:01 +03:00
Peter Dimov
013c7856ce Merge branch 'develop' into feature/bit 2022-09-21 21:41:43 +03:00
Andrey Semashev
1c79871f0f Added dependency on Boost.Config to fclose_deleter_test CMake target. 2022-09-21 21:20:40 +03:00
Andrey Semashev
09f2aa123a Enabled parallel build in CMake CI jobs. 2022-09-21 21:14:13 +03:00
Andrey Semashev
9cbf3ac420 Fixed fclose_deleter test failing to build with CMake.
Jamfile parser created incorrect test for fclose_deleter_test,
which resulted in a compiler error. Prevent the parser from creating
the test target by reformatting the Jamfile and create a CMake
target with proper dependencies.
2022-09-21 21:05:27 +03:00
Andrey Semashev
fd615f3bfe Use depinst in AppVeyor CI as well. 2022-09-21 20:00:24 +03:00
Andrey Semashev
a7f76af262 Fixed unintentional change to CMake configure step in GHA config. 2022-09-21 20:00:24 +03:00
Andrey Semashev
860eed6baf Use depinst to install library dependencies in GHA config. 2022-09-21 19:19:38 +03:00
Peter Dimov
66a742f41e Statically assert the unsigned integer requirements in bit.hpp. Fixes #129. 2022-09-21 19:19:02 +03:00
Peter Dimov
2cc3e23447 Add test/bit_width_fail (refs #129) 2022-09-21 19:19:02 +03:00
Andrey Semashev
00f4f11f14 Added a check for NULL pointer in fclose_deleter.
The deleter can be called on a null pointer by shared_ptr.

Also added tests with unique_ptr from Boost.Move and shared_ptr
from Boost.SmartPtr.
2022-09-21 18:09:42 +03:00
Andrey Semashev
3510f6244b Added fclose_deleter.
fclose_deleter can be used as a deleter function object for std::FILE
pointers returned by std::fopen.
2022-09-21 13:50:22 +03:00
tocic
89852794ca Fix typos in docs (#127)
* Fix typos in docs

Use "Acknowledgments" everywhere for consistency.

* amend! Fix typos in docs

Fix typos in docs

Use "Acknowledgements" everywhere for consistency.
2022-09-19 12:53:00 +03:00
Peter Dimov
0ac87736f8 Explicitly disable sv_nullptr_fail when BOOST_NO_CXX11_NULLPTR is defined, because libc++ seems to have nullptr even in C++03 mode 2022-09-18 21:10:18 +03:00
Peter Dimov
1fa592c9ec Add a deleted constructor from nullptr_t to string_view; closes #113 2022-09-18 13:53:55 +03:00
Andrey Semashev
162a4e1d24 Disabled warnings about deprecated builtins on clang-15.
The warnings are caused by Boost.TypeTraits:

https://github.com/boostorg/type_traits/issues/173
2022-09-10 02:49:25 +03:00
Andrey Semashev
68f8f36b04 GitHub Actions config update.
- Added clang-15 jobs.
- Added C++23 testing for gcc and clang on Linux.
- Updated clang version for UBSAN job.
- Removed clang-12 libc++ job - libc++ is now tested with clang-15.
- Updated Ubuntu version for clang jobs to avoid having to use external APT
  repository.
- Updated python package installation for compatibility with Ubuntu 22.04.
2022-09-10 00:55:04 +03:00
Vinnie Falco
6fb57488a2 add boost_core.natvis and interface project sources 2022-08-19 12:18:32 -07:00
Andrey Semashev
414dfb4668 Removed ubuntu-18.04 image from CMake tests in GHA config as this image is deprecated. 2022-08-14 18:27:48 +03:00
Andrey Semashev
1b3a907394 Switched gcc-9 to ubuntu-20.04 GHA CI image. 2022-08-14 17:51:54 +03:00
Andrey Semashev
ab23246301 Replaced ubuntu-18.04 GHA CI images with containers.
Also use ubuntu-latest image for jobs that are running in a container.
2022-08-14 14:24:08 +03:00
Glen Fernandes
48bc47cce2 Update empty_value docs 2022-08-06 21:24:09 -04:00
Glen Fernandes
e3745b2072 Add constexpr support to empty_value 2022-08-06 21:20:55 -04:00
Peter Dimov
4162dbed57 Merge pull request #120 from renbaoshuo/patch-1
chore: bump macos runner version
2022-07-25 12:50:49 +03:00
Baoshuo Ren
38937b0fa3 chore: bump macos runner version
GitHub Action is sunsetting the macOS 10.15 Actions runner. It will stop working intermittently until being completely removed by 2022-8-30: https://github.blog/changelog/2022-07-20-github-actions-the-macos-10-15-actions-runner-image-is-being-deprecated-and-will-be-removed-by-8-30-22
2022-07-25 14:35:22 +08:00
Glen Fernandes
8503c536dc Add documentation for rebind C++03 compatibility 2022-07-17 17:18:54 -04:00
Glen Fernandes
7100c05490 In C++03 use rebind<U>::other instead of rebind<U> 2022-07-17 10:06:51 -04:00
Peter Dimov
ac9d79992e Update ci.yml 2022-06-24 14:09:47 +03:00
Peter Dimov
b6c3190468 Add tn_holder specializations for __int128 (avoids macOS link errors for missing typeinfo for same) 2022-05-30 04:03:18 +03:00
Peter Dimov
f941d2e1f7 Add tests for __int128 to type_name_test.cpp 2022-05-30 03:00:37 +03:00
Glen Fernandes
c0e2211c2b Simplify test 2022-05-14 13:05:56 -04:00
Glen Fernandes
eec8689d58 Merge pull request #116 from boostorg/feature/span_boost_begin_test
Add test around the MSVC defect
2022-05-14 01:59:39 -04:00
Glen Fernandes
45e5b1ebcf Add test around the MSVC defect 2022-05-14 00:51:05 -04:00
Peter Dimov
8645bcb06e Merge pull request #101 from boostorg/feature/bit_use_if_constexpr
bit.hpp: Use C++17 if constexpr where possible
2022-05-14 04:35:13 +03:00
Glen Fernandes
ebff02a932 Merge pull request #115 from glenfe/develop
Remove inline friend begin and end functions
2022-05-13 20:45:27 -04:00
Glen Fernandes
42ed795866 Remove inline friend begin and end functions 2022-05-13 18:26:08 -04:00
Peter Dimov
0212774324 Avoid -Wshadow warning under g++ 4.8 2022-04-29 02:43:37 +03:00
Peter Dimov
43d0da03f3 Remove msvc-14.1 from ci.yml 2022-04-28 21:28:11 +03:00
Peter Dimov
0011697492 Add hash_value (refs #110) 2022-04-28 20:42:48 +03:00
Glen Fernandes
d74140983d Correct definition of C++11 alias rebind 2022-04-26 14:11:31 -04:00
Glen Fernandes
1e5c86eb9d Add tests for the C++11 alias rebind 2022-04-26 14:10:21 -04:00
Andrey Semashev
00cc660f28 Merge pull request #108 from Aiee/fix-typo
[Minor] Fix typo
2022-04-19 11:17:52 +03:00
Yichen Wang
44610b65ba Fix typo 2022-04-19 15:26:36 +08:00
Glen Fernandes
5e0ff1680f Use a different workaround for supporting noinit_adaptor in C++03 2022-03-15 14:47:39 -04:00
Glen Fernandes
4defdfd233 Add allocator_construct_n to allocator_access and deprecate alloc_construct 2022-03-12 10:45:05 -05:00
Glen Fernandes
c4deb479fd Add detection support for single argument construct and destroy 2022-03-12 01:31:31 -05:00
Glen Fernandes
f326683d42 Add allocator_construct and allocator_destroy tests to Jamfile 2022-03-12 00:51:52 -05:00
Peter Dimov
dbefea9631 Update revision history 2022-02-15 20:54:37 +02:00
Peter Dimov
a32c1ee7ac Disable test under CMake, CTest doesn't like crashing tests 2022-02-15 06:49:46 +02:00
Peter Dimov
230dd83002 Add newlines, fflush 2022-02-15 06:49:46 +02:00
Peter Dimov
ec91f29d56 Disable msvc warnings 2022-02-15 06:49:46 +02:00
Peter Dimov
188ca25bf3 Mark verbose_terminate_handler as inline 2022-02-15 06:49:46 +02:00
Peter Dimov
ed84fc4e23 Document verbose_terminate_handler 2022-02-15 06:49:46 +02:00
Peter Dimov
622b7a398a Add core/verbose_terminate_handler.hpp 2022-02-15 06:49:46 +02:00
Peter Dimov
35a4e09854 Add clang-win to GHA 2022-02-15 05:46:09 +02:00
Peter Dimov
b7c987f83c Mark quick_exit as inline 2022-02-15 02:08:30 +02:00
Peter Dimov
89d8efb7ff Avoid -Wlong-long in bit_ceil_test.cpp 2022-02-08 22:58:45 +02:00
Peter Dimov
f12eeb6b9f Avoid -Wlong-long in bit_rotate_test.cpp 2022-02-08 22:55:08 +02:00
Peter Dimov
ad63dcda9f Fix -Wlong-long warnings in splitmix64.hpp 2022-02-08 22:49:44 +02:00
Peter Dimov
6a5f726602 Add splitmix64_test.cpp 2022-02-08 22:48:01 +02:00
Peter Dimov
cf619432a7 Fix GCC -Wlong-long warnings 2022-02-08 22:00:42 +02:00
Peter Dimov
b38c148969 Enable -pedantic for the cmath.hpp and bit.hpp tests 2022-02-08 21:37:34 +02:00
Peter Dimov
bae7c049b0 Avoid conversion warning in bit_width 2022-01-19 17:20:39 +02:00
Glen Fernandes
ea7b623b7d Use consistent section titles in documentation 2022-01-07 11:16:44 -05:00
Andrey Semashev
6ae6ff79f1 Deprecated boost/iterator.hpp, emit warnings on inclusion.
The header defines boost::iterator template, which is an alias for
std::iterator, which is itself deprecated since C++17.

Updated test to avoid testing the definition in C++17 onwards
to avoid failures due to deprecation warnings from libc++-13.
2021-12-23 16:46:29 +03:00
Andrey Semashev
06976ccad7 Use path-constant to specify path to headers in docs Jamfile. 2021-12-23 15:10:58 +03:00
Andrey Semashev
65723e0e1f Added clang-13 CI jobs. 2021-12-23 14:50:35 +03:00
Peter Dimov
df3b9827cf Enclose std::min in parentheses to guard against <windows.h> 2021-12-20 01:35:55 +02:00
Peter Dimov
392cc988dd Add sv_windows_h_test 2021-12-20 01:30:32 +02:00
Peter Dimov
0ef1c06fd8 Add cxxstd=20 to msvc-14.2, msvc-14.3 2021-12-18 21:59:21 +02:00
Peter Dimov
0b9624d047 Add sv_common_reference_test2 2021-12-18 18:53:42 +02:00
Peter Dimov
574c7cf86e Update string_view.hpp to use BOOST_NO_CXX20_HDR_CONCEPTS 2021-12-18 18:39:03 +02:00
Peter Dimov
6e6af5fc90 Update sv_common_reference_test to check BOOST_NO_CXX20_HDR_CONCEPTS 2021-12-18 18:18:19 +02:00
Peter Dimov
95f2a76c90 Specialize std::basic_common_reference to enable std::common_reference and std::common_reference_with 2021-12-18 07:43:33 +02:00
Peter Dimov
28d26d13f1 Add sv_common_reference_test 2021-12-18 07:34:16 +02:00
Peter Dimov
ac71c55b4e Remove msvc-14.2 from appveyor.yml (in GHA); use clang-win from VS2019 2021-12-18 05:07:12 +02:00
Peter Dimov
c83e682b7e Update ci.yml 2021-12-18 05:05:36 +02:00
Peter Dimov
7a79d17da2 Add conversions from and to boost::string_view 2021-12-18 04:15:06 +02:00
Glen Fernandes
02b3f91fc3 Use same style of detection in pointer_traits and allocator_traits 2021-12-15 15:30:57 -05:00
Glen Fernandes
a2b37091eb Update documentation 2021-12-15 11:36:02 -05:00
Glen Fernandes
78dd0cce2f Make pointer_to SFINAE friendlier 2021-12-15 09:31:34 -05:00
Glen Fernandes
a121ab0278 Update release notes for 1.79 2021-12-14 07:52:42 -05:00
Glen Fernandes
0e62373aa2 Make pointer_traits SFINAE friendly 2021-12-13 13:13:12 -05:00
Glen Fernandes
6da7958281 Update unit tests 2021-12-08 10:26:49 -05:00
Glen Fernandes
c8479b4eca Simplify C++03 detection traits slightly 2021-12-07 21:17:28 -05:00
Glen Fernandes
f5ab83efe8 Merge pull request #104 from boostorg/feature/allocator_access
Support additional is_empty intrinsics
2021-12-07 11:02:04 -05:00
Glen Fernandes
eb7bc1ff53 Support additional is_empty intrinsics 2021-12-07 10:10:07 -05:00
Glen Fernandes
d038633f98 Correct spelling of detail macro 2021-12-07 02:57:14 -05:00
Glen Fernandes
ac4bdcc4c5 Update documentation 2021-12-06 23:43:03 -05:00
Glen Fernandes
85a3183c01 Update bool constant 2021-12-06 23:36:48 -05:00
Glen Fernandes
0c9675cf56 Add partial C++03 support for C++11 allocator model 2021-12-06 19:56:57 -05:00
Glen Fernandes
5abadf4472 Change A::value_type to allocator_value_type 2021-12-06 16:41:16 -05:00
Glen Fernandes
6b3fb219cc Minor refactoring in allocator access 2021-12-06 15:58:48 -05:00
Glen Fernandes
febc195093 Add default_allocator allocate hint overload in C++03 mode 2021-12-04 14:41:23 -05:00
Glen Fernandes
8985ce604e Simplify test 2021-12-04 14:39:36 -05:00
Glen Fernandes
15c884438c Correct note in documentation 2021-12-04 14:38:18 -05:00
Glen Fernandes
15f7fb7eaa Move Notes to a top level section 2021-12-04 00:32:27 -05:00
Glen Fernandes
46f37b2f16 Make max_size noexcept 2021-12-04 00:24:45 -05:00
Glen Fernandes
c1be2097d7 Minor documentation changes 2021-12-04 00:22:51 -05:00
Glen Fernandes
c8b989d80b Add allocator_traits that uses allocator_access 2021-12-03 23:55:40 -05:00
Glen Fernandes
74c770206a Allow all individual traits to be specialized 2021-12-02 23:09:09 -05:00
Andrey Semashev
a1ad1784bf Updated check for apt-add-repository capabilities.
In Ubuntu 20.04 there appeared an updated version of the
software-properties-common package in focal-updates, which ships a newer
apt-add-repository version that doesn't support -P/-S/-U command line arguments.

Since we cannot rely on package version checks to determine apt-add-repository
capabilities, we have to parse its --help output instead.

Also, made source list processing more protected against spaces.
2021-11-16 00:36:15 +03:00
Andrey Semashev
213e4695bf Use C++17 if constexpr where possible. 2021-11-01 22:35:28 +03:00
Glen Fernandes
a4172b4319 MSVC warning workaround for empty_value 2021-11-01 06:33:44 -04:00
Peter Dimov
e4fb94b73c Merge branch 'develop' into feature/warnings-as-errors 2021-11-01 05:12:33 +02:00
Peter Dimov
ef3505db59 Disable -Wtype-limits for g++ 4.4 in Jamfile 2021-11-01 04:44:07 +02:00
Peter Dimov
f94db671f6 Disable C4702 in lightweight_test_fail6, no_exceptions_support_test 2021-11-01 04:17:51 +02:00
Peter Dimov
7b45315af1 Avoid C4996 in sv_copy_test.cpp 2021-11-01 04:15:33 +02:00
Peter Dimov
bdd4bf7d9a #pragma GCC diagnostic push requires g++ 4.6 2021-11-01 04:04:52 +02:00
Peter Dimov
9f2cdfa7d2 Disable C4244 in scoped_enum.cpp, underlying_type.cpp 2021-11-01 03:58:37 +02:00
Peter Dimov
964ef98eee Avoid streamsize -> size_t warning in string_view.hpp 2021-11-01 03:52:09 +02:00
Peter Dimov
f09ab90243 Disable -Wsign-compare for g++ 4.4 2021-11-01 03:14:53 +02:00
Glen Fernandes
d2e897fd60 MSVC warning workaround for dynamic_extent 2021-10-31 21:14:40 -04:00
Peter Dimov
66f6ea594a Disable -Wtype-limits in string_view.hpp 2021-11-01 03:10:42 +02:00
Peter Dimov
6a91536da6 Disable -Wunused-function in swap_array(_of_array)_of_class.cpp 2021-11-01 03:05:47 +02:00
Peter Dimov
c3a398b9a0 Merge branch 'develop' into feature/warnings-as-errors 2021-11-01 02:56:47 +02:00
Peter Dimov
e73e8bfc83 Disable C4512 in uncaught_exceptions(_np).cpp 2021-11-01 02:55:52 +02:00
Glen Fernandes
633a47f85b MSVC warning workaround for destroy 2021-10-31 20:52:44 -04:00
Glen Fernandes
eae98e909e MSVC warning workaround for as_bytes 2021-10-31 20:52:23 -04:00
Peter Dimov
a581a42c4f Disable C4577 in no_exceptions_support_test.cpp 2021-11-01 02:50:16 +02:00
Peter Dimov
e44781e290 Avoid C4101 in explicit_operator_bool_noexcept.cpp 2021-11-01 02:44:24 +02:00
Peter Dimov
11958e9568 Avoid C4101 in scoped_enum.cpp 2021-11-01 02:42:03 +02:00
Peter Dimov
56566d9abc Disable C4100 in alloc_construct_cxx11_test.cpp 2021-11-01 02:38:19 +02:00
Peter Dimov
9efeed68cb Disable C4530 in no_exceptions_support_test.cpp 2021-11-01 02:32:49 +02:00
Peter Dimov
da3c89dc5b Apply a better fix to iterator_test.cpp 2021-11-01 02:26:06 +02:00
Peter Dimov
ba208ad7fc Avoid signed/unsigned mismatch warning in span.hpp 2021-11-01 02:20:26 +02:00
Peter Dimov
bbfa6344fa Avoid ptrdiff_t -> int warning in eif_constructors.cpp 2021-11-01 02:18:51 +02:00
Peter Dimov
bf4354a3a4 Disable C4127 in bit_endian_test.cpp 2021-11-01 02:16:31 +02:00
Peter Dimov
a4b661068d Disable C4127, C4244 in bit.hpp 2021-11-01 02:14:43 +02:00
Peter Dimov
8299d25eb2 Avoid size_t to int conversion warning in visit_each_test.cpp 2021-11-01 02:06:42 +02:00
Peter Dimov
847f9d43fe Disable C4702 in quick_exit_test.cpp, quick_exit_fail.cpp 2021-11-01 02:04:45 +02:00
Peter Dimov
44e294fff1 Avoid unused parameter warning in to_address_test.cpp 2021-11-01 01:58:05 +02:00
Peter Dimov
b5f59858b9 Avoid unused parameter warning in visit_each_test.cpp 2021-11-01 01:56:27 +02:00
Peter Dimov
bed07e7d5b Disable -Wdeprecated-declarations in iterator_test.cpp 2021-11-01 01:47:28 +02:00
Peter Dimov
971cda2e4c Avoid -Wmissing-braces in swap_array_of_template.cpp 2021-11-01 01:45:15 +02:00
Peter Dimov
d81c61abb4 Disable -Wstring-plus-int in lightweight_test_fail10.cpp 2021-11-01 01:43:50 +02:00
Peter Dimov
370a74c249 Avoid self-assignment warning in ref_ct_test.cpp 2021-11-01 01:41:54 +02:00
Peter Dimov
62d1b1bb59 Avoid sturct/class mismatch warning in use_default_test.cpp 2021-11-01 01:39:13 +02:00
Peter Dimov
bb99544852 Use warnings-as-errors=off for compile-fail tests 2021-11-01 01:35:57 +02:00
Peter Dimov
9b5bf05fae Disable -Wdeprecated-declarations in get_pointer_test.cpp 2021-11-01 01:29:15 +02:00
Peter Dimov
309a6bb797 Fix unused parameter 't' warnings in eif_*.cpp 2021-11-01 01:27:01 +02:00
Peter Dimov
9d1b59ec6c Enable warnings=extra, warnings-as-errors=on 2021-11-01 01:24:02 +02:00
Glen Fernandes
12f5f51427 Switch tests to not rely on requires checks 2021-10-27 01:41:40 -04:00
Peter Dimov
0565456622 Use boost::(u)long_long_type to avoid g++ warning 2021-10-27 04:45:40 +03:00
Peter Dimov
fda0f87576 Add void, move nullptr_t to fundamental type section 2021-10-27 03:46:06 +03:00
Peter Dimov
e9718374ac Hardcode all integral and floating point types 2021-10-27 03:41:40 +03:00
Peter Dimov
79b7c49fb3 Refactor typeid_name<T> slighlty 2021-10-27 03:20:22 +03:00
Peter Dimov
585ac9ace1 Move string_view.hpp to boost/core/detail 2021-10-27 03:08:10 +03:00
Peter Dimov
493832a570 Remove string_view from documentation 2021-10-27 02:57:55 +03:00
Peter Dimov
8942e8ecc9 Update cmake_subdir_test/CMakeLists.txt 2021-10-26 01:00:15 +03:00
Peter Dimov
cbf03c4b9c Add msvc-14.3 to GHA 2021-10-26 00:54:37 +03:00
Glen Fernandes
5cf3569218 Correct documentation 2021-10-20 22:26:25 -04:00
Peter Dimov
d5bd40e528 Update test/Jamfile and test/CMakeLists.txt so that missing dependencies are caught 2021-10-16 18:10:13 +03:00
Peter Dimov
0e57df5aab Regenerate CMakeLists.txt 2021-10-16 17:55:35 +03:00
Glen Fernandes
62b23df9ef Update revision history 2021-10-15 19:00:57 -04:00
Glen Fernandes
fdf1ed78a7 Contribute span implementation 2021-10-14 21:16:19 -04:00
Peter Dimov
e02c333706 Update string_view.qbk 2021-10-11 02:09:45 +03:00
Peter Dimov
b677d1eeae Only update the necessary submodules in ci.yml 2021-10-10 19:35:26 +03:00
Peter Dimov
0f7d02de01 Update revision history 2021-10-10 19:29:46 +03:00
Peter Dimov
773499db5e Remove concurrency section from ci.yml 2021-10-10 18:23:21 +03:00
Peter Dimov
ce912859aa Change cancel-in-progress to false in ci.yml 2021-10-10 18:22:08 +03:00
Peter Dimov
bfeee019dd Update revision history 2021-10-10 18:20:46 +03:00
Peter Dimov
220d4ae0a9 Improve starts_with/ends_with 2021-10-10 17:47:57 +03:00
Peter Dimov
5d7b469e29 Improve .find 2021-10-10 03:09:53 +03:00
Peter Dimov
3cec508460 Update string_view.qbk 2021-10-10 02:25:50 +03:00
Peter Dimov
a47fac1449 Update string_view.qbk 2021-10-10 02:04:43 +03:00
Peter Dimov
7340f123fe Update string_view.qbk 2021-10-10 01:46:32 +03:00
Peter Dimov
038064e824 Update string_view.qbk 2021-10-10 00:44:00 +03:00
Peter Dimov
52c58efc36 Improve operator== 2021-10-09 21:04:38 +03:00
Peter Dimov
15fdc0ab39 Test std::pmr::string in sv_lt_test 2021-10-09 20:14:06 +03:00
Peter Dimov
b520289660 Test std::pmr::string in sv_eq_test 2021-10-09 20:12:32 +03:00
Peter Dimov
9b22937647 g++ 11 has <memory_resource> but not std::pmr::string 2021-10-09 20:06:20 +03:00
Peter Dimov
903d44c0c5 Test std::pmr::string in sv_conversion_test 2021-10-09 19:52:10 +03:00
Peter Dimov
88eee0c628 Test std::pmr::string in sv_construct_test 2021-10-09 19:50:34 +03:00
Peter Dimov
54965f567d Add an allocator argument to operator string() 2021-10-09 19:50:15 +03:00
Peter Dimov
c43a172ded Use os << "" for the padding instead of os << p[0] 2021-10-09 19:31:41 +03:00
Peter Dimov
ddf9b5087b Add sv_conversion_test 2021-10-09 18:36:05 +03:00
Peter Dimov
d17313d407 Add missing #include <ios> 2021-10-09 18:00:58 +03:00
Peter Dimov
c8b860704e Add sv_stream_insert_test 2021-10-09 17:36:06 +03:00
Peter Dimov
e9ffc4336c Remove unused npos variables 2021-10-09 17:10:52 +03:00
Peter Dimov
a121d5a000 Add sv_lt_test 2021-10-09 17:09:23 +03:00
Peter Dimov
5c82e38c93 Add other relational operators; update sv_eq_test 2021-10-09 16:55:33 +03:00
Peter Dimov
db15c7419d Add sv_eq_test 2021-10-09 16:50:14 +03:00
Peter Dimov
62e9d9b868 Update tests 2021-10-09 07:13:56 +03:00
Peter Dimov
b01f2fe4d2 Add optimized implementation of find_last_not_of 2021-10-09 07:08:48 +03:00
Peter Dimov
408cd96595 Update sv_find_last_not_of_test 2021-10-09 07:00:32 +03:00
Peter Dimov
9f2ec3bfca Update find_first_not_of_test 2021-10-09 06:58:11 +03:00
Peter Dimov
63f3a97a15 Update find_last_of_test 2021-10-09 06:54:23 +03:00
Peter Dimov
b70bbf14db Update sv_find_first_of_test 2021-10-09 06:52:08 +03:00
Peter Dimov
b251310a8f Update implementation of find_last_of 2021-10-09 06:47:39 +03:00
Peter Dimov
969a201c75 Update implementation of find_first_of 2021-10-09 06:43:48 +03:00
Peter Dimov
b9f1b9f39a Add optimized implementation of find_first_not_of 2021-10-09 06:40:59 +03:00
Peter Dimov
3d4eb536cd Add optimized implementation of find_last_of 2021-10-09 05:13:23 +03:00
Peter Dimov
a51364c5d3 sv_find_last_not_of_test 2021-10-09 03:33:10 +03:00
Peter Dimov
ab3950fdfb Add sv_find_first_not_of_test 2021-10-09 03:09:32 +03:00
Peter Dimov
fe9c0164c0 Add sv_find_last_of_test 2021-10-09 02:32:00 +03:00
Peter Dimov
8ec0e7f68a Merge branch 'develop' into feature/string-view 2021-10-09 01:50:17 +03:00
Peter Dimov
85e24f0483 Disable std::tuple tests on msvc-10.0 2021-10-08 18:21:04 +03:00
Peter Dimov
be820fea2e Remove uint64_t mask path from find_first_of; no longer a win after fix 2021-10-08 10:28:06 +03:00
Peter Dimov
af3e6a667b Update sv_find_first_of_test 2021-10-08 10:21:07 +03:00
Peter Dimov
c3cfe7a861 Merge branch 'develop' into feature/string-view 2021-10-08 10:15:05 +03:00
Peter Dimov
d87766a768 Remove no longer necessary workarounds 2021-10-08 10:14:21 +03:00
Peter Dimov
706747ab08 Work around g++'s instantiating X on typeid(X*) 2021-10-08 09:44:23 +03:00
Peter Dimov
41c3b6a7dd Reimplement type_name with class templates to avoid instantiating types such as pair<void, void> and tuple<void> 2021-10-08 09:23:26 +03:00
Peter Dimov
8223ff03e4 Add char8_t tests to sv_find_first_of_test 2021-10-08 07:14:54 +03:00
Peter Dimov
18334b1614 Add optimized implementation of find_first_of 2021-10-08 07:03:39 +03:00
Peter Dimov
df65ea6600 Update sv_find_first_of_test 2021-10-08 06:21:52 +03:00
Peter Dimov
d1ad50cefb Add sv_contains_test 2021-10-08 05:50:00 +03:00
Peter Dimov
09870f0739 Add sv_find_first_of_test 2021-10-08 05:39:24 +03:00
Peter Dimov
95e64ef71f Fix msvc-14.0 failure 2021-10-06 17:45:10 +03:00
Peter Dimov
673e3c302c Add sv_rfind_test 2021-10-06 05:49:09 +03:00
Peter Dimov
a8e7a3395e Add sv_iteration_test 2021-10-06 05:36:12 +03:00
Peter Dimov
09044f58d6 Add sv_find_test 2021-10-06 05:04:32 +03:00
Peter Dimov
f9fa1772f2 Add sv_ends_with_test 2021-10-06 04:39:16 +03:00
Peter Dimov
c7dfa29f29 Add sv_starts_with_test 2021-10-06 04:38:27 +03:00
Peter Dimov
93c18fb937 Use BOOST_TEST_TRAIT_SAME in sv_types_test 2021-10-06 03:36:40 +03:00
Peter Dimov
c005ad5e55 Merge branch 'develop' into feature/string-view 2021-10-06 03:32:05 +03:00
Peter Dimov
8cf4d16297 Merge branch 'feature/type-name' into feature/lwt-type-name 2021-10-05 19:47:11 +03:00
Peter Dimov
0deaa2d502 Update msvc-12.0 workaround 2021-10-05 19:22:20 +03:00
Peter Dimov
22de922125 Merge branch 'develop' into feature/type-name 2021-10-05 19:17:39 +03:00
Peter Dimov
3ec157eb6f Disable cmath_test_generic on msvc-8.0 2021-10-05 19:16:24 +03:00
Peter Dimov
531726eb09 Update msvc workarounds in type_name_test 2021-10-05 19:05:40 +03:00
Peter Dimov
31a9336778 Merge branch 'develop' into feature/lwt-type-name 2021-10-05 18:47:25 +03:00
Peter Dimov
75fc48ad32 Add a revision history section to documentation 2021-10-05 18:46:47 +03:00
Peter Dimov
87c21a23bb Update copyright 2021-10-05 17:32:50 +03:00
Peter Dimov
3e9cc2153b Disable no-rtti tests for g++ 4.4 because <memory> breaks 2021-10-05 17:11:31 +03:00
Peter Dimov
98630095f3 Merge branch 'develop' into feature/lwt-type-name 2021-10-05 16:24:49 +03:00
Peter Dimov
6985b1ae25 Remove extra semicolons 2021-10-05 15:53:16 +03:00
Peter Dimov
8ab119135c Add overload for char8_t because Mac has no typeinfo for char8_t 2021-10-05 15:46:22 +03:00
Peter Dimov
1fd2cadddd g++ 4.4 has no string::front 2021-10-05 15:38:33 +03:00
Peter Dimov
bb0c6381f6 Add msvc workarounds 2021-10-05 08:04:01 +03:00
Peter Dimov
4f6f7c3799 Add tests for all fundamental types 2021-10-05 07:50:52 +03:00
Peter Dimov
cd1a8fd238 Support pointers to members 2021-10-05 07:25:35 +03:00
Peter Dimov
b0b48c5783 Support qualified function types 2021-10-05 07:05:34 +03:00
Peter Dimov
ccdf5ce031 Track the type suffix independently for better decomposition of functions and arrays 2021-10-05 06:45:41 +03:00
Peter Dimov
b3906601f7 Merge branch 'feature/type-name' into feature/lwt-type-name 2021-10-05 05:43:01 +03:00
Peter Dimov
f833040d48 Disable msvc warnings around tn_is_function 2021-10-05 05:42:41 +03:00
Peter Dimov
3b5595e940 Merge branch 'feature/type-name' into feature/lwt-type-name 2021-10-05 05:31:09 +03:00
Peter Dimov
b93317815c Apply msvc-12.0 (and below) workarounds 2021-10-05 05:30:37 +03:00
Peter Dimov
01bd23df5d Add tests for function types 2021-10-05 05:04:56 +03:00
Peter Dimov
36cec9a5cc Handle references to functions 2021-10-05 05:01:05 +03:00
Peter Dimov
290340fd27 Use core::type_name in lightweight_test_trait 2021-10-05 04:58:52 +03:00
Peter Dimov
003c7365bc Use VS2019 for clang-win, because VS2017 fails to find msvcrt(d).lib for some reason now 2021-10-05 01:00:09 +03:00
Peter Dimov
31e2caef12 Add sv_compare_test 2021-10-04 22:11:14 +03:00
Peter Dimov
042bb98142 Add sv_substr_test 2021-10-04 20:57:10 +03:00
Peter Dimov
c65c05c006 Add sv_copy_test 2021-10-04 20:45:10 +03:00
Peter Dimov
1aa8341bd7 Add sv_modifiers_test 2021-10-04 20:36:40 +03:00
Peter Dimov
e206cddc6f Fix line endings 2021-10-04 20:27:14 +03:00
Peter Dimov
c8b55f1bde Change BOOST_CONSTEXPR to BOOST_CXX14_CONSTEXPR appropriately 2021-10-04 19:12:05 +03:00
Peter Dimov
62ba7ca18b Define npos as BOOST_CONSTEXPR_OR_CONST 2021-10-04 19:08:12 +03:00
Peter Dimov
964dfe2b74 Fix line endings 2021-10-04 17:45:24 +03:00
Peter Dimov
016ae92ecf Add sv_element_access_test 2021-10-04 17:33:04 +03:00
Peter Dimov
7d05dfa87d Add sv_construct_test 2021-10-04 17:25:34 +03:00
Peter Dimov
95924b1329 Add boost/core/string_view.hpp 2021-10-04 16:49:46 +03:00
Peter Dimov
5e382efa84 Fix std::ostream failure on libstdc++ 2021-10-01 15:51:13 +03:00
Peter Dimov
e260bb865d Add support for string_view 2021-10-01 15:07:19 +03:00
Peter Dimov
f884833b42 Add workaround for msvc-10.0 2021-09-30 03:21:31 +03:00
Peter Dimov
8265fe6405 Minor documentation fix 2021-09-29 21:55:40 +03:00
Peter Dimov
f7b04afe4d Add documentation for type_name 2021-09-29 21:34:23 +03:00
Peter Dimov
2c1eb07a68 Add test for scoped enums 2021-09-29 21:12:54 +03:00
Peter Dimov
a5cbddc466 Add test for enums 2021-09-29 21:09:19 +03:00
Peter Dimov
91a64b3bcf Add support for std::array 2021-09-29 21:02:39 +03:00
Peter Dimov
a039f8c318 Support -fno-rtti 2021-09-29 20:53:38 +03:00
Peter Dimov
bebb7349ba Add workarounds for msvc-12.0 and earlier 2021-09-29 20:05:23 +03:00
Peter Dimov
dc6e3261ec Use typedef instead of using 2021-09-29 19:51:16 +03:00
Peter Dimov
15a7d84858 Use basic_string<char8_t> instead of u8string 2021-09-29 19:50:14 +03:00
Peter Dimov
06023d4ffe Strip libstdc++ and libc++ inline namespaces 2021-09-29 19:34:37 +03:00
Peter Dimov
3e0bc52c32 Add <boost/core/type_name.hpp> 2021-09-29 19:13:12 +03:00
Andrey Semashev
b83f27a9e0 Another fix in git version check. 2021-09-26 20:35:37 +03:00
Andrey Semashev
578e3105b8 Fixed git version check on Mac OS. 2021-09-26 20:31:43 +03:00
Andrey Semashev
f34c4986c1 Added a timeout for GHA CI. 2021-09-15 20:45:23 +03:00
Andrey Semashev
cfd469d858 Removed unused reference to extra_tests variable in GHA config. 2021-09-15 18:27:17 +03:00
Peter Dimov
b1e01b53f3 Merge branch 'develop' into feature/cmath 2021-09-14 19:15:41 +03:00
Peter Dimov
177c093151 Automatically use generic cmath if FP_SUBNORMAL isn't defined 2021-09-14 18:57:33 +03:00
Peter Dimov
cffaabead8 Update and fix CMake test jobs 2021-09-14 18:49:03 +03:00
Peter Dimov
2715f9b5d8 Add a workaround for g++ 4.4, 4.6 2021-09-14 18:35:31 +03:00
Peter Dimov
8043bafb6b Add a generic cmath.hpp implementation, enabled when BOOST_CORE_USE_GENERIC_CMATH is defined 2021-09-14 16:50:34 +03:00
Andrey Semashev
f6bdb17fd9 Updated GitHub Actions config for better configurability.
Reworked extra package installation and added explicit specification
of external package sources. Moved some common constants to environment
variables. Removed installation of unneeded packages in the containers.
2021-09-12 18:28:02 +03:00
Andrey Semashev
cd6847aee8 Update GitHub Actions config to switch Ubuntu 16.04 jobs to Docker containers.
The Ubuntu 16.04 environment is scheduled to be removed from GitHub Actions
in September 2021. Migrate those jobs to Docker containers or Ubuntu 18.04.

Also, added some older compilers. Ported CMake tests from Travis CI.

Based on https://github.com/boostorg/core/pull/95.
Closes https://github.com/boostorg/core/pull/95.
2021-09-06 02:00:12 +03:00
Andrey Semashev
9ff312e2fb Updated README.md to refer to GitHub Actions instead of Travis. 2021-09-06 01:24:19 +03:00
Andrey Semashev
494927312d Removed Travis CI config file.
Travis CI no longer provides (adequate) service to open source projects,
so we have switched to GitHub Actions as a replacement.
2021-09-06 01:24:19 +03:00
Peter Dimov
df91243a1d Whether wchar_t is signed is implementation-defined 2021-08-21 20:28:47 +03:00
Andrey Semashev
f4b3d5dba6 Merge pull request #93 from sdarwin/feature/gha_fix
Small GHA fix, create destination dir
2021-07-27 23:53:44 +03:00
sdarwin
9f0b97c80b Small GHA fix, create destination dir 2021-07-27 13:35:51 -05:00
Andrey Semashev
ce53cc1f8f Changed quotes in format() expression. 2021-07-02 20:38:22 +03:00
Andrey Semashev
8fad14b804 Use gcc-7 toolchain for clang-8 CI job. 2021-07-02 20:35:45 +03:00
Andrey Semashev
24b6d89e7f Changed CI concurrency group format.
This should fix CI and also make concurrncy work for PRs.
2021-07-02 20:34:19 +03:00
Andrey Semashev
ffd79a28e1 Added concurrency settings to auto-cancel redundant CI jobs. 2021-07-02 20:03:50 +03:00
Andrey Semashev
aa97e418f2 Increased git fetch jobs on Windows and use CPU count for build jobs. 2021-07-02 19:33:06 +03:00
Andrey Semashev
f563d50d42 Use more git fetch jobs to speed up clones. 2021-07-02 19:19:48 +03:00
Andrey Semashev
c55a20dff2 Reverted gcc package removal and instead setup a dummy gcc toolset tree.
Removing gcc and libstdc++ packages did not fix the clang-8 test failures.

Instead, setup a dummy gcc toolset tree and point clang to it to force
the compiler detect and use an older libstdc++.
2021-07-02 19:14:04 +03:00
Andrey Semashev
bc508f8b4c Remove gcc-10 for clang-8 testing.
This is another attempt to make clang-8 tests not fail in C++20 mode. Remove
gcc-10 and libstdc++-10 to prevent clang using it.

Also, use apt-get instead of apt since the former is recommended to use in
scripts. This should silence apt warnings.
2021-07-02 16:15:59 +03:00
Andrey Semashev
03c5481dd4 Moved clang-8 to Bionic and gcc-10,11 to Focal.
clang-8 jobs fail in C++20 mode since it doesn't support
std::is_constant_evaluated, which is called from libstdc++-10 that is installed
in Focal image. Moving it back to Bionic should work around the issue
as it should use an older libstdc++ version.

gcc-10 and 11 were moved to Focal just to make this configuration tested.

Also, changed 2a to 20 for compilers that support this.
2021-07-02 11:52:44 +03:00
Andrey Semashev
8e7ee90080 Merge pull request #92 from evanmiller/develop
Restore support for ancient Mac OS
2021-07-02 01:59:50 +03:00
Evan Miller
128d9314d6 Restore support for ancient Mac OS
Mac OS 10.4 and earlier lack Availability.h, causing compilation to
fail. Rearrange the macro logic to include Availability.h only if we
already think there may be support for uncaught exceptions.
2021-07-01 16:32:40 -04:00
Peter Dimov
012d96a72b Use non-const references in non-variadic branch as well 2021-06-10 10:09:46 +03:00
Peter Dimov
27d700ec01 Use non-const references in ignore_unused to avoid g++-11 warning 2021-06-10 09:54:51 +03:00
Peter Dimov
507c182f4c Revert "Initialize variables in ignore_unused_test to avoid a g++-11 warning"
This reverts commit 1a011cde56.
2021-06-10 09:40:08 +03:00
Peter Dimov
1a011cde56 Initialize variables in ignore_unused_test to avoid a g++-11 warning 2021-06-10 08:25:28 +03:00
Peter Dimov
71c3d320d5 Update ci.yml 2021-06-10 07:20:24 +03:00
Peter Dimov
b3fa7ca565 Take care of gcc-4.4 in addition to gcc-4.4.7 2021-06-10 04:58:17 +03:00
Peter Dimov
d3aa4a2f12 Update .travis.yml 2021-06-10 04:56:26 +03:00
Peter Dimov
67107dbaf9 Update ci.yml 2021-06-10 04:22:36 +03:00
Peter Dimov
0b74f0d394 Update CMakeLists.txt 2021-06-10 02:03:10 +03:00
Peter Dimov
e53393357f Update .github/workflows 2021-04-19 18:11:37 +03:00
Peter Dimov
7daee1d41b Add -DBUILD_TESTING=ON to .yml files; it's not default anymore 2021-03-19 03:53:31 +02:00
Glen Fernandes
ddbaa242a9 Update copyright comments 2021-02-16 02:14:14 -05:00
Glen Fernandes
86bff4c2d3 Revise allocator access utilities
Now supports MSVC 2013, and no workarounds use allocator_traits.
2021-02-15 22:11:41 -05:00
Peter Dimov
2e5ecbe6f6 Add test for typeid(struct X) across libraries 2021-02-11 04:43:05 +02:00
Peter Dimov
1c43651533 Test (signed char)-1 instead of 1 2021-01-20 02:40:37 +02:00
Peter Dimov
afba04cf7f Output non-printable chars as \xXY 2021-01-20 02:38:57 +02:00
Peter Dimov
0ae16756eb Add run-fail test for BOOST_TEST_NE and character types 2021-01-20 02:04:30 +02:00
Peter Dimov
2729beab83 Print char types as numeric values (C++20 deletes these ostream overloads) 2021-01-20 01:54:37 +02:00
Peter Dimov
71d60a3fb7 Fix typos in macro names 2021-01-20 01:39:09 +02:00
Peter Dimov
2642ad4562 Add test for BOOST_TEST_EQ and character types 2021-01-20 01:10:57 +02:00
Peter Dimov
f7c1f6c6ab Merge pull request #85 from eldiener/develop
[skip ci] Add "cxxstd" json field
2021-01-20 00:28:10 +02:00
Edward Diener
10eb5cdf7c [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. 2021-01-19 13:08:18 -05:00
Glen Fernandes
82a51aea40 Merge branch 'develop' into feature/update-travis 2020-12-31 13:54:01 -05:00
Glen Fernandes
5726534f6d Correct unit test for allocator_size_type 2020-12-31 11:41:04 -05:00
Peter Dimov
a13a82f8c1 Fix Travis configurations 2020-12-31 17:48:48 +02:00
Peter Dimov
cb94f76a5e Remove redundant configurations from Travis; add non-redundant ones 2020-12-30 20:58:04 +02:00
Peter Dimov
a6cab03127 Add documentation for bit.hpp 2020-12-30 20:34:34 +02:00
Peter Dimov
fa82b680cf Work around clang++ 3.3 failure 2020-12-30 19:40:52 +02:00
Peter Dimov
16e9536146 Implement boost::core::endian 2020-12-29 02:41:15 +02:00
Peter Dimov
919b98d425 Use __builtin_popcount 2020-12-29 02:06:56 +02:00
Peter Dimov
e8aa0c75b4 Use _BitScanForward 2020-12-29 02:02:33 +02:00
Peter Dimov
8bd2239b0b Use __builtin_ctz 2020-12-29 01:56:34 +02:00
Peter Dimov
c838ebc003 Use _BitScanReverse 2020-12-29 01:53:30 +02:00
Peter Dimov
aca46fae91 Use __builtin_clz 2020-12-29 01:28:59 +02:00
Peter Dimov
409c809cd8 Add popcount 2020-12-29 01:06:22 +02:00
Peter Dimov
dc8aa5eb39 Update test_bit_floor 2020-12-29 00:30:54 +02:00
Peter Dimov
26728848b4 Add bit_ceil 2020-12-29 00:29:44 +02:00
Peter Dimov
3e41929dfb Update bit_floor_test 2020-12-29 00:22:45 +02:00
Peter Dimov
579cb8f7f3 Add bit_floor_test 2020-12-29 00:06:25 +02:00
Peter Dimov
3b14a3677d Add has_single_bit_test 2020-12-28 23:59:58 +02:00
Peter Dimov
26991f0c75 Add bit_width_test 2020-12-28 23:52:39 +02:00
Peter Dimov
cc877e6b5b Add countl_zero, countl_one 2020-12-28 23:40:59 +02:00
Peter Dimov
123b567051 Add missing unsigned short tests to bit_rotate_test 2020-12-28 21:54:42 +02:00
Peter Dimov
a47eebf41a Add countr_zero, countr_one 2020-12-28 21:52:02 +02:00
Peter Dimov
045487ba96 Add boost/core/bit.hpp (bit_cast, rotl, rotr) 2020-12-28 21:12:22 +02:00
Peter Dimov
804c5b250d Add documentation for cmath.hpp 2020-12-24 01:20:32 +02:00
Peter Dimov
bee040b8cc Add fpclassify. 2020-12-24 00:58:56 +02:00
Peter Dimov
c307f86520 Add core/cmath.hpp 2020-12-24 00:19:20 +02:00
Peter Dimov
0364b64927 Compute LIBRARY from GITHUB_REPOSITORY 2020-12-23 06:47:00 +02:00
Peter Dimov
a04803b6cb Fix BOOST_BRANCH 2020-12-23 05:15:04 +02:00
Peter Dimov
88896d0805 Update ci.yml 2020-12-19 17:54:04 +02:00
Peter Dimov
bff4172486 Move windows.yml into ci.yml 2020-12-19 17:45:30 +02:00
Peter Dimov
ea0b1dc8a9 Rename posix.yml to ci.yml 2020-12-19 17:44:32 +02:00
Peter Dimov
3d6683edb5 Update maintainer e-mail 2020-12-12 01:01:07 +02:00
Peter Dimov
72089753f7 Add Doxygen annotation 2020-11-21 18:18:31 +02:00
Peter Dimov
156a016865 Add matrix.addrmd, toolset=gcc to windows.yml 2020-11-20 05:22:06 +02:00
Peter Dimov
0dcd164a12 Add .github/workflows 2020-11-20 04:23:22 +02:00
Peter Dimov
54671134ae Add implicit conversion between compatible reference wrappers (refs #83) 2020-11-19 18:57:56 +02:00
Peter Dimov
7bc2873e38 Update appveyor.yml 2020-11-14 22:02:03 +02:00
Andrey Semashev
ca4893063f Switch to from c++2a to c++20 for gcc-10 and clang-10. 2020-08-20 15:10:47 +03:00
Andrey Semashev
dcc04c5508 Added a workaround for uncaught_exceptions for older Mac OS and iOS.
libc++ disables std::uncaught_exceptions for Mac OS < 10.12 and
iOS < 10.0, even though it defines __cpp_lib_uncaught_exceptions.

Fixes https://github.com/boostorg/core/issues/80.
2020-07-20 23:13:42 +03:00
Glen Fernandes
484487f958 MSVC2017 /std:c++17 warnings in allocator access 2020-07-17 09:30:00 -04:00
Andrey Semashev
503d035b7f Added a workaround for uncaught_exceptions on AIX with xlclang++.
The compiler provides cxxabi.h header but doesn't have __cxa_get_globals,
even in the ABI library. We have to disable __cxa_get_globals-based
implementation and fall back to std::uncaught_exception.

Fixes https://github.com/boostorg/core/issues/78.
2020-07-16 20:53:09 +03:00
Peter Dimov
35a025d59b Untabify lightweight_test_with_fail 2020-06-15 21:32:50 +03:00
Peter Dimov
c6d72da515 Document BOOST_TEST_WITH 2020-06-07 01:32:19 +03:00
Peter Dimov
f96fb31850 Rename lw_predicate_name to lwt_predicate_name 2020-06-06 22:53:20 +03:00
Peter Dimov
b414be98c9 Add lightweight_test_with_fail 2020-06-06 21:54:16 +03:00
Peter Dimov
544fd495e5 Remove unnecessary includes, add const 2020-06-06 21:49:09 +03:00
Peter Dimov
e155e13084 Change lw_name_traits to lw_predicate_name 2020-06-06 21:48:16 +03:00
Bjorn Reese
6e36923915 Added BOOST_TEST_WITH macro to verify test results with custom predicate 2020-06-06 18:52:43 +02:00
Glen Fernandes
b67cce85c8 Correct spelling mistake in documentation 2020-05-28 09:20:01 -04:00
Glen Fernandes
376aa7aa31 Revise allocator_access implementation 2020-05-25 16:14:40 -04:00
Glen Fernandes
65901249d5 Workarounds for MSVC 2013 expression detection 2020-05-24 13:10:24 -04:00
Glen Fernandes
1c16d5ed87 Workaround for MSVC 2017 warning
MSVC provides deprecated members on allocator which we detect.
2020-05-24 10:48:36 -04:00
Glen Fernandes
27715ed01a Simplify alloc_construct using allocator_access 2020-05-24 02:45:11 -04:00
Glen Fernandes
9f2dbba2fc Workaround for MSVC 2015 expression SFINAE 2020-05-24 02:45:00 -04:00
Glen Fernandes
0159b6d8e5 Revise construction in allocator_access 2020-05-24 02:43:33 -04:00
Glen Fernandes
0dbd5aaadd Update empty_value constructors 2020-05-23 19:53:16 -04:00
Glen Fernandes
34373b0127 Avoid defining a macro in default_allocator 2020-05-23 15:28:10 -04:00
Glen Fernandes
6a33e879dd Simplify noinit_adaptor using allocator_access 2020-05-23 12:26:33 -04:00
Andrey Semashev
15db54983b Added a workaround for MSVC macro max. 2020-05-23 02:39:59 +03:00
Andrey Semashev
fa6e38a9aa Upgraded clang UBSan jobs to clang 10 in Travis CI. 2020-05-22 18:35:41 +03:00
Andrey Semashev
38f827e092 Added gcc 10 build jobs to Travis CI. 2020-05-22 18:33:43 +03:00
Andrey Semashev
2b102e7357 Test the standard library rather than the compiler to select the standard header for std::swap. 2020-05-21 02:04:43 +03:00
Andrey Semashev
9c33851420 Change cxxstd to 2a on clang 10 until Boost.Build is merged to master. 2020-05-08 17:17:14 +03:00
Andrey Semashev
fb593cbbc8 Merge pull request #66 from Kojoley/add-deprecation-warnings
Add deprecation warnings for headers in detail dir
2020-05-08 13:56:33 +03:00
Andrey Semashev
032ce991fb Change cxxstd to 20 on clang 10.
Since https://github.com/boostorg/build/pull/592 was merged, we can switch
back to the most recent C++20 version for clang 10.
2020-05-08 11:49:40 +03:00
Edward Diener
6444de7098 Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-05-08 11:41:04 +03:00
Peter Dimov
d3a64554f4 Fix Travis 2020-05-06 15:28:12 +03:00
Andrey Semashev
a57c1e0a80 Added clang-10 jobs to Travis CI. 2020-05-05 23:17:39 +03:00
Glen Fernandes
e9ff763d79 Evaluate expression when BOOST_NO_EXCEPTIONS is defined 2020-05-02 09:34:29 -04:00
Glen Fernandes
6069fea76d Add documentation for BOOST_TEST_NO_THROW 2020-05-01 15:20:25 -04:00
Glen Fernandes
3ca745f400 Add BOOST_TEST_NO_THROW and print expression in BOOST_TEST_THROWS 2020-05-01 14:34:02 -04:00
Peter Dimov
94def8a3a6 Merge branch 'feature/lwt-pedantic' into develop 2020-04-28 04:21:59 +03:00
Peter Dimov
295b72cbc0 Disable -Waddress in lightweight_test_test.cpp 2020-04-28 02:04:29 +03:00
Glen Fernandes
eb86df4a04 Remove duplicate test run 2020-04-27 15:56:35 -04:00
Peter Dimov
0a6b8e667b Add warnings=pedantic to the rest of the lwt tests 2020-04-27 22:29:28 +03:00
Glen Fernandes
4d08e709fe Pedantic tests for default_allocator 2020-04-27 14:27:20 -04:00
Glen Fernandes
12ff209bf7 Revise max_size implementation in default_allocator 2020-04-27 14:27:12 -04:00
Peter Dimov
bb0ef6d41e Disable variadic macros warning in lightweight_test_trait.hpp 2020-04-27 19:17:48 +03:00
Peter Dimov
2dd51f248b Use warnings=pedantic for some lwt tests 2020-04-27 18:47:45 +03:00
Glen Fernandes
8fe9805792 Avoid C99 stdint macros in default_allocator 2020-04-26 19:49:01 -04:00
Glen Fernandes
6624532550 Correct spelling in documentation 2020-04-14 19:40:41 -04:00
Glen Fernandes
c31e23b362 Implement allocator access utilities 2020-04-14 14:52:30 -04:00
Glen Fernandes
690514e87c Use BOOST_INLINE_CONSTEXPR in empty_value 2020-04-05 19:55:24 -04:00
Peter Dimov
5a5d2adda0 Go back to ::quick_exit, but include the correct <stdlib.h>; on Linux and Cygwin, quick_exit is not brought into std in C++03 mode 2020-03-23 15:54:23 +02:00
Peter Dimov
10c01d0d56 Use std::quick_exit instead of ::quick_exit 2020-03-23 05:21:08 +02:00
Peter Dimov
27d8ef1286 Change BOOST_TEST to match BOOST_TEST_EQ et al, in order to avoid 'expression result unused' warning from Clang 2020-02-21 19:46:42 +02:00
Glen Fernandes
b5c2726d1b Include cstddef in pointer_traits 2020-02-17 22:13:10 -05:00
Peter Dimov
0eecbda0b1 Remove unnecessary struct 2020-02-17 05:21:20 +02:00
Peter Dimov
2a471c3417 Add test for BOOST_TEST_* macros return values 2020-02-16 20:52:59 +02:00
Peter Dimov
5ca752323f Return a bool result from the BOOST_TEST_* macros, f.ex. to allow chaining with && 2020-02-16 20:52:12 +02:00
Peter Dimov
13e9d3d4d9 Fix typo in test/Jamfile 2020-02-16 20:17:52 +02:00
Peter Dimov
f3cd812ccb Disable 'should return report_errors()' test on CMake, because CTest doesn't like abort() 2020-01-02 21:05:07 +02:00
Peter Dimov
8f2841de83 Restrict clang-3.5 to 03/11 to avoid ::gets error 2020-01-02 21:04:06 +02:00
Peter Dimov
bf5778403e Update tools/cmake 2020-01-02 20:30:03 +02:00
Peter Dimov
fc285464aa Update Travis to Xenial 2020-01-02 20:23:07 +02:00
Peter Dimov
750625272f Add CMake tests 2020-01-02 20:00:11 +02:00
Peter Dimov
bda2b9b4b1 Disable _CrtDbgReport message boxes, displayed on debug iterator violations 2020-01-01 17:17:43 +02:00
Glen Fernandes
ac4c781cac Include lightweight_test from core and workaround from config 2020-01-01 09:02:46 -05:00
Peter Dimov
72ca0d8664 Add CMake install support 2019-12-28 18:47:11 +02:00
Glen Fernandes
253b07f630 Add empty_init constant to documentation 2019-12-15 12:46:55 -05:00
Peter Dimov
e59271fdc2 Check BOOST_MSVC in addition to __cplusplus, because msvc doesn't define __cplusplus correctly 2019-12-02 02:15:55 +02:00
Nikita Kniazev
bc82adcd0b Remove implementation specific handling 2019-12-02 01:11:04 +03:00
Nikita Kniazev
868cb07578 Try to include std::swap from the most lightweight header
Based on Boost.Move idea
2019-12-01 17:28:07 +03:00
Andrey Semashev
38f71361fb Add a convenience instance of empty_init_t (#65)
* Added a convenience instance of empty_init_t.

Closes https://github.com/boostorg/core/issues/63.
2019-11-23 21:00:59 -05:00
Peter Dimov
6d62fb5f5e Remove clang-win 32 bit, because it fails to link with 'unable to load mspdbcore.dll (error code: 126)' 2019-11-23 21:52:53 +02:00
Peter Dimov
0d71f42365 Separate Appveyor Clang configurations 2019-11-23 21:11:26 +02:00
Nikita Kniazev
080e8581d5 Add deprecation warnings for headers in detail dir 2019-11-23 16:53:32 +03:00
Peter Dimov
259587da7f Add clang-9 to Travis 2019-10-11 21:34:55 +03:00
Peter Dimov
882a792856 Add 2019 to Appveyor 2019-10-11 18:50:35 +03:00
Peter Dimov
130c8f2439 Disable Wsign-compare on gcc 4.4.7 2019-10-11 17:19:01 +03:00
Peter Dimov
e38997be4d Reorder conditions to support clang-cl 2019-10-11 16:43:48 +03:00
Peter Dimov
d112d23e9d Test that BOOST_TEST_EQ doesn't emit sign-compare warnings 2019-10-11 16:02:45 +03:00
Glen Fernandes
e94af0d41a Also define make_nvp in boost::serialization 2019-10-01 08:14:07 -04:00
Glen Fernandes
ac427ad64a Define nvp inside boost::serialization and bring it into boost 2019-10-01 07:28:25 -04:00
Glen Fernandes
f2644886f5 Update section title in documentation 2019-10-01 07:28:06 -04:00
Glen Fernandes
0591b1d855 Add BOOST_NVP convenience macro 2019-09-16 02:15:53 -04:00
Glen Fernandes
7cc1047ab7 Update NVP implementation, tests, docs 2019-09-15 21:12:16 -04:00
Glen Fernandes
f52dec58c2 Add a definition for nvp_bool 2019-09-10 08:04:40 -04:00
Glen Fernandes
26497003f2 Remove save and load helpers and update documentation for NVP 2019-09-04 21:47:39 -04:00
Glen Fernandes
5fb5a3e292 Update nvp tests and documentation 2019-09-04 12:28:00 -04:00
Glen Fernandes
7b8385afc3 Implement NVP in Core for Serialization and other libraries 2019-09-04 09:58:04 -04:00
Glen Fernandes
106a7c0939 Mark throw_exception BOOST_NORETURN 2019-08-27 07:28:28 -04:00
Peter Dimov
f2ee17fa24 Update .travis.yml 2019-07-25 12:27:19 +03:00
Peter Dimov
eba08e936a Only return an 8 bit result from report_errors 2019-06-26 19:53:58 +03:00
Andrey Semashev
7e1d028958 Updated comment about QNX workaround in uncaught_exceptions.hpp. 2019-06-18 12:48:18 +03:00
Andrey Semashev
420dff80b5 Added a workaround for QNX in uncaught_exceptions.hpp.
QNX provides cxxabi.h from LLVM libc++abi, which does not declare
__cxa_get_globals but provides its implementation in the library.
To make things more fun, QNX developers commented _LIBCPPABI_VERSION
definition, which breaks detection of libc++abi in uncaught_exceptions.hpp.

There is also cxxabi.h from glibcxx that does provide __cxa_get_globals
declaration. We want to use that declaration, if possible, to avoid possible
mismatch in attributes.

This commit adds non-glibcxx cxxabi.h on QNX to the list of platforms that
need our declaration of __cxa_get_globals.

Fixes https://github.com/boostorg/core/issues/59.
2019-06-13 15:38:43 +03:00
Glen Fernandes
4f141646b5 Add overloads for non-const lvalue reference 2019-05-19 23:48:11 -04:00
Glen Fernandes
29f281fe7a Add alloc_construct overload for non-const lvalue reference 2019-05-19 21:14:23 -04:00
Glen Fernandes
c96dfcec4a Update test and documentation 2019-05-13 23:43:57 -04:00
Glen Fernandes
ca832d9384 Implement first_scalar 2019-05-13 15:04:26 -04:00
Glen Fernandes
6b65cde816 Add alloc_construct_n overload for input iterators 2019-05-11 12:50:39 -04:00
Glen Fernandes
b0df75ad1c Rename identifiers in alloc_construct documentation 2019-05-10 08:35:35 -04:00
Glen Fernandes
5ffce48fa1 Correct example in documentation 2019-05-06 22:26:46 -04:00
Glen Fernandes
cb154c3ac2 Minor documentation fixes 2019-05-04 01:41:00 -04:00
Glen Fernandes
14fb9e4433 More documentation updates 2019-05-03 21:31:00 -04:00
Glen Fernandes
a90dc39e06 Minor documentation update for noinit_adaptor 2019-05-03 19:53:56 -04:00
Glen Fernandes
8f5f7f9c42 Minor documentation update for alloc_construct 2019-05-03 18:59:04 -04:00
Glen Fernandes
612069c7e4 Move construct and destroy from Smart_Ptr to Core 2019-05-03 08:54:09 -04:00
Glen Fernandes
f3a382c017 Update order of includes in noinit_adaptor_test.cpp 2019-05-02 10:20:58 -04:00
Glen Fernandes
ce05d650dc Update documentation and conditionally include headers in noinit_adaptor.hpp 2019-05-02 07:43:55 -04:00
Glen Fernandes
836ae6917d Update vector value type in unit test 2019-04-29 02:29:00 -04:00
Glen Fernandes
a0e1100421 Add noinit_adapt() free function utility 2019-04-29 02:04:54 -04:00
Glen Fernandes
50491408b1 Implement noinit_allocator_adaptor 2019-04-28 02:10:37 -04:00
Glen Fernandes
62fff4d829 Update documentation for default_allocator 2019-04-27 19:11:45 -04:00
Glen Fernandes
151f2cf645 Support C++03 implementations that require reference and const_pointer 2019-04-27 06:15:24 -04:00
Glen Fernandes
5a549b8b22 Update max_size() implementation and tests 2019-04-25 13:05:06 -04:00
Glen Fernandes
e859d01186 Correct max_size() when PTRDIFF_MAX is less than SIZE_MAX 2019-04-25 12:11:34 -04:00
Glen Fernandes
08382d184d Suppress warnings in Quickbook variablelists 2019-04-25 11:55:03 -04:00
Glen Fernandes
69f7b0c76b Update computation of max_size 2019-04-25 11:49:36 -04:00
Glen Fernandes
b5c178ef0b Increase the size of test type 2019-04-25 09:36:08 -04:00
Glen Fernandes
ba79489ea1 Remove null check in allocate 2019-04-25 02:32:31 -04:00
Glen Fernandes
2eaed5b9e9 Merge pull request #56 from boostorg/feature/default_allocator
Implement default_allocator
2019-04-25 16:25:51 +10:00
Glen Fernandes
9c88e5cbb1 Implement default_allocator 2019-04-25 02:22:45 -04:00
Peter Dimov
006c159dbb Fix typo 2019-04-23 03:06:35 +03:00
Piotr Jawniak
c7f0fa8900 Document an emulation limitation of scoped enum (#28) 2019-04-22 17:00:26 -07:00
Peter Dimov
fb417474ae Mark detail/sp_typeinfo.hpp as deprecated 2019-04-22 17:28:31 +03:00
Peter Dimov
fc83a2e3af Fix expected failures when no rvalue references 2019-04-20 13:09:18 +03:00
Peter Dimov
e023e28369 Merge branch 'develop' of https://github.com/glenfe/boost.core into feature/lwt-print-cvref 2019-04-20 12:58:36 +03:00
Peter Dimov
b1e0735d8f Check number of failures in lightweight_test_all_with_eq, lightweight_test_all_with_fail 2019-04-20 10:11:16 +03:00
Glen Fernandes
a78c25e4ab Print type with cvref qualifiers 2019-04-20 03:04:06 -04:00
Hans Dembinski
02041f6c9f report_errors with expected failures (#51)
* Return number of failures from report_errors
2019-04-19 23:55:50 -07:00
Peter Dimov
f14a464b29 Only disable C4127 on msvc-pre-14.0 2019-04-19 23:41:26 +03:00
Peter Dimov
af7e01b8c4 Merge branch 'no_exceptions_support-conditional-expression-is-constant' of https://github.com/Kojoley/core into feature/no-exceptions-support 2019-04-19 23:33:33 +03:00
Peter Dimov
40424bf0b6 Merge branch 'develop' into feature/no-exceptions-support 2019-04-19 23:28:02 +03:00
Peter Dimov
8d4c039f34 Remove unnecessary include 2019-04-19 23:27:37 +03:00
Peter Dimov
e6aa65a002 Add clang-win to Appveyor 2019-04-19 20:14:03 +03:00
Peter Dimov
bb2e7e4c69 Add __clang__ to BOOST_NO_TYPEID comparison conditions 2019-04-19 20:13:41 +03:00
Peter Dimov
026e0aa732 Add libs/throw_exception to .yml files 2019-04-19 20:05:34 +03:00
Peter Dimov
0600b49827 Add no_exceptions_support_test 2019-04-19 17:32:05 +03:00
Andrey Semashev
d9b524d2e5 Envelop URL in quotes to avoid Boost.Build warning about unescaped special char. 2019-04-19 13:24:36 +03:00
Peter Dimov
8702664188 Switch Appveyor to 2015 image 2019-04-14 18:04:46 +03:00
Andrey Semashev
0c5cff67b6 Corrected a typo in the comment. 2019-04-13 19:19:40 +03:00
Nikita Kniazev
8ac5b5b00e no_exceptions_support: Suppress conditional expression is constant warning 2019-03-26 17:01:41 +03:00
Glen Fernandes
4ea704e80a Add use_default to Core 2019-02-22 16:51:33 -05:00
Glen Fernandes
266076f83b Update empty_value test cases 2019-02-19 02:09:54 -05:00
Peter Dimov
8ea2ac50fe Document BOOST_TEST_TRAIT_SAME 2019-02-06 18:12:25 +02:00
Peter Dimov
7f96d56eff Simplify implementation of BOOST_TEST_TRAIT_SAME 2019-02-06 04:38:27 +02:00
Peter Dimov
dcbe62c6bf Add BOOST_TEST_TRAIT_SAME 2019-02-06 02:02:40 +02:00
Peter Dimov
a8ef600c30 Remove duplicate Travis job 2019-01-28 23:16:52 +02:00
Peter Dimov
d8895bab46 Mark checked_delete as noexcept 2019-01-28 19:15:24 +02:00
Andrey Semashev
a8c870e2e7 Merge branch 'develop' 2019-01-15 13:34:33 +03:00
Peter Dimov
9db11ce554 Add more xcode configurations to Travis 2019-01-13 04:26:10 +02:00
Peter Dimov
3f3bba7869 Add test/cmake_subdir_test 2019-01-12 21:25:10 +02:00
Andrey Semashev
61b4e1a45d Use multiple jobs to checkout submodules in CI. 2019-01-12 21:24:45 +02:00
Andrey Semashev
b1949c0509 Added tools/boost_install and libs/headers manual init to CI jobs. 2019-01-12 21:24:28 +02:00
Andrey Semashev
7d70451b49 Updated the comment about __cxa_uncaught_exceptions. 2019-01-08 04:47:51 +03:00
Andrey Semashev
bf932b4908 Removed the use of __cxa_uncaught_exceptions.
Travis CI shows linking errors on Linux and OS X when __cxa_uncaught_exceptions
is used to implement uncaught_exceptions. There's probably some library missing,
which should be linked in implicitly by the compiler, or the library indeed
does not export the symbol. In any case, __cxa_get_globals-based implementation
should provide the same effect.
2019-01-08 04:17:24 +03:00
Andrey Semashev
e3629dd1c1 Added libc++abi-dev package installation, changed OS X image to xcode10.1.
This is in attempt to debug/work around strange issues in CI with cxxabi.h
provided by libc++abi-dev. The header declares __cxa_uncaught_exceptions
function, but on linking stage the function is missing. The current theory
is that the header and the libc++abi library do not match on CI machines for
some reason, and this commit tries to mitigate or verify that.
2019-01-08 00:29:53 +03:00
Andrey Semashev
dea6b04157 Added workarounds for gcc < 4.7 on Linux and OpenBSD.
Apparently, gcc < 4.7 on Linux also don't have __cxa_get_globals
declaration in cxxabi.h. Declare the function ourselves.

Also, on OpenBSD it seems there is no declaration either, and
on that platform the function implementation has no exception
specification, like on FreeBSD. Add a declaration of that platform.

Lastly, changed __cxa_get_globals and _getptd-based implementations
to avoid violating strict aliasing rules. This is still formally UB
to access structure fields like we do, but this is one less reason to
cause miscompilation or compiler warnings.
2019-01-08 00:23:09 +03:00
Andrey Semashev
9f9da9dc9b Limit __cxa_uncaught_exceptions to only since libc++abi 1002 and later. 2019-01-07 13:34:52 +03:00
Andrey Semashev
cdcc50a455 Added an implementation for uncaught_exceptions for libc++abi.
This should fix compilation errors due to missing declaration of
__cxa_get_globals when compiled against libc++ on Linux.
2019-01-07 02:14:31 +03:00
Andrey Semashev
6f3e6254e7 Only declare __cxa_get_globals on MinGW gcc < 4.7, where it's needed.
This should work around differences between the function signatures on other
platforms, like FreeBSD, for example.
2019-01-06 21:29:15 +03:00
Peter Dimov
245297ab85 Add test/cmake_subdir_test 2019-01-06 04:43:47 +02:00
Andrey Semashev
2574ae8a0c Made git branch selection less obscure and more POSIX shell conforming. 2019-01-03 23:47:43 +03:00
Andrey Semashev
bbcd5b8f5c Use the actual number of logical CPUs for the number of CI build/test jobs. 2019-01-03 23:05:17 +03:00
Andrey Semashev
83ea633d09 Use multiple jobs to checkout submodules in CI. 2018-12-18 22:19:50 +03:00
Andrey Semashev
2b60d044ac Added tools/boost_install and libs/headers manual init to CI jobs. 2018-12-18 21:53:49 +03:00
Andrey Semashev
3cd1885209 Reorganized code and made __cxa_get_globals signature closer to the original.
This should resolve gcc errors caused by mismatch of the return types of
aur declaration of __cxa_get_globals and the original in cxxabi.h.

Fixes https://github.com/boostorg/core/issues/45.
2018-12-18 20:49:24 +03:00
Andrey Semashev
9d123dc9a3 Added missing include guards. 2018-11-11 13:43:04 +03:00
Andrey Semashev
82957de970 Extracted uncaught_exceptions function from Boost.Log.
The uncaught_exceptions function is functionally equivalent to
unhandled_exceptions_count in Boost.Log and implements functionality
similar to the same named C++17 standard function. Tests and docs are
also included.

One notable difference from std::uncaught_exceptions is that the return
type is unsigned rather than signed. This is deliberate as uncaught_exceptions
must never return a negative value and unsigned int better documents that.
Theoretically, as a counter, it may also overflow.
2018-11-10 17:44:13 +03:00
Andrey Semashev
d60775659b Changed http to https in URLs in readme. 2018-11-01 20:40:42 +03:00
Andrey Semashev
bade4d23e8 Added clang 7 CI job. 2018-11-01 20:30:07 +03:00
Peter Dimov
a5c891441c Disable boost::swap for const objects. Fixes #43. 2018-10-24 12:23:56 +03:00
Peter Dimov
e9f986d11e Add compile-fail test for const boost::Wrapper 2018-10-24 12:06:45 +03:00
Peter Dimov
5a55d9572f Add -fsanitize=undefined to Travis 2018-10-21 21:37:14 +03:00
Peter Dimov
e98a546e89 Use string comparison on MinGW/Cygwin when comparing typeinfo across DLLs 2018-10-21 20:29:10 +03:00
Peter Dimov
4dc12c59bd Fix test to compare typeinfo rather than its address 2018-10-21 18:44:34 +03:00
Peter Dimov
3c9c9603ad Add BOOST_SYMBOL_VISIBLE to core_typeid_ 2018-10-21 18:09:31 +03:00
Peter Dimov
026be7659c Add test for BOOST_CORE_TYPEID in a library 2018-10-21 17:47:33 +03:00
Andrey Semashev
ada6b9e447 Merge pull request #42 from igaztanaga/patch-1
_set_abort_behavior not supported in old MSVC
2018-10-12 14:12:33 +03:00
Ion Gaztañaga
79e3bf7175 _set_abort_behavior not supported in old MSVC
Last patch before deprecating old MSVC compilers
2018-10-12 12:17:45 +02:00
Glen Fernandes
1d9d6f579e Qualify empty_init_t and use_empty_value_base 2018-10-01 00:46:43 -04:00
Glen Fernandes
5ed58ee20f Add ADL guard for empty_value and new member typedef 2018-10-01 00:26:08 -04:00
Peter Dimov
9dfa265b49 Add 'unsupported' comment to CMakeLists.txt 2018-09-30 04:24:11 +03:00
Peter Dimov
3aa817e8d0 Reformat copyright banner 2018-09-20 02:58:06 +03:00
Peter Dimov
4ae42efdae Add minimal CMakeLists.txt 2018-09-20 00:04:10 +03:00
Peter Dimov
32ac6c5b36 Add documentation for quick_exit 2018-09-06 22:52:52 +03:00
Peter Dimov
13c09e805b Add .gitignore 2018-09-06 22:39:26 +03:00
Peter Dimov
81df44e80b MinGW-w64 has no quick_exit either 2018-09-06 05:44:56 +03:00
Peter Dimov
944f27853b Declare _exit as extern 'C' 2018-09-06 05:28:23 +03:00
Peter Dimov
0bc795de4a Merge branch 'develop' into feature/quick_exit 2018-09-06 00:30:15 +03:00
Glen Fernandes
d2b20486a0 Call test_results() in BOOST_TEST_THROWS() 2018-09-05 16:40:10 -04:00
Peter Dimov
88acbce1e9 Declare and use _exit under MinGW32 2018-09-05 20:56:03 +03:00
Peter Dimov
0c605bf32f MacOS doesn't have quick_exit; Cygwin doesn't declare it in C++03 mode 2018-09-05 20:45:51 +03:00
Peter Dimov
53772c8c73 Merge branch 'develop' into feature/quick_exit 2018-09-05 20:28:40 +03:00
Peter Dimov
6dd97ee415 Add more Appveyor configurations 2018-09-05 20:25:05 +03:00
Peter Dimov
8d4f1bb4af Revert to always using std::abort instead of the platform-specific _exit/_Exit 2018-09-05 20:23:13 +03:00
Peter Dimov
d56c31d688 Add noreturn/noexcept; use _exit on msvc-12.0 and earlier (and compatible); use ::quick_exit instead of std::quick_exit 2018-09-05 18:16:15 +03:00
Peter Dimov
5e08874182 Add initial implementation of quick_exit 2018-09-05 17:06:42 +03:00
Glen Fernandes
56bd3784bf Update e-mail address in comments and libraries.json 2018-09-05 08:21:35 -04:00
Peter Dimov
cf66842419 MinGW doesn't have _exit either 2018-09-05 08:39:35 +03:00
Peter Dimov
861eb5cf4c Merge branch 'develop' into feature/Exit 2018-09-05 07:24:23 +03:00
Peter Dimov
205b319b57 Use _exit instead of _Exit on MinGW 2018-09-05 07:17:58 +03:00
Glen Fernandes
6f1d88d153 Provide detail::test_errors() as others are using it 2018-09-05 00:16:17 -04:00
Peter Dimov
7f7c4c5b83 Call _set_abort_behavior on all compilers impersonating MSVC 2018-09-05 07:01:29 +03:00
Peter Dimov
dfd5a0b8db Remove dead #else branch 2018-09-05 06:56:59 +03:00
Peter Dimov
d8c0768788 Use _Exit(3) instead of abort() to avoid core dump 2018-09-05 06:26:40 +03:00
Peter Dimov
d0a9206d6a Call _set_abort_behavior on clang-win too 2018-09-05 06:04:53 +03:00
Glen Fernandes
76c3538315 Suppress MSVC error dialogs and add test for report_errors() 2018-09-04 21:16:36 -04:00
Glen Fernandes
f2638b6d64 Merge pull request #40 from glenfe/develop
Abort instead of assert if report_errors() not called
2018-09-04 20:25:11 -04:00
Glen Fernandes
30c006ac82 Call test_results() in BOOST_TEST() 2018-09-04 20:22:56 -04:00
Glen Fernandes
c71eb0e479 Abort instead of assert if report_errors() not called 2018-09-04 17:00:50 -04:00
Glen Fernandes
3f7d36445d Reduce statics in Lightweight_test 2018-09-04 16:53:25 -04:00
Peter Dimov
a08dda22b2 Remove clang-3.7 from Travis, as it's not in trusty-updates and the -precise sources no longer work 2018-08-31 01:52:04 +03:00
Glen Fernandes
2d99acd7ec Name the empty_value template parameters 2018-08-27 22:48:06 -04:00
Glen Fernandes
65b98db868 Update formatting in documentation 2018-08-27 00:57:45 -04:00
Glen Fernandes
edcd9e2cf5 Add documentation for empty_value 2018-08-26 20:16:26 -04:00
Glen Fernandes
2eaba7d6d1 Make empty_value<T> trivial if T is trivial 2018-08-26 02:10:02 -04:00
Peter Dimov
a05906fd44 Add comment describing noncopyable_::base_token 2018-08-25 15:15:53 +03:00
Peter Dimov
f3782a946f Derive noncopyable from a base_token class to allow it to be detected by Type Traits without an #include 2018-08-25 01:47:47 +03:00
Glen Fernandes
f504872d89 Implement empty_value 2018-08-24 16:24:34 -04:00
Glen Fernandes
e1f070b7b4 Remove anti_op and change the error output
The new output is no less useful, and not potentially misleading (for example in the case of BOOST_TEST_LT(1, nan) failing, it was not right to say that 1 >= nan).
2018-08-09 08:04:09 -04:00
Hans Dembinski
740f2142c5 new test backend based on predicates (#39)
* Work in progress, some tests fail

* adding tests

* missing header

* moved close_to to detail, added constness, replaced predicates from <functional> with custom ones, new code does not rely on partial template specialization

* renamed predicates and removed close_to predicate

* removing now superfluous headers

* unpatching the fix to put in a separate PR

* move predicate to first argument

* call op and anti_op as normal methods
2018-08-08 15:37:51 +03:00
Peter Dimov
5c10ee4517 explicit_operator_bool: fix g++ 4.6 workaround 2018-08-08 00:27:59 +03:00
Peter Dimov
b7ad896707 explicit_operator_bool: under g++ 4.6 the operator can't be constexpr 2018-08-07 22:59:25 +03:00
Peter Dimov
70413b0568 Add more Travis configurations 2018-08-07 18:50:14 +03:00
Peter Dimov
b8a9b2c234 Add lightweight_test_test3 2018-08-07 17:58:23 +03:00
Peter Dimov
e11fa9ac03 In lightweight_test_eq_nullptr, test with nullptr as first argument as well 2018-08-07 17:43:38 +03:00
Peter Dimov
e1d50a1de2 Fix typo in lightweight_test.hpp 2018-08-07 17:40:47 +03:00
Glen Fernandes
e128f4e1b8 Add documentation for exchange 2018-07-20 08:25:48 -04:00
Glen Fernandes
cc119253b4 Simplify test case; type does not need to be noncopyable 2018-07-12 21:48:05 -04:00
Glen Fernandes
19ec659a91 Simplify exchange implementation for pre-C++11 2018-07-09 08:48:50 -04:00
Glen Fernandes
75ae238d0c Use #else instead of #elif BOOST_WORKAROUND 2018-07-08 12:04:09 -04:00
Glen Fernandes
630ab2aae4 Workaround MSVC10 and MSVC11 for exchange 2018-07-08 11:18:17 -04:00
Glen Fernandes
2cd4753a02 Implement boost::exchange 2018-07-08 09:25:07 -04:00
Glen Fernandes
9445d08ea7 Rename detail identifiers in addressof 2018-01-27 12:44:50 -05:00
Glen Fernandes
dbb3305050 Only checking BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION is sufficient 2018-01-27 09:42:02 -05:00
Glen Fernandes
23f10ab4bf Update pointer_traits and to_address to reflect the design adopted for C++20 2018-01-27 05:15:05 -05:00
Glen Fernandes
e5281335e0 Simplify pointer_traits detail traits 2018-01-27 01:37:42 -05:00
jzmaddock
b5dcd204e5 address_of.hpp: VC12 namespace ambiguity
I'm seeing compiler errors with vc12, when testing serialization of Boost.Multiprecision types - there is ambiguity between boost::detail and boost::multiprecision::detail.  I assume the error occurs for serialization of any type that has it's own detail namespace.  The fix is trivially to qualify the use of "detail::".
2017-12-25 20:34:11 -05:00
Peter Dimov
081ca76d6c Update Travis and Appveyor 2017-11-06 15:10:55 +02:00
Peter Dimov
2a3387451f Avoid 'unused variable v' warning on msvc-10.0, msvc-11.0 2017-11-01 15:38:54 +02:00
Peter Dimov
69bd3e73bf Fix .travis.yml to support branches 2017-10-27 15:33:19 +03:00
Peter Dimov
0296f44b2b Update .travis.yml 2017-10-25 17:34:21 +03:00
Andrey Semashev
2738af9b52 Removed the deprecated empty_deleter header. 2017-09-18 02:02:38 +03:00
Peter Dimov
6a1c3a82a1 Add quick test target 2017-09-04 15:32:13 +03:00
361 changed files with 28461 additions and 1694 deletions

431
.drone.jsonnet Normal file
View File

@@ -0,0 +1,431 @@
# Copyright 2022 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
local library = "core";
local triggers =
{
branch: [ "master", "develop", "feature/*" ]
};
local ubsan = { UBSAN: '1', UBSAN_OPTIONS: 'print_stacktrace=1' };
local asan = { ASAN: '1' };
local linux_pipeline(name, image, environment, packages = "", sources = [], arch = "amd64") =
{
name: name,
kind: "pipeline",
type: "docker",
trigger: triggers,
platform:
{
os: "linux",
arch: arch
},
steps:
[
{
name: "everything",
image: image,
environment: environment,
commands:
[
'set -e',
'uname -a',
'echo $DRONE_STAGE_MACHINE',
'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -',
] +
(if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) +
(if packages != "" then [ 'apt-get update', 'apt-get -y install ' + packages ] else []) +
[
'export LIBRARY=' + library,
'./.drone/drone.sh',
]
}
]
};
local macos_pipeline(name, environment, xcode_version = "12.2", osx_version = "catalina", arch = "amd64") =
{
name: name,
kind: "pipeline",
type: "exec",
trigger: triggers,
platform: {
"os": "darwin",
"arch": arch
},
node: {
"os": osx_version
},
steps: [
{
name: "everything",
environment: environment + { "DEVELOPER_DIR": "/Applications/Xcode-" + xcode_version + ".app/Contents/Developer" },
commands:
[
'export LIBRARY=' + library,
'./.drone/drone.sh',
]
}
]
};
local windows_pipeline(name, image, environment, arch = "amd64") =
{
name: name,
kind: "pipeline",
type: "docker",
trigger: triggers,
platform:
{
os: "windows",
arch: arch
},
"steps":
[
{
name: "everything",
image: image,
environment: environment,
commands:
[
'cmd /C .drone\\\\drone.bat ' + library,
]
}
]
};
[
linux_pipeline(
"Linux 16.04 GCC 4.4",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-4.4', CXXSTD: '98,0x' },
"g++-4.4",
[ "ppa:ubuntu-toolchain-r/test" ],
),
linux_pipeline(
"Linux 16.04 GCC 4.6 32/64",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-4.6', CXXSTD: '98,0x', ADDRMD: '32,64' },
"g++-4.6-multilib",
[ "ppa:ubuntu-toolchain-r/test" ],
),
linux_pipeline(
"Linux 16.04 GCC 4.7 32/64",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-4.7', CXXSTD: '98,0x', ADDRMD: '32,64' },
"g++-4.7-multilib",
),
linux_pipeline(
"Linux 16.04 GCC 4.8 32/64",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11', ADDRMD: '32,64' },
"g++-4.8-multilib",
),
linux_pipeline(
"Linux 16.04 GCC 4.9 32/64",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-4.9', CXXSTD: '03,11', ADDRMD: '32,64' },
"g++-4.9-multilib",
),
linux_pipeline(
"Linux 16.04 GCC 5* 32/64",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14', ADDRMD: '32,64' },
),
linux_pipeline(
"Linux 18.04 GCC 6 32/64",
"cppalliance/droneubuntu1804:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-6', CXXSTD: '03,11,14', ADDRMD: '32,64' },
"g++-6-multilib",
),
linux_pipeline(
"Linux 18.04 GCC 7* 32/64",
"cppalliance/droneubuntu1804:1",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17', ADDRMD: '32,64' },
),
linux_pipeline(
"Linux 18.04 GCC 8 32/64",
"cppalliance/droneubuntu1804:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-8', CXXSTD: '03,11,14,17', ADDRMD: '32,64' },
"g++-8-multilib",
),
linux_pipeline(
"Linux 20.04 GCC 9* 32/64",
"cppalliance/droneubuntu2004:1",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a', ADDRMD: '32,64' },
),
linux_pipeline(
"Linux 20.04 GCC 9* ARM64",
"cppalliance/droneubuntu2004:multiarch",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a' },
arch="arm64",
),
linux_pipeline(
"Linux 20.04 GCC 9* S390x",
"cppalliance/droneubuntu2004:multiarch",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a' },
arch="s390x",
),
linux_pipeline(
"Linux 20.04 GCC 10 32/64",
"cppalliance/droneubuntu2004:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-10', CXXSTD: '03,11,14,17,20', ADDRMD: '32,64' },
"g++-10-multilib",
),
linux_pipeline(
"Linux 22.04 GCC 11* 32/64",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a', ADDRMD: '32,64' },
),
linux_pipeline(
"Linux 22.04 GCC 12 32/64",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32,64' },
"g++-12-multilib",
),
linux_pipeline(
"Linux 23.04 GCC 13 32/64",
"cppalliance/droneubuntu2304:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32,64' },
"g++-13-multilib",
),
linux_pipeline(
"Linux 24.04 GCC 14 32 ASAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan,
"g++-14-multilib",
),
linux_pipeline(
"Linux 24.04 GCC 14 64 ASAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + asan,
"g++-14-multilib",
),
linux_pipeline(
"Linux 24.04 GCC 14 32 UBSAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + ubsan,
"g++-14-multilib",
),
linux_pipeline(
"Linux 24.04 GCC 14 64 UBSAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + ubsan,
"g++-14-multilib",
),
linux_pipeline(
"Linux 16.04 Clang 3.5",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-3.5', CXXSTD: '03,11' },
"clang-3.5",
),
linux_pipeline(
"Linux 16.04 Clang 3.6",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-3.6', CXXSTD: '03,11,14' },
"clang-3.6",
),
linux_pipeline(
"Linux 16.04 Clang 3.7",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-3.7', CXXSTD: '03,11,14' },
"clang-3.7",
),
linux_pipeline(
"Linux 16.04 Clang 3.8",
"cppalliance/droneubuntu1604:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-3.8', CXXSTD: '03,11,14' },
"clang-3.8",
),
linux_pipeline(
"Linux 18.04 Clang 3.9",
"cppalliance/droneubuntu1804:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-3.9', CXXSTD: '03,11,14' },
"clang-3.9",
),
linux_pipeline(
"Linux 18.04 Clang 4.0",
"cppalliance/droneubuntu1804:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-4.0', CXXSTD: '03,11,14' },
"clang-4.0",
),
linux_pipeline(
"Linux 18.04 Clang 5.0",
"cppalliance/droneubuntu1804:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-5.0', CXXSTD: '03,11,14,1z' },
"clang-5.0",
),
linux_pipeline(
"Linux 18.04 Clang 6.0",
"cppalliance/droneubuntu1804:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-6.0', CXXSTD: '03,11,14,17' },
"clang-6.0",
),
linux_pipeline(
"Linux 20.04 Clang 7",
"cppalliance/droneubuntu2004:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-7', CXXSTD: '03,11,14,17' },
"clang-7",
),
linux_pipeline(
"Linux 20.04 Clang 8",
"cppalliance/droneubuntu2004:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-8', CXXSTD: '03,11,14,17' },
"clang-8",
),
linux_pipeline(
"Linux 20.04 Clang 9",
"cppalliance/droneubuntu2004:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-9', CXXSTD: '03,11,14,17,2a' },
"clang-9",
),
linux_pipeline(
"Linux 20.04 Clang 10",
"cppalliance/droneubuntu2004:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-10', CXXSTD: '03,11,14,17,2a' },
"clang-10",
),
linux_pipeline(
"Linux 20.04 Clang 11",
"cppalliance/droneubuntu2004:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-11', CXXSTD: '03,11,14,17,2a' },
"clang-11",
),
linux_pipeline(
"Linux 20.04 Clang 12",
"cppalliance/droneubuntu2004:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-12', CXXSTD: '03,11,14,17,2a' },
"clang-12",
),
linux_pipeline(
"Linux 22.04 Clang 13",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-13', CXXSTD: '03,11,14,17,20' },
"clang-13",
),
linux_pipeline(
"Linux 22.04 Clang 14",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-14', CXXSTD: '03,11,14,17,20,2b' },
"clang-14",
),
linux_pipeline(
"Linux 22.04 Clang 15",
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-15', CXXSTD: '03,11,14,17,20,2b' },
"clang-15",
),
linux_pipeline(
"Linux 23.04 Clang 16",
"cppalliance/droneubuntu2304:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-16', CXXSTD: '03,11,14,17,20,2b' },
"clang-16",
),
linux_pipeline(
"Linux 23.10 Clang 17",
"cppalliance/droneubuntu2310:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '03,11,14,17,20,2b' },
"clang-17",
),
linux_pipeline(
"Linux 24.04 Clang 18 UBSAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
"clang-18",
),
linux_pipeline(
"Linux 24.04 Clang 18 ASAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + asan,
"clang-18",
),
macos_pipeline(
"MacOS 10.15 Xcode 12.2 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,1z' } + ubsan,
),
macos_pipeline(
"MacOS 10.15 Xcode 12.2 ASAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,1z' } + asan,
),
macos_pipeline(
"MacOS 12.4 Xcode 13.4.1 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
xcode_version = "13.4.1", osx_version = "monterey", arch = "arm64",
),
macos_pipeline(
"MacOS 12.4 Xcode 13.4.1 ASAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + asan,
xcode_version = "13.4.1", osx_version = "monterey", arch = "arm64",
),
windows_pipeline(
"Windows VS2015 msvc-14.0",
"cppalliance/dronevs2015",
{ TOOLSET: 'msvc-14.0', CXXSTD: '14,latest', B2_DONT_EMBED_MANIFEST: '1' },
),
windows_pipeline(
"Windows VS2017 msvc-14.1",
"cppalliance/dronevs2017",
{ TOOLSET: 'msvc-14.1', CXXSTD: '14,17,latest', ADDRMD: '32,64' },
),
windows_pipeline(
"Windows VS2019 msvc-14.2",
"cppalliance/dronevs2019",
{ TOOLSET: 'msvc-14.2', CXXSTD: '14,17,20,latest', ADDRMD: '32,64' },
),
windows_pipeline(
"Windows VS2022 msvc-14.3",
"cppalliance/dronevs2022:1",
{ TOOLSET: 'msvc-14.3', CXXSTD: '14,17,20,latest', ADDRMD: '32,64' },
),
]

23
.drone/drone.bat Normal file
View File

@@ -0,0 +1,23 @@
@REM Copyright 2022 Peter Dimov
@REM Distributed under the Boost Software License, Version 1.0.
@REM https://www.boost.org/LICENSE_1_0.txt
@ECHO ON
set LIBRARY=%1
set DRONE_BUILD_DIR=%CD%
set BOOST_BRANCH=develop
if "%DRONE_BRANCH%" == "master" set BOOST_BRANCH=master
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init tools/boostdep
xcopy /s /e /q %DRONE_BUILD_DIR% libs\%LIBRARY%\
python tools/boostdep/depinst/depinst.py -I examples %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
b2 -j3 libs/%LIBRARY%/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release embed-manifest-via=linker

25
.drone/drone.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Copyright 2022 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
set -ex
export PATH=~/.local/bin:/usr/local/bin:$PATH
DRONE_BUILD_DIR=$(pwd)
BOOST_BRANCH=develop
if [ "$DRONE_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init tools/boostdep
cp -r $DRONE_BUILD_DIR/* libs/$LIBRARY
python tools/boostdep/depinst/depinst.py -I examples $LIBRARY
./bootstrap.sh
./b2 -d0 headers
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
./b2 -j3 libs/$LIBRARY/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${ADDRMD:+address-model=$ADDRMD} ${UBSAN:+undefined-sanitizer=norecover debug-symbols=on} ${ASAN:+address-sanitizer=norecover debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}

1064
.github/workflows/ci.yml vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,413 +0,0 @@
# Copyright 2016, 2017 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
language: cpp
sudo: false
os:
- linux
- osx
branches:
only:
- master
- develop
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
- os: linux
env: TOOLSET=gcc COMPILER=g++ CXXSTD=c++03
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++03
addons:
apt:
packages:
- g++-4.7
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++11
addons:
apt:
packages:
- g++-4.7
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++03
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++11
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++03
addons:
apt:
packages:
- g++-4.9
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++11
addons:
apt:
packages:
- g++-4.9
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++03
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++11
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++1z
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++03
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++11
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++14
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++17
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
- os: linux
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.6
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.6
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++14
addons:
apt:
packages:
- clang-3.8
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++1z
addons:
apt:
packages:
- clang-3.8
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.9
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.9
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++14
addons:
apt:
packages:
- clang-3.9
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++1z
addons:
apt:
packages:
- clang-3.9
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++03
addons:
apt:
packages:
- clang-4.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++11
addons:
apt:
packages:
- clang-4.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++14
addons:
apt:
packages:
- clang-4.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++1z
addons:
apt:
packages:
- clang-4.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++1z
install:
- cd ..
- git clone -b $TRAVIS_BRANCH https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule init libs/assert
- git submodule init libs/config
- git submodule init libs/predef
- git submodule init libs/static_assert
- git submodule init libs/type_traits
- git submodule init tools/build
- git submodule update
- cp -r $TRAVIS_BUILD_DIR/* libs/core
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD ;" > ~/user-config.jam
- ./b2 libs/core/test toolset=$TOOLSET
notifications:
email:
on_success: always

36
CMakeLists.txt Normal file
View File

@@ -0,0 +1,36 @@
# Generated by `boostdep --cmake core`
# Copyright 2020, 2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.20)
project(boost_core VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_core INTERFACE)
add_library(Boost::core ALIAS boost_core)
target_include_directories(boost_core INTERFACE include)
target_link_libraries(boost_core
INTERFACE
Boost::assert
Boost::config
Boost::static_assert
Boost::throw_exception
)
if(CMAKE_VERSION VERSION_GREATER 3.18 AND CMAKE_GENERATOR MATCHES "Visual Studio")
file(GLOB_RECURSE boost_core_IDEFILES CONFIGURE_DEPENDS include/*.hpp)
source_group(TREE ${PROJECT_SOURCE_DIR}/include FILES ${boost_core_IDEFILES} PREFIX "Header Files")
list(APPEND boost_core_IDEFILES extra/boost_core.natvis)
target_sources(boost_core PRIVATE ${boost_core_IDEFILES})
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()

View File

@@ -1,19 +1,19 @@
Boost.Core
==========
Boost.Core, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), is a collection of core utilities used by other Boost libraries.
Boost.Core, part of collection of the [Boost C++ Libraries](https://github.com/boostorg), is a collection of core utilities used by other Boost libraries.
The criteria for inclusion is that the utility component be:
* simple,
* used by other Boost libraries, and
* not dependent on any other Boost modules except Core itself, Config, Assert, Static Assert, or Predef.
### CI Status
### Build Status
Branch | Travis | Appveyor
---------|--------|---------
Develop | [![Build Status](https://travis-ci.org/boostorg/core.svg?branch=develop)](https://travis-ci.org/boostorg/core) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/core?branch=develop&svg=true)](https://ci.appveyor.com/project/pdimov/core)
Master | [![Build Status](https://travis-ci.org/boostorg/core.svg?branch=master)](https://travis-ci.org/boostorg/core) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/core?branch=master&svg=true)](https://ci.appveyor.com/project/pdimov/core)
Branch | GitHub Actions | AppVeyor | Test Matrix | Dependencies |
---------|----------------|--------- | ----------- | ------------ |
Develop | [![GitHub Actions](https://github.com/boostorg/core/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/filesystem/actions?query=branch%3Adevelop) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/boostorg/core?branch=develop&svg=true)](https://ci.appveyor.com/project/pdimov/core) | [![Tests](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/core.html) | [![Dependencies](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/core.html)
Master | [![GitHub Actions](https://github.com/boostorg/core/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/filesystem/actions?query=branch%3Amaster) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/boostorg/core?branch=master&svg=true)](https://ci.appveyor.com/project/pdimov/core) | [![Tests](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/core.html) | [![Dependencies](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/core.html)
### Directories
@@ -23,10 +23,10 @@ Master | [![Build Status](https://travis-ci.org/boostorg/core.svg?branch=maste
### More information
* [Documentation](http://boost.org/libs/core)
* [Documentation](https://boost.org/libs/core)
* [Report bugs](https://svn.boost.org/trac/boost/newticket?component=core;version=Boost%20Release%20Branch). Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt).
### License
Distributed under the [Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt).
Distributed under the [Boost Software License, Version 1.0](https://boost.org/LICENSE_1_0.txt).

View File

@@ -1,4 +1,4 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2016-2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
@@ -10,63 +10,107 @@ branches:
only:
- master
- develop
- /feature\/.*/
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-9.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-10.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-11.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-12.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\cygwin\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++03
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\cygwin\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++11
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++03
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++11
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++03
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++11
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-14.0
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
ADDRMD: 32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-12.0,msvc-14.0
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
ADDRMD: 32,64
CXXSTD: 14,17
# clang-win 32 bit fails to link with "unable to load mspdbcore.dll (error code: 126)"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: clang-win
ADDRMD: 64
CXXSTD: 14,17,latest
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
TOOLSET: clang-win
ADDRMD: 64
CXXSTD: 14,17,latest
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ADDPATH: C:\cygwin\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ADDPATH: C:\cygwin64\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ADDPATH: C:\mingw\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ADDPATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_SUBDIR: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
CMAKE_INSTALL: 1
install:
- set GIT_FETCH_JOBS=8
- set BOOST_BRANCH=develop
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
- cd ..
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
- git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule init libs/assert
- git submodule init libs/config
- git submodule init libs/predef
- git submodule init libs/static_assert
- git submodule init libs/type_traits
- git submodule init tools/build
- git submodule update
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\core
- git submodule update --init tools/boostdep
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\core\
- python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" core
- cmd /c bootstrap
- b2 headers
- b2 -d0 headers
build: off
test_script:
- PATH=%ADDPATH%%PATH%
- b2 libs/core/test toolset=%TOOLSET% %CXXFLAGS%
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
- if "%CMAKE%%CMAKE_SUBDIR%%CMAKE_INSTALL%" == "" b2 -j %NUMBER_OF_PROCESSORS% libs/core/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release embed-manifest-via=linker
- if not "%CMAKE%" == "" mkdir __build__ && cd __build__
- if not "%CMAKE%" == "" cmake -DBUILD_TESTING=ON -DBOOST_INCLUDE_LIBRARIES=core ..
- if not "%CMAKE%" == "" cmake --build . --target tests -j 3 --config Debug & ctest --output-on-failure --no-tests=error -j 3 -C Debug
- if not "%CMAKE%" == "" cmake --build . --target tests -j 3 --config Release & ctest --output-on-failure --no-tests=error -j 3 -C Release
- if not "%CMAKE%" == "" cmake --build . --target tests -j 3 --config MinSizeRel & ctest --output-on-failure --no-tests=error -j 3 -C MinSizeRel
- if not "%CMAKE%" == "" cmake --build . --target tests -j 3 --config RelWithDebInfo & ctest --output-on-failure --no-tests=error -j 3 -C RelWithDebInfo
- if not "%CMAKE_SUBDIR%" == "" cd libs/core/test/cmake_subdir_test && mkdir __build__ && cd __build__
- if not "%CMAKE_SUBDIR%" == "" cmake ..
- if not "%CMAKE_SUBDIR%" == "" cmake --build . --config Debug && cmake --build . --target check --config Debug
- if not "%CMAKE_SUBDIR%" == "" cmake --build . --config Release && cmake --build . --target check --config Release
- if not "%CMAKE_SUBDIR%" == "" cmake --build . --config MinSizeRel && cmake --build . --target check --config MinSizeRel
- if not "%CMAKE_SUBDIR%" == "" cmake --build . --config RelWithDebInfo && cmake --build . --target check --config RelWithDebInfo
- if not "%CMAKE_INSTALL%" == "" mkdir __build__ && cd __build__
- if not "%CMAKE_INSTALL%" == "" cmake -DBOOST_INCLUDE_LIBRARIES=core -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
- if not "%CMAKE_INSTALL%" == "" cmake --build . --target install --config Debug
- if not "%CMAKE_INSTALL%" == "" cmake --build . --target install --config Release
- if not "%CMAKE_INSTALL%" == "" cd ../libs/core/test/cmake_install_test && mkdir __build__ && cd __build__
- if not "%CMAKE_INSTALL%" == "" cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
- if not "%CMAKE_INSTALL%" == "" cmake --build . --config Debug && cmake --build . --target check --config Debug
- if not "%CMAKE_INSTALL%" == "" cmake --build . --config Release && cmake --build . --target check --config Release

23
build.jam Normal file
View File

@@ -0,0 +1,23 @@
# Copyright 2023-2024 René Ferdinand Rivera Morell
# Copyright 2024 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
require-b2 5.2 ;
constant boost_dependencies :
/boost/assert//boost_assert
/boost/config//boost_config
/boost/static_assert//boost_static_assert
/boost/throw_exception//boost_throw_exception
;
project /boost/core ;
explicit
[ alias boost_core : : : : <include>include <library>$(boost_dependencies) ]
[ alias all : boost_core test ]
;
call-if : boost-library core
;

3
doc/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
/html/
/pdf/
ref_reference.xml

View File

@@ -1,16 +1,19 @@
# Copyright (c) 2014 Glen Joseph Fernandes
# glenfe at live dot com
# Copyright 2014 Glen Joseph Fernandes
# (glenjofe@gmail.com)
#
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://boost.org/LICENSE_1_0.txt)
import project ;
import doxygen ;
import quickbook ;
path-constant INCLUDES : ../include ;
doxygen ref_reference
:
[ glob ../../../boost/core/ref.hpp ]
$(INCLUDES)/boost/core/ref.hpp
:
<doxygen:param>ENABLE_PREPROCESSING=YES
<doxygen:param>EXPAND_ONLY_PREDEF=YES
@@ -49,7 +52,7 @@ boostbook standalone
<xsl:param>boost.root=../../../..
<xsl:param>generate.section.toc.level=1
<xsl:param>toc.max.depth=1
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/core/doc/html
<format>pdf:<xsl:param>boost.url.prefix="http://www.boost.org/doc/libs/release/libs/core/doc/html"
;
###############################################################################

33
doc/alignof.qbk Normal file
View File

@@ -0,0 +1,33 @@
[/
Copyright 2023 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt
]
[section:alignof alignof]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/alignof.hpp>]
The header `<boost/core/alignof.hpp>` defines the macro `BOOST_CORE_ALIGNOF`,
a portable equivalent of the `alignof` operator from C++11.
[section Example]
``
#include <boost/core/alignof.hpp>
#include <cstddef>
constexpr std::size_t alignment_of_double = BOOST_CORE_ALIGNOF(double);
``
[endsect]
[endsect]
[endsect]

302
doc/allocator_access.qbk Normal file
View File

@@ -0,0 +1,302 @@
[/
Copyright 2020-2022 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section allocator_access]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header `<boost/core/allocator_access.hpp>` provides the class and function
templates to simplify allocator use. It provides the same functionality as the
C++ standard library `std::allocator_traits` but with individual templates for
each allocator feature.
It also adds additional functionality for allocator aware exception safe
construction and destruction of arrays.
These facilities also simplify existing libraries by avoiding having to check
for `BOOST_NO_CXX11_ALLOCATOR` and conditionally use `std::allocator_traits`.
[endsect]
[section Examples]
The following example shows these utilities used in the definition of
an allocator-aware container class:
```
template<class T, class A = boost::default_allocator<T> >
class container
: boost::empty_value<typename boost::allocator_rebind<A, T>::type> {
public:
typedef T value_type;
typedef A allocator_type;
typedef typename boost::allocator_size_type<A>::type size_type;
typedef typename boost::allocator_difference_type<A>::type difference_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename boost::allocator_pointer<A>::type pointer;
typedef typename boost::allocator_const_pointer<A>::type const_pointer;
// ...
};
```
In C++11 or above, aliases such as `boost::allocator_pointer_t<A>` can be used
instead of `typename boost::allocator_pointer<A>::type`.
The following example allocates storage for an array of `n` elements of `T`
using an allocator `a` and constructs `T` elements in that storage. If any
exception was thrown during construction of an element, the constructed
elements are destroyed in reverse order.
```
template<class A>
auto create(A& a, std::size_t n)
{
auto p = a.allocate(n);
try {
boost::allocator_construct_n(a, boost::to_address(p), n);
} catch (...) {
a.deallocate(p, n);
throw;
}
return p;
}
```
[endsect]
[section Reference]
```
namespace boost {
template<class A>
struct allocator_value_type;
template<class A>
using allocator_value_type_t = typename allocator_value_type<A>::type;
template<class A>
struct allocator_pointer;
template<class A>
using allocator_pointer_t = typename allocator_pointer<A>::type;
template<class A>
struct allocator_const_pointer;
template<class A>
using allocator_const_pointer_t = typename allocator_const_pointer<A>::type;
template<class A>
struct allocator_void_pointer;
template<class A>
using allocator_void_pointer_t = typename allocator_void_pointer<A>::type;
template<class A>
struct allocator_const_void_pointer;
template<class A>
using allocator_const_void_pointer_t =
typename allocator_const_void_pointer<A>::type;
template<class A>
struct allocator_difference_type;
template<class A>
using allocator_difference_type_t =
typename allocator_difference_type<A>::type;
template<class A>
struct allocator_size_type;
template<class A>
using allocator_size_type_t = typename allocator_size_type<A>::type;
template<class A>
struct allocator_propagate_on_container_copy_assignment;
template<class A>
using allocator_propagate_on_container_copy_assignment_t =
typename allocator_propagate_on_container_copy_assignment<A>::type;
template<class A>
struct allocator_propagate_on_container_move_assignment;
template<class A>
using allocator_propagate_on_container_move_assignment_t =
typename allocator_propagate_on_container_move_assignment<A>::type;
template<class A>
struct allocator_propagate_on_container_swap;
template<class A>
using allocator_propagate_on_container_swap_t =
typename allocator_propagate_on_container_swap<A>::type;
template<class A>
struct allocator_is_always_equal;
template<class A>
using allocator_is_always_equal_t =
typename allocator_is_always_equal<A>::type;
template<class A, class T>
struct allocator_rebind;
template<class A, class T>
using allocator_rebind_t = typename allocator_rebind<A, T>::type;
template<class A>
allocator_pointer_t<A> allocator_allocate(A& a, allocator_size_type_t<A> n);
template<class A>
allocator_pointer_t<A> allocator_allocate(A& a, allocator_size_type_t<A> n,
allocator_const_void_pointer_t<A> h);
template<class A>
void allocator_deallocate(A& a, allocator_pointer_t<A> p,
allocator_size_type_t<A> n);
template<class A, class T, class... Args>
void allocator_construct(A& a, T* p, Args&&... args);
template<class A, class T>
void allocator_construct_n(A& a, T* p, std::size_t n);
template<class A, class T>
void allocator_construct_n(A& a, T* p, std::size_t n, const T* l,
std::size_t m);
template<class A, class T, class I>
void allocator_construct_n(A& a, T* p, std::size_t n, I begin);
template<class A, class T>
void allocator_destroy(A& a, T* p);
template<class A, class T>
void allocator_destroy_n(A& a, T* p, std::size_t n);
template<class A>
allocator_size_type_t<A> allocator_max_size(const A& a);
template<class A>
A allocator_select_on_container_copy_construction(const A& a);
} // boost
```
[section Types]
[variablelist
[[`template<class A> struct allocator_value_type;`]
[The member `type` is `A::value_type`.]]
[[`template<class A> struct allocator_pointer;`]
[The member `type` is `A::pointer` if valid, otherwise
`allocator_value_type_t<A>*`.]]
[[`template<class A> struct allocator_const_pointer;`]
[The member `type` is `A::const_pointer` if valid, otherwise
`pointer_traits<allocator_pointer_t<A> >::rebind<const
allocator_value_type_t<A> >`.]]
[[`template<class A> struct allocator_void_pointer;`]
[The member `type` is `A::void_pointer` if valid, otherwise
`pointer_traits<allocator_pointer_t<A> >::rebind<void>`.]]
[[`template<class A> struct allocator_const_void_pointer;`]
[The member `type` is `A::const_void_pointer` if valid, otherwise
`pointer_traits<allocator_pointer_t<A> >::rebind<const void>`.]]
[[`template<class A> struct allocator_difference_type;`]
[The member `type` is `A::difference_type` if valid, otherwise
`pointer_traits<allocator_pointer_t<A> >::difference_type`.]]
[[`template<class A> struct allocator_size_type;`]
[The member `type` is `A::size_type` if valid, otherwise
`std::make_unsigned_t<allocator_difference_type_t<A> >`.]]
[[`template<class A> struct allocator_propagate_on_container_copy_assignment;`]
[The member `type` is `A::propagate_on_container_copy_assignment` if valid,
otherwise `std::false_type`.]]
[[`template<class A> struct allocator_propagate_on_container_move_assignment;`]
[The member `type` is `A::propagate_on_container_move_assignment` if valid,
otherwise `std::false_type`.]]
[[`template<class A> struct allocator_propagate_on_container_swap;`]
[The member `type` is `A::propagate_on_container_swap` if valid, otherwise
`std::false_type`.]]
[[`template<class A> struct allocator_is_always_equal;`]
[The member `type` is `A::is_always_equal` if valid, otherwise
`std::is_empty<A>::type`.]]
[[`template<class A, class T> struct allocator_rebind;`]
[The member `type` is `A::rebind<T>::other` if valid, otherwise `A<T, Args>`
if this `A` is `A<U, Args>`.]]]
[endsect]
[section Functions]
[variablelist
[[`template<class A>
allocator_pointer_t<A> allocator_allocate(A& a, allocator_size_type_t<A> n);`]
[Calls `a.allocate(n)`.]]
[[`template<class A> allocator_pointer_t<A> allocator_allocate(A& a,
allocator_size_type_t<A> n, allocator_const_void_pointer_t<A> hint);`]
[Calls `a.allocate(n, hint)` if valid, otherwise calls `a.allocate(n)`.]]
[[`template<class A> void allocator_deallocate(A& a, allocator_pointer_t<A> p,
allocator_size_type_t<A> n);`]
[Calls `a.deallocate(p, n)`.]]
[[`template<class A, class T, class... Args>
void allocator_construct(A& a, T*p, Args&&... args);`]
[Calls `a.construct(p, std::forward<Args>(args)...)` if valid, otherwise calls
`::new(static_cast<void*>(p)) T(std::forward<Args>(args)...)`.]]
[[`template<class A, class T>
void alloc_construct_n(A& a, T* p, std::size_t n);`]
[Constructs each `i`-th element in order by calling
`boost::allocator_construct(a, &p[i])`.
If an exception is thrown destroys each already constructed `j`-th element in
reverse order by calling `boost::allocator_destroy(a, &p[j])`.]]
[[`template<class A, class T>
void alloc_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m);`]
[Constructs each `i`-th element in order by calling
`boost::allocator_construct(a, &p[i], l[i % m])`.
If an exception is thrown destroys each already constructed `j`-th element in
reverse order by calling `boost::allocator_destroy(a, &p[j])`.]]
[[`template<class A, class T, class I>
void alloc_construct_n(A& a, T* p, std::size_t n, I begin);`]
[Constructs each `i`-th element in order by calling
`boost::allocator_construct(a, &p[i], *begin++)`.
If an exception is thrown destroys each already constructed `j`-th element in
reverse order by calling `boost::allocator_destroy(a, &p[j])`.]]
[[`template<class A, class T> void allocator_destroy(A& a, T* p);`]
[Calls `a.destroy(p)` if valid, otherwise calls `p->~T()`.]]
[[`template<class A, class T>
void allocator_destroy_n(A& a, T* p, std::size_t n);`]
[Destroys each `i`-th element in reverse order by calling
`boost::allocator_destroy(a, &p[i])`.]]
[[`template<class A> allocator_size_type_t<A> allocator_max_size(const A& a);`]
[Returns `a.max_size()` if valid, otherwise returns
`std::numeric_limits<allocator_size_type_t<A> >::max() /
sizeof(allocator_value_type_t<A>)`.]]
[[`template<class A> A allocator_select_on_container_copy_construction(const
A& a);`]
[Returns `a.select_on_container_copy_construction()` if valid, otherwise
returns `a`.]]]
[endsect]
[endsect]
[section Acknowledgements]
Glen Fernandes implemented the allocator access utilities.
[endsect]
[endsect]

116
doc/allocator_traits.qbk Normal file
View File

@@ -0,0 +1,116 @@
[/
Copyright 2021 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:allocator_traits allocator_traits]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
This header <boost/core/allocator_traits.hpp> provides an implementation of the
C++ standard library class template `allocator_traits` based on the facilities
in [link core.allocator_access Allocator Access]. Users should still prefer the
individual traits, but this utility exists to simplify migration.
[endsect]
[section Reference]
```
namespace boost {
template<class A>
struct allocator_traits {
using allocator_type = A;
using value_type = allocator_value_type_t<A>;
using pointer = allocator_pointer_t<A>;
using const_pointer = allocator_const_pointer_t<A>;
using void_pointer = allocator_void_pointer_t<A>;
using const_pointer = allocator_const_void_pointer_t<A>;
using difference_type = allocator_difference_type_t<A>;
using size_type = allocator_size_type_t<A>;
using propagate_on_container_copy_assignment =
allocator_propagate_on_container_copy_assignment_t<A>;
using propagate_on_container_move_assignment =
allocator_propagate_on_container_move_assignment_t<A>;
using propagate_on_container_swap =
allocator_propagate_on_container_swap_t<A>;
using is_always_equal = allocator_is_always_equal_t<A>;
template<class T>
using rebind_traits = allocator_traits<allocator_rebind_t<A, T> >;
static pointer allocate(A& a, size_type n);
static pointer allocate(A& a, size_type n, const_void_pointer h);
static void deallocate(A& a, pointer p, size_type n);
template<class T, class... Args>
static void construct(A& a, T* p, Args&&... args);
static void destroy(A& a, T* p);
static size_type max_size(const A& a) noexcept;
static A select_on_container_copy_construction(const A& a);
};
} /* boost */
```
[section Static member functions]
[variablelist
[[`static pointer allocate(A& a, size_type n);`]
[Equivalent to: `return boost::allocator_allocate(a, n);`]]
[[`static pointer allocate(A& a, size_type n, const_void_pointer h);`]
[Equivalent to: `return boost::allocator_allocate(a, n, h);`]]
[[`static void deallocate(A& a, pointer p, size_type n);`]
[Equivalent to: `boost::allocator_deallocate(a, n, h);`]]
[[`template<class T, class... Args>
static void construct(A& a, T* p, Args&&... args);`]
[Equivalent to:
`boost::allocator_construct(a, p, std::forward<Args>(args)...);`]]
[[`static void destroy(A& a, T* p);`]
[Equivalent to: `boost::allocator_destroy(a, p);`]]
[[`static size_type max_size(const A& a) noexcept;`]
[Equivalent to: `return boost::allocator_max_size(a);`]]
[[`static A select_on_container_copy_construction(const A& a);`]
[Equivalent to:
`return boost::allocator_select_on_container_copy_construction(a);`]]]
[endsect]
[endsect]
[section Notes]
# The member `rebind_alloc` is not provided for parity with C++03 where it is
unimplementable. Instead of `allocator_traits<A>::rebind_alloc<U>` you can
express the same with `allocator_traits<A>::rebind_traits<U>::allocator_type`
or more simply with `allocator_rebind_t<A, U>`.
[endsect]
[endsect]

219
doc/bit.qbk Normal file
View File

@@ -0,0 +1,219 @@
[/
Copyright 2020 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt
or copy at http://boost.org/LICENSE_1_0.txt
]
[section:bit bit]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/bit.hpp>]
The header `<boost/core/bit.hpp>` implements, in a portable way,
the C++20 `<bit>` header.
[section Synopsis]
``
namespace boost
{
namespace core
{
// bit_cast
template<class To, class From>
To bit_cast(From const& from) noexcept;
// byteswap
template<class T>
constexpr T byteswap(T x) noexcept;
// Integral powers of 2
template<class T>
constexpr bool has_single_bit(T x) noexcept;
template<class T>
constexpr T bit_ceil(T x) noexcept;
template<class T>
constexpr T bit_floor(T x) noexcept;
template<class T>
constexpr int bit_width(T x) noexcept;
// Rotating
template<class T>
constexpr T rotl(T x, int s) noexcept;
template<class T>
constexpr T rotr(T x, int s) noexcept;
// Counting
template<class T>
constexpr int countl_zero(T x) noexcept;
template<class T>
constexpr int countl_one(T x) noexcept;
template<class T>
constexpr int countr_zero(T x) noexcept;
template<class T>
constexpr int countr_one(T x) noexcept;
template<class T>
constexpr int popcount(T x) noexcept;
// Endian
enum class endian
{
little = see below,
big = see below,
native = see below
};
using endian_type = endian; // portable alias for C++03 code
} // namespace core
} // namespace boost
``
Note: even though the functions are shown as `constexpr` in the synopsis, since they are implemented
via compiler-specific intrinsics, portable code cannot generally rely on their being usable in a
constant expression context.
[endsect]
[section bit_cast]
`template<class To, class From> To bit_cast(From const& from) noexcept;`
* *Requires:* `To` and `From` must be trivially copyable and `sizeof(To)` must be the same as `sizeof(From)`.
* *Returns:* A value of type `To` with the storage bytes copied from `from`.
[endsect]
[section byteswap]
`template<class T> constexpr T byteswap(T x) noexcept;`
* *Requires:* `T` must be an integer type (i.e. one of `char`, `signed char`,
`unsigned char`, `short`, `unsigned short`, `int`, `unsigned int`, `long`,
`unsigned long`, `long long`, `unsigned long long`) without padding bits.
* *Returns:* `x` with the storage bytes reversed.
[endsect]
[section Integral powers of 2]
`template<class T> constexpr bool has_single_bit(T x) noexcept;`
* *Requires:* `T` must be an unsigned integer type (i.e. one of `unsigned char`, `unsigned short`, `unsigned int`, `unsigned long`, `unsigned long long`).
* *Returns:* `true` if `x` is an integral power of two, `false` otherwise. (`has_single_bit(0u)` is false.)
`template<class T> constexpr T bit_ceil(T x) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* The smallest integral power of 2 greater than or equal to `x`. If this value is not representable in `T`, behavior is undefined.
`template<class T> constexpr T bit_floor(T x) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* If `x == 0`, 0; otherwise the maximal value `y` such that `has_single_bit(y)` is `true` and `y <= x`.
`template<class T> constexpr int bit_width(T x) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* If `x == 0`, 0; otherwise one plus the base-2 logarithm of `x`, with any fractional part discarded.
[endsect]
[section Rotating]
In the following descriptions, `N` denotes `numeric_limits<T>::digits` and `r` denotes `s % N`.
`template<class T> constexpr T rotl(T x, int s) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* If `s` is negative, `rotr(x, -s)`; if `r` is 0, `x`; if `r` is positive, `(x << r) | (x >> (N - r))`.
`template<class T> constexpr T rotr(T x, int s) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* If `s` is negative, `rotl(x, -s)`; if `r` is 0, `x`; if `r` is positive, `(x >> r) | (x << (N - r))`.
[endsect]
[section Counting]
`template<class T> constexpr int countl_zero(T x) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* The number of consecutive 0 bits in the value of `x`, starting from the most significant ("left") bit.
`template<class T> constexpr int countl_one(T x) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* The number of consecutive 1 bits in the value of `x`, starting from the most significant bit.
`template<class T> constexpr int countr_zero(T x) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* The number of consecutive 0 bits in the value of `x`, starting from the least significant ("right") bit.
`template<class T> constexpr int countr_one(T x) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* The number of consecutive 1 bits in the value of `x`, starting from the least significant bit.
`template<class T> constexpr int popcount(T x) noexcept;`
* *Requires:* `T` must be an unsigned integer type.
* *Returns:* The number of 1 bits in the value of `x`.
[endsect]
[section Endian]
Under C++11, `endian` is defined as `enum class endian` as shown in the synopsis. Under C++03, its definition is
``
namespace endian
{
enum type
{
little = see below,
big = see below,
native = see below
};
}
typedef endian::type endian_type;
``
The values of `endian::big` and `endian::little` are distinct. `endian::native` is equal to `endian::big` on
big endian platforms, equal to `endian::little` on little endian platforms, and a distinct value on platforms
that are neither.
Note that you should not rely on `little` and `big` having any specific values, because the C++20 standard
leaves these unspecified.
[endsect]
[endsect]
[endsect]

214
doc/changes.qbk Normal file
View File

@@ -0,0 +1,214 @@
[/
Copyright 2021 Peter Dimov
Copyright 2022-2024 Andrey Semashev
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt)
]
[section Revision History]
[section Changes in 1.86.0]
* Added a [link core.pointer_in_range `boost/core/pointer_in_range.hpp`] header with a `pointer_in_range`
function template to check if a pointer is within a given range.
* Fixed `type_name` for abstract classes. ([github_issue 172])
* Fixed `boost/core/type_name.hpp` compilation error with MSVC with disabled native `wchar_t` type.
([github_issue 173])
* Added a workaround for an MSVC [@https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025 bug]
causing `empty_value` compilation errors when it is used with a nested class. ([github_pr 175])
[endsect]
[section Changes in 1.85.0]
* Added a new [link core.functor `boost/core/functor.hpp`] header with a `functor` class template
for wrapping a raw function into a function object class.
* Changed [link core.null_deleter `null_deleter`], [link core.fclose_deleter `fclose_deleter`]
and [link core.checked_delete checked deleter] definitions so that they don't bring namespace `boost`
into argument-dependent lookup in cases like this:
```
std::unique_ptr< std::FILE, boost::fclose_deleter > p1, p2;
swap(p1, p2); // no longer looks for boost::swap as part of ADL
```
Users may need to either explicitly qualify the namespace of the called function or add a
`using`-declaration.
[endsect]
[section Changes in 1.84.0]
* `boost::swap` utility function has been renamed to `boost::core::invoke_swap` to
avoid forming a potential infinite recursion when the arguments are not swappable.
The new function is defined in `boost/core/invoke_swap.hpp` and is functionally equivalent
to `boost::swap`. The old `boost::swap` name is preserved for backward compatibility
but deprecated and will be removed in a future release. Its `noexcept` specification
has been removed to avoid compile errors caused by compile-time recursion.
`BOOST_ALLOW_DEPRECATED_SYMBOLS` or `BOOST_ALLOW_DEPRECATED` can be defined to suppress
deprecation warnings for the transition period. ([@https://github.com/boostorg/core/issues/148 #148])
* Headers `boost/swap.hpp`, `boost/utility/swap.hpp` and `boost/core/swap.hpp` are
deprecated and will be removed. Please, switch to `boost/core/invoke_swap.hpp`.
`BOOST_ALLOW_DEPRECATED_HEADERS` or `BOOST_ALLOW_DEPRECATED` can be defined to suppress
deprecation warnings.
[endsect]
[section Changes in 1.83.0]
* Added support for incomplete types to [link core.type_name `boost::core::type_name`].
* Bit manipulation functions in [link core.bit `boost/core/bit.hpp`] are now
`constexpr` on recent MSVC versions (VS2019 update 5 and later.)
* Added `boost::core::byteswap` (an implementation of `std::byteswap` from
C++23) to [link core.bit `boost/core/bit.hpp`].
* Moved the yield primitives `sp_thread_pause`, `sp_thread_yield`, `sp_thread_sleep`
from SmartPtr implementation details to `boost/core/yield_primitives.hpp`.
[endsect]
[section Changes in 1.82.0]
* Added [link core.snprintf `boost/core/snprintf.hpp`] header with portable definitions of `snprintf`, `vsnprintf` and
their `wchar_t` counterparts.
* Deprecated `boost/core/is_same.hpp` and `boost::core::is_same`. The header will be removed in a future release.
Users are advised to use [@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/index.html Boost.TypeTraits]
or C++ standard library type traits instead.
* Marked `boost::ref` member functions and associated methods with `noexcept`.
* Marked `boost::swap` function with `noexcept`, depending on whether the type supports a non-throwing swap operation.
* Added [link core.launder `boost::core::launder`], a portable implementation of `std::launder`.
* Added [link core.alignof `BOOST_CORE_ALIGNOF`], a portable implementation of `alignof`.
* Added [link core.max_align `boost::core::max_align_t`], a portable equivalent of `std::max_align_t`, and
`boost::core::max_align`, the alignment of `max_align_t`.
* Added [link core.memory_resource `boost::core::memory_resource`], a portable equivalent of `std::pmr::memory_resource`
from C++17.
* Added [link core.serialization `boost/core/serialization.hpp`], a collection of primitives allowing libraries to
implement Boost.Serialization support for their types without including a Serialization header and thereby making
their libraries depend on Serialization.
* Added [link core.data `boost::data`], an implementation of `std::data`.
* Added [link core.size `boost::size`], an implementation of `std::size`.
* Updated `boost::span` to use `boost::data` which adds support for range
construction from an `std::initializer_list`.
* Added [link core.identity `boost::identity`], an implementation of
`std::identity`. This facility has been moved from Boost.Functional.
[endsect]
[section Changes in 1.81.0]
* [link core.empty_value `empty_value`] members are now marked as `constexpr`.
* Added [link core.fclose_deleter `fclose_deleter`], a deleter that calls `std::fclose` on a pointer to `std::FILE`.
* Bit manipulation utilities in [link core.bit `boost/core/bit.hpp`] now explicitly require unsigned integers on input.
([@https://github.com/boostorg/core/issues/129 #129])
* `bit_width` now returns `int` instead of a value of the input argument type. This follows the
resolution of [@https://cplusplus.github.io/LWG/issue3656 LWG3656].
[endsect]
[section Changes in 1.80.0]
* In [link core.allocator_access `boost/core/allocator_access.hpp`], added detection of `construct` and `destroy`
members of an allocator.
* `boost/core/alloc_construct.hpp` header is now deprecated and will be removed in a future release. Its functionality
was moved to [link core.allocator_access `boost/core/allocator_access.hpp`]. In particular, new methods
`allocator_construct_n` and `allocator_destroy_n` were added for allocating and destroying arrays.
* Worked around MSVC bug that failed to compile [link core.span `span`] in C++17 mode when Boost.Range headers were included.
([@https://github.com/boostorg/core/issues/105 #105], [@https://github.com/boostorg/core/pull/115 PR#115])
* Added support for 128-bit integer types in [link core.type_name `type_name`].
* In [link core.pointer_traits `pointer_traits`], pointer rebinding now supports C++03 compilers.
[endsect]
[section Changes in 1.79.0]
* Added `boost::allocator_traits`, an implementation of `std::allocator_traits`.
* Made `boost::pointer_traits` SFINAE friendly.
* `boost/iterator.hpp` is deprecated and will be removed in a future release. The header defines the
`boost::iterator` template, which is equivalent to `std::iterator` in the `<iterator>` header. However,
since `std::iterator` is itself deprecated in C++17, users are advised to remove the use of `boost::iterator`
or `std::iterator` from their code.
* Added `boost::core::verbose_terminate_handler`, a utility function intended
to be passed to `std::set_terminate` that prints information about the
uncaught exception to `stderr`.
[endsect]
[section Changes in 1.78.0]
* Added a generic implementation to `boost/core/cmath.hpp`, enabled when `BOOST_CORE_USE_GENERIC_CMATH`
is defined or when the platform does not provide the necessary facilities in `<cmath>`.
* Added `boost::core::type_name`, a utility function that returns the name of a type as a string.
* Added `boost::span`, a C++11 implementation of C++20's `std::span`.
[endsect]
[section Changes in 1.77.0]
* `boost/core/uncaught_exceptions.hpp` has been modified for compatibility with Mac OS 10.4 and older.
[endsect]
[section Changes in 1.76.0]
* Added implicit conversion between compatible reference wrappers.
* Added `boost/core/cmath.hpp`, a portable implementation of the floating point classification functions from `<cmath>`.
* Added `boost/core/bit.hpp`, a portable implementation of the C++20 standard header `<bit>`.
* Fixed `BOOST_TEST_EQ`, `BOOST_TEST_NE` for character types under C++20.
* Revised allocator access utilities (now support VS2013, and no workarounds use `allocator_traits`.)
[endsect]
[section Changes in 1.74.0]
* Implemented the allocator access utilities which provide a replacement for `allocator_traits`
with individual traits and functions for each facility. They support the C++11 allocator model
when possible and provide a fallback for C++98 compatibility.
* Added `BOOST_TEST_WITH` to Lightweight Test.
[endsect]
[section Changes in 1.71.0]
* Added functions `alloc_construct`, `alloc_construct_n`, `alloc_destroy`, and `alloc_destroy_n`
in `<boost/core/alloc_construct.hpp>` for allocator aware and exception safe construction and
destruction of objects and arrays.
* Added constexpr functions `first_scalar` in `<boost/core/first_scalar.hpp>` for obtaining a pointer
to the first scalar element of an array. Given a pointer of type `T*` they return a pointer of type
`remove_all_extents_t<T>*`.
* Added class template `noinit_adaptor` in `<boost/core/noinit_adaptor.hpp>` which is an allocator adaptor
that converts any allocator into one whose `construct(ptr)` performs default initialization via placement
`new`, and whose `destroy(ptr)` invokes the `value_type` destructor directly.
* Added class template `default_allocator` in `<boost/core/default_allocator.hpp>`, which can serve as a minimal
default allocator that has interface similar to C++20 `std::allocator`, supports configurations with disabled
exceptions and does not have `std` as an associated namespace. The allocator uses `operator new` and
`operator delete` for allocation.
* In `<boost/core/uncaught_exceptions.hpp>` header, added workarounds for better compatibility with QNX SDP 7.0
when libc++/libc++abi libraries are used.
* The `<boost/detail/sp_typeinfo.hpp>` header is now marked as deprecated and will be removed in a future release.
`<boost/core/typeinfo.hpp>` should be used instead.
[endsect]
[section Changes in 1.69.0]
* Implemented `boost::empty_value`, for library authors to conveniently leverage the Empty Base Optimization to
store objects of potentially empty types.
* Implemented `boost::quick_exit` to provide the C++11 standard library facility `std::quick_exit` functionality.
* Reduced the number of statics in Lightweight Test, and employ lighter abort behavior for MSVC compilers upon
failure to call `boost::report_errors`.
[endsect]
[section Changes in 1.67.0]
* Updated `to_address` and `pointer_traits` to reflect the design adopted for C++20 in
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0653r2.html P0653R2].
[endsect]
[section Changes in 1.65.0]
* Implemented `pointer_traits` for C++03 and higher, that implements
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0653r0.html P0653r0].
* Added `BOOST_TEST_GT` and `BOOST_TEST_GE` to Lightweight Test.
[endsect]
[endsect]

122
doc/cmath.qbk Normal file
View File

@@ -0,0 +1,122 @@
[/
Copyright 2018 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt
or copy at http://boost.org/LICENSE_1_0.txt
]
[section:cmath cmath]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/cmath.hpp>]
The header `<boost/core/cmath.hpp>` defines, in a portable way, the floating
point classification and sign manipulation functions from C++11.
[section Synopsis]
``
namespace boost
{
namespace core
{
// fpclassify return values
int const fp_zero = /*unspecified*/;
int const fp_subnormal = /*unspecified*/;
int const fp_normal = /*unspecified*/;
int const fp_infinite = /*unspecified*/;
int const fp_nan = /*unspecified*/;
// Classification functions
template<class T> bool isfinite( T x );
template<class T> bool isnan( T x );
template<class T> bool isinf( T x );
template<class T> bool isnormal( T x );
template<class T> int fpclassify( T x );
// Sign manipulation functions
template<class T> bool signbit( T x );
template<class T> T copysign( T x, T y );
} // namespace core
} // namespace boost
``
[endsect]
[section Classification Functions]
[section template<class T> bool isfinite( T x );]
* *Requires:* `T` must be `float`, `double`, or `long double`.
* *Returns:* `true` when `x` is finite (not infinity or NaN), `false` otherwise.
[endsect]
[section template<class T> bool isnan( T x );]
* *Requires:* `T` must be `float`, `double`, or `long double`.
* *Returns:* `true` when `x` is NaN, `false` otherwise.
[endsect]
[section template<class T> bool isinf( T x );]
* *Requires:* `T` must be `float`, `double`, or `long double`.
* *Returns:* `true` when `x` is infinity, `false` otherwise.
[endsect]
[section template<class T> bool isnormal( T x );]
* *Requires:* `T` must be `float`, `double`, or `long double`.
* *Returns:* `true` when `x` is a normal number (not zero, subnormal, infinity, or NaN), `false` otherwise.
[endsect]
[section template<class T> int fpclassify( T x );]
* *Requires:* `T` must be `float`, `double`, or `long double`.
* *Returns:*
* `fp_zero` when `x` is zero;
* `fp_subnormal` when `x` is subnormal;
* `fp_infinite` when `x` is infinity;
* `fp_nan` when `x` is NaN;
* `fp_normal` otherwise.
[endsect]
[endsect]
[section Sign Manipulation Functions]
[section template<class T> bool signbit( T x );]
* *Requires:* `T` must be `float`, `double`, or `long double`.
* *Returns:* `true` when `x` is negative, `false` otherwise.
[endsect]
[section template<class T> bool copysign( T x, T y );]
* *Requires:* `T` must be `float`, `double`, or `long double`.
* *Returns:* `x` with the sign copied from `y`.
[endsect]
[endsect]
[endsect]
[endsect]

View File

@@ -1,10 +1,10 @@
[/
Copyright (c) 2014 Glen Joseph Fernandes
glenfe at live dot com
Copyright 2014 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt
or copy at http://boost.org/LICENSE_1_0.txt)
Distributed under the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt
or copy at http://boost.org/LICENSE_1_0.txt)
]
[library Boost.Core
@@ -20,6 +20,9 @@
]
]
[template github_issue[key]'''<ulink url="https://github.com/boostorg/core/issues/'''[key]'''">#'''[key]'''</ulink>''']
[template github_pr[key]'''<ulink url="https://github.com/boostorg/core/pull/'''[key]'''">PR#'''[key]'''</ulink>''']
[template simplesect[title]
[block '''<simplesect><title>'''[title]'''</title>''']]
@@ -34,23 +37,55 @@ criteria for inclusion is that the utility component be:
* simple,
* used by other Boost libraries, and
* not dependent on any other Boost modules except Core
itself, Config, Assert, Static Assert, or Predef.
itself, Config, Assert, StaticAssert, or ThrowException.
[endsect]
[include changes.qbk]
[include addressof.qbk]
[include alignof.qbk]
[include allocator_access.qbk]
[include allocator_traits.qbk]
[include bit.qbk]
[include checked_delete.qbk]
[include cmath.qbk]
[include data.qbk]
[include default_allocator.qbk]
[include demangle.qbk]
[include empty_value.qbk]
[include enable_if.qbk]
[include exchange.qbk]
[include explicit_operator_bool.qbk]
[include first_scalar.qbk]
[include functor.qbk]
[include identity.qbk]
[include ignore_unused.qbk]
[include is_same.qbk]
[include launder.qbk]
[include lightweight_test.qbk]
[include make_span.qbk]
[include max_align.qbk]
[include memory_resource.qbk]
[include no_exceptions_support.qbk]
[include noinit_adaptor.qbk]
[include noncopyable.qbk]
[include null_deleter.qbk]
[include fclose_deleter.qbk]
[include nvp.qbk]
[include pointer_in_range.qbk]
[include pointer_traits.qbk]
[include quick_exit.qbk]
[include ref.qbk]
[include scoped_enum.qbk]
[include serialization.qbk]
[include size.qbk]
[include span.qbk]
[include swap.qbk]
[include typeinfo.qbk]
[include type_name.qbk]
[include snprintf.qbk]
[include uncaught_exceptions.qbk]
[include use_default.qbk]
[include verbose_terminate_handler.qbk]
[include yield_primitives.qbk]

67
doc/data.qbk Normal file
View File

@@ -0,0 +1,67 @@
[/
Copyright 2023 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:data data]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/core/data.hpp> provides function templates `data`
to obtain the pointer to the first element in a range.
[endsect]
[section Reference]
```
namespace boost {
template<class C>
constexpr auto
data(C& c) noexcept(noexcept(c.data())) -> decltype(c.data());
template<class C>
constexpr auto
data(const C& c) noexcept(noexcept(c.data())) -> decltype(c.data());
template<class T, std::size_t N>
constexpr T*
data(T(&a)[N]) noexcept;
template<class T>
constexpr const T*
data(std::initializer_list<T> l) noexcept;
} /* boost */
```
[section Functions]
[variablelist
[[`template<class C> constexpr auto data(C& c) noexcept(noexcept(c.data())) ->
decltype(c.data());`]
[Returns `c.data()`.]]
[[`template<class C> constexpr auto data(const C& c)
noexcept(noexcept(c.data())) -> decltype(c.data());`]
[Returns `c.data()`.]]
[[`template<class T, std::size_t N> constexpr T* data(T(&a)[N]) noexcept;`]
[Returns `a`.]]
[[`template<class T> constexpr const T* data(std::initializer_list<T> l)
noexcept;`]
[Returns `l.begin()`.]]]
[endsect]
[endsect]
[endsect]

140
doc/default_allocator.qbk Normal file
View File

@@ -0,0 +1,140 @@
[/
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:default_allocator default_allocator]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/core/default_allocator.hpp> provides the class template
`boost::default_allocator` to serve as a minimal default allocator that:
* Like C++2a's `std::allocator`, does not provide members such as `construct()`
and `destroy()` to be eligible for optimizations by allocator-aware code that
detects the absence of these members to provide more optimal construction.
* Supports `BOOST_NO_EXCEPTIONS` in allocation.
* Does not have `std` as an associated namespace.
[endsect]
[section Examples]
The following snippet shows the use of this allocator as the default allocator
for a container.
```
template<class Key, class Compare = std::less<Key>,
class Allocator = boost::default_allocator<Key> >
class FlatSet;
```
Facilities like `make_shared` can be implemented using `allocate_shared` with
`default_allocator`.
```
template<class T, class... Args>
enable_if_t<!is_array_v<T>, shared_ptr<T> >
make_shared(Args&&... args)
{
return allocate_shared<T>(boost::default_allocator<remove_cv_t<T> >(),
std::forward<Args>(args)...);
}
```
[endsect]
[section Reference]
```
namespace boost {
template<class T>
struct default_allocator {
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef std::add_lvalue_reference_t<T> reference;
typedef std::add_lvalue_reference_t<const T> const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef ``['true_type]`` propagate_on_container_move_assignment;
typedef ``['true_type]`` is_always_equal;
template<class U>
struct rebind {
typedef default_allocator<U> other;
};
constexpr default_allocator() = default;
template<class U>
constexpr default_allocator(const default_allocator<U>&) noexcept { }
constexpr std::size_t max_size() const noexcept;
T* allocate(std::size_t n);
void deallocate(T* p, std::size_t);
};
template<class T, class U>
constexpr bool operator==(const default_allocator<T>&,
const default_allocator<U>&) noexcept;
template<class T, class U>
constexpr bool operator!=(const default_allocator<T>&,
const default_allocator<U>&) noexcept;
} /* boost */
```
[section Members]
[variablelist
[[`constexpr std::size_t max_size() const noexcept;`]
[[variablelist
[[Returns][The largest value `N` for which the call `allocate(N)` might
succeed.]]]]]
[[`T* allocate(std::size_t n);`]
[[variablelist
[[Returns]
[A pointer to the initial element of an array of storage of size
`n * sizeof(T)`, aligned appropriately for objects of type `T`.]]
[[Remarks][The storage is obtained by calling `::operator new`.]]
[[Throws][`std::bad_alloc` if the storage cannot be obtained.]]]]]
[[`void deallocate(T* p, std::size_t n);`]
[[variablelist
[[Requires]
[`p` shall be a pointer value obtained from `allocate()`. `n` shall equal the
value passed as the first argument to the invocation of `allocate` which
returned `p`.]]
[[Effects][Deallocates the storage referenced by `p`.]]
[[Remarks][Uses `::operator delete`.]]]]]]
[endsect]
[section Operators]
[variablelist
[[`template<class T, class U> constexpr bool operator==(const
default_allocator<T>&, const default_allocator<U>&) noexcept;`]
[[variablelist
[[Returns][`true`.]]]]]
[[`template<class T, class U> constexpr bool operator!=(const
default_allocator<T>&, const default_allocator<U>&) noexcept;`]
[[variablelist
[[Returns][`false`.]]]]]]
[endsect]
[endsect]
[endsect]

View File

@@ -125,7 +125,7 @@ return `nullptr` if demangling failed.
[endsect]
[section Acknowledgments]
[section Acknowledgements]
The implementation of `core::demangle` was taken from
`boost/exception/detail/type_info.hpp`, which in turn was adapted

141
doc/empty_value.qbk Normal file
View File

@@ -0,0 +1,141 @@
[/
Copyright 2018 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:empty_value empty_value]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/core/empty_value.hpp> provides the class template
`boost::empty_value` for library authors to conveniently leverage the Empty
Base Optimization to store objects of potentially empty types.
[endsect]
[section Examples]
The following example shows `boost::empty_value` used to create a type that
stores a pointer, comparer, and allocator, where the comparer and allocator
could be empty types.
```
template<class Ptr, class Compare, class Allocator>
class storage
: empty_value<Compare, 0>
, empty_value<Allocator, 1> {
public:
storage()
: empty_value<Compare, 0>(empty_init_t())
, empty_value<Allocator, 1>(empty_init_t())
, ptr_() { }
storage(const Compare& c, const Allocator& a)
: empty_value<Compare, 0>(empty_init_t(), c)
, empty_value<Allocator, 1>(empty_init_t(), a)
, ptr_() { }
const Ptr& pointer() const {
return ptr_;
}
Ptr& pointer() {
return ptr_;
}
const Compare& compare() const {
return empty_value<Compare, 0>::get();
}
Compare& compare() {
return empty_value<Compare, 0>::get();
}
const Allocator& allocator() const {
return empty_value<Allocator, 1>::get();
}
Allocator& allocator() {
return empty_value<Allocator, 1>::get();
}
private:
Ptr ptr_;
};
```
[endsect]
[section Reference]
```
namespace boost {
struct empty_init_t { };
template<class T, unsigned Index = 0, bool Empty = ``/see below/``>
class empty_value {
public:
typedef T type;
empty_value() = default;
template<class... Args>
constepxr empty_value(empty_init_t, Args&&... args);
constepxr const T& get() const noexcept;
constepxr T& get() noexcept;
};
inline constexpr empty_init_t empty_init{ };
} /* boost */
```
[section Template parameters]
[variablelist
[[`T`][The type of value to store]]
[[`Index`][Optional: Specify to create a distinct base type]]
[[`Empty`][Optional: Specify to force inheritance from type]]]
[endsect]
[section Member types]
[variablelist
[[`type`][The template parameter `T`]]]
[endsect]
[section Constructors]
[variablelist
[[`constepxr empty_value() = default;`][Default initialize the value]]
[[`template<class... Args>
constepxr empty_value(empty_init_t, Args&&... args);`]
[Initialize the value with `std::forward<Args>(args)...`]]]
[endsect]
[section Member functions]
[variablelist
[[`constepxr const T& get() const noexcept;`][Returns the value]]
[[`constepxr T& get() noexcept;`][Returns the value]]]
[endsect]
[endsect]
[endsect]

View File

@@ -304,8 +304,8 @@ depends on the template arguments of the class. Note that
again, the second argument to `enable_if` is not needed; the
default (`void`) is the correct value.
The `enable_if_has_type` template is usable this scenario but instead of
using a type traits to enable or disable a specialization, it use a
The `enable_if_has_type` template is usable in this scenario but instead of
using a type trait to enable or disable a specialization, it uses a
SFINAE context to check for the existence of a dependent type inside
its parameter. For example, the following structure extracts a dependent
`value_type` from T if and only if `T::value_type` exists.

63
doc/exchange.qbk Normal file
View File

@@ -0,0 +1,63 @@
[/
Copyright 2018 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:exchange exchange]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/core/exchange.hpp> provides the function template
`boost::exchange` which is an implementation of the `std::exchange`
function introduced in C++14. `boost::exchange(o, v)` replaces the
value of `o` with `v` and returns the old value of `o`.
[endsect]
[section Examples]
The following example shows `boost::exchange` used to simplify the
implementation of a move constructor.
```
Node(Node&& other)
: head_(boost::exchange(other.head_, nullptr))
, tail_(boost::exchange(other.tail_, nullptr)) { }
```
[endsect]
[section Reference]
```
namespace boost {
template<class T, class U = T>
constexpr T exchange(T& t, U&& u);
}
```
[section Functions]
[*`template<class T, class U = T> constexpr T exchange(T& t, U&& u);`]
Equivalent to:
```
T v = std::move(t);
t = std::forward<U>(u);
return v;
```
[endsect]
[endsect]
[endsect]

34
doc/fclose_deleter.qbk Normal file
View File

@@ -0,0 +1,34 @@
[/
/ Copyright (c) 2022 Andrey Semashev
/
/ 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)
/]
[section:fclose_deleter fclose_deleter]
[simplesect Authors]
* Andrey Semashev
[endsimplesect]
[section Header <boost/core/fclose_deleter.hpp>]
The header `<boost/core/fclose_deleter.hpp>` defines the `boost::fclose_deleter` function object,
which can be used as a deleter with smart pointers such as `unique_ptr` or `shared_ptr` pointing to `std::FILE`.
structures returned by `std::fopen` calls. The deleter calls `std::fclose` on the passed pointer, causing
the file stream to be flushed and closed.
[section Example]
``
std::unique_ptr< std::FILE, boost::fclose_deleter > make_file(const char* filename, const char* open_mode)
{
return { std::fopen(filename, open_mode) };
}
``
[endsect]
[endsect]
[endsect]

91
doc/first_scalar.qbk Normal file
View File

@@ -0,0 +1,91 @@
[/
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:first_scalar first_scalar]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/core/first_scalar.hpp> provides the function templates
`boost::first_scalar` that can be used to obtain a pointer to the first scalar
element of an array. Given a pointer of type `T*` they return a pointer of
type `remove_all_extents_t<T>*`. The functions are `constexpr` and can be used
in constant expressions.
[endsect]
[section Examples]
The following function uses an allocator to allocate an array of arrays and
constructs each scalar element in it.
```
#include <boost/alloc_construct.hpp>
#include <boost/first_scalar.hpp>
template<class A>
auto create(const A& allocator)
{
typename std::allocator_traits<A>::template
rebind_alloc<int[2][3]> other(allocator);
auto ptr = other.allocate(4);
try {
boost::alloc_construct_n(other,
boost::first_scalar(boost::to_address(ptr)), 24);
} catch (...) {
other.deallocate(ptr, 4);
throw;
}
return ptr;
}
```
[endsect]
[section Reference]
```
namespace boost {
template<class T>
constexpr T* first_scalar(T* p) noexcept;
template<class T, std::size_t N>
constexpr auto first_scalar(T (*p)[N]) noexcept;
} /* boost */
```
[section Functions]
[variablelist
[[`template<class T> constexpr T* first_scalar(T* p) noexcept;`]
[[variablelist
[[Returns][`p`.]]]]]
[[`template<class T, std::size_t N> constexpr auto first_scalar(T (*p)[N])
noexcept;`]
[[variablelist
[[Returns][`first_scalar(&(*p)[0])`.]]]]]]
[endsect]
[endsect]
[section History]
Glen Fernandes implemented `first_scalar`. Peter Dimov suggested a change for
GCC to support an additional `constexpr` use.
[endsect]
[endsect]

101
doc/functor.qbk Normal file
View File

@@ -0,0 +1,101 @@
[/
/ Copyright (c) 2024 Andrey Semashev
/
/ 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)
/]
[section:functor functor]
[simplesect Authors]
* Andrey Semashev
[endsimplesect]
[section Header <boost/core/functor.hpp>]
[note This component requires a compiler supporting C++17 or newer.]
The header `<boost/core/functor.hpp>` defines the `boost::core::functor` class template
that wraps a raw function specified in its template parameter into a function object class.
The function object forwards any arguments passed to it to the wrapped function and returns
the result of the call.
The `functor` wrapper can be useful in cases when a function object class type is required,
for example, for use with smart pointers such as `std::unique_ptr`, where the actual logic
of the function object is already implemented as a raw function, possibly provided by a
third party library. Since `functor` is default-constructible and does not store a pointer
to the wrapped function internally, using `functor` is less error-prone and more efficient
than using the pointer to function instead. For example, with `std::unique_ptr` you don't
need to pass a pointer to the deleter function in the `std::unique_ptr` constructor, and
the `std::unique_ptr` object does not store and invoke a pointer to the deleter function.
With `functor`, the deleter function becomes part of the `std::unique_ptr` type, which
prevents mixing pointers with incompatible deleters.
```
void my_deleter(void* p);
using malloc_ptr = std::unique_ptr< char, boost::core::functor< std::free > >;
using my_ptr = std::unique_ptr< char, boost::core::functor< my_deleter > >;
my_ptr create_string(std::size_t size);
void consume_string(my_ptr&& str);
malloc_ptr ptr1(static_cast< char* >(std::malloc(size)));
// ptr1 = allocate_string(size); // error, cannot convert my_ptr to malloc_ptr
my_ptr ptr2 = create_string(size); // ok
// consume_string(std::move(ptr1)); // error, cannot convert malloc_ptr&& to my_ptr
consume_string(std::move(ptr2)); // ok
```
Using `functor` may also be beneficial for reducing generated code sizes. For example, in
order to avoid storing and invoking a pointer to the deleter function in `std::shared_ptr`,
one may be inclined to use lambda functions to wrap the deleter function call like this:
```
std::shared_ptr< int > ptr(static_cast< int* >(std::malloc(sizeof(int))), [](int* p) { std::free(p); });
```
The problem is that every lambda function declaration introduces a unique type, even if
the lambda function definition matches exactly one of the previously declared lambda
functions. Thus, if `std::shared_ptr` objects like the one above are created in multiple
places in the program, the definition of the shared pointer counter and associated code
and data (e.g. virtual function table) will be duplicated for each instance.
Replacing the lambda function with `functor` solves this problem without sacrificing
readability or efficiency:
```
std::shared_ptr< int > ptr(static_cast< int* >(std::malloc(sizeof(int))), boost::core::functor< std::free >());
```
[section Synopsis]
```
namespace boost::core {
template< auto Function >
struct functor
{
template< typename... Args >
decltype(auto) operator() (Args&&... args) const noexcept(...);
};
} // namespace boost::core
```
[endsect]
[section `template< typename... Args > decltype(auto) operator() (Args&&... args) const noexcept(...);`]
* *Effects:* `return Function(std::forward< Args >(args)...)`.
* *Throws:* Nothing, unless invoking `Function` throws.
* *Note:* This function only participates in overload resolution if `Function(std::forward< Args >(args)...)` is a valid call expression.
[endsect]
[endsect]
[endsect]

61
doc/identity.qbk Normal file
View File

@@ -0,0 +1,61 @@
[/
Copyright 2021-2023 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:identity identity]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/functional/identity.hpp> provides the function object
`boost::identity` whose `operator()` returns its argument. It is an
implementation of C++20's `std::identity` that supports C++03 and above.
[endsect]
[section Example]
It is commonly used as the default projection in constrained algorithms.
```
template<class Range, class Projection = boost::identity>
void print(Range&& range, Projection projection = {});
```
[endsect]
[section Reference]
```
namespace boost {
struct identity {
using is_transparent = unspecified;
template<class T>
T&& operator()(T&& value) const noexcept;
};
} /* boost */
```
[section Operators]
[variablelist
[[`template<class T> T&& operator()(T&& value) const noexcept;`]
[Returns `std::forward<T>(value)`.]]]
[endsect]
[endsect]
[endsect]

View File

@@ -51,7 +51,7 @@ int fun( int foo, int bar )
[endsect]
[section Acknowledgments]
[section Acknowledgements]
`boost::ignore_unused()` was contributed by Adam Wulkiewicz.

View File

@@ -17,6 +17,11 @@
[section Header <boost/core/is_same.hpp>]
[warning This component is deprecated and will be removed in a future release.
Users are recommended to use `boost::is_same` from
[@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/index.html Boost.TypeTraits]
or `std::is_same` from C++ standard library `<type_traits>` instead.]
The header `<boost/core/is_same.hpp>` defines the class template
`boost::core::is_same<T1,T2>`. It defines a nested integral constant
`value` which is `true` when `T1` and `T2` are the same type, and

39
doc/launder.qbk Normal file
View File

@@ -0,0 +1,39 @@
[/
Copyright 2023 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt
]
[section:launder launder]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/launder.hpp>]
The header `<boost/core/launder.hpp>` defines the function
`void boost::core::launder()`, a portable implementation of
`std::launder`.
[section Synopsis]
``
namespace boost
{
namespace core
{
template<class T> T* launder( T* p );
} // namespace core
} // namespace boost
``
[endsect]
[endsect]
[endsect]

View File

@@ -1,7 +1,7 @@
[/
Copyright 2010, 2011 Beman Dawes
Copyright 2013 Ion Gaztanaga
Copyright 2014, 2017 Peter Dimov
Copyright 2014-2019 Peter Dimov
Copyright 2017 Kohei Takahashi
Distributed under the Boost Software License, Version 1.0.
@@ -43,14 +43,24 @@ When using `lightweight_test.hpp`, *do not forget* to
#define BOOST_TEST_GE(expr1, expr2) /*unspecified*/
#define BOOST_TEST_CSTR_EQ(expr1, expr2) /*unspecified*/
#define BOOST_TEST_CSTR_NE(expr1, expr2) /*unspecified*/
#define BOOST_TEST_WITH(expr1, expr2, pred) /*unspecified*/
#define BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2) /* unspecified */
#define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) /* unspecified */
#define BOOST_TEST_THROWS(expr, excep) /*unspecified*/
#define BOOST_TEST_NO_THROW(expr) /*unspecified*/
namespace boost
{
int report_errors();
}
int report_errors();
namespace core
{
void lwt_init();
} // namespace core
} // namespace boost
``
[endsect]
@@ -174,6 +184,17 @@ Specialization of `BOOST_TEST_NE` which interprets `expr1` and `expr2` as pointe
[endsect]
[section BOOST_TEST_WITH]
``
BOOST_TEST_WITH(expr1, expr2, pred)
``
If `pred(expr1, expr2)` is not true increases the error count and outputs a
message containing both expressions.
[endsect]
[section BOOST_TEST_ALL_EQ]
``
@@ -209,6 +230,20 @@ nothing and `expr` is not evaluated.
[endsect]
[section BOOST_TEST_NO_THROW]
``
BOOST_TEST_NO_THROW(expr)
``
If `BOOST_NO_EXCEPTIONS` is *not* defined and if `expr` throws an exception,
increases the error count and outputs a message containing the expression
and (if possible) the exception message.
If `BOOST_NO_EXCEPTIONS` is defined, `expr` is evaluated.
[endsect]
[section report_errors]
``
@@ -219,6 +254,25 @@ Return the error count from `main`.
[endsect]
[section lwt_init]
``
void boost::core::lwt_init()
``
Performs one-time initialization. Disables the interactive message
boxes displayed by the Microsoft Windows debug runtime library on
`abort`, failing `assert`, and other abnormal program terminations
(to facilitate unattended testing), and ensures that in case
`boost::report_errors` is not called (a common mistake), the program
ends with a nonzero exit code.
`lwt_init` is automatically called by the test macros. There is
no need to call it explicitly, except in cases where a test fails due
to e.g. an assertion failure before the first test macro is invoked.
[endsect]
[section Example]
``
@@ -253,6 +307,7 @@ return a boolean value.
``
#define BOOST_TEST_TRAIT_TRUE((Trait)) /*unspecified*/
#define BOOST_TEST_TRAIT_FALSE((Trait)) /*unspecified*/
#define BOOST_TEST_TRAIT_SAME(Type1, Type2) /*unspecified*/
``
[endsect]
@@ -280,23 +335,39 @@ message containing `Trait`. Note the double set of parentheses.
[endsect]
[section BOOST_TEST_TRAIT_SAME]
``
BOOST_TEST_TRAIT_SAME(Type1, Type2)
``
If the two types are not the same, increases the error count and outputs a
message containing them. This macro requires that the compiler supports
variadic macros and `__VA_ARGS__`. (Note that unlike `BOOST_TEST_TRAIT_TRUE`
and `BOOST_TEST_TRAIT_FALSE`, this macro only requires a single set of
parentheses.)
[endsect]
[section Example]
``
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/core/is_same.hpp>
#include <boost/type_traits/is_same.hpp>
template<class T, class U> struct X
{
typedef T type;
};
using boost::core::is_same;
using boost::is_same;
int main()
{
BOOST_TEST_TRAIT_TRUE(( is_same<X<int, long>::type, int> ));
BOOST_TEST_TRAIT_SAME( X<int, long>::type, int );
return boost::report_errors();
}
``

81
doc/make_span.qbk Normal file
View File

@@ -0,0 +1,81 @@
[/
Copyright 2023 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:make_span make_span]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/core/make_span.hpp> provides function templates `make_span`
to conveniently create `span` objects. They are useful before C++17 where Class
Template Argument Deduction (CTAD) is not available.
[endsect]
[section Reference]
```
namespace boost {
template<class I>
constexpr span<I>
make_span(I* d, std::size_t n) noexcept;
template<class I>
constexpr span<I>
make_span(I* b, I* e) noexcept;
template<class T, std::size_t N>
constexpr span<T, N>
make_span(T(&a)[N]) noexcept;
template<class T, std::size_t N>
constexpr span<T, N>
make_span(std::array<T, N>& a) noexcept;
template<class T, std::size_t N>
constexpr span<const T, N>
make_span(const std::array<T, N>& a) noexcept;
template<class R>
span<remove_pointer_t<iterator_t<R> > >
make_span(R&& r);
} /* boost */
```
[section Functions]
[variablelist
[[`template<class I> span<I> make_span(I* f, std::size_t c);`]
[Returns `span<I>(f, c)`.]]
[[`template<class I> span<I> make_span(I* f, I* l);`]
[Returns `span<I>(f, l)`.]]
[[`template<class T, std::size_t N> span<T, N> make_span(T(&a)[N]);`]
[Returns `span<T, N>(a)`.]]
[[`template<class T, std::size_t N> span<T, N>
make_span(std::array<T, N>& a);`]
[Returns `span<T, N>(a)`.]]
[[`template<class T, std::size_t N> span<const T, N>
make_span(const std::array<T, N>& a);`]
[Returns `span<const T, N>(a)`.]]
[[`template<class R>
span<remove_pointer_t<iterator_t<R> > >
make_span(R&& r);`]
[Returns `span<remove_pointer_t<iterator_t<R> > >(std::forward<R>(r))`.]]]
[endsect]
[endsect]
[endsect]

42
doc/max_align.qbk Normal file
View File

@@ -0,0 +1,42 @@
[/
Copyright 2023 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt
]
[section:max_align max_align]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/max_align.hpp>]
The header `<boost/core/max_align.hpp>` defines the type
`boost::core::max_align_t`, a portable equivalent of
`std::max_align_t`, and the constant `boost::core::max_align`,
the alignment of `max_align_t`.
[section Synopsis]
``
namespace boost
{
namespace core
{
union max_align_t;
constexpr std::size_t max_align = alignof(max_align_t);
} // namespace core
} // namespace boost
``
[endsect]
[endsect]
[endsect]

139
doc/memory_resource.qbk Normal file
View File

@@ -0,0 +1,139 @@
[/
Copyright 2023 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt
]
[section:memory_resource memory_resource]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/memory_resource.hpp>]
The header `<boost/core/memory_resource.hpp>` defines the class
`boost::core::memory_resource`, a portable equivalent of
`std::pmr::memory_resource` from C++17.
This is not a complete implementation of the standard `<memory_resource>`
header; for such, one should use Boost.Container. The abstract base class
is only provided by Core so that Boost libraries that provide and take
advantage of PMR facilities such as concrete implementations of memory
resources, or implementations of `polymorphic_allocator`, can interoperate.
[section Synopsis]
``
namespace boost
{
namespace core
{
class memory_resource
{
public:
virtual ~memory_resource() = default;
[[nodiscard]] void* allocate( std::size_t bytes, std::size_t alignment = max_align );
void deallocate( void* p, std::size_t bytes, std::size_t alignment = max_align );
bool is_equal( memory_resource const & other ) const noexcept;
private:
virtual void* do_allocate( std::size_t bytes, std::size_t alignment ) = 0;
virtual void do_deallocate( void* p, std::size_t bytes, std::size_t alignment ) = 0;
virtual bool do_is_equal( memory_resource const& other ) const noexcept = 0;
};
inline bool operator==( memory_resource const& a, memory_resource const& b ) noexcept;
inline bool operator!=( memory_resource const& a, memory_resource const& b ) noexcept;
} // namespace core
} // namespace boost
``
[endsect]
[section `allocate`]
`[[nodiscard]] void* allocate( std::size_t bytes, std::size_t alignment = max_align );`
* *Returns:* `do_allocate( bytes, alignment )`.
* *Remarks:* Implicitly creates objects in the returned region of storage.
[endsect]
[section `deallocate`]
`void deallocate( void* p, std::size_t bytes, std::size_t alignment = max_align );`
* *Effects:* `do_deallocate( bytes, alignment )`.
[endsect]
[section `is_equal`]
`bool is_equal( memory_resource const& other ) const noexcept;`
* *Returns:* `do_is_equal( other )`.
[endsect]
[section `do_allocate`]
`void* do_allocate( std::size_t bytes, std::size_t alignment ) = 0;`
* *Remarks:* A derived class should implement this member function to return
a pointer to allocated storage of size at least `bytes` and alignment at
least `alignment`.
* *Throws:* An appropriate exception (by convention `std::bad_alloc` or
derived) when storage with the specified size and alignment could not be
obtained.
[endsect]
[section `do_deallocate`]
`void do_deallocate( void* p, std::size_t bytes, std::size_t alignment ) = 0;`
* *Remarks:* A derived class should implement this member function to deallocate
a region of storage previously allocated by `do_allocate`.
* *Throws:* Nothing.
[endsect]
[section `do_is_equal`]
`bool do_is_equal( memory_resource const& other ) const noexcept = 0;`
* *Remarks:* A derived class shall implement this function to return `true` if
memory allocated from `*this` can be deallocated from `other` and vice-versa,
otherwise `false`.
[endsect]
[section `operator==`]
`bool operator==( memory_resource const& a, memory_resource const& b ) noexcept;`
* *Returns:* `&a == &b || a.is_equal( b )`.
[endsect]
[section `operator!=`]
`bool operator!=( memory_resource const& a, memory_resource const& b ) noexcept;`
* *Returns:* `!( a == b )`.
[endsect]
[endsect]
[endsect]

163
doc/noinit_adaptor.qbk Normal file
View File

@@ -0,0 +1,163 @@
[/
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:noinit_adaptor noinit_adaptor]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/core/noinit_adaptor.hpp> provides the class
template `boost::noinit_adaptor` that converts any allocator into
one whose `construct(ptr)` performs default initialization via placement new,
and whose `destroy(ptr)` invokes `value_type` destructor directly.
[endsect]
[section Examples]
The following example shows use of this allocator adaptor to achieve default
initialization of elements of a trivial type, which are later assigned values.
```
#include <boost/core/noinit_adaptor.hpp>
#include <numeric>
#include <vector>
int main()
{
std::vector<int, boost::noinit_adaptor<std::allocator<int> > > v(5);
std::iota(v.begin(), v.end(), 1);
}
```
The `allocate_shared_noinit` function templates are now implemented simply
using `allocate_shared` with `noinit_adaptor`.
```
template<class T, class A>
enable_if_t<is_unbounded_array_v<T>, shared_ptr<T> >
allocate_shared_noinit(const A& a, size_t n)
{
return allocate_shared<T>(boost::noinit_adapt(a), n);
}
template<class T, class A>
enable_if_t<!is_unbounded_array_v<T>, shared_ptr<T> >
allocate_shared_noinit(const A& a)
{
return allocate_shared<T>(boost::noinit_adapt(a));
}
```
[endsect]
[section Reference]
```
namespace boost {
template<class A>
struct noinit_adaptor
: A {
template<class U>
struct rebind {
typedef noinit_adaptor<allocator_rebind_t<A, U> > other;
};
noinit_adaptor() noexcept;
template<class U>
noinit_adaptor(U&& u) noexcept;
template<class U>
noinit_adaptor(const noinit_adaptor<U>& u) noexcept;
template<class U>
void construct(U* p);
template<class U>
void destroy(U* p);
};
template<class T, class U>
bool operator==(const noinit_adaptor<T>& lhs,
const noinit_adaptor<U>& rhs) noexcept;
template<class T, class U>
bool operator!=(const noinit_adaptor<T>& lhs,
const noinit_adaptor<U>& rhs) noexcept;
template<class A>
noinit_adaptor<A> noinit_adapt(const A& a) noexcept;
} /* boost */
```
[section Constructors]
[variablelist
[[`noinit_adaptor() noexcept;`]
[[variablelist
[[Effects][Value initializes the A base class.]]]]]
[[`template<class U> noinit_adaptor(U&& u) noexcept;`]
[[variablelist
[[Requires][`A` shall be constructible from `U`.]]
[[Effects][Initializes the `A` base class with `std::forward<U>(u)`.]]]]]
[[`template<class U> noinit_adaptor(const noinit_adaptor<U>& u) noexcept;`]
[[variablelist
[[Requires][`A` shall be constructible from `U`.]]
[[Effects][Initializes the `A` base class with
`static_cast<const A&>(u)`.]]]]]]
[endsect]
[section Member functions]
[variablelist
[[`template<class U> void construct(U* p);`]
[[variablelist
[[Effects][`::new((void*)p) U`.]]]]]
[[`template<class U> void destroy(U* p);`]
[[variablelist
[[Effects][`p->~U()`.]]]]]]
[endsect]
[section Operators]
[variablelist
[[`template<class T, class U> constexpr bool
operator==(const noinit_adaptor<T>& lhs,
const noinit_adaptor<U>& rhs) noexcept;`]
[[variablelist
[[Returns][`static_cast<const T&>(lhs) == static_cast<const U&>(rhs)`.]]]]]
[[`template<class T, class U> constexpr bool
operator!=(const noinit_adaptor<T>& lhs,
const noinit_adaptor<U>& rhs) noexcept;`]
[[variablelist
[[Returns][`!(lhs == rhs)`.]]]]]]
[endsect]
[section Free functions]
[variablelist
[[`template<class A> noinit_adaptor<A> noinit_adapt(const A& a) noexcept;`]
[[variablelist
[[Returns][`noinit_adaptor<A>(a)`.]]]]]]
[endsect]
[endsect]
[endsect]

108
doc/nvp.qbk Normal file
View File

@@ -0,0 +1,108 @@
[/
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:nvp nvp]
[section Overview]
The header <boost/core/nvp.hpp> provides the class template `boost::nvp` that
pairs a name (`const char*`) with the address of a value (`T*`). It is the new
implementation of the NVP type previously provided by the Boost Serialization
library. This type now lives in the Core library so that other Boost libraries
can support named value serialization without taking a dependency on the
Serialization library.
[endsect]
[section Examples]
The following snippet shows use in a member serialize function:
```
template<class A>
void serialize(A& archive, unsigned)
{
archive & boost::make_nvp("x", x_) & boost::make_nvp("y", y_);
}
```
[endsect]
[section Reference]
```
namespace boost {
template<class T>
class nvp {
public:
nvp(const char* name, T& value) noexcept;
const char* name() const noexcept;
T& value() const noexcept;
const T& const_value() const noexcept;
};
template<class T>
const nvp<T> make_nvp(const char* name, T& value) noexcept;
} /* boost */
#define BOOST_NVP(object) ``['see below]``
```
[section Constructors]
[variablelist
[[`nvp(const char* name, T& value) noexcept;`]
[Initializes the stored name pointer with `name` and the value pointer with
`addressof(value)`.]]]
[endsect]
[section Members]
[variablelist
[[`const char* name() const noexcept;`]
[Returns a pointer to the name.]]
[[`T& value() const noexcept;`]
[Returns a reference to the value.]]
[[`const T& const_value() const noexcept;`]
[Returns a reference to the value.]]]
[endsect]
[section Functions]
[variablelist
[[`template<class T> const nvp<T> make_nvp(const char* name, T& value)
noexcept;`]
[Returns `nvp<T>(name, value)`.]]]
[endsect]
[section Macros]
[variablelist
[[`#define BOOST_NVP(object) see below`]
[Expands to `boost::make_nvp(BOOST_STRINGIZE(object), object)`.]]]
[endsect]
[endsect]
[section History]
Robert Ramey originally implemented NVP in the Serialization library. Glen
Fernandes implemented this new (but compatible) version in the Core library.
[endsect]
[endsect]

81
doc/pointer_in_range.qbk Normal file
View File

@@ -0,0 +1,81 @@
[/
Copyright 2024 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:pointer_in_range pointer_in_range]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/core/pointer_in_range.hpp> provides the function template
`boost::pointer_in_range` to check if a pointer is in a given range. This
can be used in constant expressions in C++14 or higher when the compiler has a
builtin to support `std::is_constant_evaluated`.
[endsect]
[section Examples]
The following is an example of an allocator's deallocation function that does
nothing if the pointer falls within a small automatically allocated buffer.
```
template<class T, class N>
void
Allocator<T, N>::deallocate(pointer ptr, size_type)
{
if (!boost::pointer_in_range(ptr, buffer_, buffer_ + N)) {
::operator delete(ptr);
}
}
```
[endsect]
[section Reference]
```
namespace boost {
template<class T>
constexpr bool pointer_in_range(const T* ptr, const T* begin, const T* end);
} /* boost */
```
[section Functions]
[variablelist
[[`template<class T> constexpr bool pointer_in_range(const T* ptr,
const T* begin, const T* end);`]
[[variablelist
[[Requires][`[begin,end)` is a valid range.]]
[[Returns][`true` if `ptr` is in range `[begin,end)`, otherwise `false`.]]]]]]
[endsect]
[endsect]
[section Notes]
If `boost::pointer_in_range` is not usable in constant expressions the macro
`BOOST_CORE_NO_CONSTEXPR_POINTER_IN_RANGE` is defined.
[endsect]
[section History]
Glen Fernandes implemented `pointer_in_range`.
[endsect]
[endsect]

View File

@@ -1,5 +1,5 @@
[/
Copyright 2017 Glen Joseph Fernandes
Copyright 2017-2021 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
@@ -20,8 +20,10 @@ The header <boost/core/pointer_traits.hpp> provides the class template
`boost::pointer_traits` to facilitate use of pointer-like types. The C++11
standard library introduced `std::pointer_traits` along with an allocator
model which supported pointer-like types in addition to plain raw pointers.
This implementation also supports C++98, and adds additional functionality
for obtaining raw pointers from pointers.
This implementation also supports C++98.
It also provides the function template `boost::to_address` to obtain a raw
pointer from an object of any pointer-like type.
[endsect]
@@ -45,96 +47,128 @@ void function(Allocator& a)
```
namespace boost {
template<class T> struct pointer_traits {
template<class T>
struct pointer_traits {
typedef T pointer;
typedef ``['see below]`` element_type;
typedef ``['see below]`` difference_type;
template<class U> struct rebind_to { typedef ``['see below]`` type; };
template<class U> using rebind = typename rebind_to<U>::type;
template<class U>
struct rebind_to {
typedef ``['see below]`` type;
};
static pointer pointer_to(``['see below]`` v);
static element_type* to_address(const pointer& v) noexcept;
};
template<class U>
using rebind = typename rebind_to<U>::type;
template<class T> struct pointer_traits<T*> {
static pointer pointer_to(element_type& v);
};
template<class T>
struct pointer_traits<T*> {
typedef T* pointer;
typedef T element_type;
typedef std::ptrdiff_t difference_type;
template<class U> struct rebind_to { typedef U* type; };
template<class U> using rebind = typename rebind_to<U>::type;
template<class U>
struct rebind_to {
typedef U* type;
};
template<class U>
using rebind = typename rebind_to<U>::type;
static pointer pointer_to(``['see below]`` v) noexcept;
static element_type* to_address(pointer v) noexcept;
};
};
template<class T>
typename pointer_traits<T>::element_type* to_address(const T& v) noexcept;
}
template<class T>
constexpr T* to_address(T* v) noexcept;
template<class T>
auto to_address(const T& v) noexcept;
} // boost
```
[section Overview]
If the member type `element_type` is not defined, then all other members are
also not defined (`pointer_traits` is SFINAE-friendly).
[endsect]
[section Member types]
[variablelist
[[`typedef` ['see below] `element_type;`]
[`T::element_type` if such a type exists; otherwise `U` if `T` is a class
template instantiation of the form `Pointer<U, Args>`, where `Args` is zero
or more type arguments; otherwise the specialization is ill-formed.]]
or more type arguments; otherwise the member is not defined.]]
[[`typedef` ['see below] `difference_type;`]
[`T::difference_type` if such a type exists; otherwise `std::ptrdiff_t`.]]
[[`template<class U> struct rebind_to { typedef` ['see below] `type; };`]
[`type` is `T::rebind<U>` if such a type exists; otherwise, `Pointer<V, Args>`
if `T` is a class template instantiation of the form `Pointer<T, Args>`,
where `Args` is zero or more type arguments; otherwise, the instantiation of
`rebind_to` is ill-formed.]]]
where `Args` is zero or more type arguments; otherwise, the member is not
defined.]]]
[note When C++11 template aliases are not supported, the `type` for `rebind` is
`T::rebind<U>::other` if such a type exists.]
[endsect]
[section Member functions]
[variablelist pointer_traits
[[`static pointer pointer_to(`['see below] `v);`]
[variablelist
[[`static pointer pointer_traits::pointer_to(element_type& v);`]
[[variablelist
[[Remark]
[If `element_type` is a void type, the type of `v` is unspecified; otherwise,
it is `element_type&`.]]
[If `element_type` is a void type, or if `T::pointer_to(v)` is not well-formed,
this member is not defined.]]
[[Returns]
[A pointer to `v` obtained by calling `T::pointer_to(v)`.]]]]]
[[`static element_type* to_address(const pointer& v) noexcept;`]
[[variablelist
[[Requires] [`v` is not a null pointer.]]
[[Returns]
[A pointer of type `element_type*` that references the same location
as the argument.]]]]]]
[variablelist pointer_traits<T*>
[[`static pointer pointer_to(`['see below] `v) noexcept;`]
[[`static pointer pointer_traits<T*>::pointer_to(element_type& v) noexcept;`]
[[variablelist
[[Remark]
[If `element_type` is a void type, the type of `v` is unspecified; otherwise,
it is `element_type&`.]]
[[Returns] [The result of `boost::addressof(v)`.]]]]]
[If `element_type` is a void type, this member is not defined.]]
[[Returns][`addressof(v)`.]]]]]]
[endsect]
[section Optional members]
[variablelist
[[`static element_type* to_address(pointer v) noexcept;`]
[[variablelist [[Returns] [The value of `v`.]]]]]]
[[variablelist
[[Returns]
[A pointer of type `element_type*` that references the same location as the
argument `p`.]]
[[Note]
[This function should be the inverse of `pointer_to`. If defined, it
customizes the behavior of the non-member function `to_address`.]]]]]]
[endsect]
[section Free functions]
[variablelist
[[`template<class T> typename pointer_traits<T>::element_type*
to_address(const T& v) noexcept;`]
[[variablelist [[Returns] [`boost::pointer_traits<T>::to_address(v)`.]]]]]]
[[`template<class T> constexpr T* to_address(T* v) noexcept;`]
[[variablelist
[[Returns][`v`.]]]]]
[[`template<class T> auto to_address(const T& v) noexcept;`]
[[variablelist
[[Returns][`pointer_traits<T>::to_address(v)` if that
expression is well-formed, otherwise `to_address(v.operator->())`.]]]]]]
[endsect]
[endsect]
[section Acknowledgments]
[section Acknowledgements]
Glen Fernandes implemented `pointer_traits` with reviews and guidance from
Peter Dimov.
Glen Fernandes implemented `pointer_traits` and `to_address` with reviews and
guidance from Peter Dimov.
[endsect]

40
doc/quick_exit.qbk Normal file
View File

@@ -0,0 +1,40 @@
[/
Copyright 2018 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt
or copy at http://boost.org/LICENSE_1_0.txt
]
[section:quick_exit quick_exit]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/quick_exit.hpp>]
The header `<boost/core/quick_exit.hpp>` defines the function
`void boost::quick_exit(int code)`. It calls the standard C++11 function
[@https://en.cppreference.com/w/cpp/utility/program/quick_exit
`std::quick_exit(code)`], if that is available, and otherwise exits the
process via [@https://en.cppreference.com/w/cpp/utility/program/_Exit
`std::_Exit(code)`] or equivalent.
[section Synopsis]
``
namespace boost
{
[[noreturn]] void quick_exit(int code) noexcept;
}
``
[endsect]
[endsect]
[endsect]

View File

@@ -68,7 +68,7 @@ The type-expression `boost::unwrap_reference<T>::type` is
[xinclude ref_reference.xml]
[section Acknowledgments]
[section Acknowledgements]
`ref` and `cref` were originally part of the Tuple library by
Jaakko J\u00E4rvi. They were "promoted to `boost::` status" by

View File

@@ -46,7 +46,7 @@ The user can portably declare such enumeration as follows:
}
BOOST_SCOPED_ENUM_DECLARE_END(future_errc)
These macros allows to use `future_errc` in almost all the cases as an scoped enum.
These macros allow using `future_errc` in almost all the cases as a scoped enum.
future_errc ev = future_errc::no_state;
@@ -67,9 +67,9 @@ The enumeration can be forward declared:
BOOST_SCOPED_ENUM_FORWARD_DECLARE(future_errc);
There are however some limitations. First, the emulated scoped enum is not a C++ enum, so `is_enum< future_errc >` will be `false_type`.
There are however some limitations. The emulated scoped enum is not a C++ enum, so `is_enum< future_errc >` will be `false_type`.
Second, the emulated scoped enum can not be used in switch nor in template arguments. For these cases the user needs to use some helpers. Instead of
The emulated scoped enum can not be used in switch nor in template arguments. For these cases the user needs to use some helpers. Instead of
switch (ev)
{
@@ -99,10 +99,29 @@ use
{
};
Lastly, explicit conversion to the underlying type should be performed with `boost::underlying_cast` instead of `static_cast`:
Explicit conversion to the underlying type should be performed with `boost::underlying_cast` instead of `static_cast`:
unsigned int val = boost::underlying_cast< unsigned int >(ev);
In C++03, scoped enums behave differently in case of calling an overloaded function when one overload takes a scoped enum as a parameter, and the other takes a parameter of an integral type. Consider the following code:
enum enum_regular { REGULAR_A, REGULAR_B };
BOOST_SCOPED_ENUM_DECLARE_BEGIN(enum_scoped)
{
a, b
}
BOOST_SCOPED_ENUM_DECLARE_END(enum_scoped)
void regular_or_int(enum_regular); // (1)
void regular_or_int(int); // (2)
void scoped_or_int(enum_scoped); // (3)
void scoped_or_int(int); // (4)
regular_or_int(REGULAR_A); // calls (1) in C++03 and C++11
scoped_or_int(enum_scoped::a); // calls (3) in C++11 but (4) in C++03!
scoped_or_int(enum_scoped(enum_scoped::a)); // calls (3) in C++03 and C++11
Here is usage example:
BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(algae, char)
@@ -160,7 +179,7 @@ such cases.
[endsect]
[section Acknowledgments]
[section Acknowledgements]
This scoped enum emulation was developed by Beman Dawes, Vicente J. Botet Escriba and Anthony Williams.

145
doc/serialization.qbk Normal file
View File

@@ -0,0 +1,145 @@
[/
Copyright 2023 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt
]
[section:serialization serialization]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/serialization.hpp>]
The header `<boost/core/serialization.hpp>` implements primitives
that are necessary to implement Boost.Serialization support without
including a Boost.Serialization header and thereby making a library
dependent on Boost.Serialization.
[section Synopsis]
``
#include <boost/core/nvp.hpp>
namespace boost
{
namespace serialization
{
// forward declarations
template<class T> struct version;
class access;
// core_version_type
struct core_version_type;
} // namespace serialization
namespace core
{
// nvp
using serialization::nvp;
using serialization::make_nvp;
// split_free
template<class Ar, class T> void split_free( Ar& ar, T& t, unsigned int v );
// split_member
template<class Ar, class T> void split_member( Ar& ar, T& t, unsigned int v );
// load_construct_data_adl
template<class Ar, class T> void load_construct_data_adl( Ar& ar, T* t, unsigned int v );
// save_construct_data_adl
template<class Ar, class T> void save_construct_data_adl( Ar& ar, T const* t, unsigned int v );
} // namespace core
} // namespace boost
``
[endsect]
[section `core_version_type`]
``
struct core_version_type
{
unsigned int version_;
core_version_type( unsigned int version ): version_( version ) {}
operator unsigned int () const { return version_; }
};
``
`core_version_type` is a Core reimplementation of
`boost::serialization::version_type`, needed to call ADL serialization
primitives such as, for example, `load_construct_data` below.
It's defined in the `serialization` namespace instead of the `core`
namespace because its only purpose is to add `boost::serialization` to
the list of the associated namespaces of the corresponding call.
[endsect]
[section `split_free`]
`template<class Ar, class T> inline void split_free( Ar& ar, T& t, unsigned int v );`
`boost::core::split_free` is a Core reimplementation of
`boost::serialization::split_free`.
* *Effects:*
* If `Ar::is_saving::value` is `true`, calls `save( ar, t, core_version_type( v ) )`;
* Otherwise, calls `load( ar, t, core_version_type( v ) )`.
[endsect]
[section `split_member`]
`template<class Ar, class T> void split_member( Ar& ar, T& t, unsigned int v );`
`boost::core::split_member` is a Core reimplementation of
`boost::serialization::split_member`.
* *Effects:*
* If `Ar::is_saving::value` is `true`, calls `t.save( ar, v )`;
* Otherwise, calls `t.load( ar, v )`.
[endsect]
[section `load_construct_data_adl`]
`template<class Ar, class T> void load_construct_data_adl( Ar& ar, T* t, unsigned int v );`
`boost::core::load_construct_data_adl` is a Core reimplementation of
`boost::serialization::load_construct_data_adl`.
* *Effects:* `load_construct_data( ar, t, serialization::core_version_type( v ) );`.
[endsect]
[section `save_construct_data_adl`]
`template<class Ar, class T> void save_construct_data_adl( Ar& ar, T const* t, unsigned int v );`
`boost::core::save_construct_data_adl` is a Core reimplementation of
`boost::serialization::save_construct_data_adl`.
* *Effects:* `save_construct_data( ar, t, serialization::core_version_type( v ) );`.
[endsect]
[endsect]
[endsect]

54
doc/size.qbk Normal file
View File

@@ -0,0 +1,54 @@
[/
Copyright 2023 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:size size]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
The header <boost/core/size.hpp> provides function templates `size` to obtain
the number of elements in a range.
[endsect]
[section Reference]
```
namespace boost {
template<class C>
constexpr auto
size(const C& c) noexcept(noexcept(c.size())) -> decltype(c.size());
template<class T, std::size_t N>
constexpr std::size_t
size(T(&)[N]) noexcept;
} /* boost */
```
[section Functions]
[variablelist
[[`template<class C> constexpr auto size(const C& c)
noexcept(noexcept(c.size())) -> decltype(c.size());`]
[Returns `c.size()`.]]
[[`template<class T, std::size_t N> constexpr std::size_t size(T(&)[N])
noexcept;`]
[Returns `N`.]]]
[endsect]
[endsect]
[endsect]

47
doc/snprintf.qbk Normal file
View File

@@ -0,0 +1,47 @@
[/
/ Copyright (c) 2022 Andrey Semashev
/
/ 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)
/]
[section:snprintf snprintf]
[simplesect Authors]
* Andrey Semashev
[endsimplesect]
[section Header <boost/core/snprintf.hpp>]
The header `<boost/core/snprintf.hpp>` provides portable definition of [@https://en.cppreference.com/w/c/io/fprintf `snprintf`],
`vsnprintf` and their corresponding `wchar_t` counterparts. On a platform that supports these functions in the standard library,
these definitions are equivalent to the standard functions. On other platforms (mainly, older MSVC versions) these functions
are emulated through non-standard functions that have similar behavior.
Depending on the standard library, certain implementation differences are exposed to the user:
* Any non-standard behavior with respect to string format description are not hidden by the emulation.
* Returned value of `boost::core::snprintf` in case if the output buffer is too small may not be equal to the number of characters
that would have been written if the buffer was large enough. It is, however, equal or larger than the buffer size,
which still allows the caller to detect the buffer overflow condition. The formatted output is still properly null-terminated
in this case.
[note Unlike `snprintf`, `swprintf` does not return the number of characters to be written if the output buffer is too small
but returns -1 instead. Furthermore, `swprintf` may or may not produce characters in the output buffer in this case.]
[section Example]
``
char buf[10];
int n = boost::core::snprintf(buf, sizeof(buf), "%d", i);
if (n < 0)
throw std::runtime_error("Formatting error");
if (n >= sizeof(buf))
throw std::runtime_error("Formatting buffer overflow");
``
[endsect]
[endsect]
[endsect]

396
doc/span.qbk Normal file
View File

@@ -0,0 +1,396 @@
[/
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:span span]
[simplesect Authors]
* Glen Fernandes
[endsimplesect]
[section Overview]
This header <boost/core/span.hpp> provides class template `span`, which is a
view over a sequence of objects. It implements the C++20 standard library
`std::span` facility. This implementation supports C++11 and higher.
In addition to referencing the sequence of objects, the span knows the count of
objects. There are two kinds of spans:
* Dynamic size (`span<T>` or `span<T, dynamic_extent>`)
* Static size (`span<T, N>`)
Dynamic size spans have a count that can be a value known at run time. Static
size spans have a count that must be known at compile time.
[endsect]
[section Examples]
The following snippet shows a function to compute a SHA1 hash whose parameters
and return type use spans.
```
auto sha1(boost::span<const unsigned char> input,
boost::span<unsigned char, SHA_DIGEST_LENGTH> ouput)
{
SHA_CTX context;
SHA1_Init(&context);
SHA1_Update(&context, input.data(), input.size());
SHA1_Final(output.data(), &context);
return output;
}
```
[endsect]
[section Reference]
```
namespace boost {
constexpr std::size_t dynamic_extent = -1;
template<class T, std::size_t E = dynamic_extent>
class span {
public:
typedef T element_type;
typedef std::remove_cv_t<T> value_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
typedef T* iterator;
typedef const T* const_iterator;
typedef std::reverse_iterator<T*> reverse_iterator;
typedef std::reverse_iterator<const T*> const_reverse_iterator;
static constexpr std::size_t extent = E;
constexpr span() noexcept;
explicit(E != dynamic_extent)
template<class I>
constexpr span(I* f, size_type c);
explicit(E != dynamic_extent)
template<class I, class L>
constexpr span(I* f, L* l);
template<std::size_t N>
constexpr span(type_identity_t<T> (&a)[N]);
template<class U, std::size_t N>
constexpr span(std::array<U, N>& a) noexcept;
template<class U, std::size_t N>
constexpr span(const std::array<U, N>& a) noexcept;
explicit(E != dynamic_extent)
template<class R>
constexpr span(R&& r);
explicit(E != dynamic_extent && N == dynamic_extent)
template<class U, std::size_t N>
constexpr span(const span<U, N>& s) noexcept;
template<std::size_t C>
constexpr span<T, C> first() const;
template<std::size_t C>
constexpr span<T, C> last() const;
template<std::size_t O, std::size_t C = dynamic_extent>
constexpr span<T, see below> subspan() const;
constexpr span<T, dynamic_extent> first(size_type c) const;
constexpr span<T, dynamic_extent> last(size_type c) const;
constexpr span<T, dynamic_extent> subspan(size_type o,
size_type c = dynamic_extent) const;
constexpr size_type size() const noexcept;
constexpr size_type size_bytes() const noexcept;
constexpr bool empty() const noexcept;
constexpr reference operator[](size_type i) const;
constexpr reference front() const;
constexpr reference back() const;
constexpr pointer data() const noexcept;
constexpr iterator begin() const noexcept;
constexpr iterator end() const noexcept;
constexpr reverse_iterator rbegin() const noexcept;
constexpr reverse_iterator rend() const noexcept;
constexpr const_iterator cbegin() const noexcept;
constexpr const_iterator cend() const noexcept;
constexpr const_reverse_iterator crbegin() const noexcept;
constexpr const_reverse_iterator crend() const noexcept;
};
template<class I, class L>
span(I*, L) -> span<I>;
template<class T, std::size_t N>
span(T(&)[N]) -> span<T, N>;
template<class T, std::size_t N>
span(std::array<T, N>&) -> span<T, N>;
template<class T, std::size_t N>
span(const std::array<T, N>&) -> span<const T, N>;
template<class R>
span(R&&) -> span<remove_pointer_t<iterator_t<R> > >;
template<class T, std::size_t E>
span<const std::byte, E == dynamic_extent ? dynamic_extent : sizeof(T) * E>
as_bytes(span<T, E> s) noexcept;
template<class T, std::size_t E>
span<std::byte, E == dynamic_extent ? dynamic_extent : sizeof(T) * E>
as_writable_bytes(span<T, E> s) noexcept;
} /* boost */
```
[section Constructors]
[variablelist
[[`constexpr span() noexcept;`]
[[variablelist
[[Constraints][`E == dynamic_extent || E == 0` is `true`.]]
[[Postconditions][`size() == 0 && data() == nullptr`.]]]]]
[[`explicit(E != dynamic_extent)
template<class I>
constexpr span(I* f, size_type c);`]
[[variablelist
[[Constraints]
[`is_convertible_v<I(*)[], T(*)[]>` is `true`.]]
[[Preconditions]
[[itemized_list
[`[f, f + c)` is a valid range.]
[If `E` is not equal to `dynamic_extent`, then `c` is equal to `E`.]]]]
[[Effects][Constructs a `span` with data `f` and size `c`.]]
[[Throws][Nothing.]]]]]
[[`explicit(E != dynamic_extent)
template<class I, class L>
constexpr span(I* f, L* l);`]
[[variablelist
[[Constraints]
[`is_convertible_v<I(*)[], T(*)[]>` is `true`.]]
[[Preconditions]
[[itemized_list
[If `E` is not equal to `dynamic_extent`, then `l - f` is equal to `E`.]
[`[f, l)` is a valid range.]]]]
[[Effects][Constructs a `span` with data `f` and size `l - f`.]]
[[Throws][Nothing.]]]]]
[[`template<std::size_t N>
constexpr span(type_identity_t<T> (&a)[N]);`]
[[variablelist
[[Constraints][`E == dynamic_extent || E == N` is `true`.]]
[[Effects][Constructs a `span` that is a view over the supplied array.]]
[[Postconditions][`size() == N && data() == &a[0]` is `true`.]]]]]
[[`template<class U, std::size_t N>
constexpr span(std::array<U, N>& a) noexcept;`]
[[variablelist
[[Constraints]
[[itemized_list
[`E == dynamic_extent || E == N` is `true`, and]
[`U(*)[]` is convertible to `T(*)[]`.]]]]
[[Effects][Constructs a `span` that is a view over the supplied array.]]
[[Postconditions][`size() == N && data() == a.data()` is `true`.]]]]]
[[`template<class U, std::size_t N>
constexpr span(const std::array<U, N>& a) noexcept;`]
[[variablelist
[[Constraints]
[[itemized_list
[`E == dynamic_extent || E == N` is `true`, and]
[`U(*)[]` is convertible to `T(*)[]`.]]]]
[[Effects][Constructs a `span` that is a view over the supplied array.]]
[[Postconditions][`size() == N && data() == a.data()` is `true`.]]]]]
[[`explicit(E != dynamic_extent)
template<class R>
constexpr span(R&& r);`]
[[variablelist
[[Constraints]
[[itemized_list
[`is_lvalue_reference_v<R> || is_const_v<T>` is `true`]
[`remove_cvref_t<R>` is not a specialization of `span`,]
[`remove_cvref_t<R>` is not a specialization of `array`,]
[`is_array_v<remove_cvref_t<R>>` is `false`,]
[`data(r)` is well-formed and
`is_convertible_v<remove_pointer_t<iterator_t<R> >(*)[],
T(*)[]>` is `true`, and]
[`r.size()` is well-formed and
`is_convertible_v<decltype(declval<R&>().size()), size_t>` is `true`.]]]]
[[Effects][Constructs a `span` with data `data(r)` and size `r.size()`.]]
[[Throws][What and when data(r) and r.size() throw.]]]]]
[[`explicit(E != dynamic_extent && N == dynamic_extent)
template<class U, std::size_t N>
constexpr span(const span<U, N>& s) noexcept;`]
[[variablelist
[[Constraints]
[[itemized_list
[`E == dynamic_extent || N == dynamic_extent || E == N` is `true`, and]
[`is_convertible_v<U(*)[], T(*)[]>` is `true`.]]]]
[[Preconditions]
[If `E` is not equal to `dynamic_extent`, then `s.size()` is equal to `E`.]]
[[Effects]
[Constructs a `span` that is a view over the range
`[s.data(), s.data() + s.size())`.]]
[[Postconditions][`size() == s.size() && data() == s.data()`.]]]]]]
[endsect]
[section Subviews]
[variablelist
[[`template<std::size_t C> constexpr span<T, C> first() const;`]
[[variablelist
[[Mandates][`C <= E` is `true`.]]
[[Preconditions][`C <= size()` is `true`.]]
[[Effects]
[Equivalent to `return R{data(), C};` where `R` is the return type.]]]]]
[[`template<std::size_t C> constexpr span<T, C> last() const;`]
[[variablelist
[[Mandates][`C <= E` is `true`.]]
[[Preconditions][`C <= size()` is `true`.]]
[[Effects]
[Equivalent to `return R{data() + (size() - C), C};` where `R` is the return
type.]]]]]
[[`template<std::size_t O, std::size_t C = dynamic_extent>
constexpr span<T, see below> subspan() const;`]
[[variablelist
[[Mandates][`O <= E && (C == dynamic_extent || C <= E - O)` is `true`.]]
[[Preconditions]
[`O <= size() && (C == dynamic_extent || C <= size() - O)` is `true`.]]
[[Effects]
[Equivalent to
`return span<T, see below>(data() + O,
C != dynamic_extent ? C : size() - O);`.]]
[[Remarks]
[The second template argument of the returned span type is:
`C != dynamic_extent ? C : (E != dynamic_extent ? E - O :
dynamic_extent)`]]]]]
[[`constexpr span<T, dynamic_extent> first(size_type c) const;`]
[[variablelist
[[Preconditions][`c <= size()` is `true`.]]
[[Effects][Equivalent to: `return {data(), c};`]]]]]
[[`constexpr span<T, dynamic_extent> last(size_type c) const;`]
[[variablelist
[[Preconditions][`c <= size()` is `true`.]]
[[Effects][Equivalent to: `return {data() + (size() - c), c};`]]]]]
[[`constexpr span<T, dynamic_extent> subspan(size_type o,
size_type c = dynamic_extent) const;`]
[[variablelist
[[Preconditions]
[`o <= size() && (c == dynamic_extent || o + c <= size())` is `true`.]]
[[Effects]
[Equivalent to:
`return {data() + o, c == dynamic_extent ? size() - o : c};`]]]]]]
[endsect]
[section Observers]
[variablelist
[[`constexpr size_type size() const noexcept;`]
[[variablelist
[[Returns][The number of elements in the span.]]]]]
[[`constexpr size_type size_bytes() const noexcept;`]
[[variablelist
[[Effects][Equivalent to: `return size() * sizeof(T);`]]]]]
[[`constexpr bool empty() const noexcept;`]
[[variablelist
[[Effects][Equivalent to: `return size() == 0;`]]]]]]
[endsect]
[section Element access]
[variablelist
[[`constexpr reference operator[](size_type i) const;`]
[[variablelist
[[Preconditions][`i < size()` is `true`.]]
[[Effects][Equivalent to: `return *(data() + i);`]]]]]
[[`constexpr reference front() const;`]
[[variablelist
[[Preconditions][`empty()` is `false`.]]
[[Effects][Equivalent to: `return *data();`]]]]]
[[`constexpr reference back() const;`]
[[variablelist
[[Preconditions][`empty()` is `false`.]]
[[Effects][Equivalent to: `return *(data() + (size() - 1);`]]]]]
[[`constexpr pointer data() const noexcept;`]
[[variablelist
[[Returns][A pointer to the first element in the span.]]]]]]
[endsect]
[section Iterator support]
[variablelist
[[`constexpr iterator begin() const noexcept;`]
[[variablelist
[[Returns][A constant iterator referring to the first element in the span. If `empty()`,
then it returns the same value as `cend()`.]]]]]
[[`constexpr iterator end() const noexcept;`]
[[variablelist
[[Returns][A constant iterator which is the past-the-end value.]]]]]
[[`constexpr reverse_iterator rbegin() const noexcept;`]
[[variablelist
[[Effects][Equivalent to: `return reverse_iterator(end());`]]]]]
[[`constexpr reverse_iterator rend() const noexcept;`]
[[variablelist
[[Effects][Equivalent to: `return reverse_iterator(begin());`]]]]]
[[`constexpr const_iterator cbegin() const noexcept;`]
[[variablelist
[[Returns]
[A constant iterator referring to the first element in the span. If `empty()`,
then it returns the same value as `cend()`.]]]]]
[[`constexpr const_iterator cend() const noexcept;`]
[[variablelist
[[Returns][A constant iterator which is the past-the-end value.]]]]]
[[`constexpr const_reverse_iterator crbegin() const noexcept;`]
[[variablelist
[[Effects][Equivalent to: `return const_reverse_iterator(cend());`]]]]]
[[`constexpr const_reverse_iterator crend() const noexcept;`]
[[variablelist
[[Effects]
[Equivalent to: `return const_reverse_iterator(cbegin());`]]]]]]
[endsect]
[section Views of object representation]
[variablelist
[[`template<class T, std::size_t E>
span<const std::byte, E == dynamic_extent ? dynamic_extent : sizeof(T) * E>
as_bytes(span<T, E> s) noexcept;`]
[[variablelist
[[Effects]
[Equivalent to:
`return {reinterpret_cast<const byte*>(s.data()), s.size_bytes()};`.]]]]]
[[`template<class T, std::size_t E>
span<std::byte, E == dynamic_extent ? dynamic_extent : sizeof(T) * E>
as_writable_bytes(span<T, E> s) noexcept;`]
[[variablelist
[[Constraints][`is_const_v<T>` is `false`.]]
[[Effects]
[Equivalent to: `return R{reinterpret_cast<byte*>(s.data()), s.size_bytes()};`
where `R` is the return type.]]]]]]
[endsect]
[endsect]
[endsect]

768
doc/string_view.qbk Normal file
View File

@@ -0,0 +1,768 @@
[/
Copyright 2021 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt
]
[section:string_view string_view]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/string_view.hpp>]
The header `<boost/core/string_view.hpp>` defines `boost::core::string_view`,
a portable and interoperable implementation of `std::string_view`.
Unlike `boost::string_view`, `boost::core::string_view` has implicit
conversions from and to `std::string_view`, which allows Boost libraries that
support C++11/C++14 to use it in interfaces without forcing users to forgo the
use of `std::string_view` in their code.
[section Synopsis]
``
namespace boost
{
namespace core
{
template<class Ch> class basic_string_view
{
public:
// types
typedef std::char_traits<Ch> traits_type;
typedef Ch value_type;
typedef Ch* pointer;
typedef Ch const* const_pointer;
typedef Ch& reference;
typedef Ch const& const_reference;
typedef Ch const* const_iterator;
typedef const_iterator iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef const_reverse_iterator reverse_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
// npos
static constexpr size_type npos = static_cast<size_type>( -1 );
public:
// construction and assignment
constexpr basic_string_view() noexcept;
constexpr basic_string_view( basic_string_view const& ) noexcept = default;
constexpr basic_string_view& operator=( basic_string_view const& ) noexcept & = default;
constexpr basic_string_view( Ch const* str ) noexcept;
constexpr basic_string_view( Ch const* str, size_type len ) noexcept;
constexpr basic_string_view( Ch const* begin, Ch const* end ) noexcept;
template<class A> basic_string_view( std::basic_string<Ch, std::char_traits<Ch>, A> const& str ) noexcept;
basic_string_view( std::basic_string_view<Ch, std::char_traits<Ch>> const& str ) noexcept;
// conversions
template<class A> operator std::basic_string<Ch, std::char_traits<Ch>, A>() const;
template<class Ch2> operator std::basic_string_view<Ch2>() const noexcept;
// iterator support
constexpr const_iterator begin() const noexcept;
constexpr const_iterator end() const noexcept;
constexpr const_iterator cbegin() const noexcept;
constexpr const_iterator cend() const noexcept;
constexpr const_reverse_iterator rbegin() const noexcept;
constexpr const_reverse_iterator rend() const noexcept;
constexpr const_reverse_iterator crbegin() const noexcept;
constexpr const_reverse_iterator crend() const noexcept;
// capacity
constexpr size_type size() const noexcept;
constexpr size_type length() const noexcept;
constexpr size_type max_size() const noexcept;
constexpr bool empty() const noexcept;
// element access
constexpr const_reference operator[]( size_type pos ) const noexcept;
constexpr const_reference at( size_type pos ) const;
constexpr const_reference front() const noexcept;
constexpr const_reference back() const noexcept;
constexpr const_pointer data() const noexcept;
// modifiers
constexpr void remove_prefix( size_type n ) noexcept;
constexpr void remove_suffix( size_type n ) noexcept;
constexpr void swap( basic_string_view& s ) noexcept;
// string operations
constexpr size_type copy( Ch* s, size_type n, size_type pos = 0 ) const;
constexpr basic_string_view substr( size_type pos = 0, size_type n = npos ) const;
// compare
constexpr int compare( basic_string_view str ) const noexcept;
constexpr int compare( size_type pos1, size_type n1, basic_string_view str ) const;
constexpr int compare( size_type pos1, size_type n1, basic_string_view str, size_type pos2, size_type n2 ) const;
constexpr int compare( Ch const* s ) const;
constexpr int compare( size_type pos1, size_type n1, Ch const* s ) const;
constexpr int compare( size_type pos1, size_type n1, Ch const* s, size_type n2 ) const;
// starts_with
constexpr bool starts_with( basic_string_view x ) const noexcept;
constexpr bool starts_with( Ch x ) const noexcept;
constexpr bool starts_with( Ch const* x ) const noexcept;
// ends_with
constexpr bool ends_with( basic_string_view x ) const noexcept;
constexpr bool ends_with( Ch x ) const noexcept;
constexpr bool ends_with( Ch const* x ) const noexcept;
// find
constexpr size_type find( basic_string_view str, size_type pos = 0 ) const noexcept;
constexpr size_type find( Ch c, size_type pos = 0 ) const noexcept;
constexpr size_type find( Ch const* s, size_type pos, size_type n ) const noexcept;
constexpr size_type find( Ch const* s, size_type pos = 0 ) const noexcept;
// rfind
constexpr size_type rfind( basic_string_view str, size_type pos = npos ) const noexcept;
constexpr size_type rfind( Ch c, size_type pos = npos ) const noexcept;
constexpr size_type rfind( Ch const* s, size_type pos, size_type n ) const noexcept;
constexpr size_type rfind( Ch const* s, size_type pos = npos ) const noexcept;
// find_first_of
constexpr size_type find_first_of( basic_string_view str, size_type pos = 0 ) const noexcept;
constexpr size_type find_first_of( Ch c, size_type pos = 0 ) const noexcept;
constexpr size_type find_first_of( Ch const* s, size_type pos, size_type n ) const noexcept;
constexpr size_type find_first_of( Ch const* s, size_type pos = 0 ) const noexcept;
// find_last_of
constexpr size_type find_last_of( basic_string_view str, size_type pos = npos ) const noexcept;
constexpr size_type find_last_of( Ch c, size_type pos = npos ) const noexcept;
constexpr size_type find_last_of( Ch const* s, size_type pos, size_type n ) const noexcept;
constexpr size_type find_last_of( Ch const* s, size_type pos = npos ) const noexcept;
// find_first_not_of
constexpr size_type find_first_not_of( basic_string_view str, size_type pos = 0 ) const noexcept;
constexpr size_type find_first_not_of( Ch c, size_type pos = 0 ) const noexcept;
constexpr size_type find_first_not_of( Ch const* s, size_type pos, size_type n ) const noexcept;
constexpr size_type find_first_not_of( Ch const* s, size_type pos = 0 ) const noexcept;
// find_last_not_of
constexpr size_type find_last_not_of( basic_string_view str, size_type pos = npos ) const noexcept;
constexpr size_type find_last_not_of( Ch c, size_type pos = npos ) const noexcept;
constexpr size_type find_last_not_of( Ch const* s, size_type pos, size_type n ) const noexcept;
constexpr size_type find_last_not_of( Ch const* s, size_type pos = npos ) const noexcept;
// contains
constexpr bool contains( basic_string_view sv ) const noexcept;
constexpr bool contains( Ch c ) const noexcept;
constexpr bool contains( Ch const* s ) const noexcept;
// relational operators
constexpr friend bool operator==( basic_string_view sv1, basic_string_view sv2 ) noexcept;
constexpr friend bool operator!=( basic_string_view sv1, basic_string_view sv2 ) noexcept;
constexpr friend bool operator<( basic_string_view sv1, basic_string_view sv2 ) noexcept;
constexpr friend bool operator<=( basic_string_view sv1, basic_string_view sv2 ) noexcept;
constexpr friend bool operator>( basic_string_view sv1, basic_string_view sv2 ) noexcept;
constexpr friend bool operator>=( basic_string_view sv1, basic_string_view sv2 ) noexcept;
};
// stream inserter
template<class Ch> std::basic_ostream<Ch>& operator<<( std::basic_ostream<Ch>& os, basic_string_view<Ch> str );
// typedef names
typedef basic_string_view<char> string_view;
typedef basic_string_view<wchar_t> wstring_view;
typedef basic_string_view<char16_t> u16string_view;
typedef basic_string_view<char32_t> u32string_view;
typedef basic_string_view<char8_t> u8string_view;
} // namespace core
} // namespace boost
``
[endsect]
[section Construction]
[section `constexpr basic_string_view() noexcept;`]
* *Ensures:* `data() == 0`; `size() == 0`.
[endsect]
[section `constexpr basic_string_view( Ch const* str ) noexcept;`]
* *Ensures:* `data() == str`; `size() == traits_type::length( str )`.
[endsect]
[section `constexpr basic_string_view( Ch const* str, size_type len ) noexcept;`]
* *Ensures:* `data() == str`; `size() == len`.
[endsect]
[section `constexpr basic_string_view( Ch const* begin, Ch const* end ) noexcept;`]
* *Requires:* `end >= begin`.
* *Ensures:* `data() == begin`; `size() == end - begin`.
[endsect]
[section `template<class A> basic_string_view( std::basic_string<Ch, std::char_traits<Ch>, A> const& str ) noexcept;`]
* *Ensures:* `data() == str.data()`; `size() == str.size()`.
[endsect]
[section `basic_string_view( std::basic_string_view<Ch, std::char_traits<Ch>> const& str ) noexcept;`]
* *Ensures:* `data() == str.data()`; `size() == str.size()`.
[endsect]
[endsect]
[section Conversions]
[section `template<class A> operator std::basic_string<Ch, std::char_traits<Ch>, A>() const;`]
* *Returns:* `std::basic_string<Ch, std::char_traits<Ch>, A>( data(), size() )`.
[endsect]
[section `template<class Ch2> operator std::basic_string_view<Ch2>() const noexcept;`]
* *Constraints:* `Ch2` is the same type as `Ch`.
* *Returns:* `std::basic_string_view<Ch2>( data(), size() )`.
[endsect]
[endsect]
[section Iterator Support]
[section `constexpr const_iterator begin() const noexcept;`]
* *Returns:* `data()`.
[endsect]
[section `constexpr const_iterator end() const noexcept;`]
* *Returns:* `data() + size()`.
[endsect]
[section `constexpr const_iterator cbegin() const noexcept;`]
* *Returns:* `begin()`.
[endsect]
[section `constexpr const_iterator cend() const noexcept;`]
* *Returns:* `end()`.
[endsect]
[section `constexpr const_reverse_iterator rbegin() const noexcept;`]
* *Returns:* `const_reverse_iterator( end() )`.
[endsect]
[section `constexpr const_reverse_iterator rend() const noexcept;`]
* *Returns:* `const_reverse_iterator( begin() )`.
[endsect]
[section `constexpr const_reverse_iterator crbegin() const noexcept;`]
* *Returns:* `rbegin()`.
[endsect]
[section `constexpr const_reverse_iterator crend() const noexcept;`]
* *Returns:* `rend()`.
[endsect]
[endsect]
[section Capacity]
[section `constexpr size_type size() const noexcept;`]
* *Returns:* the length of the referenced character sequence.
[endsect]
[section `constexpr size_type length() const noexcept;`]
* *Returns:* `size()`.
[endsect]
[section `constexpr size_type max_size() const noexcept;`]
* *Returns:* `std::numeric_limits<size_type>::max() / sizeof(Ch)`.
[endsect]
[section `constexpr bool empty() const noexcept;`]
* *Returns:* `size() == 0`.
[endsect]
[endsect]
[section Element Access]
[section `constexpr const_reference operator[]( size_type pos ) const noexcept;`]
* *Requires:* `pos < size()`.
* *Returns:* `data()[ pos ]`.
[endsect]
[section `constexpr const_reference at( size_type pos ) const;`]
* *Returns:* `data()[ pos ]`.
* *Throws:* `std::out_of_range` when `pos >= size()`.
[endsect]
[section `constexpr const_reference front() const noexcept;`]
* *Requires:* `!empty()`.
* *Returns:* `data()[ 0 ]`.
[endsect]
[section `constexpr const_reference back() const noexcept;`]
* *Requires:* `!empty()`.
* *Returns:* `data()[ size() - 1 ]`.
[endsect]
[section `constexpr const_pointer data() const noexcept;`]
* *Returns:* a pointer to the beginning of the referenced character sequence.
[endsect]
[endsect]
[section Modifiers]
[section `constexpr void remove_prefix( size_type n ) noexcept;`]
* *Requires:* `n <= size()`.
* *Effects:* advances `data()` by `n` and decreases `size()` by `n`.
[endsect]
[section `constexpr void remove_suffix( size_type n ) noexcept;`]
* *Requires:* `n <= size()`.
* *Effects:* decreases `size()` by `n`.
[endsect]
[section `constexpr void swap( basic_string_view& s ) noexcept;`]
* *Effects:* exchanges the contents of `*this` and `s`.
[endsect]
[endsect]
[section String Operations]
[section copy]
[section `constexpr size_type copy( Ch* s, size_type n, size_type pos = 0 ) const;`]
* *Effects:* copies to `s` the contents of `substr( pos, n )`.
* *Throws:* `std::out_of_range` when `pos >= size()`.
[endsect]
[endsect]
[section substr]
[section `constexpr basic_string_view substr( size_type pos = 0, size_type n = npos ) const;`]
* *Returns:* `basic_string_view( data() + pos, std::min( size() - pos, n ) )`.
* *Throws:* `std::out_of_range` when `pos >= size()`.
[endsect]
[endsect]
[section compare]
[section `constexpr int compare( basic_string_view str ) const noexcept;`]
* *Returns:*
* if `traits_type::compare( data(), str.data(), std::min( size(), str.size() ) )` is not zero, returns it. Otherwise,
* if `size() < str.size()`, returns a negative number. Otherwise,
* if `size() > str.size()`, returns a positive number. Otherwise,
* returns 0.
[endsect]
[section `constexpr int compare( size_type pos1, size_type n1, basic_string_view str ) const;`]
* *Returns:* `substr( pos1, n1 ).compare( str )`.
[endsect]
[section `constexpr int compare( size_type pos1, size_type n1, basic_string_view str, size_type pos2, size_type n2 ) const;`]
* *Returns:* `substr( pos1, n1 ).compare( str.substr( pos2, n2 ) )`.
[endsect]
[section `constexpr int compare( Ch const* s ) const noexcept;`]
* *Returns:* `compare( basic_string_view( s ) )`.
[endsect]
[section `constexpr int compare( size_type pos1, size_type n1, Ch const* s ) const;`]
* *Returns:* `substr( pos1, n1 ).compare( basic_string_view( s ) )`.
[endsect]
[section `constexpr int compare( size_type pos1, size_type n1, Ch const* s, size_type n2 ) const;`]
* *Returns:* `substr( pos1, n1 ).compare( basic_string_view( s, n2 ) )`.
[endsect]
[endsect]
[section starts_with]
[section `constexpr bool starts_with( basic_string_view x ) const noexcept;`]
* *Returns:* `substr( 0, x.size() ) == x`.
[endsect]
[section `constexpr bool starts_with( Ch x ) const noexcept;`]
* *Returns:* `starts_with( basic_string_view( &x, 1 ) )`.
[endsect]
[section `constexpr bool starts_with( Ch const* x ) const noexcept;`]
* *Returns:* `starts_with( basic_string_view( x ) )`.
[endsect]
[endsect]
[section ends_with]
[section `constexpr bool ends_with( basic_string_view x ) const noexcept;`]
* *Returns:* `size() >= x.size() && substr( size() - x.size(), x.size() ) == x`.
[endsect]
[section `constexpr bool ends_with( Ch x ) const noexcept;`]
* *Returns:* `ends_with( basic_string_view( &x, 1 ) )`.
[endsect]
[section `constexpr bool ends_with( Ch const* x ) const noexcept;`]
* *Returns:* `ends_with( basic_string_view( x ) )`.
[endsect]
[endsect]
[endsect]
[section Searching]
[section find]
[section `constexpr size_type find( basic_string_view str, size_type pos = 0 ) const noexcept;`]
* *Returns:* The lowest position `i` such that `i >= pos` and `substr( i, str.size() ) == str`, or `npos` if such a position doesn't exist.
[endsect]
[section `constexpr size_type find( Ch c, size_type pos = 0 ) const noexcept;`]
* *Returns:* `find( basic_string_view( &c, 1 ), pos )`.
[endsect]
[section `constexpr size_type find( Ch const* s, size_type pos, size_type n ) const noexcept;`]
* *Returns:* `find( basic_string_view( s, n ), pos )`.
[endsect]
[section `constexpr size_type find( Ch const* s, size_type pos = 0 ) const noexcept;`]
* *Returns:* `find( basic_string_view( s ), pos )`.
[endsect]
[endsect]
[section rfind]
[section `constexpr size_type rfind( basic_string_view str, size_type pos = npos ) const noexcept;`]
* *Returns:* The highest position `i` such that `i <= pos` and `substr( i, str.size() ) == str`, or `npos` if such a position doesn't exist.
[endsect]
[section `constexpr size_type rfind( Ch c, size_type pos = npos ) const noexcept;`]
* *Returns:* `rfind( basic_string_view( &c, 1 ), pos )`.
[endsect]
[section `constexpr size_type rfind( Ch const* s, size_type pos, size_type n ) const noexcept;`]
* *Returns:* `rfind( basic_string_view( s, n ), pos )`.
[endsect]
[section `constexpr size_type rfind( Ch const* s, size_type pos = npos ) const noexcept;`]
* *Returns:* `rfind( basic_string_view( s ), pos )`.
[endsect]
[endsect]
[section find_first_of]
[section `constexpr size_type find_first_of( basic_string_view str, size_type pos = 0 ) const noexcept;`]
* *Returns:* The lowest position `i` such that `i >= pos` and the character at position `i` is equal to one of the characters in `str`, or `npos` if such a position doesn't exist.
[endsect]
[section `constexpr size_type find_first_of( Ch c, size_type pos = 0 ) const noexcept;`]
* *Returns:* `find_first_of( basic_string_view( &c, 1 ), pos )`.
[endsect]
[section `constexpr size_type find_first_of( Ch const* s, size_type pos, size_type n ) const noexcept;`]
* *Returns:* `find_first_of( basic_string_view( s, n ), pos )`.
[endsect]
[section `constexpr size_type find_first_of( Ch const* s, size_type pos = 0 ) const noexcept;`]
* *Returns:* `find_first_of( basic_string_view( s ), pos )`.
[endsect]
[endsect]
[section find_last_of]
[section `constexpr size_type find_last_of( basic_string_view str, size_type pos = npos ) const noexcept;`]
* *Returns:* The highest position `i` such that `i <= pos` and the character at position `i` is equal to one of the characters in `str`, or `npos` if such a position doesn't exist.
[endsect]
[section `constexpr size_type find_last_of( Ch c, size_type pos = npos ) const noexcept;`]
* *Returns:* `find_last_of( basic_string_view( &c, 1 ), pos )`.
[endsect]
[section `constexpr size_type find_last_of( Ch const* s, size_type pos, size_type n ) const noexcept;`]
* *Returns:* `find_last_of( basic_string_view( s, n ), pos )`.
[endsect]
[section `constexpr size_type find_last_of( Ch const* s, size_type pos = npos ) const noexcept;`]
* *Returns:* `find_last_of( basic_string_view( s ), pos )`.
[endsect]
[endsect]
[section find_first_not_of]
[section `constexpr size_type find_first_not_of( basic_string_view str, size_type pos = 0 ) const noexcept;`]
* *Returns:* The lowest position `i` such that `i >= pos` and the character at position `i` is not equal to one of the characters in `str`, or `npos` if such a position doesn't exist.
[endsect]
[section `constexpr size_type find_first_not_of( Ch c, size_type pos = 0 ) const noexcept;`]
* *Returns:* `find_first_not_of( basic_string_view( &c, 1 ), pos )`.
[endsect]
[section `constexpr size_type find_first_not_of( Ch const* s, size_type pos, size_type n ) const noexcept;`]
* *Returns:* `find_first_not_of( basic_string_view( s, n ), pos )`.
[endsect]
[section `constexpr size_type find_first_not_of( Ch const* s, size_type pos = 0 ) const noexcept;`]
* *Returns:* `find_first_not_of( basic_string_view( s ), pos )`.
[endsect]
[endsect]
[section find_last_not_of]
[section `constexpr size_type find_last_not_of( basic_string_view str, size_type pos = npos ) const noexcept;`]
* *Returns:* The highest position `i` such that `i <= pos` and the character at position `i` is not equal to one of the characters in `str`, or `npos` if such a position doesn't exist.
[endsect]
[section `constexpr size_type find_last_not_of( Ch c, size_type pos = npos ) const noexcept;`]
* *Returns:* `find_last_not_of( basic_string_view( &c, 1 ), pos )`.
[endsect]
[section `constexpr size_type find_last_not_of( Ch const* s, size_type pos, size_type n ) const noexcept;`]
* *Returns:* `find_last_not_of( basic_string_view( s, n ), pos )`.
[endsect]
[section `constexpr size_type find_last_not_of( Ch const* s, size_type pos = npos ) const noexcept;`]
* *Returns:* `find_last_not_of( basic_string_view( s ), pos )`.
[endsect]
[endsect]
[section contains]
[section `constexpr bool contains( basic_string_view sv ) const noexcept;`]
* *Returns:* `find( sv ) != npos`.
[endsect]
[section `constexpr bool contains( Ch c ) const noexcept;`]
* *Returns:* `find( c ) != npos`.
[endsect]
[section `constexpr bool contains( Ch const* s ) const noexcept;`]
* *Returns:* `find( s ) != npos`.
[endsect]
[endsect]
[endsect]
[section Relational Operators]
[section `constexpr friend bool operator==( basic_string_view sv1, basic_string_view sv2 ) noexcept;`]
* *Returns:* `sv1.compare( sv2 ) == 0`.
[endsect]
[section `constexpr friend bool operator!=( basic_string_view sv1, basic_string_view sv2 ) noexcept;`]
* *Returns:* `sv1.compare( sv2 ) != 0`.
[endsect]
[section `constexpr friend bool operator<( basic_string_view sv1, basic_string_view sv2 ) noexcept;`]
* *Returns:* `sv1.compare( sv2 ) < 0`.
[endsect]
[section `constexpr friend bool operator<=( basic_string_view sv1, basic_string_view sv2 ) noexcept;`]
* *Returns:* `sv1.compare( sv2 ) <= 0`.
[endsect]
[section `constexpr friend bool operator>( basic_string_view sv1, basic_string_view sv2 ) noexcept;`]
* *Returns:* `sv1.compare( sv2 ) > 0`.
[endsect]
[section `constexpr friend bool operator>=( basic_string_view sv1, basic_string_view sv2 ) noexcept;`]
* *Returns:* `sv1.compare( sv2 ) >= 0`.
[endsect]
[endsect]
[section Stream Inserter]
[section `template<class Ch> std::basic_ostream<Ch>& operator<<( std::basic_ostream<Ch>& os, basic_string_view<Ch> str );`]
* *Effects:* equivalent to `os << x`, where `x` is a pointer to a null-terminated character sequence with the same contents as `str`.
[endsect]
[endsect]
[endsect]
[endsect]

View File

@@ -20,17 +20,17 @@
[endsimplesect]
[section Header <boost/core/swap.hpp>]
[section Header <boost/core/invoke_swap.hpp>]
`template<class T> void swap(T& left, T& right);`
[^template<class T> void invoke_swap(T& left, T& right) noexcept(['see below]);]
[endsect]
[section Introduction]
The template function `boost::swap` allows the values of two
variables to be swapped, using argument dependent lookup to
select a specialized swap function if available. If no
The template function `boost::core::invoke_swap` allows the
values of two variables to be swapped, using argument dependent
lookup to select a specialized swap function if available. If no
specialized swap function is available, `std::swap` is used.
[endsect]
@@ -40,13 +40,14 @@ specialized swap function is available, `std::swap` is used.
The generic `std::swap` function requires that the elements
to be swapped are assignable and copy constructible. It is
usually implemented using one copy construction and two
assignments - this is often both unnecessarily restrictive and
unnecessarily slow. In addition, where the generic swap
implementation provides only the basic guarantee, specialized
swap functions are often able to provide the no-throw exception
guarantee (and it is considered best practice to do so where
possible [footnote Scott Meyers, Effective C++ Third Edition,
Item 25: "Consider support for a non-throwing swap"].
assignments (C++11 replaces copy operations with move) - this
is often both unnecessarily restrictive and unnecessarily slow.
In addition, where the generic swap implementation provides
only the basic guarantee, specialized swap functions are often
able to provide the no-throw exception guarantee (and it is
considered best practice to do so where possible[footnote Scott
Meyers, Effective C++ Third Edition, Item 25: "Consider support
for a non-throwing swap"].
The alternative to using argument dependent lookup in this
situation is to provide a template specialization of
@@ -55,23 +56,27 @@ Although this is legal C++, no Boost libraries use this method,
whereas many Boost libraries provide specialized swap functions
in their own namespaces.
`boost::swap` also supports swapping built-in arrays. Note that
`std::swap` originally did not do so, but a request to add an
overload of `std::swap` for built-in arrays has been accepted
`boost::core::invoke_swap` also supports swapping built-in arrays.
Note that `std::swap` originally did not do so, but a request to
add an overload of `std::swap` for built-in arrays has been accepted
by the C++ Standards Committee[footnote
[@http://open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#809
[@http://open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#809
LWG Defect Report 809: std::swap should be overloaded for array
types]].
[endsect]
[section Exception Safety]
`boost::swap` provides the same exception guarantee as the
underlying swap function used, with one exception; for an array
`boost::core::invoke_swap` provides the same exception guarantee as
the underlying swap function used, with one exception; for an array
of type `T[n]`, where `n > 1` and the underlying swap function
for `T` provides the strong exception guarantee, `boost::swap`
provides only the basic exception guarantee.
for `T` provides the strong exception guarantee,
`boost::core::invoke_swap` provides only the basic exception guarantee.
In C++11 and later, `boost::core::invoke_swap` propagates the same
`noexcept` specification as the one specified in the underlying swap
function.
[endsect]
@@ -79,42 +84,44 @@ provides only the basic exception guarantee.
Either:
* T must be assignable
* T must be copy constructible
* `T` must be copy assignable (/since C++11:/ move assignable)
* `T` must be copy constructible (/since C++11:/ move constructible)
Or:
* A function with the signature `swap(T&,T&)` is available via
* A function with the signature `swap(T&, T&)` is available via
argument dependent lookup
Or:
* A template specialization of `std::swap` exists for T
* A template specialization of `std::swap` exists for `T`
Or:
* T is a built-in array of swappable elements
* `T` is a built-in array of swappable elements
[endsect]
[section Portability]
Several older compilers do not support argument dependent
lookup. On these compilers `boost::swap` will call
lookup. On these compilers `boost::core::invoke_swap` will call
`std::swap`, ignoring any specialized swap functions that
could be found as a result of argument dependent lookup.
[endsect]
[endsect]
[section Credits]
* *Niels Dekker* - for implementing and documenting support for
* *Niels Dekker* - for implementing and documenting support for
built-in arrays
* *Joseph Gauterin* - for the initial idea, implementation,
tests, and documentation
* *Steven Watanabe* - for the idea to make `boost::swap` less
specialized than `std::swap`, thereby allowing the function
to have the name 'swap' without introducing ambiguity
to have the name 'swap' without introducing ambiguity. However,
later the function was renamed to `boost::core::invoke_swap`
to avoid potential infinite recursion.
[endsect]

77
doc/type_name.qbk Normal file
View File

@@ -0,0 +1,77 @@
[/
Copyright 2021 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt
]
[section:type_name type_name]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/type_name.hpp>]
The header `<boost/core/type_name.hpp>` defines the function
template `boost::core::type_name<T>()` that returns a string
representation of the name of `T`, suitable for logging or
diagnostic display purposes.
The result is similar to `boost::core::demangle( typeid(T).name() )`,
but it's made more regular by eliminating some of the platform-specific
differences and extra template parameters of the standard library
container types.
For example, `type_name< std::map<std::string, int> >()` returns
`"std::map<std::string, int>"` and not
```
std::map<std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, std::allocator<
std::pair<std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const, int> > >
```
or
```
class std::map<class std::basic_string<char,struct std::char_traits<char>,
class std::allocator<char> >,int,struct std::less<class std::basic_string<
char,struct std::char_traits<char>,class std::allocator<char> > >,class
std::allocator<struct std::pair<class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const ,int> > >
```
The return values aren't guaranteed to be stable across Boost releases.
Compilation with `-fno-rtti` is supported, but the returned type names aren't
guaranteed to be particularly useful or unique.
[section Synopsis]
``
namespace boost
{
namespace core
{
template<class T> std::string type_name();
} // namespace core
} // namespace boost
``
[endsect]
[section template<class T> std::string type_name();]
* *Returns:* A string representation of the name of `T`.
[endsect]
[endsect]
[endsect]

View File

@@ -0,0 +1,52 @@
[/
/ Copyright (c) 2018 Andrey Semashev
/
/ 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)
/]
[section:uncaught_exceptions uncaught_exceptions]
[simplesect Authors]
* Andrey Semashev
[endsimplesect]
[section Header <boost/core/uncaught_exceptions.hpp>]
The header `<boost/core/uncaught_exceptions.hpp>` defines the `boost::core::uncaught_exceptions` function,
which is a more portable implementation of the same named function introduced in C++17. The function
returns the number of the currently pending exceptions. When that function returns a value greater than 0,
throwing an exception from a destructor can terminate the program.
Unfortunately, the function cannot be implemented on every pre-C++17 compiler, although the most commonly
used compilers are supported. When the compiler does not provide the necessary functionality,
`boost::core::uncaught_exceptions` returns a non-zero value if at least one exception is pending (i.e. not
necessarily the number of pending exceptions), and `BOOST_CORE_UNCAUGHT_EXCEPTIONS_EMULATED` macro
is defined.
[section Example]
``
class my_class
{
private:
const unsigned int m_exception_count;
public:
my_class() : m_exception_count(boost::core::uncaught_exceptions())
{
}
~my_class() noexcept(false)
{
if (m_exception_count == boost::core::uncaught_exceptions())
do_something_potentially_throwing();
}
};
``
[endsect]
[endsect]
[endsect]

47
doc/use_default.qbk Normal file
View File

@@ -0,0 +1,47 @@
[/
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
]
[section:use_default use_default]
[section Overview]
The header <boost/core/use_default.hpp> provides the type `boost::use_default`
which is used by other Boost libraries as a sentinel type in templates to
indicate defaults.
[endsect]
[section Example]
```
template<class Derived, class Base,
class Value = boost::use_default,
class CategoryOrTraversal = boost::use_default,
class Reference = boost::use_default,
class Difference = boost::use_default>
class iterator_adaptor;
template<class Value>
class node_iterator
: public iterator_adaptor<node_iterator<Value>, Value*,
boost::use_default, boost::forward_traversal_tag>;
```
[endsect]
[section Reference]
```
namespace boost {
struct use_default { };
}
```
[endsect]
[endsect]

View File

@@ -0,0 +1,70 @@
[/
Copyright 2022 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt
]
[section:verbose_terminate_handler verbose_terminate_handler]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/verbose_terminate_handler.hpp>]
The header `<boost/core/verbose_terminate_handler.hpp>` defines
the function `void boost::core::verbose_terminate_handler()`. Its
purpose is to be set as a terminate handler as in
```
std::set_terminate( boost::core::verbose_terminate_handler );
```
When invoked, the function prints information about the current
uncaught exception to `stderr` and then calls `std::abort`.
[section Synopsis]
``
namespace boost
{
namespace core
{
[[noreturn]] void verbose_terminate_handler();
} // namespace core
} // namespace boost
``
[endsect]
[section Example]
```
#include <boost/core/verbose_terminate_handler.hpp>
#include <boost/throw_exception.hpp>
#include <exception>
int main()
{
std::set_terminate( boost::core::verbose_terminate_handler );
boost::throw_with_location( std::exception() );
}
```
Sample output:
```
std::terminate called after throwing an exception:
type: class boost::detail::with_throw_location<class std::exception>
what(): Unknown exception
location: example.cpp:8:12 in function 'main'
```
[endsect]
[endsect]
[endsect]

79
doc/yield_primitives.qbk Normal file
View File

@@ -0,0 +1,79 @@
[/
Copyright 2023 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://boost.org/LICENSE_1_0.txt
]
[section:yield_primitives Yield Primitives]
[simplesect Authors]
* Peter Dimov
[endsimplesect]
[section Header <boost/core/yield_primitives.hpp>]
The header `<boost/core/yield_primitives.hpp>` implements a
collection of primitives that allow the current thread to
yield the CPU in various ways.
Very low level, specialized functionality, generally only useful for
implementing spinlocks. Normal synchronization primitives should
almost always be preferable in application code.
[section Synopsis]
``
namespace boost
{
namespace core
{
void sp_thread_pause() noexcept;
void sp_thread_yield() noexcept;
void sp_thread_sleep() noexcept;
} // namespace core
} // namespace boost
``
[endsect]
[section sp_thread_pause]
`void sp_thread_pause() noexcept;`
Emits a PAUSE instruction (on x86) or a YIELD instruction (on ARM).
A portable equivalent of the GCC builtin function `__builtin_ia32_pause`.
[endsect]
[section sp_thread_yield]
`void sp_thread_yield() noexcept;`
Informs the scheduler that the current thread wishes to relinquish
the rest of its timeslice.
A portable equivalent of POSIX `sched_yield`.
[endsect]
[section sp_thread_sleep]
`void sp_thread_sleep() noexcept;`
Sleeps for a short period, as if by calling POSIX `nanosleep` with
a small, implementation-dependent, interval (usually one microsecond).
A more forcing yield primitive than `sp_thread_yield`, because it's
generally not ignored even if all other waiting threads are of lower
priority.
[endsect]
[endsect]
[endsect]

8
extra/boost_core.natvis Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="boost::core::basic_string_view&lt;*&gt;">
<DisplayString>{p_,[n_]s}</DisplayString>
</Type>
</AutoVisualizer>

View File

@@ -49,20 +49,20 @@ namespace boost {
namespace detail {
template<class T>
class addressof_ref {
class addrof_ref {
public:
BOOST_FORCEINLINE addressof_ref(T& o) BOOST_NOEXCEPT
BOOST_FORCEINLINE addrof_ref(T& o) BOOST_NOEXCEPT
: o_(o) { }
BOOST_FORCEINLINE operator T&() const BOOST_NOEXCEPT {
return o_;
}
private:
addressof_ref& operator=(const addressof_ref&);
addrof_ref& operator=(const addrof_ref&);
T& o_;
};
template<class T>
struct address_of {
struct addrof {
static BOOST_FORCEINLINE T* get(T& o, long) BOOST_NOEXCEPT {
return reinterpret_cast<T*>(&
const_cast<char&>(reinterpret_cast<const volatile char&>(o)));
@@ -76,38 +76,38 @@ struct address_of {
#if !defined(BOOST_NO_CXX11_DECLTYPE) && \
(defined(__INTEL_COMPILER) || \
(defined(__clang__) && !defined(_LIBCPP_VERSION)))
typedef decltype(nullptr) addressof_null_t;
typedef decltype(nullptr) addrof_null_t;
#else
typedef std::nullptr_t addressof_null_t;
typedef std::nullptr_t addrof_null_t;
#endif
template<>
struct address_of<addressof_null_t> {
typedef addressof_null_t type;
struct addrof<addrof_null_t> {
typedef addrof_null_t type;
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
return &o;
}
};
template<>
struct address_of<const addressof_null_t> {
typedef const addressof_null_t type;
struct addrof<const addrof_null_t> {
typedef const addrof_null_t type;
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
return &o;
}
};
template<>
struct address_of<volatile addressof_null_t> {
typedef volatile addressof_null_t type;
struct addrof<volatile addrof_null_t> {
typedef volatile addrof_null_t type;
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
return &o;
}
};
template<>
struct address_of<const volatile addressof_null_t> {
typedef const volatile addressof_null_t type;
struct addrof<const volatile addrof_null_t> {
typedef const volatile addrof_null_t type;
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
return &o;
}
@@ -125,11 +125,11 @@ template<class T>
BOOST_FORCEINLINE T*
addressof(T& o) BOOST_NOEXCEPT
{
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) || \
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x610)) || \
BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5120)
return detail::address_of<T>::get(o, 0);
return boost::detail::addrof<T>::get(o, 0);
#else
return detail::address_of<T>::get(detail::addressof_ref<T>(o), 0);
return boost::detail::addrof<T>::get(boost::detail::addrof_ref<T>(o), 0);
#endif
}
@@ -137,21 +137,21 @@ addressof(T& o) BOOST_NOEXCEPT
namespace detail {
template<class T>
struct addressof_result {
struct addrof_result {
typedef T* type;
};
} /* detail */
template<class T, std::size_t N>
BOOST_FORCEINLINE typename detail::addressof_result<T[N]>::type
BOOST_FORCEINLINE typename boost::detail::addrof_result<T[N]>::type
addressof(T (&o)[N]) BOOST_NOEXCEPT
{
return &o;
}
#endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
template<class T, std::size_t N>
BOOST_FORCEINLINE
T (*addressof(T (&o)[N]) BOOST_NOEXCEPT)[N]
@@ -170,79 +170,79 @@ const T (*addressof(const T (&o)[N]) BOOST_NOEXCEPT)[N]
namespace detail {
template<class T>
T addressof_declval() BOOST_NOEXCEPT;
T addrof_declval() BOOST_NOEXCEPT;
template<class>
struct addressof_void {
struct addrof_void {
typedef void type;
};
template<class T, class E = void>
struct addressof_member_operator {
struct addrof_member_operator {
static constexpr bool value = false;
};
template<class T>
struct addressof_member_operator<T, typename
addressof_void<decltype(addressof_declval<T&>().operator&())>::type> {
struct addrof_member_operator<T, typename
addrof_void<decltype(addrof_declval<T&>().operator&())>::type> {
static constexpr bool value = true;
};
#if BOOST_WORKAROUND(BOOST_INTEL, < 1600)
struct addressof_addressable { };
struct addrof_addressable { };
addressof_addressable*
operator&(addressof_addressable&) BOOST_NOEXCEPT;
addrof_addressable*
operator&(addrof_addressable&) BOOST_NOEXCEPT;
#endif
template<class T, class E = void>
struct addressof_non_member_operator {
struct addrof_non_member_operator {
static constexpr bool value = false;
};
template<class T>
struct addressof_non_member_operator<T, typename
addressof_void<decltype(operator&(addressof_declval<T&>()))>::type> {
struct addrof_non_member_operator<T, typename
addrof_void<decltype(operator&(addrof_declval<T&>()))>::type> {
static constexpr bool value = true;
};
template<class T, class E = void>
struct addressof_expression {
struct addrof_expression {
static constexpr bool value = false;
};
template<class T>
struct addressof_expression<T,
typename addressof_void<decltype(&addressof_declval<T&>())>::type> {
struct addrof_expression<T,
typename addrof_void<decltype(&addrof_declval<T&>())>::type> {
static constexpr bool value = true;
};
template<class T>
struct addressof_is_constexpr {
static constexpr bool value = addressof_expression<T>::value &&
!addressof_member_operator<T>::value &&
!addressof_non_member_operator<T>::value;
struct addrof_is_constexpr {
static constexpr bool value = addrof_expression<T>::value &&
!addrof_member_operator<T>::value &&
!addrof_non_member_operator<T>::value;
};
template<bool E, class T>
struct addressof_if { };
struct addrof_if { };
template<class T>
struct addressof_if<true, T> {
struct addrof_if<true, T> {
typedef T* type;
};
template<class T>
BOOST_FORCEINLINE
typename addressof_if<!addressof_is_constexpr<T>::value, T>::type
typename addrof_if<!addrof_is_constexpr<T>::value, T>::type
addressof(T& o) BOOST_NOEXCEPT
{
return address_of<T>::get(addressof_ref<T>(o), 0);
return addrof<T>::get(addrof_ref<T>(o), 0);
}
template<class T>
constexpr BOOST_FORCEINLINE
typename addressof_if<addressof_is_constexpr<T>::value, T>::type
typename addrof_if<addrof_is_constexpr<T>::value, T>::type
addressof(T& o) BOOST_NOEXCEPT
{
return &o;
@@ -254,7 +254,7 @@ template<class T>
constexpr BOOST_FORCEINLINE T*
addressof(T& o) BOOST_NOEXCEPT
{
return detail::addressof(o);
return boost::detail::addressof(o);
}
#endif

View File

@@ -0,0 +1,57 @@
#ifndef BOOST_CORE_ALIGNOF_HPP_INCLUDED
#define BOOST_CORE_ALIGNOF_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#include <cstddef>
#if !defined(BOOST_NO_CXX11_ALIGNOF)
#define BOOST_CORE_ALIGNOF alignof
#elif defined(__GNUC__)
#define BOOST_CORE_ALIGNOF __alignof__
#elif defined(_MSC_VER)
#define BOOST_CORE_ALIGNOF __alignof
#else
namespace boost
{
namespace core
{
namespace detail
{
template<class T> struct alignof_helper
{
char x;
T t;
};
} // namespace detail
} // namespace core
} // namespace boost
#if defined(__GNUC__)
// ignoring -Wvariadic-macros with #pragma doesn't work under GCC
# pragma GCC system_header
#endif
#define BOOST_CORE_ALIGNOF(...) offsetof( ::boost::core::detail::alignof_helper<__VA_ARGS__>, t );
#endif
#endif // #ifndef BOOST_CORE_ALIGNOF_HPP_INCLUDED

View File

@@ -0,0 +1,95 @@
/*
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_ALLOC_CONSTRUCT_HPP
#define BOOST_CORE_ALLOC_CONSTRUCT_HPP
/*
This functionality is now in <boost/core/allocator_access.hpp>.
*/
#include <boost/core/noinit_adaptor.hpp>
namespace boost {
template<class A, class T>
inline void
alloc_destroy(A& a, T* p)
{
boost::allocator_destroy(a, p);
}
template<class A, class T>
inline void
alloc_destroy_n(A& a, T* p, std::size_t n)
{
boost::allocator_destroy_n(a, p, n);
}
template<class A, class T>
inline void
alloc_construct(A& a, T* p)
{
boost::allocator_construct(a, p);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class A, class T, class U, class... V>
inline void
alloc_construct(A& a, T* p, U&& u, V&&... v)
{
boost::allocator_construct(a, p, std::forward<U>(u),
std::forward<V>(v)...);
}
#else
template<class A, class T, class U>
inline void
alloc_construct(A& a, T* p, U&& u)
{
boost::allocator_construct(a, p, std::forward<U>(u));
}
#endif
#else
template<class A, class T, class U>
inline void
alloc_construct(A& a, T* p, const U& u)
{
boost::allocator_construct(a, p, u);
}
template<class A, class T, class U>
inline void
alloc_construct(A& a, T* p, U& u)
{
boost::allocator_construct(a, p, u);
}
#endif
template<class A, class T>
inline void
alloc_construct_n(A& a, T* p, std::size_t n)
{
boost::allocator_construct_n(a, p, n);
}
template<class A, class T>
inline void
alloc_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m)
{
boost::allocator_construct_n(a, p, n, l, m);
}
template<class A, class T, class I>
inline void
alloc_construct_n(A& a, T* p, std::size_t n, I b)
{
boost::allocator_construct_n(a, p, n, b);
}
} /* boost */
#endif

View File

@@ -0,0 +1,834 @@
/*
Copyright 2020-2022 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_ALLOCATOR_ACCESS_HPP
#define BOOST_CORE_ALLOCATOR_ACCESS_HPP
#include <boost/config.hpp>
#include <boost/core/pointer_traits.hpp>
#include <limits>
#include <new>
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#include <type_traits>
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#include <utility>
#endif
#if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 40300)
#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T)
#elif defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500)
#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T)
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T)
#elif defined(BOOST_CLANG) && !defined(__CUDACC__)
#if __has_feature(is_empty)
#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T)
#endif
#elif defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)
#define BOOST_DETAIL_ALLOC_EMPTY(T) __oracle_is_empty(T)
#elif defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600)
#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T)
#elif defined(BOOST_CODEGEARC)
#define BOOST_DETAIL_ALLOC_EMPTY(T) __is_empty(T)
#endif
#if defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH)
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
#endif
#if defined(_STL_DISABLE_DEPRECATED_WARNING)
_STL_DISABLE_DEPRECATED_WARNING
#endif
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wdeprecated-declarations")
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
# endif
#elif defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4996)
#elif defined(BOOST_GCC) && BOOST_GCC >= 40600
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
namespace boost {
template<class A>
struct allocator_value_type {
typedef typename A::value_type type;
};
namespace detail {
template<class A, class = void>
struct alloc_ptr {
typedef typename boost::allocator_value_type<A>::type* type;
};
template<class>
struct alloc_void {
typedef void type;
};
template<class A>
struct alloc_ptr<A,
typename alloc_void<typename A::pointer>::type> {
typedef typename A::pointer type;
};
} /* detail */
template<class A>
struct allocator_pointer {
typedef typename detail::alloc_ptr<A>::type type;
};
namespace detail {
template<class A, class = void>
struct alloc_const_ptr {
typedef typename boost::pointer_traits<typename
boost::allocator_pointer<A>::type>::template rebind_to<const typename
boost::allocator_value_type<A>::type>::type type;
};
template<class A>
struct alloc_const_ptr<A,
typename alloc_void<typename A::const_pointer>::type> {
typedef typename A::const_pointer type;
};
} /* detail */
template<class A>
struct allocator_const_pointer {
typedef typename detail::alloc_const_ptr<A>::type type;
};
namespace detail {
template<class, class>
struct alloc_to { };
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<template<class> class A, class T, class U>
struct alloc_to<A<U>, T> {
typedef A<T> type;
};
template<template<class, class> class A, class T, class U, class V>
struct alloc_to<A<U, V>, T> {
typedef A<T, V> type;
};
template<template<class, class, class> class A, class T, class U, class V1,
class V2>
struct alloc_to<A<U, V1, V2>, T> {
typedef A<T, V1, V2> type;
};
#else
template<template<class, class...> class A, class T, class U, class... V>
struct alloc_to<A<U, V...>, T> {
typedef A<T, V...> type;
};
#endif
template<class A, class T, class = void>
struct alloc_rebind {
typedef typename alloc_to<A, T>::type type;
};
template<class A, class T>
struct alloc_rebind<A, T,
typename alloc_void<typename A::template rebind<T>::other>::type> {
typedef typename A::template rebind<T>::other type;
};
} /* detail */
template<class A, class T>
struct allocator_rebind {
typedef typename detail::alloc_rebind<A, T>::type type;
};
namespace detail {
template<class A, class = void>
struct alloc_void_ptr {
typedef typename boost::pointer_traits<typename
boost::allocator_pointer<A>::type>::template
rebind_to<void>::type type;
};
template<class A>
struct alloc_void_ptr<A,
typename alloc_void<typename A::void_pointer>::type> {
typedef typename A::void_pointer type;
};
} /* detail */
template<class A>
struct allocator_void_pointer {
typedef typename detail::alloc_void_ptr<A>::type type;
};
namespace detail {
template<class A, class = void>
struct alloc_const_void_ptr {
typedef typename boost::pointer_traits<typename
boost::allocator_pointer<A>::type>::template
rebind_to<const void>::type type;
};
template<class A>
struct alloc_const_void_ptr<A,
typename alloc_void<typename A::const_void_pointer>::type> {
typedef typename A::const_void_pointer type;
};
} /* detail */
template<class A>
struct allocator_const_void_pointer {
typedef typename detail::alloc_const_void_ptr<A>::type type;
};
namespace detail {
template<class A, class = void>
struct alloc_diff_type {
typedef typename boost::pointer_traits<typename
boost::allocator_pointer<A>::type>::difference_type type;
};
template<class A>
struct alloc_diff_type<A,
typename alloc_void<typename A::difference_type>::type> {
typedef typename A::difference_type type;
};
} /* detail */
template<class A>
struct allocator_difference_type {
typedef typename detail::alloc_diff_type<A>::type type;
};
namespace detail {
#if defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A, class = void>
struct alloc_size_type {
typedef std::size_t type;
};
#else
template<class A, class = void>
struct alloc_size_type {
typedef typename std::make_unsigned<typename
boost::allocator_difference_type<A>::type>::type type;
};
#endif
template<class A>
struct alloc_size_type<A,
typename alloc_void<typename A::size_type>::type> {
typedef typename A::size_type type;
};
} /* detail */
template<class A>
struct allocator_size_type {
typedef typename detail::alloc_size_type<A>::type type;
};
namespace detail {
#if defined(BOOST_NO_CXX11_ALLOCATOR)
template<bool V>
struct alloc_bool {
typedef bool value_type;
typedef alloc_bool type;
static const bool value = V;
operator bool() const BOOST_NOEXCEPT {
return V;
}
bool operator()() const BOOST_NOEXCEPT {
return V;
}
};
template<bool V>
const bool alloc_bool<V>::value;
typedef alloc_bool<false> alloc_false;
#else
typedef std::false_type alloc_false;
#endif
template<class A, class = void>
struct alloc_pocca {
typedef alloc_false type;
};
template<class A>
struct alloc_pocca<A,
typename alloc_void<typename
A::propagate_on_container_copy_assignment>::type> {
typedef typename A::propagate_on_container_copy_assignment type;
};
} /* detail */
template<class A, class = void>
struct allocator_propagate_on_container_copy_assignment {
typedef typename detail::alloc_pocca<A>::type type;
};
namespace detail {
template<class A, class = void>
struct alloc_pocma {
typedef alloc_false type;
};
template<class A>
struct alloc_pocma<A,
typename alloc_void<typename
A::propagate_on_container_move_assignment>::type> {
typedef typename A::propagate_on_container_move_assignment type;
};
} /* detail */
template<class A>
struct allocator_propagate_on_container_move_assignment {
typedef typename detail::alloc_pocma<A>::type type;
};
namespace detail {
template<class A, class = void>
struct alloc_pocs {
typedef alloc_false type;
};
template<class A>
struct alloc_pocs<A,
typename alloc_void<typename A::propagate_on_container_swap>::type> {
typedef typename A::propagate_on_container_swap type;
};
} /* detail */
template<class A>
struct allocator_propagate_on_container_swap {
typedef typename detail::alloc_pocs<A>::type type;
};
namespace detail {
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A, class = void>
struct alloc_equal {
typedef typename std::is_empty<A>::type type;
};
#elif defined(BOOST_DETAIL_ALLOC_EMPTY)
template<class A, class = void>
struct alloc_equal {
typedef alloc_bool<BOOST_DETAIL_ALLOC_EMPTY(A)> type;
};
#else
template<class A, class = void>
struct alloc_equal {
typedef alloc_false type;
};
#endif
template<class A>
struct alloc_equal<A,
typename alloc_void<typename A::is_always_equal>::type> {
typedef typename A::is_always_equal type;
};
} /* detail */
template<class A>
struct allocator_is_always_equal {
typedef typename detail::alloc_equal<A>::type type;
};
template<class A>
inline typename allocator_pointer<A>::type
allocator_allocate(A& a, typename allocator_size_type<A>::type n)
{
return a.allocate(n);
}
template<class A>
inline void
allocator_deallocate(A& a, typename allocator_pointer<A>::type p,
typename allocator_size_type<A>::type n)
{
a.deallocate(p, n);
}
#if defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A>
inline typename allocator_pointer<A>::type
allocator_allocate(A& a, typename allocator_size_type<A>::type n,
typename allocator_const_void_pointer<A>::type h)
{
return a.allocate(n, h);
}
#else
namespace detail {
template<class>
struct alloc_no {
char x, y;
};
template<class A>
class alloc_has_allocate {
template<class O>
static auto check(int)
-> alloc_no<decltype(std::declval<O&>().allocate(std::declval<typename
boost::allocator_size_type<A>::type>(), std::declval<typename
boost::allocator_const_void_pointer<A>::type>()))>;
template<class>
static char check(long);
public:
BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1;
};
} /* detail */
template<class A>
inline typename std::enable_if<detail::alloc_has_allocate<A>::value,
typename allocator_pointer<A>::type>::type
allocator_allocate(A& a, typename allocator_size_type<A>::type n,
typename allocator_const_void_pointer<A>::type h)
{
return a.allocate(n, h);
}
template<class A>
inline typename std::enable_if<!detail::alloc_has_allocate<A>::value,
typename allocator_pointer<A>::type>::type
allocator_allocate(A& a, typename allocator_size_type<A>::type n,
typename allocator_const_void_pointer<A>::type)
{
return a.allocate(n);
}
#endif
namespace detail {
#if defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A, class = void>
struct alloc_has_construct {
BOOST_STATIC_CONSTEXPR bool value = false;
};
template<class A>
struct alloc_has_construct<A,
typename alloc_void<typename A::_default_construct_destroy>::type> {
BOOST_STATIC_CONSTEXPR bool value = true;
};
#else
template<class A, class T, class... Args>
class alloc_has_construct {
template<class O>
static auto check(int)
-> alloc_no<decltype(std::declval<O&>().construct(std::declval<T*>(),
std::declval<Args&&>()...))>;
template<class>
static char check(long);
public:
BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1;
};
#endif
template<bool, class = void>
struct alloc_if { };
template<class T>
struct alloc_if<true, T> {
typedef T type;
};
} /* detail */
#if defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A, class T>
inline typename detail::alloc_if<detail::alloc_has_construct<A>::value>::type
allocator_construct(A& a, T* p)
{
a.construct(p);
}
template<class A, class T>
inline typename detail::alloc_if<!detail::alloc_has_construct<A>::value>::type
allocator_construct(A&, T* p)
{
::new((void*)p) T();
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class A, class T, class V, class... Args>
inline void
allocator_construct(A&, T* p, V&& v, Args&&... args)
{
::new((void*)p) T(std::forward<V>(v), std::forward<Args>(args)...);
}
#else
template<class A, class T, class V>
inline void
allocator_construct(A&, T* p, V&& v)
{
::new((void*)p) T(std::forward<V>(v));
}
#endif
#else
template<class A, class T, class V>
inline void
allocator_construct(A&, T* p, const V& v)
{
::new((void*)p) T(v);
}
template<class A, class T, class V>
inline void
allocator_construct(A&, T* p, V& v)
{
::new((void*)p) T(v);
}
#endif
#else
template<class A, class T, class... Args>
inline typename std::enable_if<detail::alloc_has_construct<A, T,
Args...>::value>::type
allocator_construct(A& a, T* p, Args&&... args)
{
a.construct(p, std::forward<Args>(args)...);
}
template<class A, class T, class... Args>
inline typename std::enable_if<!detail::alloc_has_construct<A, T,
Args...>::value>::type
allocator_construct(A&, T* p, Args&&... args)
{
::new((void*)p) T(std::forward<Args>(args)...);
}
#endif
namespace detail {
#if defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A, class, class = void>
struct alloc_has_destroy {
BOOST_STATIC_CONSTEXPR bool value = false;
};
template<class A, class T>
struct alloc_has_destroy<A, T,
typename alloc_void<typename A::_default_construct_destroy>::type> {
BOOST_STATIC_CONSTEXPR bool value = true;
};
#else
template<class A, class T>
class alloc_has_destroy {
template<class O>
static auto check(int)
-> alloc_no<decltype(std::declval<O&>().destroy(std::declval<T*>()))>;
template<class>
static char check(long);
public:
BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1;
};
#endif
} /* detail */
template<class A, class T>
inline typename detail::alloc_if<detail::alloc_has_destroy<A, T>::value>::type
allocator_destroy(A& a, T* p)
{
a.destroy(p);
}
template<class A, class T>
inline typename detail::alloc_if<!detail::alloc_has_destroy<A, T>::value>::type
allocator_destroy(A&, T* p)
{
p->~T();
(void)p;
}
namespace detail {
#if defined(BOOST_NO_CXX11_ALLOCATOR)
template<class T, T>
struct alloc_no {
char x, y;
};
template<class A>
class alloc_has_max_size {
template<class O>
static alloc_no<typename boost::allocator_size_type<O>::type(O::*)(),
&O::max_size> check(int);
template<class O>
static alloc_no<typename boost::allocator_size_type<O>::type(O::*)() const,
&O::max_size> check(int);
template<class O>
static alloc_no<typename boost::allocator_size_type<O>::type(*)(),
&O::max_size> check(int);
template<class>
static char check(long);
public:
BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1;
};
#else
template<class A>
class alloc_has_max_size {
template<class O>
static auto check(int)
-> alloc_no<decltype(std::declval<const O&>().max_size())>;
template<class>
static char check(long);
public:
BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1;
};
#endif
} /* detail */
template<class A>
inline typename detail::alloc_if<detail::alloc_has_max_size<A>::value,
typename allocator_size_type<A>::type>::type
allocator_max_size(const A& a) BOOST_NOEXCEPT
{
return a.max_size();
}
template<class A>
inline typename detail::alloc_if<!detail::alloc_has_max_size<A>::value,
typename allocator_size_type<A>::type>::type
allocator_max_size(const A&) BOOST_NOEXCEPT
{
return (std::numeric_limits<typename
allocator_size_type<A>::type>::max)() /
sizeof(typename allocator_value_type<A>::type);
}
namespace detail {
#if defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A>
class alloc_has_soccc {
template<class O>
static alloc_no<O(O::*)(), &O::select_on_container_copy_construction>
check(int);
template<class O>
static alloc_no<O(O::*)() const, &O::select_on_container_copy_construction>
check(int);
template<class O>
static alloc_no<O(*)(), &O::select_on_container_copy_construction>
check(int);
template<class>
static char check(long);
public:
BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1;
};
#else
template<class A>
class alloc_has_soccc {
template<class O>
static auto check(int) -> alloc_no<decltype(std::declval<const
O&>().select_on_container_copy_construction())>;
template<class>
static char check(long);
public:
BOOST_STATIC_CONSTEXPR bool value = sizeof(check<A>(0)) > 1;
};
#endif
} /* detail */
template<class A>
inline typename detail::alloc_if<detail::alloc_has_soccc<A>::value, A>::type
allocator_select_on_container_copy_construction(const A& a)
{
return a.select_on_container_copy_construction();
}
template<class A>
inline typename detail::alloc_if<!detail::alloc_has_soccc<A>::value, A>::type
allocator_select_on_container_copy_construction(const A& a)
{
return a;
}
template<class A, class T>
inline void
allocator_destroy_n(A& a, T* p, std::size_t n)
{
while (n > 0) {
boost::allocator_destroy(a, p + --n);
}
}
namespace detail {
template<class A, class T>
class alloc_destroyer {
public:
alloc_destroyer(A& a, T* p) BOOST_NOEXCEPT
: a_(a), p_(p), n_(0) { }
~alloc_destroyer() {
boost::allocator_destroy_n(a_, p_, n_);
}
std::size_t& size() BOOST_NOEXCEPT {
return n_;
}
private:
alloc_destroyer(const alloc_destroyer&);
alloc_destroyer& operator=(const alloc_destroyer&);
A& a_;
T* p_;
std::size_t n_;
};
} /* detail */
template<class A, class T>
inline void
allocator_construct_n(A& a, T* p, std::size_t n)
{
detail::alloc_destroyer<A, T> d(a, p);
for (std::size_t& i = d.size(); i < n; ++i) {
boost::allocator_construct(a, p + i);
}
d.size() = 0;
}
template<class A, class T>
inline void
allocator_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m)
{
detail::alloc_destroyer<A, T> d(a, p);
for (std::size_t& i = d.size(); i < n; ++i) {
boost::allocator_construct(a, p + i, l[i % m]);
}
d.size() = 0;
}
template<class A, class T, class I>
inline void
allocator_construct_n(A& a, T* p, std::size_t n, I b)
{
detail::alloc_destroyer<A, T> d(a, p);
for (std::size_t& i = d.size(); i < n; void(++i), void(++b)) {
boost::allocator_construct(a, p + i, *b);
}
d.size() = 0;
}
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class A>
using allocator_value_type_t = typename allocator_value_type<A>::type;
template<class A>
using allocator_pointer_t = typename allocator_pointer<A>::type;
template<class A>
using allocator_const_pointer_t = typename allocator_const_pointer<A>::type;
template<class A>
using allocator_void_pointer_t = typename allocator_void_pointer<A>::type;
template<class A>
using allocator_const_void_pointer_t =
typename allocator_const_void_pointer<A>::type;
template<class A>
using allocator_difference_type_t =
typename allocator_difference_type<A>::type;
template<class A>
using allocator_size_type_t = typename allocator_size_type<A>::type;
template<class A>
using allocator_propagate_on_container_copy_assignment_t =
typename allocator_propagate_on_container_copy_assignment<A>::type;
template<class A>
using allocator_propagate_on_container_move_assignment_t =
typename allocator_propagate_on_container_move_assignment<A>::type;
template<class A>
using allocator_propagate_on_container_swap_t =
typename allocator_propagate_on_container_swap<A>::type;
template<class A>
using allocator_is_always_equal_t =
typename allocator_is_always_equal<A>::type;
template<class A, class T>
using allocator_rebind_t = typename allocator_rebind<A, T>::type;
#endif
} /* boost */
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wdeprecated-declarations")
# pragma clang diagnostic pop
# endif
#elif defined(_MSC_VER)
# pragma warning(pop)
#elif defined(BOOST_GCC) && BOOST_GCC >= 40600
# pragma GCC diagnostic pop
#endif
#if defined(_STL_RESTORE_DEPRECATED_WARNING)
_STL_RESTORE_DEPRECATED_WARNING
#endif
#if defined(_LIBCPP_SUPPRESS_DEPRECATED_POP)
_LIBCPP_SUPPRESS_DEPRECATED_POP
#endif
#endif

View File

@@ -0,0 +1,112 @@
/*
Copyright 2021 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_ALLOCATOR_TRAITS_HPP
#define BOOST_CORE_ALLOCATOR_TRAITS_HPP
#include <boost/core/allocator_access.hpp>
namespace boost {
template<class A>
struct allocator_traits {
typedef A allocator_type;
typedef typename allocator_value_type<A>::type value_type;
typedef typename allocator_pointer<A>::type pointer;
typedef typename allocator_const_pointer<A>::type const_pointer;
typedef typename allocator_void_pointer<A>::type void_pointer;
typedef typename allocator_const_void_pointer<A>::type const_void_pointer;
typedef typename allocator_difference_type<A>::type difference_type;
typedef typename allocator_size_type<A>::type size_type;
typedef typename allocator_propagate_on_container_copy_assignment<A>::type
propagate_on_container_copy_assignment;
typedef typename allocator_propagate_on_container_move_assignment<A>::type
propagate_on_container_move_assignment;
typedef typename allocator_propagate_on_container_swap<A>::type
propagate_on_container_swap;
typedef typename allocator_is_always_equal<A>::type is_always_equal;
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class T>
using rebind_traits = allocator_traits<typename
allocator_rebind<A, T>::type>;
#else
template<class T>
struct rebind_traits
: allocator_traits<typename allocator_rebind<A, T>::type> { };
#endif
static pointer allocate(A& a, size_type n) {
return boost::allocator_allocate(a, n);
}
static pointer allocate(A& a, size_type n, const_void_pointer h) {
return boost::allocator_allocate(a, n, h);
}
static void deallocate(A& a, pointer p, size_type n) {
return boost::allocator_deallocate(a, p, n);
}
template<class T>
static void construct(A& a, T* p) {
boost::allocator_construct(a, p);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class T, class V, class... Args>
static void construct(A& a, T* p, V&& v, Args&&... args) {
boost::allocator_construct(a, p, std::forward<V>(v),
std::forward<Args>(args)...);
}
#else
template<class T, class V>
static void construct(A& a, T* p, V&& v) {
boost::allocator_construct(a, p, std::forward<V>(v));
}
#endif
#else
template<class T, class V>
static void construct(A& a, T* p, const V& v) {
boost::allocator_construct(a, p, v);
}
template<class T, class V>
static void construct(A& a, T* p, V& v) {
boost::allocator_construct(a, p, v);
}
#endif
template<class T>
static void destroy(A& a, T* p) {
boost::allocator_destroy(a, p);
}
static size_type max_size(const A& a) BOOST_NOEXCEPT {
return boost::allocator_max_size(a);
}
static A select_on_container_copy_construction(const A& a) {
return boost::allocator_select_on_container_copy_construction(a);
}
};
} /* boost */
#endif

954
include/boost/core/bit.hpp Normal file
View File

@@ -0,0 +1,954 @@
#ifndef BOOST_CORE_BIT_HPP_INCLUDED
#define BOOST_CORE_BIT_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// boost/core/bit.hpp
//
// A portable version of the C++20 standard header <bit>
//
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#include <boost/static_assert.hpp>
#include <boost/cstdint.hpp>
#include <limits>
#include <cstring>
#include <cstdlib>
#if defined(_MSC_VER)
# include <intrin.h>
# pragma intrinsic(_BitScanForward)
# pragma intrinsic(_BitScanReverse)
# if defined(_M_X64)
# pragma intrinsic(_BitScanForward64)
# pragma intrinsic(_BitScanReverse64)
# endif
# pragma warning(push)
# pragma warning(disable: 4127) // conditional expression is constant
# pragma warning(disable: 4244) // conversion from int to T
#endif // defined(_MSC_VER)
#if defined(BOOST_MSVC) && BOOST_MSVC >= 1925
# define BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL
#endif
#if defined(__has_builtin)
# if __has_builtin(__builtin_bit_cast)
# define BOOST_CORE_HAS_BUILTIN_BIT_CAST
# endif
# if __has_builtin(__builtin_bswap16)
# define BOOST_CORE_HAS_BUILTIN_BSWAP16
# endif
#endif
#if !defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST) && (defined(BOOST_MSVC) && BOOST_MSVC >= 1926)
# define BOOST_CORE_HAS_BUILTIN_BIT_CAST
#endif
#if !defined(BOOST_CORE_HAS_BUILTIN_BSWAP16) && (defined(BOOST_GCC) && BOOST_GCC >= 40800)
# define BOOST_CORE_HAS_BUILTIN_BSWAP16
#endif
namespace boost
{
namespace core
{
// bit_cast
#if defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST)
template<class To, class From>
BOOST_CONSTEXPR To bit_cast( From const & from ) BOOST_NOEXCEPT
{
return __builtin_bit_cast( To, from );
}
#else
template<class To, class From>
To bit_cast( From const & from ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( sizeof(To) == sizeof(From) );
To to;
std::memcpy( &to, &from, sizeof(To) );
return to;
}
#endif
// countl
#if defined(__GNUC__) || defined(__clang__)
namespace detail
{
BOOST_CONSTEXPR inline int countl_impl( unsigned char x ) BOOST_NOEXCEPT
{
return x? __builtin_clz( x ) - ( std::numeric_limits<unsigned int>::digits - std::numeric_limits<unsigned char>::digits ): std::numeric_limits<unsigned char>::digits;
}
BOOST_CONSTEXPR inline int countl_impl( unsigned short x ) BOOST_NOEXCEPT
{
return x? __builtin_clz( x ) - ( std::numeric_limits<unsigned int>::digits - std::numeric_limits<unsigned short>::digits ): std::numeric_limits<unsigned short>::digits;
}
BOOST_CONSTEXPR inline int countl_impl( unsigned int x ) BOOST_NOEXCEPT
{
return x? __builtin_clz( x ): std::numeric_limits<unsigned int>::digits;
}
BOOST_CONSTEXPR inline int countl_impl( unsigned long x ) BOOST_NOEXCEPT
{
return x? __builtin_clzl( x ): std::numeric_limits<unsigned long>::digits;
}
BOOST_CONSTEXPR inline int countl_impl( boost::ulong_long_type x ) BOOST_NOEXCEPT
{
return x? __builtin_clzll( x ): std::numeric_limits<boost::ulong_long_type>::digits;
}
} // namespace detail
template<class T>
BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
return boost::core::detail::countl_impl( x );
}
#else // defined(__GNUC__) || defined(__clang__)
namespace detail
{
#if defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
if( __builtin_is_constant_evaluated() )
{
constexpr unsigned char mod37[ 37 ] = { 32, 31, 6, 30, 9, 5, 0, 29, 16, 8, 2, 4, 21, 0, 19, 28, 25, 15, 0, 7, 10, 1, 17, 3, 22, 20, 26, 0, 11, 18, 23, 27, 12, 24, 13, 14, 0 };
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
return mod37[ x % 37 ];
}
else
{
unsigned long r;
if( _BitScanReverse( &r, x ) )
{
return 31 - static_cast<int>( r );
}
else
{
return 32;
}
}
}
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint8_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 24;
}
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 16;
}
#elif defined(_MSC_VER)
inline int countl_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
unsigned long r;
if( _BitScanReverse( &r, x ) )
{
return 31 - static_cast<int>( r );
}
else
{
return 32;
}
}
inline int countl_impl( boost::uint8_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 24;
}
inline int countl_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 16;
}
#else
inline int countl_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
static unsigned char const mod37[ 37 ] = { 32, 31, 6, 30, 9, 5, 0, 29, 16, 8, 2, 4, 21, 0, 19, 28, 25, 15, 0, 7, 10, 1, 17, 3, 22, 20, 26, 0, 11, 18, 23, 27, 12, 24, 13, 14, 0 };
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
return mod37[ x % 37 ];
}
inline int countl_impl( boost::uint8_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 24;
}
inline int countl_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 16;
}
#endif
#if defined(_MSC_VER) && defined(_M_X64) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
if( __builtin_is_constant_evaluated() )
{
return static_cast<boost::uint32_t>( x >> 32 ) != 0?
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x >> 32 ) ):
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) + 32;
}
else
{
unsigned long r;
if( _BitScanReverse64( &r, x ) )
{
return 63 - static_cast<int>( r );
}
else
{
return 64;
}
}
}
#elif defined(_MSC_VER) && defined(_M_X64)
inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
unsigned long r;
if( _BitScanReverse64( &r, x ) )
{
return 63 - static_cast<int>( r );
}
else
{
return 64;
}
}
#elif defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
return static_cast<boost::uint32_t>( x >> 32 ) != 0?
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x >> 32 ) ):
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) + 32;
}
#else
inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
return static_cast<boost::uint32_t>( x >> 32 ) != 0?
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x >> 32 ) ):
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) + 32;
}
#endif
} // namespace detail
template<class T>
BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) );
BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) )
{
return boost::core::detail::countl_impl( static_cast<boost::uint8_t>( x ) );
}
else BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint16_t) )
{
return boost::core::detail::countl_impl( static_cast<boost::uint16_t>( x ) );
}
else BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint32_t) )
{
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) );
}
else
{
return boost::core::detail::countl_impl( static_cast<boost::uint64_t>( x ) );
}
}
#endif // defined(__GNUC__) || defined(__clang__)
template<class T>
BOOST_CONSTEXPR int countl_one( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
return boost::core::countl_zero( static_cast<T>( ~x ) );
}
// countr
#if defined(__GNUC__) || defined(__clang__)
namespace detail
{
BOOST_CONSTEXPR inline int countr_impl( unsigned char x ) BOOST_NOEXCEPT
{
return x? __builtin_ctz( x ): std::numeric_limits<unsigned char>::digits;
}
BOOST_CONSTEXPR inline int countr_impl( unsigned short x ) BOOST_NOEXCEPT
{
return x? __builtin_ctz( x ): std::numeric_limits<unsigned short>::digits;
}
BOOST_CONSTEXPR inline int countr_impl( unsigned int x ) BOOST_NOEXCEPT
{
return x? __builtin_ctz( x ): std::numeric_limits<unsigned int>::digits;
}
BOOST_CONSTEXPR inline int countr_impl( unsigned long x ) BOOST_NOEXCEPT
{
return x? __builtin_ctzl( x ): std::numeric_limits<unsigned long>::digits;
}
BOOST_CONSTEXPR inline int countr_impl( boost::ulong_long_type x ) BOOST_NOEXCEPT
{
return x? __builtin_ctzll( x ): std::numeric_limits<boost::ulong_long_type>::digits;
}
} // namespace detail
template<class T>
BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
return boost::core::detail::countr_impl( x );
}
#else // defined(__GNUC__) || defined(__clang__)
namespace detail
{
#if defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
if( __builtin_is_constant_evaluated() )
{
constexpr unsigned char mod37[ 37 ] = { 32, 0, 1, 26, 2, 23, 27, 0, 3, 16, 24, 30, 28, 11, 0, 13, 4, 7, 17, 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, 21, 14, 9, 5, 20, 8, 19, 18 };
return mod37[ ( -(boost::int32_t)x & x ) % 37 ];
}
else
{
unsigned long r;
if( _BitScanForward( &r, x ) )
{
return static_cast<int>( r );
}
else
{
return 32;
}
}
}
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint8_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x100 );
}
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x10000 );
}
#elif defined(_MSC_VER)
inline int countr_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
unsigned long r;
if( _BitScanForward( &r, x ) )
{
return static_cast<int>( r );
}
else
{
return 32;
}
}
inline int countr_impl( boost::uint8_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x100 );
}
inline int countr_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x10000 );
}
#else
inline int countr_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
static unsigned char const mod37[ 37 ] = { 32, 0, 1, 26, 2, 23, 27, 0, 3, 16, 24, 30, 28, 11, 0, 13, 4, 7, 17, 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, 21, 14, 9, 5, 20, 8, 19, 18 };
return mod37[ ( -(boost::int32_t)x & x ) % 37 ];
}
inline int countr_impl( boost::uint8_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x100 );
}
inline int countr_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x10000 );
}
#endif
#if defined(_MSC_VER) && defined(_M_X64) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
if( __builtin_is_constant_evaluated() )
{
return static_cast<boost::uint32_t>( x ) != 0?
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) ):
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x >> 32 ) ) + 32;
}
else
{
unsigned long r;
if( _BitScanForward64( &r, x ) )
{
return static_cast<int>( r );
}
else
{
return 64;
}
}
}
#elif defined(_MSC_VER) && defined(_M_X64)
inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
unsigned long r;
if( _BitScanForward64( &r, x ) )
{
return static_cast<int>( r );
}
else
{
return 64;
}
}
#elif defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
return static_cast<boost::uint32_t>( x ) != 0?
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) ):
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x >> 32 ) ) + 32;
}
#else
inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
return static_cast<boost::uint32_t>( x ) != 0?
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) ):
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x >> 32 ) ) + 32;
}
#endif
} // namespace detail
template<class T>
BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) );
BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) )
{
return boost::core::detail::countr_impl( static_cast<boost::uint8_t>( x ) );
}
else BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint16_t) )
{
return boost::core::detail::countr_impl( static_cast<boost::uint16_t>( x ) );
}
else BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint32_t) )
{
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) );
}
else
{
return boost::core::detail::countr_impl( static_cast<boost::uint64_t>( x ) );
}
}
#endif // defined(__GNUC__) || defined(__clang__)
template<class T>
BOOST_CONSTEXPR int countr_one( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
return boost::core::countr_zero( static_cast<T>( ~x ) );
}
// popcount
#if defined(__GNUC__) || defined(__clang__)
#if defined(__clang__) && __clang_major__ * 100 + __clang_minor__ < 304
# define BOOST_CORE_POPCOUNT_CONSTEXPR
#else
# define BOOST_CORE_POPCOUNT_CONSTEXPR BOOST_CONSTEXPR
#endif
namespace detail
{
BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( unsigned char x ) BOOST_NOEXCEPT
{
return __builtin_popcount( x );
}
BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( unsigned short x ) BOOST_NOEXCEPT
{
return __builtin_popcount( x );
}
BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( unsigned int x ) BOOST_NOEXCEPT
{
return __builtin_popcount( x );
}
BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( unsigned long x ) BOOST_NOEXCEPT
{
return __builtin_popcountl( x );
}
BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( boost::ulong_long_type x ) BOOST_NOEXCEPT
{
return __builtin_popcountll( x );
}
} // namespace detail
#undef BOOST_CORE_POPCOUNT_CONSTEXPR
template<class T>
BOOST_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
return boost::core::detail::popcount_impl( x );
}
#else // defined(__GNUC__) || defined(__clang__)
namespace detail
{
BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
x = x - ( ( x >> 1 ) & 0x55555555 );
x = ( x & 0x33333333 ) + ( ( x >> 2 ) & 0x33333333 );
x = ( x + ( x >> 4 ) ) & 0x0F0F0F0F;
return static_cast<unsigned>( ( x * 0x01010101 ) >> 24 );
}
BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
x = x - ( ( x >> 1 ) & 0x5555555555555555 );
x = ( x & 0x3333333333333333 ) + ( ( x >> 2 ) & 0x3333333333333333 );
x = ( x + ( x >> 4 ) ) & 0x0F0F0F0F0F0F0F0F;
return static_cast<unsigned>( ( x * 0x0101010101010101 ) >> 56 );
}
} // namespace detail
template<class T>
BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
BOOST_STATIC_ASSERT( sizeof(T) <= sizeof(boost::uint64_t) );
BOOST_IF_CONSTEXPR ( sizeof(T) <= sizeof(boost::uint32_t) )
{
return boost::core::detail::popcount_impl( static_cast<boost::uint32_t>( x ) );
}
else
{
return boost::core::detail::popcount_impl( static_cast<boost::uint64_t>( x ) );
}
}
#endif // defined(__GNUC__) || defined(__clang__)
// rotating
template<class T>
BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
unsigned const mask = std::numeric_limits<T>::digits - 1;
return static_cast<T>( x << (static_cast<unsigned>( s ) & mask) | x >> (static_cast<unsigned>( -s ) & mask) );
}
template<class T>
BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
unsigned const mask = std::numeric_limits<T>::digits - 1;
return static_cast<T>( x >> (static_cast<unsigned>( s ) & mask) | x << (static_cast<unsigned>( -s ) & mask) );
}
// integral powers of 2
template<class T>
BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
return x != 0 && ( x & ( x - 1 ) ) == 0;
}
// bit_width returns `int` now, https://cplusplus.github.io/LWG/issue3656
// has been applied to C++20 as a DR
template<class T>
BOOST_CONSTEXPR int bit_width( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
return std::numeric_limits<T>::digits - boost::core::countl_zero( x );
}
template<class T>
BOOST_CONSTEXPR T bit_floor( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
return x == 0? T(0): static_cast<T>( T(1) << ( boost::core::bit_width( x ) - 1 ) );
}
namespace detail
{
BOOST_CXX14_CONSTEXPR inline boost::uint32_t bit_ceil_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
if( x == 0 )
{
return 0;
}
--x;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
++x;
return x;
}
BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
if( x == 0 )
{
return 0;
}
--x;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
x |= x >> 32;
++x;
return x;
}
} // namespace detail
template<class T>
BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
BOOST_STATIC_ASSERT( sizeof(T) <= sizeof(boost::uint64_t) );
BOOST_IF_CONSTEXPR ( sizeof(T) <= sizeof(boost::uint32_t) )
{
return static_cast<T>( boost::core::detail::bit_ceil_impl( static_cast<boost::uint32_t>( x ) ) );
}
else
{
return static_cast<T>( boost::core::detail::bit_ceil_impl( static_cast<boost::uint64_t>( x ) ) );
}
}
// endian
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define BOOST_CORE_BIT_NATIVE_INITIALIZER =little
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define BOOST_CORE_BIT_NATIVE_INITIALIZER =big
#elif defined(__BYTE_ORDER__) && defined(__ORDER_PDP_ENDIAN__) && __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
# define BOOST_CORE_BIT_NATIVE_INITIALIZER
#elif defined(__LITTLE_ENDIAN__)
# define BOOST_CORE_BIT_NATIVE_INITIALIZER =little
#elif defined(__BIG_ENDIAN__)
# define BOOST_CORE_BIT_NATIVE_INITIALIZER =big
#elif defined(_MSC_VER) || defined(__i386__) || defined(__x86_64__)
# define BOOST_CORE_BIT_NATIVE_INITIALIZER =little
#else
# define BOOST_CORE_BIT_NATIVE_INITIALIZER
#endif
#if !defined(BOOST_NO_CXX11_SCOPED_ENUMS)
enum class endian
{
big,
little,
native BOOST_CORE_BIT_NATIVE_INITIALIZER
};
typedef endian endian_type;
#else
namespace endian
{
enum type
{
big,
little,
native BOOST_CORE_BIT_NATIVE_INITIALIZER
};
} // namespace endian
typedef endian::type endian_type;
#endif
#undef BOOST_CORE_BIT_NATIVE_INITIALIZER
// byteswap
namespace detail
{
BOOST_CONSTEXPR inline boost::uint8_t byteswap_impl( boost::uint8_t x ) BOOST_NOEXCEPT
{
return x;
}
#if defined(BOOST_CORE_HAS_BUILTIN_BSWAP16)
BOOST_CONSTEXPR inline boost::uint16_t byteswap_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{
return __builtin_bswap16( x );
}
#else
BOOST_CONSTEXPR inline boost::uint16_t byteswap_impl( boost::uint16_t x ) BOOST_NOEXCEPT
{
return static_cast<boost::uint16_t>( x << 8 | x >> 8 );
}
#endif
#if defined(__GNUC__) || defined(__clang__)
BOOST_CXX14_CONSTEXPR inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
return __builtin_bswap32( x );
}
BOOST_CXX14_CONSTEXPR inline boost::uint64_t byteswap_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
return __builtin_bswap64( x );
}
#elif defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
BOOST_CXX14_CONSTEXPR inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
if( __builtin_is_constant_evaluated() )
{
boost::uint32_t step16 = x << 16 | x >> 16;
return ((step16 << 8) & 0xff00ff00) | ((step16 >> 8) & 0x00ff00ff);
}
else
{
return _byteswap_ulong( x );
}
}
BOOST_CXX14_CONSTEXPR inline boost::uint64_t byteswap_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
if( __builtin_is_constant_evaluated() )
{
boost::uint64_t step32 = x << 32 | x >> 32;
boost::uint64_t step16 = (step32 & 0x0000FFFF0000FFFFULL) << 16 | (step32 & 0xFFFF0000FFFF0000ULL) >> 16;
return (step16 & 0x00FF00FF00FF00FFULL) << 8 | (step16 & 0xFF00FF00FF00FF00ULL) >> 8;
}
else
{
return _byteswap_uint64( x );
}
}
#elif defined(_MSC_VER)
inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
return _byteswap_ulong( x );
}
inline boost::uint64_t byteswap_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
return _byteswap_uint64( x );
}
#else
BOOST_CXX14_CONSTEXPR inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT
{
boost::uint32_t step16 = x << 16 | x >> 16;
return ((step16 << 8) & 0xff00ff00) | ((step16 >> 8) & 0x00ff00ff);
}
BOOST_CXX14_CONSTEXPR inline boost::uint64_t byteswap_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
boost::uint64_t step32 = x << 32 | x >> 32;
boost::uint64_t step16 = (step32 & 0x0000FFFF0000FFFFULL) << 16 | (step32 & 0xFFFF0000FFFF0000ULL) >> 16;
return (step16 & 0x00FF00FF00FF00FFULL) << 8 | (step16 & 0xFF00FF00FF00FF00ULL) >> 8;
}
#endif
} // namespace detail
template<class T> BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer );
BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) );
BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) )
{
return static_cast<T>( boost::core::detail::byteswap_impl( static_cast<boost::uint8_t>( x ) ) );
}
else BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint16_t) )
{
return static_cast<T>( boost::core::detail::byteswap_impl( static_cast<boost::uint16_t>( x ) ) );
}
else BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint32_t) )
{
return static_cast<T>( boost::core::detail::byteswap_impl( static_cast<boost::uint32_t>( x ) ) );
}
else
{
return static_cast<T>( boost::core::detail::byteswap_impl( static_cast<boost::uint64_t>( x ) ) );
}
}
} // namespace core
} // namespace boost
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // #ifndef BOOST_CORE_BIT_HPP_INCLUDED

View File

@@ -7,6 +7,8 @@
# pragma once
#endif
#include <boost/config.hpp>
//
// boost/checked_delete.hpp
//
@@ -26,27 +28,48 @@ namespace boost
// verify that types are complete for increased safety
template<class T> inline void checked_delete(T * x)
template<class T> inline void checked_delete(T * x) BOOST_NOEXCEPT
{
// intentionally complex - simplification causes regressions
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
#if defined(__cpp_static_assert) && __cpp_static_assert >= 200410L
static_assert( sizeof(T) != 0, "Type must be complete" );
#else
typedef char type_must_be_complete[ sizeof(T) ];
(void) sizeof(type_must_be_complete);
#endif
delete x;
}
template<class T> inline void checked_array_delete(T * x)
template<class T> inline void checked_array_delete(T * x) BOOST_NOEXCEPT
{
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
#if defined(__cpp_static_assert) && __cpp_static_assert >= 200410L
static_assert( sizeof(T) != 0, "Type must be complete" );
#else
typedef char type_must_be_complete[ sizeof(T) ];
(void) sizeof(type_must_be_complete);
#endif
delete [] x;
}
// Block unintended ADL
namespace checked_deleters
{
template<class T> struct checked_deleter
{
typedef void result_type;
typedef T * argument_type;
void operator()(T * x) const
void operator()(T * x) const BOOST_NOEXCEPT
{
// boost:: disables ADL
boost::checked_delete(x);
@@ -58,12 +81,17 @@ template<class T> struct checked_array_deleter
typedef void result_type;
typedef T * argument_type;
void operator()(T * x) const
void operator()(T * x) const BOOST_NOEXCEPT
{
boost::checked_array_delete(x);
}
};
} // namespace checked_deleters
using checked_deleters::checked_deleter;
using checked_deleters::checked_array_deleter;
} // namespace boost
#endif // #ifndef BOOST_CORE_CHECKED_DELETE_HPP

View File

@@ -0,0 +1,298 @@
#ifndef BOOST_CORE_CMATH_HPP_INCLUDED
#define BOOST_CORE_CMATH_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// boost/core/cmath.hpp
//
// Floating point classification and sign manipulation functions
// Extracted from https://github.com/boostorg/lexical_cast/pull/37
//
// Copyright 2020, 2021 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <cmath>
#if defined(BOOST_CORE_USE_GENERIC_CMATH) || (!defined(_MSC_VER) && !defined(FP_SUBNORMAL))
#include <boost/cstdint.hpp>
#include <boost/static_assert.hpp>
#include <limits>
#include <cstring>
namespace boost
{
namespace core
{
// fpclassify return values
int const fp_zero = 0;
int const fp_subnormal = 1;
int const fp_normal = 2;
int const fp_infinite = 3;
int const fp_nan = 4;
// Classification functions
template<class T> bool isfinite( T x )
{
return x <= (std::numeric_limits<T>::max)() && x >= -(std::numeric_limits<T>::max)();
}
template<class T> bool isinf( T x )
{
return x > (std::numeric_limits<T>::max)() || x < -(std::numeric_limits<T>::max)();
}
template<class T> bool isnan( T x )
{
return !isfinite( x ) && !isinf( x );
}
template<class T> bool isnormal( T x )
{
return isfinite( x ) && ( x >= (std::numeric_limits<T>::min)() || x <= -(std::numeric_limits<T>::min)() );
}
template<class T> int fpclassify( T x )
{
if( x == 0 ) return fp_zero;
if( x < 0 ) x = -x;
if( x > (std::numeric_limits<T>::max)() ) return fp_infinite;
if( x >= (std::numeric_limits<T>::min)() ) return fp_normal;
if( x < (std::numeric_limits<T>::min)() ) return fp_subnormal;
return fp_nan;
}
// Sign manipulation functions
inline bool signbit( float x )
{
boost::int32_t y;
BOOST_STATIC_ASSERT( sizeof( x ) == sizeof( y ) );
std::memcpy( &y, &x, sizeof( y ) );
return y < 0;
}
inline bool signbit( double x )
{
boost::int64_t y;
BOOST_STATIC_ASSERT( sizeof( x ) == sizeof( y ) );
std::memcpy( &y, &x, sizeof( y ) );
return y < 0;
}
inline bool signbit( long double x )
{
return signbit( static_cast<double>( x ) );
}
template<class T> T copysign( T x, T y )
{
return signbit( x ) == signbit( y )? x: -x;
}
} // namespace core
} // namespace boost
#else // defined(BOOST_CORE_USE_GENERIC_CMATH)
#if defined(_MSC_VER) && _MSC_VER < 1800
# include <float.h>
#endif
namespace boost
{
namespace core
{
#if defined(_MSC_VER) && _MSC_VER < 1800
template<class T> T copysign( T x, T y )
{
return static_cast<T>( _copysign( static_cast<double>( x ), static_cast<double>( y ) ) );
}
template<class T> bool isnan( T x )
{
return _isnan( static_cast<double>( x ) ) != 0;
}
template<class T> bool isfinite( T x )
{
return _finite( static_cast<double>( x ) ) != 0;
}
template<class T> bool isinf( T x )
{
return ( _fpclass( static_cast<double>( x ) ) & ( _FPCLASS_PINF | _FPCLASS_NINF ) ) != 0;
}
inline bool isnormal( float x )
{
// no _fpclassf in 32 bit mode
unsigned y = reinterpret_cast< unsigned const& >( x );
unsigned exp = ( y >> 23 ) & 0xFF;
return exp != 0 && exp != 0xFF;
}
inline bool isnormal( double x )
{
return ( _fpclass( x ) & ( _FPCLASS_PN | _FPCLASS_NN ) ) != 0;
}
inline bool isnormal( long double x )
{
return boost::core::isnormal( static_cast<double>( x ) );
}
template<class T> bool signbit( T x )
{
return _copysign( 1.0, static_cast<double>( x ) ) < 0.0;
}
int const fp_zero = 0;
int const fp_subnormal = 1;
int const fp_normal = 2;
int const fp_infinite = 3;
int const fp_nan = 4;
inline int fpclassify( float x )
{
switch( _fpclass( x ) )
{
case _FPCLASS_SNAN:
case _FPCLASS_QNAN:
return fp_nan;
case _FPCLASS_NINF:
case _FPCLASS_PINF:
return fp_infinite;
case _FPCLASS_NZ:
case _FPCLASS_PZ:
return fp_zero;
default:
return boost::core::isnormal( x )? fp_normal: fp_subnormal;
}
}
inline int fpclassify( double x )
{
switch( _fpclass( x ) )
{
case _FPCLASS_SNAN:
case _FPCLASS_QNAN:
return fp_nan;
case _FPCLASS_NINF:
case _FPCLASS_PINF:
return fp_infinite;
case _FPCLASS_NZ:
case _FPCLASS_PZ:
return fp_zero;
case _FPCLASS_ND:
case _FPCLASS_PD:
return fp_subnormal;
default:
return fp_normal;
}
}
inline int fpclassify( long double x )
{
return boost::core::fpclassify( static_cast<double>( x ) );
}
#else
using std::isfinite;
using std::isnan;
using std::isinf;
using std::isnormal;
using std::fpclassify;
int const fp_zero = FP_ZERO;
int const fp_subnormal = FP_SUBNORMAL;
int const fp_normal = FP_NORMAL;
int const fp_infinite = FP_INFINITE;
int const fp_nan = FP_NAN;
using std::signbit;
// std::copysign doesn't exist in libstdc++ under -std=c++03
#if !defined(__GNUC__)
template<class T> T copysign( T x, T y )
{
return std::copysign( x, y );
}
#else
namespace detail
{
// ::copysignl is unreliable, use the built-ins
inline float copysign_impl( float x, float y )
{
return __builtin_copysignf( x, y );
}
inline double copysign_impl( double x, double y )
{
return __builtin_copysign( x, y );
}
inline long double copysign_impl( long double x, long double y )
{
return __builtin_copysignl( x, y );
}
} // namespace detail
template<class T> T copysign( T x, T y )
{
return boost::core::detail::copysign_impl( x, y );
}
#endif // !defined(__GNUC__)
#endif // #if defined(_MSC_VER) && _MSC_VER < 1800
} // namespace core
} // namespace boost
#endif // defined(BOOST_CORE_USE_GENERIC_CMATH)
#endif // #ifndef BOOST_CORE_CMATH_HPP_INCLUDED

View File

@@ -0,0 +1,46 @@
/*
Copyright 2023 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_DATA_HPP
#define BOOST_CORE_DATA_HPP
#include <initializer_list>
#include <cstddef>
namespace boost {
template<class C>
inline constexpr auto
data(C& c) noexcept(noexcept(c.data())) -> decltype(c.data())
{
return c.data();
}
template<class C>
inline constexpr auto
data(const C& c) noexcept(noexcept(c.data())) -> decltype(c.data())
{
return c.data();
}
template<class T, std::size_t N>
inline constexpr T*
data(T(&a)[N]) noexcept
{
return a;
}
template<class T>
inline constexpr const T*
data(std::initializer_list<T> l) noexcept
{
return l.begin();
}
} /* boost */
#endif

View File

@@ -0,0 +1,158 @@
/*
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_DEFAULT_ALLOCATOR_HPP
#define BOOST_CORE_DEFAULT_ALLOCATOR_HPP
#include <boost/config.hpp>
#include <new>
namespace boost {
#if defined(BOOST_NO_EXCEPTIONS)
BOOST_NORETURN void throw_exception(const std::exception&);
#endif
namespace default_ {
template<bool V>
struct bool_constant {
typedef bool value_type;
typedef bool_constant type;
static const bool value = V;
operator bool() const BOOST_NOEXCEPT {
return V;
}
bool operator()() const BOOST_NOEXCEPT {
return V;
}
};
template<bool V>
const bool bool_constant<V>::value;
template<class T>
struct add_reference {
typedef T& type;
};
template<>
struct add_reference<void> {
typedef void type;
};
template<>
struct add_reference<const void> {
typedef const void type;
};
template<class T>
struct default_allocator {
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef typename add_reference<T>::type reference;
typedef typename add_reference<const T>::type const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef bool_constant<true> propagate_on_container_move_assignment;
typedef bool_constant<true> is_always_equal;
template<class U>
struct rebind {
typedef default_allocator<U> other;
};
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
default_allocator() = default;
#else
BOOST_CONSTEXPR default_allocator() BOOST_NOEXCEPT { }
#endif
template<class U>
BOOST_CONSTEXPR default_allocator(const default_allocator<U>&)
BOOST_NOEXCEPT { }
BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT {
return static_cast<std::size_t>(-1) / (2 < sizeof(T) ? sizeof(T) : 2);
}
#if !defined(BOOST_NO_EXCEPTIONS)
T* allocate(std::size_t n) {
if (n > max_size()) {
throw std::bad_alloc();
}
return static_cast<T*>(::operator new(sizeof(T) * n));
}
void deallocate(T* p, std::size_t) {
::operator delete(p);
}
#else
T* allocate(std::size_t n) {
if (n > max_size()) {
boost::throw_exception(std::bad_alloc());
}
void* p = ::operator new(sizeof(T) * n, std::nothrow);
if (!p) {
boost::throw_exception(std::bad_alloc());
}
return static_cast<T*>(p);
}
void deallocate(T* p, std::size_t) {
::operator delete(p, std::nothrow);
}
#endif
#if defined(BOOST_NO_CXX11_ALLOCATOR)
T* allocate(std::size_t n, const void*) {
return allocate(n);
}
#endif
#if (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 60000) || \
defined(BOOST_NO_CXX11_ALLOCATOR)
template<class U, class V>
void construct(U* p, const V& v) {
::new(p) U(v);
}
template<class U>
void destroy(U* p) {
p->~U();
(void)p;
}
#endif
};
template<class T, class U>
BOOST_CONSTEXPR inline bool
operator==(const default_allocator<T>&,
const default_allocator<U>&) BOOST_NOEXCEPT
{
return true;
}
template<class T, class U>
BOOST_CONSTEXPR inline bool
operator!=(const default_allocator<T>&,
const default_allocator<U>&) BOOST_NOEXCEPT
{
return false;
}
} /* default_ */
using default_::default_allocator;
} /* boost */
#endif

View File

@@ -0,0 +1,39 @@
#ifndef BOOST_CORE_DETAIL_IS_SAME_HPP_INCLUDED
#define BOOST_CORE_DETAIL_IS_SAME_HPP_INCLUDED
// is_same<T1,T2>::value is true when T1 == T2
//
// Copyright 2014 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_HAS_PRAGMA_ONCE)
# pragma once
#endif
namespace boost
{
namespace core
{
namespace detail
{
template< class T1, class T2 > struct is_same
{
BOOST_STATIC_CONSTANT( bool, value = false );
};
template< class T > struct is_same< T, T >
{
BOOST_STATIC_CONSTANT( bool, value = true );
};
} // namespace detail
} // namespace core
} // namespace boost
#endif // #ifndef BOOST_CORE_DETAIL_IS_SAME_HPP_INCLUDED

View File

@@ -0,0 +1,66 @@
#ifndef BOOST_CORE_DETAIL_LWT_UNATTENDED_HPP_INCLUDED
#define BOOST_CORE_DETAIL_LWT_UNATTENDED_HPP_INCLUDED
// Copyright 2014, 2022 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <cstdlib>
#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG)
# include <crtdbg.h>
#endif
namespace boost
{
namespace core
{
namespace detail
{
// Setup unattended mode by disabling interactive popups on
// assertion failures
inline void lwt_unattended()
{
#if defined(_MSC_VER) && (_MSC_VER > 1310)
// disable message boxes on assert(), abort()
::_set_abort_behavior( 0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT );
# pragma warning(push)
# pragma warning(disable: 4996)
# if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
# endif
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY == 100 /*WINAPI_FAMILY_DESKTOP_APP*/
// disable message box on crash
::_seterrormode( /*SEM_NOGPFAULTERRORBOX*/ 0x0002 );
#endif
# if defined(__clang__)
# pragma clang diagnostic pop
# endif
# pragma warning(pop)
#endif
#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG)
// disable message boxes on iterator debugging violations
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
#endif
}
} // namespace detail
} // namespace core
} // namespace boost
#endif // #ifndef BOOST_CORE_DETAIL_LWT_UNATTENDED_HPP_INCLUDED

View File

@@ -0,0 +1,58 @@
#ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
#define BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
// Copyright 2017 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
//
// An implementation of minstd_rand that does not require
// the Random library
#include <boost/cstdint.hpp>
namespace boost
{
namespace detail
{
class minstd_rand
{
private:
boost::uint_least32_t x_;
enum { a = 48271, m = 2147483647 };
public:
minstd_rand(): x_( 1 )
{
}
explicit minstd_rand( boost::uint_least32_t x ): x_( x % m )
{
if( x_ == 0 )
{
x_ = 1;
}
}
boost::uint_least32_t operator()()
{
boost::uint_least64_t y = x_;
y = ( a * y ) % m;
x_ = static_cast<boost::uint_least32_t>( y );
return x_;
}
};
} // namespace detail
} // namespace boost
#endif // #ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED

View File

@@ -0,0 +1,71 @@
#ifndef BOOST_CORE_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED
#define BOOST_CORE_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// boost/core/detail/sp_thread_pause.hpp
//
// inline void bost::core::sp_thread_pause();
//
// Emits a "pause" instruction.
//
// Copyright 2008, 2020, 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#if defined(__has_builtin)
# if __has_builtin(__builtin_ia32_pause) && !defined(__INTEL_COMPILER)
# define BOOST_CORE_HAS_BUILTIN_IA32_PAUSE
# endif
#endif
#if defined(BOOST_CORE_HAS_BUILTIN_IA32_PAUSE)
# define BOOST_CORE_SP_PAUSE() __builtin_ia32_pause()
#elif defined(_MSC_VER) && ( defined(_M_IX86) || defined(_M_X64) )
# include <intrin.h>
# define BOOST_CORE_SP_PAUSE() _mm_pause()
#elif defined(_MSC_VER) && ( defined(_M_ARM) || defined(_M_ARM64) )
# include <intrin.h>
# define BOOST_CORE_SP_PAUSE() __yield()
#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
# define BOOST_CORE_SP_PAUSE() __asm__ __volatile__( "rep; nop" : : : "memory" )
#elif defined(__GNUC__) && ( (defined(__ARM_ARCH) && __ARM_ARCH >= 8) || defined(__ARM_ARCH_8A__) || defined(__aarch64__) )
# define BOOST_CORE_SP_PAUSE() __asm__ __volatile__( "yield" : : : "memory" )
#else
# define BOOST_CORE_SP_PAUSE() ((void)0)
#endif
namespace boost
{
namespace core
{
BOOST_FORCEINLINE void sp_thread_pause() BOOST_NOEXCEPT
{
BOOST_CORE_SP_PAUSE();
}
} // namespace core
} // namespace boost
#undef BOOST_CORE_SP_PAUSE
#endif // #ifndef BOOST_CORE_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED

View File

@@ -0,0 +1,122 @@
#ifndef BOOST_CORE_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED
#define BOOST_CORE_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// boost/core/detail/sp_thread_sleep.hpp
//
// inline void bost::core::sp_thread_sleep();
//
// Cease execution for a while to yield to other threads,
// as if by calling nanosleep() with an appropriate interval.
//
// Copyright 2008, 2020, 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#include <boost/config/pragma_message.hpp>
#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
BOOST_PRAGMA_MESSAGE("Using Sleep(1) in sp_thread_sleep")
#endif
#include <boost/core/detail/sp_win32_sleep.hpp>
namespace boost
{
namespace core
{
namespace detail
{
inline void sp_thread_sleep() BOOST_NOEXCEPT
{
Sleep( 1 );
}
} // namespace detail
using boost::core::detail::sp_thread_sleep;
} // namespace core
} // namespace boost
#elif defined(BOOST_HAS_NANOSLEEP)
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
BOOST_PRAGMA_MESSAGE("Using nanosleep() in sp_thread_sleep")
#endif
#include <time.h>
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
# include <pthread.h>
#endif
namespace boost
{
namespace core
{
inline void sp_thread_sleep() BOOST_NOEXCEPT
{
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
int oldst;
pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &oldst );
#endif
// g++ -Wextra warns on {} or {0}
struct timespec rqtp = { 0, 0 };
// POSIX says that timespec has tv_sec and tv_nsec
// But it doesn't guarantee order or placement
rqtp.tv_sec = 0;
rqtp.tv_nsec = 1000;
nanosleep( &rqtp, 0 );
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
pthread_setcancelstate( oldst, &oldst );
#endif
}
} // namespace core
} // namespace boost
#else
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
BOOST_PRAGMA_MESSAGE("Using sp_thread_yield() in sp_thread_sleep")
#endif
#include <boost/core/detail/sp_thread_yield.hpp>
namespace boost
{
namespace core
{
inline void sp_thread_sleep() BOOST_NOEXCEPT
{
sp_thread_yield();
}
} // namespace core
} // namespace boost
#endif
#endif // #ifndef BOOST_CORE_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED

View File

@@ -0,0 +1,100 @@
#ifndef BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED
#define BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// boost/core/detail/sp_thread_yield.hpp
//
// inline void bost::core::sp_thread_yield();
//
// Gives up the remainder of the time slice,
// as if by calling sched_yield().
//
// Copyright 2008, 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#include <boost/config/pragma_message.hpp>
#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
BOOST_PRAGMA_MESSAGE("Using SwitchToThread() in sp_thread_yield")
#endif
#include <boost/core/detail/sp_win32_sleep.hpp>
namespace boost
{
namespace core
{
namespace detail
{
inline void sp_thread_yield() BOOST_NOEXCEPT
{
SwitchToThread();
}
} // namespace detail
using boost::core::detail::sp_thread_yield;
} // namespace core
} // namespace boost
#elif defined(BOOST_HAS_SCHED_YIELD)
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
BOOST_PRAGMA_MESSAGE("Using sched_yield() in sp_thread_yield")
#endif
#ifndef _AIX
# include <sched.h>
#else
// AIX's sched.h defines ::var which sometimes conflicts with Lambda's var
extern "C" int sched_yield(void);
#endif
namespace boost
{
namespace core
{
inline void sp_thread_yield() BOOST_NOEXCEPT
{
sched_yield();
}
} // namespace core
} // namespace boost
#else
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
BOOST_PRAGMA_MESSAGE("Using sp_thread_pause() in sp_thread_yield")
#endif
#include <boost/core/detail/sp_thread_pause.hpp>
namespace boost
{
namespace core
{
inline void sp_thread_yield() BOOST_NOEXCEPT
{
sp_thread_pause();
}
} // namespace core
} // namespace boost
#endif
#endif // #ifndef BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED

View File

@@ -0,0 +1,54 @@
#ifndef BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED
#define BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// boost/core/detail/sp_win32_sleep.hpp
//
// Declares the Win32 Sleep() function.
//
// Copyright 2008, 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0
// https://www.boost.org/LICENSE_1_0.txt
#if defined( BOOST_USE_WINDOWS_H )
# include <windows.h>
#endif
namespace boost
{
namespace core
{
namespace detail
{
#if !defined( BOOST_USE_WINDOWS_H )
#if defined(__clang__) && defined(__x86_64__)
// clang x64 warns that __stdcall is ignored
# define BOOST_CORE_SP_STDCALL
#else
# define BOOST_CORE_SP_STDCALL __stdcall
#endif
#if defined(__LP64__) // Cygwin 64
extern "C" __declspec(dllimport) void BOOST_CORE_SP_STDCALL Sleep( unsigned int ms );
#else
extern "C" __declspec(dllimport) void BOOST_CORE_SP_STDCALL Sleep( unsigned long ms );
#endif
extern "C" __declspec(dllimport) int BOOST_CORE_SP_STDCALL SwitchToThread();
#undef BOOST_CORE_SP_STDCALL
#endif // !defined( BOOST_USE_WINDOWS_H )
} // namespace detail
} // namespace core
} // namespace boost
#endif // #ifndef BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED

View File

@@ -0,0 +1,54 @@
#ifndef BOOST_CORE_DETAIL_SPLITMIX64_HPP_INCLUDED
#define BOOST_CORE_DETAIL_SPLITMIX64_HPP_INCLUDED
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
//
// An implementation of splitmix64 for testing purposes,
// derived from Sebastiano Vigna's public domain implementation
// http://xorshift.di.unimi.it/splitmix64.c
#include <boost/cstdint.hpp>
namespace boost
{
namespace detail
{
class splitmix64
{
private:
boost::uint64_t x_;
public:
splitmix64(): x_( 0 )
{
}
explicit splitmix64( boost::uint64_t seed ): x_( seed )
{
}
boost::uint64_t operator()()
{
x_ += ( boost::uint64_t(0x9e3779b9u) << 32 ) + 0x7f4a7c15u;
boost::uint64_t z = x_;
z ^= z >> 30;
z *= ( boost::uint64_t(0xbf58476du) << 32 ) + 0x1ce4e5b9u;
z ^= z >> 27;
z *= ( boost::uint64_t(0x94d049bbu) << 32 ) + 0x133111ebu;
z ^= z >> 31;
return z;
}
};
} // namespace detail
} // namespace boost
#endif // #ifndef BOOST_CORE_DETAIL_SPLITMIX64_HPP_INCLUDED

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,203 @@
/*
Copyright 2018 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_EMPTY_VALUE_HPP
#define BOOST_CORE_EMPTY_VALUE_HPP
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#include <utility>
#endif
#if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 40700)
#define BOOST_DETAIL_EMPTY_VALUE_BASE
#elif defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1800)
#define BOOST_DETAIL_EMPTY_VALUE_BASE
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1800)
#define BOOST_DETAIL_EMPTY_VALUE_BASE
#elif defined(BOOST_CLANG) && !defined(__CUDACC__)
#if __has_feature(is_empty) && __has_feature(is_final)
#define BOOST_DETAIL_EMPTY_VALUE_BASE
#endif
#endif
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4510)
#endif
namespace boost {
template<class T>
struct use_empty_value_base {
enum {
#if defined(BOOST_DETAIL_EMPTY_VALUE_BASE)
value = __is_empty(T) && !__is_final(T)
#else
value = false
#endif
};
};
struct empty_init_t { };
namespace empty_ {
template<class T, unsigned N = 0,
bool E = boost::use_empty_value_base<T>::value>
class empty_value {
public:
typedef T type;
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
empty_value() = default;
#else
BOOST_CONSTEXPR empty_value() { }
#endif
BOOST_CONSTEXPR empty_value(boost::empty_init_t)
: value_() { }
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class U, class... Args>
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args)
: value_(std::forward<U>(value), std::forward<Args>(args)...) { }
#else
template<class U>
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value)
: value_(std::forward<U>(value)) { }
#endif
#else
template<class U>
BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value)
: value_(value) { }
template<class U>
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value)
: value_(value) { }
#endif
BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT {
return value_;
}
BOOST_CXX14_CONSTEXPR T& get() BOOST_NOEXCEPT {
return value_;
}
private:
T value_;
};
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
#if defined(BOOST_MSVC)
/*
This is a workaround to an MSVC bug when T is a nested class:
https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025
*/
namespace detail {
template<class T>
class empty_value_base
: public T {
public:
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
empty_value_base() = default;
#else
BOOST_CONSTEXPR empty_value_base() { }
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class U, class... Args>
BOOST_CONSTEXPR empty_value_base(U&& value, Args&&... args)
: T(std::forward<U>(value), std::forward<Args>(args)...) { }
#else
template<class U>
BOOST_CONSTEXPR empty_value_base(U&& value)
: T(std::forward<U>(value)) { }
#endif
#else
template<class U>
BOOST_CONSTEXPR empty_value_base(const U& value)
: T(value) { }
template<class U>
BOOST_CONSTEXPR empty_value_base(U& value)
: T(value) { }
#endif
};
} /* detail */
#endif
template<class T, unsigned N>
class empty_value<T, N, true>
#if defined(BOOST_MSVC)
: detail::empty_value_base<T> {
typedef detail::empty_value_base<T> empty_base_;
#else
: T {
typedef T empty_base_;
#endif
public:
typedef T type;
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
empty_value() = default;
#else
BOOST_CONSTEXPR empty_value() { }
#endif
BOOST_CONSTEXPR empty_value(boost::empty_init_t)
: empty_base_() { }
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class U, class... Args>
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args)
: empty_base_(std::forward<U>(value), std::forward<Args>(args)...) { }
#else
template<class U>
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value)
: empty_base_(std::forward<U>(value)) { }
#endif
#else
template<class U>
BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value)
: empty_base_(value) { }
template<class U>
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value)
: empty_base_(value) { }
#endif
BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT {
return *this;
}
BOOST_CXX14_CONSTEXPR T& get() BOOST_NOEXCEPT {
return *this;
}
};
#endif
} /* empty_ */
using empty_::empty_value;
BOOST_INLINE_CONSTEXPR empty_init_t empty_init = empty_init_t();
} /* boost */
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif

View File

@@ -0,0 +1,49 @@
/*
Copyright 2018 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_EXCHANGE_HPP
#define BOOST_CORE_EXCHANGE_HPP
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#include <boost/config/workaround.hpp>
#include <utility>
#endif
namespace boost {
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<class T, class U>
inline T exchange(T& t, const U& u)
{
T v = t;
t = u;
return v;
}
#else
#if BOOST_WORKAROUND(BOOST_MSVC, < 1800)
template<class T, class U>
inline T exchange(T& t, U&& u)
{
T v = std::move(t);
t = std::forward<U>(u);
return v;
}
#else
template<class T, class U = T>
BOOST_CXX14_CONSTEXPR inline T exchange(T& t, U&& u)
{
T v = std::move(t);
t = std::forward<U>(u);
return v;
}
#endif
#endif
} /* boost */
#endif

View File

@@ -19,6 +19,7 @@
#define BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
@@ -52,6 +53,8 @@
return !this->operator! ();\
}
#if !BOOST_WORKAROUND(BOOST_GCC, < 40700)
/*!
* \brief The macro defines a constexpr explicit operator of conversion to \c bool
*
@@ -65,6 +68,12 @@
return !this->operator! ();\
}
#else
#define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL() BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
#endif
#else // !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
#if (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG)

View File

@@ -0,0 +1,53 @@
/*
* Copyright Andrey Semashev 2022.
* 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)
*/
/*!
* \file fclose_deleter.hpp
* \author Andrey Semashev
* \date 21.09.2022
*
* This header contains an \c fclose_deleter implementation. This is a deleter
* function object that invokes <tt>std::fclose</tt> on the passed pointer to
* a <tt>std::FILE</tt> structure.
*/
#ifndef BOOST_CORE_FCLOSE_DELETER_HPP
#define BOOST_CORE_FCLOSE_DELETER_HPP
#include <cstdio>
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
// Block unintended ADL
namespace fclose_deleter_ns {
//! A function object that closes a file
struct fclose_deleter
{
//! Function object result type
typedef void result_type;
/*!
* Closes the file handle
*/
void operator() (std::FILE* p) const BOOST_NOEXCEPT
{
if (BOOST_LIKELY(!!p))
std::fclose(p);
}
};
} // namespace fclose_deleter_ns
using fclose_deleter_ns::fclose_deleter;
} // namespace boost
#endif // BOOST_CORE_FCLOSE_DELETER_HPP

View File

@@ -0,0 +1,45 @@
/*
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_FIRST_SCALAR_HPP
#define BOOST_CORE_FIRST_SCALAR_HPP
#include <boost/config.hpp>
#include <cstddef>
namespace boost {
namespace detail {
template<class T>
struct make_scalar {
typedef T type;
};
template<class T, std::size_t N>
struct make_scalar<T[N]> {
typedef typename make_scalar<T>::type type;
};
} /* detail */
template<class T>
BOOST_CONSTEXPR inline T*
first_scalar(T* p) BOOST_NOEXCEPT
{
return p;
}
template<class T, std::size_t N>
BOOST_CONSTEXPR inline typename detail::make_scalar<T>::type*
first_scalar(T (*p)[N]) BOOST_NOEXCEPT
{
return boost::first_scalar(&(*p)[0]);
}
} /* boost */
#endif

View File

@@ -0,0 +1,41 @@
/*
* Copyright Andrey Semashev 2024.
* 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)
*/
/*!
* \file functor.hpp
* \author Andrey Semashev
* \date 2024-01-23
*
* This header contains a \c functor implementation. This is a function object
* that invokes a function that is specified as its template parameter.
*/
#ifndef BOOST_CORE_FUNCTOR_HPP
#define BOOST_CORE_FUNCTOR_HPP
namespace boost::core {
// Block unintended ADL
namespace functor_ns {
//! A function object that invokes a function specified as its template parameter
template< auto Function >
struct functor
{
template< typename... Args >
auto operator() (Args&&... args) const noexcept(noexcept(Function(static_cast< Args&& >(args)...))) -> decltype(Function(static_cast< Args&& >(args)...))
{
return Function(static_cast< Args&& >(args)...);
}
};
} // namespace functor_ns
using functor_ns::functor;
} // namespace boost::core
#endif // BOOST_CORE_FUNCTOR_HPP

View File

@@ -0,0 +1,61 @@
/*
Copyright 2021-2023 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_IDENTITY_HPP
#define BOOST_CORE_IDENTITY_HPP
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#include <utility>
#endif
namespace boost {
struct identity {
typedef void is_transparent;
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<class T>
BOOST_CONSTEXPR T&& operator()(T&& value) const BOOST_NOEXCEPT {
return std::forward<T>(value);
}
#else
template<class T>
BOOST_CONSTEXPR const T& operator()(const T& value) const BOOST_NOEXCEPT {
return value;
}
template<class T>
BOOST_CONSTEXPR T& operator()(T& value) const BOOST_NOEXCEPT {
return value;
}
#endif
template<class>
struct result { };
template<class T>
struct result<identity(T&)> {
typedef T& type;
};
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<class T>
struct result<identity(T)> {
typedef T&& type;
};
template<class T>
struct result<identity(T&&)> {
typedef T&& type;
};
#endif
};
} /* boost */
#endif

View File

@@ -11,34 +11,64 @@
namespace boost {
#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename... Ts>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(Ts&& ...)
{}
#else
template <typename... Ts>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(Ts const& ...)
{}
#endif
template <typename... Ts>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
#else
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename T1>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&)
{}
template <typename T1>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&)
{}
template <typename T1, typename T2>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&, T2&)
{}
template <typename T1, typename T2>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&)
{}
template <typename T1, typename T2, typename T3>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&, T2&, T3&)
{}
template <typename T1, typename T2, typename T3>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&)
{}
template <typename T1, typename T2, typename T3, typename T4>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&, T2&, T3&, T4&)
{}
template <typename T1, typename T2, typename T3, typename T4>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&)
{}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&, T2&, T3&, T4&, T5&)
{}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&, T5 const&)
{}

View File

@@ -0,0 +1,93 @@
// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker
// Copyright (C) 2023 Andrey Semashev
//
// 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)
// For more information, see http://www.boost.org
#ifndef BOOST_CORE_INVOKE_SWAP_HPP
#define BOOST_CORE_INVOKE_SWAP_HPP
// Note: the implementation of this utility contains various workarounds:
// - invoke_swap_impl is put outside the boost namespace, to avoid infinite
// recursion (causing stack overflow) when swapping objects of a primitive
// type.
// - std::swap is imported with a using-directive, rather than
// a using-declaration, because some compilers (including MSVC 7.1,
// Borland 5.9.3, and Intel 8.1) don't do argument-dependent lookup
// when it has a using-declaration instead.
// - The main entry function is called invoke_swap rather than swap
// to avoid forming an infinite recursion when the arguments are not
// swappable.
#include <boost/core/enable_if.hpp>
#include <boost/config.hpp>
#if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB)
#include <utility> // for std::swap (C++11)
#else
#include <algorithm> // for std::swap (C++98)
#endif
#include <cstddef> // for std::size_t
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if defined(BOOST_GCC) && (BOOST_GCC < 40700)
// gcc 4.6 ICEs on noexcept specifications below
#define BOOST_CORE_SWAP_NOEXCEPT_IF(x)
#else
#define BOOST_CORE_SWAP_NOEXCEPT_IF(x) BOOST_NOEXCEPT_IF(x)
#endif
namespace boost_swap_impl {
// we can't use type_traits here
template<class T> struct is_const { enum _vt { value = 0 }; };
template<class T> struct is_const<T const> { enum _vt { value = 1 }; };
// Use std::swap if argument dependent lookup fails.
// We need to have this at namespace scope to be able to use unqualified swap() call
// in noexcept specification.
using namespace std;
template<class T>
BOOST_GPU_ENABLED
inline void invoke_swap_impl(T& left, T& right) BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(swap(left, right)))
{
swap(left, right);
}
template<class T, std::size_t N>
BOOST_GPU_ENABLED
inline void invoke_swap_impl(T (& left)[N], T (& right)[N])
BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::invoke_swap_impl(left[0], right[0])))
{
for (std::size_t i = 0; i < N; ++i)
{
::boost_swap_impl::invoke_swap_impl(left[i], right[i]);
}
}
} // namespace boost_swap_impl
namespace boost {
namespace core {
template<class T>
BOOST_GPU_ENABLED
inline typename enable_if_c< !::boost_swap_impl::is_const<T>::value >::type
invoke_swap(T& left, T& right)
BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::invoke_swap_impl(left, right)))
{
::boost_swap_impl::invoke_swap_impl(left, right);
}
} // namespace core
} // namespace boost
#undef BOOST_CORE_SWAP_NOEXCEPT_IF
#endif // BOOST_CORE_INVOKE_SWAP_HPP

View File

@@ -1,12 +1,6 @@
#ifndef BOOST_CORE_IS_SAME_HPP_INCLUDED
#define BOOST_CORE_IS_SAME_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// is_same<T1,T2>::value is true when T1 == T2
//
// Copyright 2014 Peter Dimov
@@ -16,6 +10,15 @@
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#include <boost/core/detail/is_same.hpp>
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/config/header_deprecated.hpp>
BOOST_HEADER_DEPRECATED("<boost/type_traits/is_same.hpp>")
namespace boost
{
@@ -23,15 +26,7 @@ namespace boost
namespace core
{
template< class T1, class T2 > struct is_same
{
BOOST_STATIC_CONSTANT( bool, value = false );
};
template< class T > struct is_same< T, T >
{
BOOST_STATIC_CONSTANT( bool, value = true );
};
using boost::core::detail::is_same;
} // namespace core

View File

@@ -0,0 +1,69 @@
#ifndef BOOST_CORE_LAUNDER_HPP_INCLUDED
#define BOOST_CORE_LAUNDER_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#if defined(__has_builtin)
# if __has_builtin(__builtin_launder)
# define BOOST_CORE_HAS_BUILTIN_LAUNDER
# endif
#endif
#if defined(BOOST_MSVC) && BOOST_MSVC < 1920
// msvc-14.1 suffers from internal compiler errors when using std::launder
// https://github.com/boostorg/core/issues/160
// https://github.com/boostorg/optional/issues/122
#elif (BOOST_CXX_VERSION >= 201703L) && !defined(BOOST_CORE_HAS_BUILTIN_LAUNDER)
#include <new>
#if defined(__cpp_lib_launder)
# define BOOST_CORE_HAS_STD_LAUNDER
#endif
#endif
namespace boost
{
namespace core
{
#if defined(BOOST_CORE_HAS_BUILTIN_LAUNDER)
template<class T> T* launder( T* p )
{
return __builtin_launder( p );
}
#elif defined(BOOST_CORE_HAS_STD_LAUNDER)
template<class T> T* launder( T* p )
{
return std::launder( p );
}
#else
template<class T> T* launder( T* p )
{
return p;
}
#endif
} // namespace core
} // namespace boost
#endif // #ifndef BOOST_CORE_LAUNDER_HPP_INCLUDED

View File

@@ -14,18 +14,25 @@
// Copyright (2) Beman Dawes 2010, 2011
// Copyright (3) Ion Gaztanaga 2013
//
// Copyright 2018 Glen Joseph Fernandes
// (glenjofe@gmail.com)
//
// 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/core/no_exceptions_support.hpp>
#include <boost/assert.hpp>
#include <boost/core/detail/lwt_unattended.hpp>
#include <boost/current_function.hpp>
#include <boost/config.hpp>
#include <exception>
#include <iostream>
#include <iterator>
#include <string>
#include <cstdlib>
#include <cstring>
#include <cstddef>
#include <cctype>
// IDE's like Visual Studio perform better if output goes to std::cout or
// some other stream, so allow user to configure output stream:
@@ -35,41 +42,69 @@
namespace boost
{
namespace detail
{
struct report_errors_reminder
class test_result
{
bool called_report_errors_function;
public:
report_errors_reminder() : called_report_errors_function(false) {}
~report_errors_reminder()
test_result(): report_( false ), errors_( 0 )
{
BOOST_ASSERT(called_report_errors_function); // verify report_errors() was called
core::detail::lwt_unattended();
}
~test_result()
{
if( !report_ )
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "main() should return report_errors()" << std::endl;
std::abort();
}
}
int& errors()
{
return errors_;
}
void done()
{
report_ = true;
}
private:
bool report_;
int errors_;
};
inline report_errors_reminder& report_errors_remind()
inline test_result& test_results()
{
static report_errors_reminder r;
return r;
static test_result instance;
return instance;
}
inline int & test_errors()
inline int& test_errors()
{
static int x = 0;
report_errors_remind();
return x;
return test_results().errors();
}
inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
inline bool test_impl(char const * expr, char const * file, int line, char const * function, bool v)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr << "' failed in function '"
<< function << "'" << std::endl;
++test_errors();
if( v )
{
test_results();
return true;
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr << "' failed in function '"
<< function << "'" << std::endl;
++test_results().errors();
return false;
}
}
inline void error_impl(char const * msg, char const * file, int line, char const * function)
@@ -77,31 +112,48 @@ inline void error_impl(char const * msg, char const * file, int line, char const
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): " << msg << " in function '"
<< function << "'" << std::endl;
++test_errors();
++test_results().errors();
}
inline void throw_failed_impl(char const * excep, char const * file, int line, char const * function)
inline void throw_failed_impl(const char* expr, char const * excep, char const * file, int line, char const * function)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): Exception '" << excep << "' not thrown in function '"
<< file << "(" << line << "): expression '" << expr << "' did not throw exception '" << excep << "' in function '"
<< function << "'" << std::endl;
++test_errors();
++test_results().errors();
}
inline void no_throw_failed_impl(const char* expr, const char* file, int line, const char* function)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): expression '" << expr << "' threw an exception in function '"
<< function << "'" << std::endl;
++test_results().errors();
}
inline void no_throw_failed_impl(const char* expr, const char* what, const char* file, int line, const char* function)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): expression '" << expr << "' threw an exception in function '"
<< function << "': " << what << std::endl;
++test_results().errors();
}
// In the comparisons below, it is possible that T and U are signed and unsigned integer types, which generates warnings in some compilers.
// A cleaner fix would require common_type trait or some meta-programming, which would introduce a dependency on Boost.TypeTraits. To avoid
// the dependency we just disable the warnings.
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4389)
#elif defined(__clang__) && defined(__has_warning)
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wsign-compare")
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wsign-compare"
# endif
#elif defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4389)
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wsign-compare"
# pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
// specialize test output for char pointers to avoid printing as cstring
@@ -115,147 +167,185 @@ inline const void* test_output_impl(signed char* v) { return v; }
template<class T> inline const void* test_output_impl(T volatile* v) { return const_cast<T*>(v); }
#if !defined( BOOST_NO_CXX11_NULLPTR )
inline const void* test_output_impl(std::nullptr_t v) { return v; }
inline const void* test_output_impl(std::nullptr_t) { return nullptr; }
#endif
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 )
// print chars as numeric
inline int test_output_impl( signed char const& v ) { return v; }
inline unsigned test_output_impl( unsigned char const& v ) { return v; }
// Whether wchar_t is signed is implementation-defined
template<bool Signed> struct lwt_long_type {};
template<> struct lwt_long_type<true> { typedef long type; };
template<> struct lwt_long_type<false> { typedef unsigned long type; };
inline lwt_long_type<(static_cast<wchar_t>(-1) < static_cast<wchar_t>(0))>::type test_output_impl( wchar_t const& v ) { return v; }
#if !defined( BOOST_NO_CXX11_CHAR16_T )
inline unsigned long test_output_impl( char16_t const& v ) { return v; }
#endif
#if !defined( BOOST_NO_CXX11_CHAR32_T )
inline unsigned long test_output_impl( char32_t const& v ) { return v; }
#endif
inline std::string test_output_impl( char const& v )
{
if( t == u )
if( std::isprint( static_cast<unsigned char>( v ) ) )
{
report_errors_remind();
return std::string( 1, v );
}
else
{
static const char char_table[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
char buffer[ 4 ];
buffer[ 0 ] = '\\';
buffer[ 1 ] = 'x';
buffer[ 2 ] = char_table[ (static_cast<unsigned char>( v ) >> 4u) & 0x0f ];
buffer[ 3 ] = char_table[ static_cast<unsigned char>( v ) & 0x0f ];
return std::string( buffer, 4u );
}
}
// predicates
struct lw_test_eq
{
template <typename T, typename U>
bool operator()(const T& t, const U& u) const { return t == u; }
};
struct lw_test_ne
{
template <typename T, typename U>
bool operator()(const T& t, const U& u) const { return t != u; }
};
struct lw_test_lt
{
template <typename T, typename U>
bool operator()(const T& t, const U& u) const { return t < u; }
};
struct lw_test_le
{
template <typename T, typename U>
bool operator()(const T& t, const U& u) const { return t <= u; }
};
struct lw_test_gt
{
template <typename T, typename U>
bool operator()(const T& t, const U& u) const { return t > u; }
};
struct lw_test_ge
{
template <typename T, typename U>
bool operator()(const T& t, const U& u) const { return t >= u; }
};
// lwt_predicate_name
template<class T> char const * lwt_predicate_name( T const& )
{
return "~=";
}
inline char const * lwt_predicate_name( lw_test_eq const& )
{
return "==";
}
inline char const * lwt_predicate_name( lw_test_ne const& )
{
return "!=";
}
inline char const * lwt_predicate_name( lw_test_lt const& )
{
return "<";
}
inline char const * lwt_predicate_name( lw_test_le const& )
{
return "<=";
}
inline char const * lwt_predicate_name( lw_test_gt const& )
{
return ">";
}
inline char const * lwt_predicate_name( lw_test_ge const& )
{
return ">=";
}
//
template<class BinaryPredicate, class T, class U>
inline bool test_with_impl(BinaryPredicate pred, char const * expr1, char const * expr2,
char const * file, int line, char const * function,
T const & t, U const & u)
{
if( pred(t, u) )
{
test_results();
return true;
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' != '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
<< file << "(" << line << "): test '" << expr1 << " " << lwt_predicate_name(pred) << " " << expr2
<< "' ('" << test_output_impl(t) << "' " << lwt_predicate_name(pred) << " '" << test_output_impl(u)
<< "') failed in function '" << function << "'" << std::endl;
++test_results().errors();
return false;
}
}
template<class T, class U> inline void test_ne_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t != u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " != " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' == '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_lt_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t < u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " < " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' >= '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_le_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t <= u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " <= " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' > '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_gt_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t > u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " > " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' <= '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_ge_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t >= u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " >= " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' < '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
inline void test_cstr_eq_impl( char const * expr1, char const * expr2,
inline bool test_cstr_eq_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, char const * const t, char const * const u )
{
if( std::strcmp(t, u) == 0 )
{
report_errors_remind();
test_results();
return true;
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
<< "' failed in function '" << function << "': "
<< "'" << t << "' != '" << u << "'" << std::endl;
++test_errors();
<< file << "(" << line << "): test '" << expr1 << " == " << expr2 << "' ('" << t
<< "' == '" << u << "') failed in function '" << function << "'" << std::endl;
++test_results().errors();
return false;
}
}
inline void test_cstr_ne_impl( char const * expr1, char const * expr2,
inline bool test_cstr_ne_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, char const * const t, char const * const u )
{
if( std::strcmp(t, u) != 0 )
{
report_errors_remind();
test_results();
return true;
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
<< "' failed in function '" << function << "': "
<< "'" << t << "' == '" << u << "'" << std::endl;
++test_errors();
<< file << "(" << line << "): test '" << expr1 << " != " << expr2 << "' ('" << t
<< "' != '" << u << "') failed in function '" << function << "'" << std::endl;
++test_results().errors();
return false;
}
}
template<class FormattedOutputFunction, class InputIterator1, class InputIterator2>
void test_all_eq_impl(FormattedOutputFunction& output,
bool test_all_eq_impl(FormattedOutputFunction& output,
char const * file, int line, char const * function,
InputIterator1 first_begin, InputIterator1 first_end,
InputIterator2 second_begin, InputIterator2 second_end)
@@ -313,17 +403,19 @@ void test_all_eq_impl(FormattedOutputFunction& output,
if (error_count == 0)
{
boost::detail::report_errors_remind();
test_results();
return true;
}
else
{
output << std::endl;
++boost::detail::test_errors();
++test_results().errors();
return false;
}
}
template<class FormattedOutputFunction, class InputIterator1, class InputIterator2, typename BinaryPredicate>
void test_all_with_impl(FormattedOutputFunction& output,
bool test_all_with_impl(FormattedOutputFunction& output,
char const * file, int line, char const * function,
InputIterator1 first_begin, InputIterator1 first_end,
InputIterator2 second_begin, InputIterator2 second_end,
@@ -382,21 +474,23 @@ void test_all_with_impl(FormattedOutputFunction& output,
if (error_count == 0)
{
report_errors_remind();
test_results();
return true;
}
else
{
output << std::endl;
++test_errors();
++test_results().errors();
return false;
}
}
#if defined(_MSC_VER)
# pragma warning(pop)
#elif defined(__clang__) && defined(__has_warning)
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wsign-compare")
# pragma clang diagnostic pop
# endif
#elif defined(_MSC_VER)
# pragma warning(pop)
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
# pragma GCC diagnostic pop
#endif
@@ -405,38 +499,51 @@ void test_all_with_impl(FormattedOutputFunction& output,
inline int report_errors()
{
boost::detail::report_errors_remind().called_report_errors_function = true;
boost::detail::test_result& result = boost::detail::test_results();
result.done();
int errors = boost::detail::test_errors();
int errors = result.errors();
if( errors == 0 )
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< "No errors detected." << std::endl;
return 0;
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
return 1;
}
// `return report_errors();` from main only supports 8 bit exit codes
return errors < 256? errors: 255;
}
namespace core
{
inline void lwt_init()
{
boost::detail::test_results();
}
} // namespace core
} // namespace boost
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
#define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) )
#define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr))
#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) )
#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_WITH(expr1,expr2,predicate) ( ::boost::detail::test_with_impl(predicate, #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_LT(expr1,expr2) ( ::boost::detail::test_lt_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_LE(expr1,expr2) ( ::boost::detail::test_le_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_GT(expr1,expr2) ( ::boost::detail::test_gt_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_GE(expr1,expr2) ( ::boost::detail::test_ge_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_eq(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ne(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_LT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_lt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_LE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_le(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_GT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_gt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_GE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ge(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_CSTR_EQ(expr1,expr2) ( ::boost::detail::test_cstr_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_CSTR_NE(expr1,expr2) ( ::boost::detail::test_cstr_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
@@ -445,21 +552,38 @@ inline int report_errors()
#define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) ( ::boost::detail::test_all_with_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2, predicate) )
#ifndef BOOST_NO_EXCEPTIONS
#define BOOST_TEST_THROWS( EXPR, EXCEP ) \
try { \
EXPR; \
::boost::detail::throw_failed_impl \
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
} \
catch(EXCEP const&) { \
} \
catch(...) { \
::boost::detail::throw_failed_impl \
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
} \
#define BOOST_TEST_THROWS( EXPR, EXCEP ) \
try { \
EXPR; \
::boost::detail::throw_failed_impl \
(#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
} \
catch(EXCEP const&) { \
::boost::detail::test_results(); \
} \
catch(...) { \
::boost::detail::throw_failed_impl \
(#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
} \
//
#else
#define BOOST_TEST_THROWS( EXPR, EXCEP )
#endif
#ifndef BOOST_NO_EXCEPTIONS
# define BOOST_TEST_NO_THROW(EXPR) \
try { \
EXPR; \
} catch (const std::exception& e) { \
::boost::detail::no_throw_failed_impl \
(#EXPR, e.what(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
} catch (...) { \
::boost::detail::no_throw_failed_impl \
(#EXPR, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
}
//
#else
# define BOOST_TEST_NO_THROW(EXPR) { EXPR; }
#endif
#endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_HPP

View File

@@ -9,20 +9,24 @@
// boost/core/lightweight_test_trait.hpp
//
// BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE
// BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE, BOOST_TEST_TRAIT_SAME
//
// Copyright 2014 Peter Dimov
// Copyright 2014, 2021 Peter Dimov
//
// Copyright 2019 Glen Joseph Fernandes
// (glenjofe@gmail.com)
//
// 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/core/lightweight_test.hpp>
#include <boost/core/typeinfo.hpp>
#include <boost/core/type_name.hpp>
#include <boost/core/detail/is_same.hpp>
#include <boost/config.hpp>
namespace boost
{
namespace detail
{
@@ -31,26 +35,57 @@ template< class T > inline void test_trait_impl( char const * trait, void (*)( T
{
if( T::value == expected )
{
report_errors_remind();
test_results();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): predicate '" << trait << "' ["
<< boost::core::demangled_name( BOOST_CORE_TYPEID(T) ) << "]"
<< boost::core::type_name<T>() << "]"
<< " test failed in function '" << function
<< "' (should have been " << ( expected? "true": "false" ) << ")"
<< std::endl;
++test_errors();
++test_results().errors();
}
}
template<class T> inline bool test_trait_same_impl_( T )
{
return T::value;
}
template<class T1, class T2> inline void test_trait_same_impl( char const * types,
boost::core::detail::is_same<T1, T2> same, char const * file, int line, char const * function )
{
if( test_trait_same_impl_( same ) )
{
test_results();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test 'is_same<" << types << ">'"
<< " failed in function '" << function
<< "' ('" << boost::core::type_name<T1>()
<< "' != '" << boost::core::type_name<T2>() << "')"
<< std::endl;
++test_results().errors();
}
}
} // namespace detail
} // namespace boost
#define BOOST_TEST_TRAIT_TRUE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, true, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
#define BOOST_TEST_TRAIT_FALSE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, false, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
#if defined(__GNUC__)
// ignoring -Wvariadic-macros with #pragma doesn't work under GCC
# pragma GCC system_header
#endif
#define BOOST_TEST_TRAIT_SAME(...) ( ::boost::detail::test_trait_same_impl(#__VA_ARGS__, ::boost::core::detail::is_same< __VA_ARGS__ >(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
#endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP

View File

@@ -0,0 +1,59 @@
/*
Copyright 2023 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_MAKE_SPAN_HPP
#define BOOST_CORE_MAKE_SPAN_HPP
#include <boost/core/span.hpp>
namespace boost {
template<class I>
inline constexpr span<I>
make_span(I* f, std::size_t c) noexcept
{
return span<I>(f, c);
}
template<class I>
inline constexpr span<I>
make_span(I* f, I* l) noexcept
{
return span<I>(f, l);
}
template<class T, std::size_t N>
inline constexpr span<T, N>
make_span(T(&a)[N]) noexcept
{
return span<T, N>(a);
}
template<class T, std::size_t N>
inline constexpr span<T, N>
make_span(std::array<T, N>& a) noexcept
{
return span<T, N>(a);
}
template<class T, std::size_t N>
inline constexpr span<const T, N>
make_span(const std::array<T, N>& a) noexcept
{
return span<const T, N>(a);
}
template<class R>
inline span<typename detail::span_data<R>::type>
make_span(R&& r)
{
return span<typename detail::span_data<R>::type>(std::forward<R>(r));
}
} /* boost */
#endif

View File

@@ -0,0 +1,82 @@
#ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED
#define BOOST_CORE_MAX_ALIGN_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/core/alignof.hpp>
#include <boost/config.hpp>
#include <cstddef>
// BOOST_CORE_HAS_FLOAT128
#if defined(BOOST_HAS_FLOAT128)
# define BOOST_CORE_HAS_FLOAT128
#elif defined(__SIZEOF_FLOAT128__)
# define BOOST_CORE_HAS_FLOAT128
#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 404) && defined(__i386__)
# define BOOST_CORE_HAS_FLOAT128
#endif
// max_align_t, max_align
namespace boost
{
namespace core
{
union max_align_t
{
char c;
short s;
int i;
long l;
#if !defined(BOOST_NO_LONG_LONG)
boost::long_long_type ll;
#endif
#if defined(BOOST_HAS_INT128)
boost::int128_type i128;
#endif
float f;
double d;
long double ld;
#if defined(BOOST_CORE_HAS_FLOAT128)
__float128 f128;
#endif
void* p;
void (*pf) ();
int max_align_t::* pm;
void (max_align_t::*pmf)();
};
BOOST_CONSTEXPR_OR_CONST std::size_t max_align = BOOST_CORE_ALIGNOF( max_align_t );
} // namespace core
} // namespace boost
#endif // #ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED

View File

@@ -0,0 +1,108 @@
#ifndef BOOST_CORE_MEMORY_RESOURCE_HPP_INCLUDED
#define BOOST_CORE_MEMORY_RESOURCE_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/core/max_align.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <cstddef>
// Define our own placement new to avoid the inclusion of <new>
// (~9K extra lines) at Ion Gaztanhaga's request.
//
// We can use our own because [intro.object] p13 says:
//
// Any implicit or explicit invocation of a function named `operator new`
// or `operator new[]` implicitly creates objects in the returned region of
// storage and returns a pointer to a suitable created object.
namespace boost
{
namespace core
{
namespace detail
{
struct placement_new_tag {};
} // namespace detail
} // namespace core
} // namespace boost
inline void* operator new( std::size_t, void* p, boost::core::detail::placement_new_tag )
{
return p;
}
inline void operator delete( void*, void*, boost::core::detail::placement_new_tag )
{
}
namespace boost
{
namespace core
{
class memory_resource
{
public:
#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || BOOST_WORKAROUND(BOOST_GCC, < 40700)
virtual ~memory_resource() {}
#else
virtual ~memory_resource() = default;
#endif
BOOST_ATTRIBUTE_NODISCARD void* allocate( std::size_t bytes, std::size_t alignment = max_align )
{
// https://github.com/boostorg/container/issues/199
// https://cplusplus.github.io/LWG/issue3471
return ::operator new( bytes, do_allocate( bytes, alignment ), core::detail::placement_new_tag() );
}
void deallocate( void* p, std::size_t bytes, std::size_t alignment = max_align )
{
do_deallocate( p, bytes, alignment );
}
bool is_equal( memory_resource const & other ) const BOOST_NOEXCEPT
{
return do_is_equal( other );
}
private:
virtual void* do_allocate( std::size_t bytes, std::size_t alignment ) = 0;
virtual void do_deallocate( void* p, std::size_t bytes, std::size_t alignment ) = 0;
virtual bool do_is_equal( memory_resource const & other ) const BOOST_NOEXCEPT = 0;
};
inline bool operator==( memory_resource const& a, memory_resource const& b ) BOOST_NOEXCEPT
{
return &a == &b || a.is_equal( b );
}
inline bool operator!=( memory_resource const& a, memory_resource const& b ) BOOST_NOEXCEPT
{
return !( a == b );
}
} // namespace core
} // namespace boost
#endif // #ifndef BOOST_CORE_MEMORY_RESOURCE_HPP_INCLUDED

View File

@@ -29,12 +29,24 @@
# define BOOST_RETHROW throw;
# define BOOST_CATCH_END }
#else
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
# define BOOST_TRY { if ("")
# define BOOST_CATCH(x) else if (!"")
# else
# elif !defined(BOOST_MSVC) || BOOST_MSVC >= 1900
# define BOOST_TRY { if (true)
# define BOOST_CATCH(x) else if (false)
# else
// warning C4127: conditional expression is constant
# define BOOST_TRY { \
__pragma(warning(push)) \
__pragma(warning(disable: 4127)) \
if (true) \
__pragma(warning(pop))
# define BOOST_CATCH(x) else \
__pragma(warning(push)) \
__pragma(warning(disable: 4127)) \
if (false) \
__pragma(warning(pop))
# endif
# define BOOST_RETHROW
# define BOOST_CATCH_END }

View File

@@ -0,0 +1,90 @@
/*
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_NOINIT_ADAPTOR_HPP
#define BOOST_CORE_NOINIT_ADAPTOR_HPP
#include <boost/core/allocator_access.hpp>
namespace boost {
template<class A>
struct noinit_adaptor
: A {
typedef void _default_construct_destroy;
template<class U>
struct rebind {
typedef noinit_adaptor<typename allocator_rebind<A, U>::type> other;
};
noinit_adaptor()
: A() { }
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<class U>
noinit_adaptor(U&& u) BOOST_NOEXCEPT
: A(std::forward<U>(u)) { }
#else
template<class U>
noinit_adaptor(const U& u) BOOST_NOEXCEPT
: A(u) { }
template<class U>
noinit_adaptor(U& u) BOOST_NOEXCEPT
: A(u) { }
#endif
template<class U>
noinit_adaptor(const noinit_adaptor<U>& u) BOOST_NOEXCEPT
: A(static_cast<const A&>(u)) { }
template<class U>
void construct(U* p) {
::new((void*)p) U;
}
#if defined(BOOST_NO_CXX11_ALLOCATOR)
template<class U, class V>
void construct(U* p, const V& v) {
::new((void*)p) U(v);
}
#endif
template<class U>
void destroy(U* p) {
p->~U();
(void)p;
}
};
template<class T, class U>
inline bool
operator==(const noinit_adaptor<T>& lhs,
const noinit_adaptor<U>& rhs) BOOST_NOEXCEPT
{
return static_cast<const T&>(lhs) == static_cast<const U&>(rhs);
}
template<class T, class U>
inline bool
operator!=(const noinit_adaptor<T>& lhs,
const noinit_adaptor<U>& rhs) BOOST_NOEXCEPT
{
return !(lhs == rhs);
}
template<class A>
inline noinit_adaptor<A>
noinit_adapt(const A& a) BOOST_NOEXCEPT
{
return noinit_adaptor<A>(a);
}
} /* boost */
#endif

View File

@@ -20,7 +20,22 @@ namespace boost {
namespace noncopyable_ // protection from unintended ADL
{
class noncopyable
#ifndef BOOST_NONCOPYABLE_BASE_TOKEN_DEFINED
#define BOOST_NONCOPYABLE_BASE_TOKEN_DEFINED
// noncopyable derives from base_token to enable Type Traits to detect
// whether a type derives from noncopyable without needing the definition
// of noncopyable itself.
//
// The definition of base_token is macro-guarded so that Type Traits can
// define it locally without including this header, to avoid a dependency
// on Core.
struct base_token {};
#endif // #ifndef BOOST_NONCOPYABLE_BASE_TOKEN_DEFINED
class noncopyable: base_token
{
protected:
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS)

View File

@@ -27,6 +27,9 @@
namespace boost {
// Block unintended ADL
namespace null_deleter_ns {
//! A function object that does nothing and can be used as an empty deleter for \c shared_ptr
struct null_deleter
{
@@ -39,6 +42,10 @@ struct null_deleter
void operator() (T*) const BOOST_NOEXCEPT {}
};
} // namespace null_deleter_ns
using null_deleter_ns::null_deleter;
} // namespace boost
#endif // BOOST_CORE_NULL_DELETER_HPP

View File

@@ -0,0 +1,57 @@
/*
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_NVP_HPP
#define BOOST_CORE_NVP_HPP
#include <boost/core/addressof.hpp>
#include <boost/config.hpp>
namespace boost {
namespace serialization {
template<class T>
class nvp {
public:
nvp(const char* n, T& v) BOOST_NOEXCEPT
: n_(n)
, v_(boost::addressof(v)) { }
const char* name() const BOOST_NOEXCEPT {
return n_;
}
T& value() const BOOST_NOEXCEPT {
return *v_;
}
const T& const_value() const BOOST_NOEXCEPT {
return *v_;
}
private:
const char* n_;
T* v_;
};
template<class T>
inline const nvp<T>
make_nvp(const char* n, T& v) BOOST_NOEXCEPT
{
return nvp<T>(n, v);
}
} /* serialization */
using serialization::nvp;
using serialization::make_nvp;
} /* boost */
#define BOOST_NVP(v) boost::make_nvp(BOOST_STRINGIZE(v), v)
#endif

View File

@@ -0,0 +1,49 @@
/*
Copyright 2024 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_POINTER_IN_RANGE_HPP
#define BOOST_CORE_POINTER_IN_RANGE_HPP
#include <boost/config.hpp>
#include <functional>
#if !defined(BOOST_NO_CXX14_CONSTEXPR)
#if defined(BOOST_MSVC) && BOOST_MSVC >= 1925
#define BOOST_CORE_DETAIL_HAS_IS_CONSTEVAL
#elif defined(__has_builtin)
#if __has_builtin(__builtin_is_constant_evaluated)
#define BOOST_CORE_DETAIL_HAS_IS_CONSTEVAL
#endif
#endif
#endif
#if !defined(BOOST_CORE_DETAIL_HAS_IS_CONSTEVAL)
#define BOOST_CORE_NO_CONSTEXPR_POINTER_IN_RANGE
#endif
namespace boost {
template<class T>
inline BOOST_CONSTEXPR bool
pointer_in_range(const T* p, const T* b, const T* e)
{
#if defined(BOOST_CORE_DETAIL_HAS_IS_CONSTEVAL)
if ( __builtin_is_constant_evaluated()) {
for (; b != e; ++b) {
if (b == p) {
return true;
}
}
return false;
}
#endif
return std::less_equal<const T*>()(b, p) && std::less<const T*>()(p, e);
}
} /* boost */
#endif

View File

@@ -1,5 +1,5 @@
/*
Copyright 2017 Glen Joseph Fernandes
Copyright 2017-2021 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
@@ -9,250 +9,277 @@ Distributed under the Boost Software License, Version 1.0.
#define BOOST_CORE_POINTER_TRAITS_HPP
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_POINTER_TRAITS)
#include <memory>
#else
#include <boost/core/addressof.hpp>
#endif
#include <cstddef>
namespace boost {
template<class T>
struct pointer_traits;
namespace detail {
template<class U>
inline typename boost::pointer_traits<U>::element_type*
ptr_traits_address(const U& v) BOOST_NOEXCEPT
{
return boost::pointer_traits<U>::to_address(v);
}
struct ptr_none { };
} /* detail */
#if !defined(BOOST_NO_CXX11_POINTER_TRAITS)
template<class T>
struct pointer_traits
: std::pointer_traits<T> {
template<class U>
struct rebind_to {
typedef typename std::pointer_traits<T>::template rebind<U> type;
};
static typename std::pointer_traits<T>::element_type*
to_address(const T& v) BOOST_NOEXCEPT {
return detail::ptr_traits_address(v.operator->());
}
template<class>
struct ptr_valid {
typedef void type;
};
template<class T>
struct pointer_traits<T*>
: std::pointer_traits<T*> {
template<class U>
struct rebind_to {
typedef U* type;
};
static T* to_address(T* v) BOOST_NOEXCEPT {
return v;
}
template<class>
struct ptr_first {
typedef ptr_none type;
};
#else
namespace detail {
struct ptr_traits_none { char first, second; };
template<class T>
struct ptr_traits_has_element {
private:
template<class U>
static ptr_traits_none call(...);
template<class U>
static char call(typename U::element_type* = 0);
public:
static const bool value = sizeof(call<T>(0)) == 1;
};
template<class T>
struct ptr_traits_first;
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<template<class, class...> class T, class U, class... Args>
struct ptr_traits_first<T<U, Args...> > {
struct ptr_first<T<U, Args...> > {
typedef U type;
};
#else
template<template<class> class T, class U>
struct ptr_traits_first<T<U> > {
struct ptr_first<T<U> > {
typedef U type;
};
template<template<class, class> class T, class U1, class U2>
struct ptr_traits_first<T<U1, U2> > {
struct ptr_first<T<U1, U2> > {
typedef U1 type;
};
template<template<class, class, class> class T, class U1, class U2, class U3>
struct ptr_traits_first<T<U1, U2, U3> > {
struct ptr_first<T<U1, U2, U3> > {
typedef U1 type;
};
#endif
template<class T, bool = ptr_traits_has_element<T>::value>
struct ptr_traits_element {
template<class T, class = void>
struct ptr_element {
typedef typename ptr_first<T>::type type;
};
template<class T>
struct ptr_element<T, typename ptr_valid<typename T::element_type>::type> {
typedef typename T::element_type type;
};
template<class T>
struct ptr_traits_element<T, false> {
typedef typename ptr_traits_first<T>::type type;
};
template<class T>
struct ptr_traits_has_difference {
private:
template<class U>
static ptr_traits_none call(...);
template<class U>
static char call(typename U::difference_type* = 0);
public:
static const bool value = sizeof(call<T>(0)) == 1;
};
template<class T, bool = ptr_traits_has_difference<T>::value>
struct ptr_traits_difference {
typedef typename T::difference_type type;
};
template<class T>
struct ptr_traits_difference<T, false> {
template<class, class = void>
struct ptr_difference {
typedef std::ptrdiff_t type;
};
template<class T, class V>
struct ptr_traits_has_rebind {
private:
template<class U>
static ptr_traits_none call(...);
template<class U>
static char call(typename U::template rebind<V>* = 0);
public:
static const bool value = sizeof(call<T>(0)) == 1;
template<class T>
struct ptr_difference<T,
typename ptr_valid<typename T::difference_type>::type> {
typedef typename T::difference_type type;
};
template<class T, class V>
struct ptr_traits_rebind_to;
template<class, class>
struct ptr_transform { };
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<template<class, class...> class T, class U, class... Args, class V>
struct ptr_traits_rebind_to<T<U, Args...>, V> {
struct ptr_transform<T<U, Args...>, V> {
typedef T<V, Args...> type;
};
#else
template<template<class> class T, class U, class V>
struct ptr_traits_rebind_to<T<U>, V> {
struct ptr_transform<T<U>, V> {
typedef T<V> type;
};
template<template<class, class> class T, class U1, class U2, class V>
struct ptr_traits_rebind_to<T<U1, U2>, V> {
struct ptr_transform<T<U1, U2>, V> {
typedef T<V, U2> type;
};
template<template<class, class, class> class T,
class U1, class U2, class U3, class V>
struct ptr_traits_rebind_to<T<U1, U2, U3>, V> {
struct ptr_transform<T<U1, U2, U3>, V> {
typedef T<V, U2, U3> type;
};
#endif
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class T, class U, bool = ptr_traits_has_rebind<T, U>::value>
struct ptr_traits_rebind {
typedef typename T::template rebind<U> type;
};
template<class T, class U, class = void>
struct ptr_rebind
: ptr_transform<T, U> { };
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class T, class U>
struct ptr_traits_rebind<T, U, false> {
typedef typename ptr_traits_rebind_to<T, U>::type type;
struct ptr_rebind<T, U,
typename ptr_valid<typename T::template rebind<U> >::type> {
typedef typename T::template rebind<U> type;
};
#else
template<class T, class U>
struct ptr_traits_rebind {
typedef typename ptr_traits_rebind_to<T, U>::type type;
struct ptr_rebind<T, U,
typename ptr_valid<typename T::template rebind<U>::other>::type> {
typedef typename T::template rebind<U>::other type;
};
#endif
#if !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
template<class T, class E>
class ptr_to_expr {
template<class>
struct result {
char x, y;
};
static E& source();
template<class O>
static auto check(int) -> result<decltype(O::pointer_to(source()))>;
template<class>
static char check(long);
public:
BOOST_STATIC_CONSTEXPR bool value = sizeof(check<T>(0)) > 1;
};
template<class T, class E>
struct ptr_to_expr<T*, E> {
BOOST_STATIC_CONSTEXPR bool value = true;
};
template<class T, class E>
struct ptr_has_to {
BOOST_STATIC_CONSTEXPR bool value = ptr_to_expr<T, E>::value;
};
#else
template<class, class>
struct ptr_has_to {
BOOST_STATIC_CONSTEXPR bool value = true;
};
#endif
template<class T>
struct ptr_traits_value {
typedef T type;
struct ptr_has_to<T, void> {
BOOST_STATIC_CONSTEXPR bool value = false;
};
template<>
struct ptr_traits_value<void> {
typedef struct { } type;
template<class T>
struct ptr_has_to<T, const void> {
BOOST_STATIC_CONSTEXPR bool value = false;
};
template<class T>
struct ptr_has_to<T, volatile void> {
BOOST_STATIC_CONSTEXPR bool value = false;
};
template<class T>
struct ptr_has_to<T, const volatile void> {
BOOST_STATIC_CONSTEXPR bool value = false;
};
template<class T, class E, bool = ptr_has_to<T, E>::value>
struct ptr_to { };
template<class T, class E>
struct ptr_to<T, E, true> {
static T pointer_to(E& v) {
return T::pointer_to(v);
}
};
template<class T>
struct ptr_to<T*, T, true> {
static T* pointer_to(T& v) BOOST_NOEXCEPT {
return boost::addressof(v);
}
};
template<class T, class E>
struct ptr_traits
: ptr_to<T, E> {
typedef T pointer;
typedef E element_type;
typedef typename ptr_difference<T>::type difference_type;
template<class U>
struct rebind_to
: ptr_rebind<T, U> { };
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class U>
using rebind = typename rebind_to<U>::type;
#endif
};
template<class T>
struct ptr_traits<T, ptr_none> { };
} /* detail */
template<class T>
struct pointer_traits {
typedef T pointer;
typedef typename detail::ptr_traits_element<T>::type element_type;
typedef typename detail::ptr_traits_difference<T>::type difference_type;
template<class U>
struct rebind_to {
typedef typename detail::ptr_traits_rebind<T, U>::type type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class U>
using rebind = typename detail::ptr_traits_rebind<T, U>::type;
#endif
static pointer
pointer_to(typename detail::ptr_traits_value<element_type>::type& v) {
return pointer::pointer_to(v);
}
static element_type* to_address(const pointer& v) BOOST_NOEXCEPT {
return detail::ptr_traits_address(v.operator->());
}
};
struct pointer_traits
: detail::ptr_traits<T, typename detail::ptr_element<T>::type> { };
template<class T>
struct pointer_traits<T*> {
struct pointer_traits<T*>
: detail::ptr_to<T*, T> {
typedef T* pointer;
typedef T element_type;
typedef std::ptrdiff_t difference_type;
template<class U>
struct rebind_to {
typedef U* type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class U>
using rebind = U*;
using rebind = typename rebind_to<U>::type;
#endif
static T*
pointer_to(typename detail::ptr_traits_value<T>::type& v) BOOST_NOEXCEPT {
return addressof(v);
}
static T* to_address(T* v) BOOST_NOEXCEPT {
return v;
}
};
#endif
template<class T>
inline typename pointer_traits<T>::element_type*
to_address(const T& v) BOOST_NOEXCEPT
{
return pointer_traits<T>::to_address(v);
}
template<class T>
inline T*
BOOST_CONSTEXPR inline T*
to_address(T* v) BOOST_NOEXCEPT
{
return v;
}
#if !defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION)
namespace detail {
template<class T>
inline T*
ptr_address(T* v, int) BOOST_NOEXCEPT
{
return v;
}
template<class T>
inline auto
ptr_address(const T& v, int) BOOST_NOEXCEPT
-> decltype(boost::pointer_traits<T>::to_address(v))
{
return boost::pointer_traits<T>::to_address(v);
}
template<class T>
inline auto
ptr_address(const T& v, long) BOOST_NOEXCEPT
{
return boost::detail::ptr_address(v.operator->(), 0);
}
} /* detail */
template<class T>
inline auto
to_address(const T& v) BOOST_NOEXCEPT
{
return boost::detail::ptr_address(v, 0);
}
#else
template<class T>
inline typename pointer_traits<T>::element_type*
to_address(const T& v) BOOST_NOEXCEPT
{
return boost::to_address(v.operator->());
}
#endif
} /* boost */
#endif

View File

@@ -0,0 +1,59 @@
#ifndef BOOST_CORE_QUICK_EXIT_HPP_INCLUDED
#define BOOST_CORE_QUICK_EXIT_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// boost/core/quick_exit.hpp
//
// Copyright 2018 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 <stdlib.h>
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
extern "C" _CRTIMP __cdecl __MINGW_NOTHROW void _exit (int) __MINGW_ATTRIB_NORETURN;
#endif
#if defined(__CYGWIN__) && __cplusplus < 201103L
extern "C" _Noreturn void quick_exit(int);
#endif
namespace boost
{
BOOST_NORETURN inline void quick_exit( int code ) BOOST_NOEXCEPT
{
#if defined(_MSC_VER) && _MSC_VER < 1900
::_exit( code );
#elif defined(__MINGW32__)
::_exit( code );
#elif defined(__APPLE__)
::_Exit( code );
#else
::quick_exit( code );
#endif
}
} // namespace boost
#endif // #ifndef BOOST_CORE_QUICK_EXIT_HPP_INCLUDED

View File

@@ -1,15 +1,14 @@
#ifndef BOOST_CORE_REF_HPP
#define BOOST_CORE_REF_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <boost/core/addressof.hpp>
#include <boost/core/enable_if.hpp>
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
//
// ref.hpp - ref/cref, useful helper functions
@@ -19,7 +18,8 @@
// Copyright (C) 2002 David Abrahams
//
// Copyright (C) 2014 Glen Joseph Fernandes
// glenfe at live dot com
// (glenjofe@gmail.com)
//
// Copyright (C) 2014 Agustin Berge
//
// Distributed under the Boost Software License, Version 1.0. (See
@@ -45,6 +45,28 @@ namespace boost
#endif
namespace detail
{
template< class Y, class T > struct ref_convertible
{
typedef char (&yes) [1];
typedef char (&no) [2];
static yes f( T* );
static no f( ... );
enum _vt { value = sizeof( (f)( static_cast<Y*>(0) ) ) == sizeof(yes) };
};
#if defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS)
struct ref_empty
{
};
#endif
} // namespace detail
// reference_wrapper
/**
@@ -70,11 +92,11 @@ public:
@remark Does not throw.
*/
BOOST_FORCEINLINE explicit reference_wrapper(T& t): t_(boost::addressof(t)) {}
BOOST_FORCEINLINE explicit reference_wrapper(T& t) BOOST_NOEXCEPT : t_(boost::addressof(t)) {}
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 )
BOOST_FORCEINLINE explicit reference_wrapper( T & t, ref_workaround_tag ): t_( boost::addressof( t ) ) {}
BOOST_FORCEINLINE explicit reference_wrapper( T & t, ref_workaround_tag ) BOOST_NOEXCEPT : t_( boost::addressof( t ) ) {}
#endif
@@ -86,24 +108,46 @@ public:
public:
#endif
template<class Y> friend class reference_wrapper;
/**
@return The stored reference.
Constructs a `reference_wrapper` object that stores the
reference stored in the compatible `reference_wrapper` `r`.
@remark Only enabled when `Y*` is convertible to `T*`.
@remark Does not throw.
*/
BOOST_FORCEINLINE operator T& () const { return *t_; }
#if !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS)
template<class Y, class = typename enable_if_c<boost::detail::ref_convertible<Y, T>::value>::type>
reference_wrapper( reference_wrapper<Y> r ) BOOST_NOEXCEPT : t_( r.t_ )
{
}
#else
template<class Y> reference_wrapper( reference_wrapper<Y> r,
typename enable_if_c<boost::detail::ref_convertible<Y, T>::value,
boost::detail::ref_empty>::type = boost::detail::ref_empty() ) BOOST_NOEXCEPT : t_( r.t_ )
{
}
#endif
/**
@return The stored reference.
@remark Does not throw.
*/
BOOST_FORCEINLINE T& get() const { return *t_; }
BOOST_FORCEINLINE operator T& () const BOOST_NOEXCEPT { return *t_; }
/**
@return The stored reference.
@remark Does not throw.
*/
BOOST_FORCEINLINE T& get() const BOOST_NOEXCEPT { return *t_; }
/**
@return A pointer to the object referenced by the stored
reference.
@remark Does not throw.
*/
BOOST_FORCEINLINE T* get_pointer() const { return t_; }
BOOST_FORCEINLINE T* get_pointer() const BOOST_NOEXCEPT { return t_; }
private:
@@ -115,7 +159,7 @@ private:
/**
@cond
*/
#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) )
#if defined( BOOST_BORLANDC ) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) )
# define BOOST_REF_CONST
#else
# define BOOST_REF_CONST const
@@ -128,7 +172,7 @@ private:
@return `reference_wrapper<T>(t)`
@remark Does not throw.
*/
template<class T> BOOST_FORCEINLINE reference_wrapper<T> BOOST_REF_CONST ref( T & t )
template<class T> BOOST_FORCEINLINE reference_wrapper<T> BOOST_REF_CONST ref( T & t ) BOOST_NOEXCEPT
{
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 )
@@ -147,7 +191,7 @@ template<class T> BOOST_FORCEINLINE reference_wrapper<T> BOOST_REF_CONST ref( T
@return `reference_wrapper<T const>(t)`
@remark Does not throw.
*/
template<class T> BOOST_FORCEINLINE reference_wrapper<T const> BOOST_REF_CONST cref( T const & t )
template<class T> BOOST_FORCEINLINE reference_wrapper<T const> BOOST_REF_CONST cref( T const & t ) BOOST_NOEXCEPT
{
return reference_wrapper<T const>(t);
}
@@ -278,7 +322,7 @@ template<typename T> struct unwrap_reference< reference_wrapper<T> const volatil
@return `unwrap_reference<T>::type&(t)`
@remark Does not throw.
*/
template<class T> BOOST_FORCEINLINE typename unwrap_reference<T>::type& unwrap_ref( T & t )
template<class T> BOOST_FORCEINLINE typename unwrap_reference<T>::type& unwrap_ref( T & t ) BOOST_NOEXCEPT
{
return t;
}
@@ -288,7 +332,7 @@ template<class T> BOOST_FORCEINLINE typename unwrap_reference<T>::type& unwrap_r
/**
@cond
*/
template<class T> BOOST_FORCEINLINE T* get_pointer( reference_wrapper<T> const & r )
template<class T> BOOST_FORCEINLINE T* get_pointer( reference_wrapper<T> const & r ) BOOST_NOEXCEPT
{
return r.get_pointer();
}

View File

@@ -0,0 +1,131 @@
#ifndef BOOST_CORE_SERIALIZATION_HPP_INCLUDED
#define BOOST_CORE_SERIALIZATION_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
//
// Utilities needed to implement serialization support
// without including a Boost.Serialization header
#include <boost/core/nvp.hpp>
#include <cstddef>
namespace boost
{
namespace serialization
{
// Forward declarations (needed for specializations)
template<class T> struct version;
class access;
// Our own version_type replacement. This has to be in
// the `serialization` namespace, because its only purpose
// is to add `serialization` as an associated namespace.
struct core_version_type
{
unsigned int version_;
core_version_type( unsigned int version ): version_( version ) {}
operator unsigned int () const { return version_; }
};
} // namespace serialization
namespace core
{
// nvp
using serialization::nvp;
using serialization::make_nvp;
// split_free
namespace detail
{
template<bool IsSaving> struct load_or_save_f;
template<> struct load_or_save_f<true>
{
template<class A, class T> void operator()( A& a, T& t, unsigned int v ) const
{
save( a, t, serialization::core_version_type( v ) );
}
};
template<> struct load_or_save_f<false>
{
template<class A, class T> void operator()( A& a, T& t, unsigned int v ) const
{
load( a, t, serialization::core_version_type( v ) );
}
};
} // namespace detail
template<class A, class T> inline void split_free( A& a, T& t, unsigned int v )
{
detail::load_or_save_f< A::is_saving::value >()( a, t, v );
}
// split_member
namespace detail
{
template<bool IsSaving, class Access = serialization::access> struct load_or_save_m;
template<class Access> struct load_or_save_m<true, Access>
{
template<class A, class T> void operator()( A& a, T const& t, unsigned int v ) const
{
Access::member_save( a, t, v );
}
};
template<class Access> struct load_or_save_m<false, Access>
{
template<class A, class T> void operator()( A& a, T& t, unsigned int v ) const
{
Access::member_load( a, t, v );
}
};
} // namespace detail
template<class A, class T> inline void split_member( A& a, T& t, unsigned int v )
{
detail::load_or_save_m< A::is_saving::value >()( a, t, v );
}
// load_construct_data_adl
template<class Ar, class T> void load_construct_data_adl( Ar& ar, T* t, unsigned int v )
{
load_construct_data( ar, t, serialization::core_version_type( v ) );
}
// save_construct_data_adl
template<class Ar, class T> void save_construct_data_adl( Ar& ar, T const* t, unsigned int v )
{
save_construct_data( ar, t, serialization::core_version_type( v ) );
}
} // namespace core
} // namespace boost
#endif // #ifndef BOOST_CORE_SERIALIZATION_HPP_INCLUDED

View File

@@ -0,0 +1,31 @@
/*
Copyright 2023 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_SIZE_HPP
#define BOOST_CORE_SIZE_HPP
#include <cstddef>
namespace boost {
template<class C>
inline constexpr auto
size(const C& c) noexcept(noexcept(c.size())) -> decltype(c.size())
{
return c.size();
}
template<class T, std::size_t N>
inline constexpr std::size_t
size(T(&)[N]) noexcept
{
return N;
}
} /* boost */
#endif

Some files were not shown because too many files have changed in this diff Show More