mirror of
https://github.com/boostorg/utility.git
synced 2025-07-29 12:27:45 +02:00
Compare commits
33 Commits
boost-1.68
...
boost-1.71
Author | SHA1 | Date | |
---|---|---|---|
9eeb7f85c5 | |||
62c34f51f6 | |||
6a1917ceec | |||
47c9f69ffe | |||
7b74d2d494 | |||
57da5f0c18 | |||
dabf53a703 | |||
ff56b3649e | |||
31e0ae4c37 | |||
5fe9df91c0 | |||
f03b681d01 | |||
e120a83d1e | |||
424fea5881 | |||
53d9aa9d2f | |||
ce64b13846 | |||
32c50e0814 | |||
05dda09fd3 | |||
a4cafcc75d | |||
796fb965be | |||
08da98a551 | |||
57b027f1cd | |||
db05c11f50 | |||
3d2a7f0c17 | |||
8858bad352 | |||
fc135e0d72 | |||
bdf55e0b6f | |||
d4170ccdb5 | |||
e2d115db97 | |||
15cfa44937 | |||
473be2e4c1 | |||
6ad6bc005c | |||
d2fb06e6a0 | |||
73baeb7a63 |
64
.travis.yml
64
.travis.yml
@ -88,6 +88,17 @@ matrix:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
compiler: g++-8
|
||||
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
|
||||
@ -175,23 +186,55 @@ matrix:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-5.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-6.0
|
||||
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-6.0
|
||||
- libstdc++-5-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-6.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-7
|
||||
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-7
|
||||
- libstdc++-5-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
|
||||
- os: osx
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
|
||||
|
||||
install:
|
||||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||
- GIT_FETCH_JOBS=8
|
||||
- BOOST_BRANCH=develop
|
||||
- if [ "$TRAVIS_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/build
|
||||
- git submodule update --init libs/assert
|
||||
- git submodule update --init libs/config
|
||||
- git submodule update --init libs/core
|
||||
- git submodule update --init libs/preprocessor
|
||||
- git submodule update --init libs/static_assert
|
||||
- git submodule update --init libs/throw_exception
|
||||
- git submodule update --init libs/type_traits
|
||||
- git submodule init tools/build
|
||||
- git submodule init tools/boost_install
|
||||
- git submodule init libs/headers
|
||||
- git submodule init libs/assert
|
||||
- git submodule init libs/config
|
||||
- git submodule init libs/core
|
||||
- git submodule init libs/preprocessor
|
||||
- git submodule init libs/static_assert
|
||||
- git submodule init libs/throw_exception
|
||||
- git submodule init libs/type_traits
|
||||
- git submodule init libs/container_hash
|
||||
- git submodule init libs/integer
|
||||
- git submodule init libs/detail
|
||||
- git submodule update --jobs $GIT_FETCH_JOBS
|
||||
- cp -r $TRAVIS_BUILD_DIR/* libs/utility
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
@ -199,7 +242,8 @@ install:
|
||||
script:
|
||||
- |-
|
||||
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
|
||||
- ./b2 -j3 libs/utility/test toolset=$TOOLSET cxxstd=$CXXSTD
|
||||
- BUILD_JOBS=`(nproc || sysctl -n hw.ncpu) 2> /dev/null`
|
||||
- ./b2 -j $BUILD_JOBS libs/utility/test toolset=$TOOLSET cxxstd=$CXXSTD
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
27
CMakeLists.txt
Normal file
27
CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright 2018 Peter Dimov
|
||||
# Copyright 2018 Andrey Semashev
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
# Partial (add_subdirectory only) and experimental CMake support
|
||||
# Subject to change; please do not rely on the contents of this file yet.
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(BoostUtility LANGUAGES CXX)
|
||||
|
||||
add_library(boost_utility INTERFACE)
|
||||
add_library(Boost::utility ALIAS boost_utility)
|
||||
|
||||
target_include_directories(boost_utility INTERFACE include)
|
||||
|
||||
target_link_libraries(boost_utility
|
||||
INTERFACE
|
||||
Boost::config
|
||||
Boost::container_hash
|
||||
Boost::core
|
||||
Boost::preprocessor
|
||||
Boost::static_assert
|
||||
Boost::throw_exception
|
||||
Boost::type_traits
|
||||
)
|
24
README.md
Normal file
24
README.md
Normal file
@ -0,0 +1,24 @@
|
||||
# 
|
||||
|
||||
Boost.Utility, part of collection of the [Boost C++ Libraries](https://github.com/boostorg), provides a number of smaller components, too small to be called libraries in their own right. See the documentation for the list of components.
|
||||
|
||||
### Directories
|
||||
|
||||
* **doc** - Documentation sources
|
||||
* **include** - Interface headers of Boost.Utility
|
||||
* **test** - Boost.Utility unit tests
|
||||
|
||||
### More information
|
||||
|
||||
* [Documentation](https://boost.org/libs/utility)
|
||||
* [Report bugs](https://github.com/boostorg/utility/issues/new). Be sure to mention Boost version, Boost.Utility component, 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](https://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
### Build status
|
||||
|
||||
Master: [](https://travis-ci.org/boostorg/utility)
|
||||
Develop: [](https://travis-ci.org/boostorg/utility)
|
||||
|
||||
### License
|
||||
|
||||
Distributed under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt).
|
38
appveyor.yml
38
appveyor.yml
@ -1,4 +1,4 @@
|
||||
# Copyright 2016, 2017 Peter Dimov
|
||||
# Copyright 2016-2019 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)
|
||||
|
||||
@ -14,29 +14,38 @@ branches:
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
TOOLSET: msvc-14.0
|
||||
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
|
||||
- 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
|
||||
|
||||
install:
|
||||
- set GIT_FETCH_JOBS=8
|
||||
- set BOOST_BRANCH=develop
|
||||
- if "%APPVEYOR_REPO_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/build
|
||||
- git submodule update --init libs/assert
|
||||
- git submodule update --init libs/config
|
||||
- git submodule update --init libs/core
|
||||
- git submodule update --init libs/preprocessor
|
||||
- git submodule update --init libs/static_assert
|
||||
- git submodule update --init libs/throw_exception
|
||||
- git submodule update --init libs/type_traits
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\utility
|
||||
- git submodule init tools/build
|
||||
- git submodule init tools/boost_install
|
||||
- git submodule init libs/headers
|
||||
- git submodule init libs/assert
|
||||
- git submodule init libs/config
|
||||
- git submodule init libs/core
|
||||
- git submodule init libs/preprocessor
|
||||
- git submodule init libs/static_assert
|
||||
- git submodule init libs/throw_exception
|
||||
- git submodule init libs/type_traits
|
||||
- git submodule init libs/container_hash
|
||||
- git submodule init libs/integer
|
||||
- git submodule init libs/detail
|
||||
- git submodule update --jobs %GIT_FETCH_JOBS%
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\utility\
|
||||
- cmd /c bootstrap
|
||||
- b2 -d0 headers
|
||||
|
||||
@ -45,4 +54,5 @@ build: off
|
||||
test_script:
|
||||
- PATH=%ADDPATH%%PATH%
|
||||
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
||||
- b2 -j3 libs/utility/test toolset=%TOOLSET% %CXXSTD%
|
||||
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
|
||||
- b2 -j %NUMBER_OF_PROCESSORS% libs/utility/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release
|
||||
|
@ -493,7 +493,7 @@ call_traits can not be used with reference or array types.</p>
|
||||
<h4>Example 1:</h4>
|
||||
|
||||
<p>The following class is a trivial class that stores some type T
|
||||
by value (see the <a href="call_traits_test.cpp">call_traits_test.cpp</a>
|
||||
by value (see the <a href="test/call_traits_test.cpp">call_traits_test.cpp</a>
|
||||
file), the aim is to illustrate how each of the available
|
||||
call_traits typedefs may be used:</p>
|
||||
|
||||
|
@ -99,6 +99,19 @@ boostbook standalone_declval
|
||||
<xsl:param>generate.section.toc.level=1
|
||||
;
|
||||
|
||||
xml ostream_string : ostream_string.qbk ;
|
||||
boostbook standalone_ostream_string
|
||||
:
|
||||
ostream_string
|
||||
:
|
||||
<xsl:param>root.filename=ostream_string
|
||||
<xsl:param>chunk.section.depth=0
|
||||
<xsl:param>chunk.first.sections=0
|
||||
<xsl:param>toc.section.depth=1
|
||||
<xsl:param>toc.max.depth=1
|
||||
<xsl:param>generate.section.toc.level=1
|
||||
;
|
||||
|
||||
xml string_ref : string_ref.qbk ;
|
||||
boostbook standalone_string_ref
|
||||
:
|
||||
@ -123,5 +136,5 @@ alias boostdoc ;
|
||||
explicit boostdoc ;
|
||||
alias boostrelease :
|
||||
standalone_base_from_member standalone_compressed_pair
|
||||
standalone_declval standalone_string_ref ;
|
||||
standalone_declval standalone_ostream_string standalone_string_ref ;
|
||||
explicit boostrelease ;
|
||||
|
@ -356,7 +356,7 @@ templates that can be controlled and automated with macros. The
|
||||
implementation uses the [@../../../preprocessor/index.html Preprocessor library].
|
||||
|
||||
* [@http://www.boost.org/people/daryle_walker.html">Daryle Walker] started the
|
||||
library. Contributed the test file [@../../base_from_member_test.cpp
|
||||
library. Contributed the test file [@../../test/base_from_member_test.cpp
|
||||
base_from_member_test.cpp].
|
||||
|
||||
[endsect]
|
||||
|
BIN
doc/logo.png
Normal file
BIN
doc/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
539
doc/logo.svg
Normal file
539
doc/logo.svg
Normal file
@ -0,0 +1,539 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448819"
|
||||
height="1052.3622047"
|
||||
id="svg6858"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="utility.svg">
|
||||
<defs
|
||||
id="defs6860">
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4453-7-8-6-7-3-5"
|
||||
id="linearGradient10687-2-5"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="753.02301"
|
||||
y1="3132.0801"
|
||||
x2="1146.25"
|
||||
y2="3132.0801" />
|
||||
<linearGradient
|
||||
id="linearGradient4453-7-8-6-7-3-5">
|
||||
<stop
|
||||
style="stop-color:#aac4dd;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop4455-61-8-7-1-2-8" />
|
||||
<stop
|
||||
style="stop-color:#c2dbe9;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop4457-4-1-9-1-12-1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4453-7-8-6-7-3-5"
|
||||
id="linearGradient10685-2-2"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="753.02301"
|
||||
y1="3132.0801"
|
||||
x2="1146.25"
|
||||
y2="3132.0801" />
|
||||
<linearGradient
|
||||
id="linearGradient6749">
|
||||
<stop
|
||||
style="stop-color:#aac4dd;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6751" />
|
||||
<stop
|
||||
style="stop-color:#c2dbe9;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop6753" />
|
||||
</linearGradient>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath3387-3-6-4-2-8-4">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 862.109,3289.75 -109.086,-190.45 69.122,-124.42 164.511,-0.47 c 0,0 111.044,188.28 116.564,197.63 7.66,0 43.03,0 43.03,0 l -67.03,117.71 -217.111,0 z"
|
||||
id="path3389-2-0-7-7-8-9" />
|
||||
</clipPath>
|
||||
<linearGradient
|
||||
y2="3132.0801"
|
||||
x2="1146.25"
|
||||
y1="3132.0801"
|
||||
x1="753.02301"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient4492-8-8"
|
||||
xlink:href="#linearGradient4453-7-8-6-7-3-5"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
id="linearGradient6758">
|
||||
<stop
|
||||
style="stop-color:#aac4dd;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6760" />
|
||||
<stop
|
||||
style="stop-color:#c2dbe9;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop6762" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4453-7-8-6-7-3-5"
|
||||
id="linearGradient10691-7-8"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="1026.6899"
|
||||
y1="2937.73"
|
||||
x2="1463.14"
|
||||
y2="2937.73" />
|
||||
<linearGradient
|
||||
id="linearGradient6765">
|
||||
<stop
|
||||
style="stop-color:#aac4dd;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6767" />
|
||||
<stop
|
||||
style="stop-color:#c2dbe9;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop6769" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4453-7-8-6-7-3-5"
|
||||
id="linearGradient10689-4-2"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="1026.6899"
|
||||
y1="2937.73"
|
||||
x2="1463.14"
|
||||
y2="2937.73" />
|
||||
<linearGradient
|
||||
id="linearGradient6772">
|
||||
<stop
|
||||
style="stop-color:#aac4dd;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6774" />
|
||||
<stop
|
||||
style="stop-color:#c2dbe9;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop6776" />
|
||||
</linearGradient>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath3369-1-5-6-1-0-7">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 1131.64,3128.5 -104.95,-181.12 116.38,-200.42 208.05,0.94 112.02,191.63 -112.08,188.97 -219.42,0 z"
|
||||
id="path3371-89-4-1-6-0-1" />
|
||||
</clipPath>
|
||||
<linearGradient
|
||||
y2="2937.73"
|
||||
x2="1463.14"
|
||||
y1="2937.73"
|
||||
x1="1026.6899"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient4498-5-7"
|
||||
xlink:href="#linearGradient4453-7-8-6-7-3-5"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
id="linearGradient6781">
|
||||
<stop
|
||||
style="stop-color:#aac4dd;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6783" />
|
||||
<stop
|
||||
style="stop-color:#c2dbe9;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop6785" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4459-1-2-8-9-9-5"
|
||||
id="linearGradient10695-9-9"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="646.55499"
|
||||
y1="2736.25"
|
||||
x2="1088.27"
|
||||
y2="2736.25" />
|
||||
<linearGradient
|
||||
id="linearGradient4459-1-2-8-9-9-5">
|
||||
<stop
|
||||
id="stop4461-2-1-5-2-5-0"
|
||||
offset="0"
|
||||
style="stop-color:#839bc2;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop4463-3-2-8-7-30-3"
|
||||
offset="1"
|
||||
style="stop-color:#9fb6d4;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4459-1-2-8-9-9-5"
|
||||
id="linearGradient10693-9-4"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="646.55499"
|
||||
y1="2736.25"
|
||||
x2="1088.27"
|
||||
y2="2736.25" />
|
||||
<linearGradient
|
||||
id="linearGradient6792">
|
||||
<stop
|
||||
id="stop6794"
|
||||
offset="0"
|
||||
style="stop-color:#839bc2;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop6796"
|
||||
offset="1"
|
||||
style="stop-color:#9fb6d4;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath3351-4-7-3-5-95-0">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 757.242,2926.25 -110.687,-189.11 110.656,-190.89 219.437,0 111.622,189.1 -111.59,190.9 -219.438,0 z"
|
||||
id="path3353-1-9-3-4-1-1" />
|
||||
</clipPath>
|
||||
<linearGradient
|
||||
y2="2736.25"
|
||||
x2="1088.27"
|
||||
y1="2736.25"
|
||||
x1="646.55499"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient4510-1-5"
|
||||
xlink:href="#linearGradient4459-1-2-8-9-9-5"
|
||||
inkscape:collect="always" />
|
||||
<linearGradient
|
||||
id="linearGradient6801">
|
||||
<stop
|
||||
id="stop6803"
|
||||
offset="0"
|
||||
style="stop-color:#839bc2;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop6805"
|
||||
offset="1"
|
||||
style="stop-color:#9fb6d4;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#radialGradient3327-8-4-8-0-2-4"
|
||||
id="radialGradient10699-1-3"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
cx="997.46997"
|
||||
cy="2896.25"
|
||||
fx="997.46997"
|
||||
fy="2896.25"
|
||||
r="583.73999" />
|
||||
<radialGradient
|
||||
fx="0"
|
||||
fy="0"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(58.375,0,0,-58.375,99.75,289.625)"
|
||||
spreadMethod="pad"
|
||||
id="radialGradient3327-8-4-8-0-2-4">
|
||||
<stop
|
||||
style="stop-opacity:1;stop-color:#aeaeb3"
|
||||
offset="0"
|
||||
id="stop3329-7-0-1-0-33-2" />
|
||||
<stop
|
||||
style="stop-opacity:1;stop-color:#ffffff"
|
||||
offset="0.949438"
|
||||
id="stop3331-4-3-0-0-97-3" />
|
||||
<stop
|
||||
style="stop-opacity:1;stop-color:#ffffff"
|
||||
offset="1"
|
||||
id="stop3333-2-4-9-7-2-2" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
r="583.73999"
|
||||
fy="2896.25"
|
||||
fx="997.46997"
|
||||
cy="2896.25"
|
||||
cx="997.46997"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient13050"
|
||||
xlink:href="#radialGradient3327-8-4-8-0-2-4"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
fx="0"
|
||||
fy="0"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(58.375,0,0,-58.375,99.75,289.625)"
|
||||
spreadMethod="pad"
|
||||
id="radialGradient6813">
|
||||
<stop
|
||||
style="stop-opacity:1;stop-color:#aeaeb3"
|
||||
offset="0"
|
||||
id="stop6815" />
|
||||
<stop
|
||||
style="stop-opacity:1;stop-color:#ffffff"
|
||||
offset="0.949438"
|
||||
id="stop6817" />
|
||||
<stop
|
||||
style="stop-opacity:1;stop-color:#ffffff"
|
||||
offset="1"
|
||||
id="stop6819" />
|
||||
</radialGradient>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath3323-7-2-4-5-3-4">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 997.469,2312.51 c -322.379,0 -583.739,261.36 -583.739,583.74 0,322.38 261.36,583.74 583.739,583.74 322.381,0 583.741,-261.36 583.741,-583.74 0,-322.38 -261.36,-583.74 -583.741,-583.74"
|
||||
id="path3325-9-2-9-5-04-9" />
|
||||
</clipPath>
|
||||
<radialGradient
|
||||
r="583.73999"
|
||||
fy="2896.25"
|
||||
fx="997.46997"
|
||||
cy="2896.25"
|
||||
cx="997.46997"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient4516-8-2"
|
||||
xlink:href="#radialGradient3327-8-4-8-0-2-4"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
fx="0"
|
||||
fy="0"
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(58.375,0,0,-58.375,99.75,289.625)"
|
||||
spreadMethod="pad"
|
||||
id="radialGradient6824">
|
||||
<stop
|
||||
style="stop-opacity:1;stop-color:#aeaeb3"
|
||||
offset="0"
|
||||
id="stop6826" />
|
||||
<stop
|
||||
style="stop-opacity:1;stop-color:#ffffff"
|
||||
offset="0.949438"
|
||||
id="stop6828" />
|
||||
<stop
|
||||
style="stop-opacity:1;stop-color:#ffffff"
|
||||
offset="1"
|
||||
id="stop6830" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
r="583.73999"
|
||||
fy="2896.25"
|
||||
fx="997.46997"
|
||||
cy="2896.25"
|
||||
cx="997.46997"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient6856"
|
||||
xlink:href="#radialGradient3327-8-4-8-0-2-4"
|
||||
inkscape:collect="always" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.4"
|
||||
inkscape:cx="234.05635"
|
||||
inkscape:cy="581.46313"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1680"
|
||||
inkscape:window-height="982"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3066" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata6863">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g3319-1-2-5-1-4-4"
|
||||
transform="matrix(0.10419818,0,0,-0.10419818,137.10955,897.00327)"
|
||||
style="fill:url(#radialGradient10699-1-3);fill-opacity:1"
|
||||
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
|
||||
inkscape:export-xdpi="63.625523"
|
||||
inkscape:export-ydpi="63.625523">
|
||||
<g
|
||||
clip-path="url(#clipPath3323-7-2-4-5-3-4)"
|
||||
id="g3321-9-2-7-4-3-9"
|
||||
style="fill:url(#radialGradient6856);fill-opacity:1">
|
||||
<path
|
||||
id="path3335-8-7-3-8-92-0"
|
||||
style="fill:url(#radialGradient4516-8-2);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 997.469,2312.51 c -322.379,0 -583.739,261.36 -583.739,583.74 0,322.38 261.36,583.74 583.739,583.74 322.381,0 583.741,-261.36 583.741,-583.74 0,-322.38 -261.36,-583.74 -583.741,-583.74"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g3347-6-8-3-7-4-4"
|
||||
transform="matrix(0.125,0,0,-0.125,112.08304,959.82207)"
|
||||
style="fill:url(#linearGradient10695-9-9);fill-opacity:1"
|
||||
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
|
||||
inkscape:export-xdpi="63.625523"
|
||||
inkscape:export-ydpi="63.625523">
|
||||
<g
|
||||
clip-path="url(#clipPath3351-4-7-3-5-95-0)"
|
||||
id="g3349-5-5-4-7-9-4"
|
||||
style="fill:url(#linearGradient10693-9-4);fill-opacity:1">
|
||||
<path
|
||||
id="path3361-0-8-2-9-0-9"
|
||||
style="fill:url(#linearGradient4510-1-5);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 757.242,2926.25 -110.687,-189.11 110.656,-190.89 219.437,0 111.622,189.1 -111.59,190.9 -219.438,0"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
<path
|
||||
id="path3363-6-9-0-1-5-8"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 194.34816,617.68335 13.106,-22.3925 25.99649,0 13.21487,22.60874 -13.21487,22.39125 -25.99649,0 -13.106,-22.60749 z m 40.53761,-24.8925 -28.86524,0 -0.72412,1.23749 -13.106,22.39251 -0.73575,1.25625 0.73087,1.26 13.106,22.60744 0.72263,1.24634 28.86374,0 0.72512,-1.22884 13.215,-22.39119 0.74625,-1.265 -0.74,-1.26751 -13.21537,-22.60875 -0.72313,-1.23874"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
|
||||
inkscape:export-xdpi="63.625523"
|
||||
inkscape:export-ydpi="63.625523" />
|
||||
<g
|
||||
id="g3365-0-4-1-9-7-5"
|
||||
transform="matrix(0.125,0,0,-0.125,112.08304,959.82207)"
|
||||
style="fill:url(#linearGradient10691-7-8);fill-opacity:1"
|
||||
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
|
||||
inkscape:export-xdpi="63.625523"
|
||||
inkscape:export-ydpi="63.625523">
|
||||
<g
|
||||
clip-path="url(#clipPath3369-1-5-6-1-0-7)"
|
||||
id="g3367-2-4-2-8-4-3"
|
||||
style="fill:url(#linearGradient10689-4-2);fill-opacity:1">
|
||||
<path
|
||||
id="path3379-4-6-7-6-7-2"
|
||||
style="fill:url(#linearGradient4498-5-7);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 1131.64,3128.5 -104.95,-181.12 116.38,-200.42 208.05,0.94 112.02,191.63 -112.08,188.97 -219.42,0"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
<path
|
||||
id="path3381-6-8-0-0-66-3"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 241.86427,591.39959 12.3925,-21.38999 25.99625,0 13.27125,22.37625 -13.27125,22.7025 -24.56875,0.11 -13.82,-23.79876 z m 39.8125,-23.88999 -28.86125,0 -0.7225,1.24625 -12.3925,21.39 -0.72625,1.255 0.7275,1.25374 13.82,23.79876 0.7275,1.25125 1.44625,-0.006 24.56875,-0.11 1.4275,-0.006 0.72,-1.2325 13.27125,-22.7025 0.7425,-1.27 -0.75125,-1.26625 -13.27125,-22.37625 -0.72625,-1.225"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
|
||||
inkscape:export-xdpi="63.625523"
|
||||
inkscape:export-ydpi="63.625523" />
|
||||
<g
|
||||
id="g3383-5-5-2-2-3-0"
|
||||
transform="matrix(0.125,0,0,-0.125,112.08304,959.82207)"
|
||||
style="fill:url(#linearGradient10687-2-5);fill-opacity:1"
|
||||
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
|
||||
inkscape:export-xdpi="63.625523"
|
||||
inkscape:export-ydpi="63.625523">
|
||||
<g
|
||||
clip-path="url(#clipPath3387-3-6-4-2-8-4)"
|
||||
id="g3385-0-6-4-8-0-1"
|
||||
style="fill:url(#linearGradient10685-2-2);fill-opacity:1">
|
||||
<path
|
||||
id="path3397-9-6-1-6-9-7"
|
||||
style="fill:url(#linearGradient4492-8-8);fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 862.109,3289.75 -109.086,-190.45 69.122,-124.42 164.511,-0.47 c 0,0 111.044,188.28 116.564,197.63 7.66,0 43.03,0 43.03,0 l -67.03,117.71 -217.111,0"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
<path
|
||||
id="path3399-6-7-3-2-0-1"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 207.64603,572.41959 12.92424,-22.56624 25.68775,0 6.95625,12.21375 -3.94375,0 -14.56837,24.7025 -19.11525,-0.055 -7.94087,-14.295 z m 40.06574,-25.06624 -28.59012,0 -0.71975,1.2575 -12.92537,22.56625 -0.70112,1.22375 0.68512,1.23249 7.94137,14.295 0.71087,1.2825 1.46638,0.004 19.11525,0.055 1.43212,0.004 0.729,-1.23375 13.84375,-23.47249 6.81625,0 -2.12875,-3.7375 -6.95625,-12.21375 -0.71875,-1.2625"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
|
||||
inkscape:export-xdpi="63.625523"
|
||||
inkscape:export-ydpi="63.625523" />
|
||||
<g
|
||||
transform="matrix(1.25,0,0,-1.25,105.02062,972.84257)"
|
||||
id="g3465-0-8-9"
|
||||
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
|
||||
inkscape:export-xdpi="63.625523"
|
||||
inkscape:export-ydpi="63.625523">
|
||||
<text
|
||||
id="text3467-9-0-8"
|
||||
transform="matrix(1,0,-0.17627963,-1,0,0)"
|
||||
x="116.98372"
|
||||
y="-267.77499"
|
||||
style="font-size:11.81779194px">
|
||||
<tspan
|
||||
sodipodi:role="line"
|
||||
style="font-size:46.39999771px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#49608a;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Denmark;-inkscape-font-specification:Denmark"
|
||||
x="116.98372"
|
||||
y="-267.77499"
|
||||
id="tspan13239">UTILITY</tspan>
|
||||
<tspan
|
||||
sodipodi:role="line"
|
||||
style="font-size:46.39999771px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#49608a;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Denmark;-inkscape-font-specification:Denmark"
|
||||
x="116.98372"
|
||||
y="-209.77499"
|
||||
id="tspan11278-3" />
|
||||
</text>
|
||||
<text
|
||||
id="text3471-0-51-2"
|
||||
transform="matrix(0.99235617,0,-0.17763746,-1.0077027,0,0)"
|
||||
style="font-size:38.40000153px"
|
||||
x="112.74373"
|
||||
y="-306.75479">
|
||||
<tspan
|
||||
id="tspan3473-6-0-9"
|
||||
sodipodi:role="line"
|
||||
style="font-size:38.40000153px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#49608a;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Denmark;-inkscape-font-specification:Denmark"
|
||||
x="112.74373"
|
||||
y="-306.75479">boost</tspan>
|
||||
</text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none"
|
||||
d="m 201.43967,613.81579 4.64114,4.2175 3.3738,-3.71306 -0.92817,-0.84354 1.68708,-1.85636 20.53445,20.81026 4.2175,-4.64111 -22.22144,-18.95384 c 0,0 1.69594,-1.83698 2.53062,-2.78454 2.53905,-2.76559 5.98925,-4.72587 5.98925,-4.72587 0,0 -6.03647,0.58224 -8.76507,2.21476 -0.84428,0.92751 -6.75676,7.40649 -6.75676,7.40649 l -0.92819,-0.84355 -3.37382,3.71308"
|
||||
id="path13283"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccccccccc" />
|
||||
<g
|
||||
id="g3086"
|
||||
transform="matrix(0.99872217,-0.05053738,0.05053738,0.99872217,-31.539183,11.181538)">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path13243"
|
||||
d="m 227.74101,611.16418 -15.09943,12.783 2.55659,3.01989 15.09944,-12.78302 c 3.56324,2.16769 7.58975,-1.2411 7.0464,-5.96538 l -4.02652,3.40879 -2.55659,-3.01989 4.02652,-3.40879 c -3.56324,-2.16769 -8.59639,2.0933 -7.04641,5.9654 z"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path13243-1"
|
||||
d="m 215.25729,626.9851 15.08951,-12.7947 -2.55893,-3.01791 -15.08952,12.79471 c -3.56492,-2.16491 -7.58878,1.24699 -7.04177,5.97085 l 4.02388,-3.41192 2.55892,3.01791 -4.02387,3.41192 c 3.56491,2.16492 8.59476,-2.09997 7.04178,-5.97086 z"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 20 KiB |
78
doc/ostream_string.qbk
Normal file
78
doc/ostream_string.qbk
Normal file
@ -0,0 +1,78 @@
|
||||
[/
|
||||
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)
|
||||
]
|
||||
|
||||
[article ostream_string
|
||||
[quickbook 1.5]
|
||||
[authors [Fernandes, Glen]]
|
||||
[copyright 2019 Glen Joseph Fernandes]
|
||||
[license Distributed under the Boost Software License, Version 1.0.]]
|
||||
|
||||
[section Overview]
|
||||
|
||||
The header <boost/utility/ostream_string.hpp> provides the function template
|
||||
`boost::ostream_string` for formatted output that satisfies the requirements of
|
||||
\[ostream.formatted.reqmts\].
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Examples]
|
||||
|
||||
The inserter for class template `basic_string_view` could be implemented as
|
||||
follows:
|
||||
|
||||
```
|
||||
template<class charT, class traits>
|
||||
std::basic_ostream<charT, traits>&
|
||||
operator<<(std::basic_ostream<charT, traits>& os,
|
||||
const basic_string_view<charT, traits>& str)
|
||||
{
|
||||
return boost::ostream_string(os, str.data(), str.size());
|
||||
}
|
||||
```
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Reference]
|
||||
|
||||
```
|
||||
namespace boost {
|
||||
|
||||
template<class charT, class traits>
|
||||
std::basic_ostream<charT, traits>&
|
||||
ostream_string(std::basic_ostream<charT, traits>& os,
|
||||
const charT* data, std::size_t size);
|
||||
|
||||
} /* boost */
|
||||
```
|
||||
|
||||
[heading Free functions]
|
||||
|
||||
[variablelist
|
||||
[[`template<class charT, class traits> std::basic_ostream<charT, traits>&
|
||||
ostream_string(std::basic_ostream<charT, traits>& os, const charT* data,
|
||||
std::size_t size);`]
|
||||
[[variablelist
|
||||
[[Effects]
|
||||
[Behaves like a formatted inserter (as described in
|
||||
\[ostream.formatted.reqmts\]) of `os`. Creates a character sequence `seq` of
|
||||
`size` characters starting at `data`, each widened using `os.widen()`
|
||||
(\[basic.ios.members\]). Determines padding for `seq` as described in
|
||||
\[ostream.formatted.reqmts\]. Inserts `seq` into `os`. Calls `width(0)`.]]
|
||||
[[Returns][`os`.]]]]]]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section History]
|
||||
|
||||
[heading boost 1.71]
|
||||
|
||||
* Glen Fernandes updated the implementation of the `basic_string_ref` and
|
||||
`basic_string_view` stream insertion operators to write directly to the
|
||||
`basic_streambuf` and refactored that functionality into this common utility.
|
||||
|
||||
[endsect]
|
@ -156,6 +156,11 @@ String-like operations:
|
||||
[section History]
|
||||
[/===============]
|
||||
|
||||
[heading boost 1.71]
|
||||
* Glen Fernandes updated the implementation of the stream insertion operator to
|
||||
write directly to the `basic_streambuf` and refactored that functionality into
|
||||
a common utility.
|
||||
|
||||
[heading boost 1.53]
|
||||
* Introduced
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/is_empty.hpp>
|
||||
#include <boost/type_traits/is_final.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
|
||||
@ -42,6 +43,14 @@ class compressed_pair;
|
||||
|
||||
namespace details
|
||||
{
|
||||
template<class T, bool E = boost::is_final<T>::value>
|
||||
struct compressed_pair_empty
|
||||
: ::boost::false_type { };
|
||||
|
||||
template<class T>
|
||||
struct compressed_pair_empty<T, false>
|
||||
: ::boost::is_empty<T> { };
|
||||
|
||||
// JM altered 26 Jan 2000:
|
||||
template <class T1, class T2, bool IsSame, bool FirstEmpty, bool SecondEmpty>
|
||||
struct compressed_pair_switch;
|
||||
@ -343,8 +352,8 @@ class compressed_pair
|
||||
T1,
|
||||
T2,
|
||||
::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
|
||||
::boost::is_empty<T1>::value,
|
||||
::boost::is_empty<T2>::value>::value>
|
||||
::boost::details::compressed_pair_empty<T1>::value,
|
||||
::boost::details::compressed_pair_empty<T2>::value>::value>
|
||||
{
|
||||
private:
|
||||
typedef details::compressed_pair_imp<T1, T2,
|
||||
@ -352,8 +361,8 @@ private:
|
||||
T1,
|
||||
T2,
|
||||
::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
|
||||
::boost::is_empty<T1>::value,
|
||||
::boost::is_empty<T2>::value>::value> base;
|
||||
::boost::details::compressed_pair_empty<T1>::value,
|
||||
::boost::details::compressed_pair_empty<T2>::value>::value> base;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
@ -388,8 +397,8 @@ class compressed_pair<T, T>
|
||||
T,
|
||||
T,
|
||||
::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
|
||||
::boost::is_empty<T>::value,
|
||||
::boost::is_empty<T>::value>::value>
|
||||
::boost::details::compressed_pair_empty<T>::value,
|
||||
::boost::details::compressed_pair_empty<T>::value>::value>
|
||||
{
|
||||
private:
|
||||
typedef details::compressed_pair_imp<T, T,
|
||||
@ -397,8 +406,8 @@ private:
|
||||
T,
|
||||
T,
|
||||
::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
|
||||
::boost::is_empty<T>::value,
|
||||
::boost::is_empty<T>::value>::value> base;
|
||||
::boost::details::compressed_pair_empty<T>::value,
|
||||
::boost::details::compressed_pair_empty<T>::value>::value> base;
|
||||
public:
|
||||
typedef T first_type;
|
||||
typedef T second_type;
|
||||
|
95
include/boost/utility/ostream_string.hpp
Normal file
95
include/boost/utility/ostream_string.hpp
Normal 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_UTILITY_OSTREAM_STRING_HPP
|
||||
#define BOOST_UTILITY_OSTREAM_STRING_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <iosfwd>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
|
||||
template<class charT, class traits>
|
||||
inline std::size_t
|
||||
oss_put(std::basic_ostream<charT, traits>& os, const charT* data,
|
||||
std::size_t size)
|
||||
{
|
||||
return static_cast<std::size_t>(os.rdbuf()->sputn(data, size));
|
||||
}
|
||||
|
||||
template<class charT, class traits>
|
||||
inline bool
|
||||
oss_fill(std::basic_ostream<charT, traits>& os, std::size_t size)
|
||||
{
|
||||
charT c = os.fill();
|
||||
charT fill[] = { c, c, c, c, c, c, c, c };
|
||||
enum {
|
||||
chunk = sizeof fill / sizeof(charT)
|
||||
};
|
||||
for (; size > chunk; size -= chunk) {
|
||||
if (boost::detail::oss_put(os, fill, chunk) != chunk) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return boost::detail::oss_put(os, fill, size) == size;
|
||||
}
|
||||
|
||||
template<class charT, class traits>
|
||||
class oss_guard {
|
||||
public:
|
||||
explicit oss_guard(std::basic_ostream<charT, traits>& os) BOOST_NOEXCEPT
|
||||
: os_(&os) { }
|
||||
~oss_guard() BOOST_NOEXCEPT_IF(false) {
|
||||
if (os_) {
|
||||
os_->setstate(std::basic_ostream<charT, traits>::badbit);
|
||||
}
|
||||
}
|
||||
void release() BOOST_NOEXCEPT {
|
||||
os_ = 0;
|
||||
}
|
||||
private:
|
||||
oss_guard(const oss_guard&);
|
||||
oss_guard& operator=(const oss_guard&);
|
||||
std::basic_ostream<charT, traits>* os_;
|
||||
};
|
||||
|
||||
} /* detail */
|
||||
|
||||
template<class charT, class traits>
|
||||
inline std::basic_ostream<charT, traits>&
|
||||
ostream_string(std::basic_ostream<charT, traits>& os, const charT* data,
|
||||
std::size_t size)
|
||||
{
|
||||
typedef std::basic_ostream<charT, traits> stream;
|
||||
detail::oss_guard<charT, traits> guard(os);
|
||||
typename stream::sentry entry(os);
|
||||
if (entry) {
|
||||
std::size_t width = static_cast<std::size_t>(os.width());
|
||||
if (width <= size) {
|
||||
if (detail::oss_put(os, data, size) != size) {
|
||||
return os;
|
||||
}
|
||||
} else if ((os.flags() & stream::adjustfield) == stream::left) {
|
||||
if (detail::oss_put(os, data, size) != size ||
|
||||
!detail::oss_fill(os, width - size)) {
|
||||
return os;
|
||||
}
|
||||
} else if (!detail::oss_fill(os, width - size) ||
|
||||
detail::oss_put(os, data, size) != size) {
|
||||
return os;
|
||||
}
|
||||
os.width(0);
|
||||
}
|
||||
guard.release();
|
||||
return os;
|
||||
}
|
||||
|
||||
} /* boost */
|
||||
|
||||
#endif
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright (c) Marshall Clow 2012-2015.
|
||||
Copyright (c) Glen Joseph Fernandes 2019 (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)
|
||||
@ -17,6 +18,7 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/utility/ostream_string.hpp>
|
||||
#include <boost/utility/string_ref_fwd.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
@ -181,6 +183,7 @@ namespace boost {
|
||||
}
|
||||
|
||||
size_type find(basic_string_ref s) const {
|
||||
if (s.empty()) return 0;
|
||||
const_iterator iter = std::search ( this->cbegin (), this->cend (),
|
||||
s.cbegin (), s.cend (), traits::eq );
|
||||
return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
|
||||
@ -193,6 +196,7 @@ namespace boost {
|
||||
}
|
||||
|
||||
size_type rfind(basic_string_ref s) const {
|
||||
if (s.empty()) return 0;
|
||||
const_reverse_iterator iter = std::search ( this->crbegin (), this->crend (),
|
||||
s.crbegin (), s.crend (), traits::eq );
|
||||
return iter == this->crend () ? npos : (std::distance(iter, this->crend()) - s.size());
|
||||
@ -419,52 +423,11 @@ namespace boost {
|
||||
return basic_string_ref<charT, traits>(x) >= y;
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class charT, class traits>
|
||||
inline void sr_insert_fill_chars(std::basic_ostream<charT, traits>& os, std::size_t n) {
|
||||
enum { chunk_size = 8 };
|
||||
charT fill_chars[chunk_size];
|
||||
std::fill_n(fill_chars, static_cast< std::size_t >(chunk_size), os.fill());
|
||||
for (; n >= chunk_size && os.good(); n -= chunk_size)
|
||||
os.write(fill_chars, static_cast< std::size_t >(chunk_size));
|
||||
if (n > 0 && os.good())
|
||||
os.write(fill_chars, n);
|
||||
}
|
||||
|
||||
template<class charT, class traits>
|
||||
void sr_insert_aligned(std::basic_ostream<charT, traits>& os, const basic_string_ref<charT,traits>& str) {
|
||||
const std::size_t size = str.size();
|
||||
const std::size_t alignment_size = static_cast< std::size_t >(os.width()) - size;
|
||||
const bool align_left = (os.flags() & std::basic_ostream<charT, traits>::adjustfield) == std::basic_ostream<charT, traits>::left;
|
||||
if (!align_left) {
|
||||
detail::sr_insert_fill_chars(os, alignment_size);
|
||||
if (os.good())
|
||||
os.write(str.data(), size);
|
||||
}
|
||||
else {
|
||||
os.write(str.data(), size);
|
||||
if (os.good())
|
||||
detail::sr_insert_fill_chars(os, alignment_size);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// Inserter
|
||||
template<class charT, class traits>
|
||||
inline std::basic_ostream<charT, traits>&
|
||||
operator<<(std::basic_ostream<charT, traits>& os, const basic_string_ref<charT,traits>& str) {
|
||||
if (os.good()) {
|
||||
const std::size_t size = str.size();
|
||||
const std::size_t w = static_cast< std::size_t >(os.width());
|
||||
if (w <= size)
|
||||
os.write(str.data(), size);
|
||||
else
|
||||
detail::sr_insert_aligned(os, str);
|
||||
os.width(0);
|
||||
}
|
||||
return os;
|
||||
return boost::ostream_string(os, str.data(), str.size());
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
Copyright (c) Marshall Clow 2012-2015.
|
||||
Copyright (c) Beman Dawes 2015
|
||||
Copyright (c) Glen Joseph Fernandes 2019 (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)
|
||||
@ -19,8 +20,10 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/utility/ostream_string.hpp>
|
||||
#include <boost/utility/string_view_fwd.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/container_hash/hash_fwd.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
@ -183,7 +186,7 @@ namespace boost {
|
||||
if (pos > size())
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("string_view::copy" ));
|
||||
size_type rlen = (std::min)(n, len_ - pos);
|
||||
traits_type::copy(s, data() + pos, rlen);
|
||||
traits_type::copy(s, data() + pos, rlen);
|
||||
return rlen;
|
||||
}
|
||||
|
||||
@ -570,53 +573,12 @@ namespace boost {
|
||||
return basic_string_view<charT, traits>(x) >= y;
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class charT, class traits>
|
||||
inline void sv_insert_fill_chars(std::basic_ostream<charT, traits>& os, std::size_t n) {
|
||||
enum { chunk_size = 8 };
|
||||
charT fill_chars[chunk_size];
|
||||
std::fill_n(fill_chars, static_cast< std::size_t >(chunk_size), os.fill());
|
||||
for (; n >= chunk_size && os.good(); n -= chunk_size)
|
||||
os.write(fill_chars, static_cast< std::size_t >(chunk_size));
|
||||
if (n > 0 && os.good())
|
||||
os.write(fill_chars, n);
|
||||
}
|
||||
|
||||
template<class charT, class traits>
|
||||
void sv_insert_aligned(std::basic_ostream<charT, traits>& os, const basic_string_view<charT,traits>& str) {
|
||||
const std::size_t size = str.size();
|
||||
const std::size_t alignment_size = static_cast< std::size_t >(os.width()) - size;
|
||||
const bool align_left = (os.flags() & std::basic_ostream<charT, traits>::adjustfield) == std::basic_ostream<charT, traits>::left;
|
||||
if (!align_left) {
|
||||
detail::sv_insert_fill_chars(os, alignment_size);
|
||||
if (os.good())
|
||||
os.write(str.data(), size);
|
||||
}
|
||||
else {
|
||||
os.write(str.data(), size);
|
||||
if (os.good())
|
||||
detail::sv_insert_fill_chars(os, alignment_size);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// Inserter
|
||||
template<class charT, class traits>
|
||||
inline std::basic_ostream<charT, traits>&
|
||||
operator<<(std::basic_ostream<charT, traits>& os,
|
||||
const basic_string_view<charT,traits>& str) {
|
||||
if (os.good()) {
|
||||
const std::size_t size = str.size();
|
||||
const std::size_t w = static_cast< std::size_t >(os.width());
|
||||
if (w <= size)
|
||||
os.write(str.data(), size);
|
||||
else
|
||||
detail::sv_insert_aligned(os, str);
|
||||
os.width(0);
|
||||
}
|
||||
return os;
|
||||
return boost::ostream_string(os, str.data(), str.size());
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -690,6 +652,10 @@ namespace boost {
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class charT, class traits>
|
||||
std::size_t hash_value(basic_string_view<charT, traits> s) {
|
||||
return boost::hash_range(s.begin(), s.end());
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -31,6 +31,7 @@
|
||||
<a href="utility.htm#result_of">result_of</a><br>
|
||||
<a href="throw_exception.html">throw_exception</a><br>
|
||||
<a href="utility.htm">utility</a><br>
|
||||
<a href="doc/html/ostream_string.html">ostream_string</a><br>
|
||||
<a href="doc/html/string_ref.html">string_ref</a><br>
|
||||
<a href="value_init.htm">value_init</a><br>
|
||||
</p>
|
||||
|
@ -85,6 +85,19 @@
|
||||
"Daniel Frey <d.frey -at- gmx.de>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "utility/ostream_string",
|
||||
"name": "ostream_string",
|
||||
"description": "String formatted output function.",
|
||||
"documentation": "doc/html/ostream_string.html",
|
||||
"category": [
|
||||
"IO"
|
||||
],
|
||||
"authors": "Glen Fernandes",
|
||||
"maintainers": [
|
||||
"Glen Fernandes <glenjofe -at- gmail.com>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "utility/result_of",
|
||||
"name": "Result Of",
|
||||
@ -98,6 +111,19 @@
|
||||
"Daniel Walker <daniel.j.walker -at- gmail.com>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "utility/string_ref",
|
||||
"name": "string_ref",
|
||||
"description": "String view templates.",
|
||||
"documentation": "doc/html/string_ref.html",
|
||||
"category": [
|
||||
"Containers"
|
||||
],
|
||||
"authors": "Marshall Clow",
|
||||
"maintainers": [
|
||||
"Marshall Clow <marshall -at- idio.com>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "utility/value_initialized",
|
||||
"name": "Value Initialized",
|
||||
|
@ -119,8 +119,8 @@
|
||||
also want <code>x > y, x >= y,</code> and <code>x <= y</code>.
|
||||
Moreover, unless your class has really surprising behavior, some of these
|
||||
related operators can be defined in terms of others (e.g. <code>x >= y
|
||||
<=> !(x < y)</code>). Replicating this boilerplate for multiple
|
||||
classes is both tedious and error-prone. The <cite><a href=
|
||||
is equivalent to !(x < y)</code>). Replicating this boilerplate for
|
||||
multiple classes is both tedious and error-prone. The <cite><a href=
|
||||
"../../boost/operators.hpp">boost/operators.hpp</a></cite> templates help
|
||||
by generating operators for you at namespace scope based on other
|
||||
operators you've defined in your class.</p>
|
||||
@ -1586,7 +1586,7 @@ T operator+( T lhs, const T& rhs )
|
||||
<h3><a name="a_demo">Arithmetic Operators Demonstration</a> and Test
|
||||
Program</h3>
|
||||
|
||||
<p>The <cite><a href="operators_test.cpp">operators_test.cpp</a></cite>
|
||||
<p>The <cite><a href="test/operators_test.cpp">operators_test.cpp</a></cite>
|
||||
program demonstrates the use of the arithmetic operator templates, and
|
||||
can also be used to verify correct operation. Check the compiler status
|
||||
report for the test results with selected platforms.</p>
|
||||
@ -1998,7 +1998,7 @@ struct function_output_iterator
|
||||
|
||||
<h3><a name="i_demo">Iterator Demonstration</a> and Test Program</h3>
|
||||
|
||||
<p>The <cite><a href="iterators_test.cpp">iterators_test.cpp</a></cite>
|
||||
<p>The <cite><a href="test/iterators_test.cpp">iterators_test.cpp</a></cite>
|
||||
program demonstrates the use of the iterator templates, and can also be
|
||||
used to verify correct operation. The following is the custom iterator
|
||||
defined in the test program. It demonstrates a correct (though trivial)
|
||||
@ -2064,7 +2064,7 @@ public:
|
||||
<dt><a href="http://www.boost.org/people/beman_dawes.html">Beman Dawes</a></dt>
|
||||
|
||||
<dd>Contributed <cite><a href=
|
||||
"operators_test.cpp">operators_test.cpp</a></cite>.</dd>
|
||||
"test/operators_test.cpp">operators_test.cpp</a></cite>.</dd>
|
||||
|
||||
<dt><a href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a></dt>
|
||||
|
||||
|
@ -16,6 +16,7 @@ run binary_test.cpp ;
|
||||
run call_traits_test.cpp : -u ;
|
||||
|
||||
run compressed_pair_test.cpp ;
|
||||
run compressed_pair_final_test.cpp ;
|
||||
|
||||
run iterators_test.cpp ;
|
||||
|
||||
@ -41,3 +42,5 @@ compile-fail value_init_test_fail2.cpp ;
|
||||
compile-fail value_init_test_fail3.cpp ;
|
||||
compile-fail initialized_test_fail1.cpp ;
|
||||
compile-fail initialized_test_fail2.cpp ;
|
||||
|
||||
run ostream_string_test.cpp ;
|
||||
|
55
test/compressed_pair_final_test.cpp
Normal file
55
test/compressed_pair_final_test.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
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)
|
||||
*/
|
||||
#include <boost/config.hpp>
|
||||
#if !defined(BOOST_NO_CXX11_FINAL)
|
||||
#include <boost/compressed_pair.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
struct type1 {
|
||||
operator bool() const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
struct type2 final {
|
||||
operator bool() const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#if !defined(BOOST_IS_FINAL)
|
||||
namespace boost {
|
||||
|
||||
template<>
|
||||
struct is_final<type2>
|
||||
: true_type { };
|
||||
|
||||
} /* boost*/
|
||||
#endif
|
||||
|
||||
template<class T1, class T2>
|
||||
void test()
|
||||
{
|
||||
boost::compressed_pair<T1, T2> p;
|
||||
BOOST_TEST(!p.first());
|
||||
BOOST_TEST(!p.second());
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<type1, type2>();
|
||||
test<type2, type1>();
|
||||
test<type2, type2>();
|
||||
return boost::report_errors();
|
||||
}
|
||||
#else
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
136
test/ostream_string_test.cpp
Normal file
136
test/ostream_string_test.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
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)
|
||||
*/
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/utility/ostream_string.hpp>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::ostringstream os;
|
||||
os.width(1);
|
||||
os.fill('.');
|
||||
os.setf(std::ios_base::left, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, "xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == "xy");
|
||||
}
|
||||
{
|
||||
std::wostringstream os;
|
||||
os.width(1);
|
||||
os.fill('.');
|
||||
os.setf(std::ios_base::left, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, L"xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == L"xy");
|
||||
}
|
||||
{
|
||||
std::ostringstream os;
|
||||
os.width(1);
|
||||
os.fill('.');
|
||||
os.setf(std::ios_base::right, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, "xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == "xy");
|
||||
}
|
||||
{
|
||||
std::wostringstream os;
|
||||
os.width(1);
|
||||
os.fill('.');
|
||||
os.setf(std::ios_base::right, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, L"xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == L"xy");
|
||||
}
|
||||
{
|
||||
std::ostringstream os;
|
||||
os.width(4);
|
||||
os.fill('.');
|
||||
os.setf(std::ios_base::left, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, "xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == "xy..");
|
||||
}
|
||||
{
|
||||
std::wostringstream os;
|
||||
os.width(4);
|
||||
os.fill(L'.');
|
||||
os.setf(std::ios_base::left, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, L"xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == L"xy..");
|
||||
}
|
||||
{
|
||||
std::ostringstream os;
|
||||
os.width(4);
|
||||
os.fill('.');
|
||||
os.setf(std::ios_base::right, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, "xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == "..xy");
|
||||
}
|
||||
{
|
||||
std::wostringstream os;
|
||||
os.width(4);
|
||||
os.fill(L'.');
|
||||
os.setf(std::ios_base::right, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, L"xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == L"..xy");
|
||||
}
|
||||
{
|
||||
std::ostringstream os;
|
||||
os.width(12);
|
||||
os.fill('.');
|
||||
os.setf(std::ios_base::left, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, "xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == "xy..........");
|
||||
}
|
||||
{
|
||||
std::wostringstream os;
|
||||
os.width(12);
|
||||
os.fill(L'.');
|
||||
os.setf(std::ios_base::left, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, L"xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == L"xy..........");
|
||||
}
|
||||
{
|
||||
std::ostringstream os;
|
||||
os.width(12);
|
||||
os.fill('.');
|
||||
os.setf(std::ios_base::right, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, "xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == "..........xy");
|
||||
}
|
||||
{
|
||||
std::wostringstream os;
|
||||
os.width(12);
|
||||
os.fill(L'.');
|
||||
os.setf(std::ios_base::right, std::ios_base::adjustfield);
|
||||
boost::ostream_string(os, L"xy", 2);
|
||||
BOOST_TEST(os.good());
|
||||
BOOST_TEST(os.width() == 0);
|
||||
BOOST_TEST(os.str() == L"..........xy");
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
@ -93,6 +93,10 @@ void find ( const char *arg ) {
|
||||
string_ref sr2;
|
||||
const char *p;
|
||||
|
||||
// When we search for the empty string, we find it at position 0
|
||||
BOOST_TEST ( sr1.find (sr2) == 0 );
|
||||
BOOST_TEST ( sr1.rfind(sr2) == 0 );
|
||||
|
||||
// Look for each character in the string(searching from the start)
|
||||
p = arg;
|
||||
sr1 = arg;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <string>
|
||||
|
||||
#include <boost/utility/string_view.hpp>
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
@ -85,6 +86,14 @@ void test_remove ( const std::string &str ) {
|
||||
}
|
||||
}
|
||||
|
||||
void test_hash(const std::string& str) {
|
||||
string_view ref = str;
|
||||
BOOST_TEST(boost::hash_value(ref) == boost::hash_value(str));
|
||||
boost::hash<std::string> hstr;
|
||||
boost::hash<string_view> hsv;
|
||||
BOOST_TEST(hsv(ref) == hstr(str));
|
||||
}
|
||||
|
||||
const char *test_strings [] = {
|
||||
"",
|
||||
"1",
|
||||
@ -102,6 +111,7 @@ int main()
|
||||
test_substr ( *p );
|
||||
test_remove ( *p );
|
||||
null_tests ( *p );
|
||||
test_hash( *p );
|
||||
|
||||
p++;
|
||||
}
|
||||
|
@ -97,6 +97,10 @@ void find ( const char *arg ) {
|
||||
string_view sr2;
|
||||
const char *p;
|
||||
|
||||
// When we search for the empty string, we find it at position 0
|
||||
BOOST_TEST ( sr1.find (sr2) == 0 );
|
||||
BOOST_TEST ( sr1.rfind(sr2) == 0 );
|
||||
|
||||
// Look for each character in the string(searching from the start)
|
||||
p = arg;
|
||||
sr1 = arg;
|
||||
|
Reference in New Issue
Block a user