mirror of
https://github.com/boostorg/utility.git
synced 2025-06-25 03:51:34 +02:00
Compare commits
34 Commits
boost-1.78
...
esp-idf-co
Author | SHA1 | Date | |
---|---|---|---|
7d5d019900 | |||
ff7f512a45 | |||
06548cf5fa | |||
932973fe39 | |||
c63d36cf5b | |||
0106ffda5f | |||
0c1d01d30a | |||
7ac95c156c | |||
eb29d71245 | |||
fe417f6237 | |||
d5c33889b9 | |||
11cff46019 | |||
f11a56c2a7 | |||
69f6588d7c | |||
6950023bca | |||
c3aab6a184 | |||
7717dac7bc | |||
63aadf3f0f | |||
0feb28b467 | |||
78f1b38930 | |||
e6edd4eb91 | |||
9d1284ef6d | |||
aa0ccfa65e | |||
c21d2818c7 | |||
5ae025b56a | |||
f3f7c3c041 | |||
bdc983b804 | |||
a1583e3072 | |||
30caa722c1 | |||
96169c9fc6 | |||
b6119df27f | |||
9941e831bb | |||
a8cdbe516d | |||
485a160dde |
@ -3,6 +3,8 @@
|
||||
# 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
|
||||
|
||||
if(NOT DEFINED IDF_TARGET)
|
||||
|
||||
cmake_minimum_required(VERSION 3.5...3.20)
|
||||
|
||||
project(boost_utility VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||
@ -22,3 +24,25 @@ target_link_libraries(boost_utility
|
||||
Boost::throw_exception
|
||||
Boost::type_traits
|
||||
)
|
||||
|
||||
else()
|
||||
|
||||
FILE(GLOB_RECURSE headers include/*.h include/*.hpp)
|
||||
|
||||
idf_component_register(
|
||||
SRCS
|
||||
${headers}
|
||||
INCLUDE_DIRS
|
||||
include
|
||||
REQUIRES
|
||||
boost_config
|
||||
boost_core
|
||||
boost_io
|
||||
boost_preprocessor
|
||||
boost_static_assert
|
||||
boost_throw_exception
|
||||
boost_type_traits
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
|
14
appveyor.yml
14
appveyor.yml
@ -1,5 +1,5 @@
|
||||
# Copyright 2016-2019 Peter Dimov
|
||||
# Copyright 2019 Andrey Semashev
|
||||
# Copyright 2019, 2022 Andrey Semashev
|
||||
# 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)
|
||||
|
||||
@ -22,21 +22,25 @@ environment:
|
||||
ADDRMD: 32,64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
- TOOLSET: msvc-14.1
|
||||
CXXSTD: 14,17
|
||||
CXXSTD: 14,17,latest
|
||||
ADDRMD: 32,64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
- TOOLSET: msvc-14.2
|
||||
ADDRMD: 32,64
|
||||
CXXSTD: 14,17
|
||||
CXXSTD: 14,17,20,latest
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
- TOOLSET: msvc-14.3
|
||||
ADDRMD: 32,64
|
||||
CXXSTD: 14,17,20,latest
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
|
||||
- TOOLSET: clang-win
|
||||
ADDRMD: 32
|
||||
CXXSTD: 14,17
|
||||
CXXSTD: 14,17,latest
|
||||
ENV_SCRIPT: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
- TOOLSET: clang-win
|
||||
ADDRMD: 64
|
||||
CXXSTD: 14,17
|
||||
CXXSTD: 14,17,latest
|
||||
ENV_SCRIPT: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
- TOOLSET: gcc
|
||||
|
@ -35,7 +35,7 @@ In addition, LL and ULL suffixes may be used for representing
|
||||
them as an extension.
|
||||
|
||||
The `BOOST_BINARY` family of macros resides in the header
|
||||
[@../../../include/boost/utility/binary.hpp <boost/utility/binary.hpp>].
|
||||
[@../../../../boost/utility/binary.hpp <boost/utility/binary.hpp>].
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -79,7 +79,3 @@ Contributed by Matt Calabrese.
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2,50 +2,19 @@
|
||||
# subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import project ;
|
||||
import doxygen ;
|
||||
import quickbook ;
|
||||
|
||||
project : requirements
|
||||
# Path for links to Boost:
|
||||
<xsl:param>boost.root=../../../..
|
||||
|
||||
# Some general style settings:
|
||||
<xsl:param>table.footnote.number.format=1
|
||||
<xsl:param>footnote.number.format=1
|
||||
|
||||
# HTML options first:
|
||||
# Use graphics not text for navigation:
|
||||
<xsl:param>navig.graphics=1
|
||||
# PDF Options:
|
||||
# TOC Generation: this is needed for FOP-0.9 and later:
|
||||
<xsl:param>fop1.extensions=0
|
||||
<xsl:param>xep.extensions=1
|
||||
# TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
|
||||
<xsl:param>fop.extensions=0
|
||||
# No indent on body text:
|
||||
<xsl:param>body.start.indent=0pt
|
||||
# Margin size:
|
||||
<xsl:param>page.margin.inner=0.5in
|
||||
# Margin size:
|
||||
<xsl:param>page.margin.outer=0.5in
|
||||
# Paper type = A4
|
||||
<xsl:param>paper.type=A4
|
||||
# Yes, we want graphics for admonishments:
|
||||
<xsl:param>admon.graphics=1
|
||||
# Set this one for PDF generation *only*:
|
||||
# default pnd graphics are awful in PDF form,
|
||||
# better use SVG's instead:
|
||||
<format>pdf:<xsl:param>admon.graphics.extension=".svg"
|
||||
<format>pdf:<xsl:param>"admon.graphics.path=$(boost-images)/"
|
||||
<format>pdf:<xsl:param>"boost.url.prefix=http://www.boost.org/doc/libs/release/libs/utility/doc/html"
|
||||
;
|
||||
project boost/libs/utility/doc ;
|
||||
|
||||
path-constant INCLUDES : ../../.. ;
|
||||
path-constant boost-images : ../../../doc/src/images ;
|
||||
|
||||
# Generate XML doxygen reference for base_from_member component in base_from_member_reference.xml
|
||||
doxygen base_from_member_reference
|
||||
:
|
||||
../include/boost/utility/base_from_member.hpp
|
||||
$(INCLUDES)/boost/utility/base_from_member.hpp
|
||||
:
|
||||
<location>tmp
|
||||
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||
@ -89,7 +58,7 @@ doxygen base_from_member_reference
|
||||
# Generate XML doxygen reference for boost_binary component in boost_binary_reference.xml
|
||||
doxygen boost_binary_reference
|
||||
:
|
||||
../include/boost/utility/binary.hpp
|
||||
$(INCLUDES)/boost/utility/binary.hpp
|
||||
:
|
||||
<location>tmp
|
||||
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||
@ -133,8 +102,8 @@ doxygen boost_binary_reference
|
||||
# Generate XML doxygen reference for call_traits component in call_traits_reference.xml
|
||||
doxygen call_traits_reference
|
||||
:
|
||||
../include/boost/call_traits.hpp
|
||||
../include/boost/detail/call_traits.hpp
|
||||
$(INCLUDES)/boost/call_traits.hpp
|
||||
$(INCLUDES)/boost/detail/call_traits.hpp
|
||||
:
|
||||
<location>tmp
|
||||
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||
@ -178,8 +147,8 @@ doxygen call_traits_reference
|
||||
# Generate XML doxygen reference for compressed_pair component in compressed_pair_reference.xml
|
||||
doxygen compressed_pair_reference
|
||||
:
|
||||
../include/boost/compressed_pair.hpp
|
||||
../include/boost/detail/compressed_pair.hpp
|
||||
$(INCLUDES)/boost/compressed_pair.hpp
|
||||
$(INCLUDES)/boost/detail/compressed_pair.hpp
|
||||
:
|
||||
<location>tmp
|
||||
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||
@ -223,8 +192,8 @@ doxygen compressed_pair_reference
|
||||
# Generate XML doxygen reference for in_place_factory component in in_place_factory_reference.xml
|
||||
doxygen in_place_factory_reference
|
||||
:
|
||||
../include/boost/utility/in_place_factory.hpp
|
||||
../include/boost/utility/typed_in_place_factory.hpp
|
||||
$(INCLUDES)/boost/utility/in_place_factory.hpp
|
||||
$(INCLUDES)/boost/utility/typed_in_place_factory.hpp
|
||||
:
|
||||
<location>tmp
|
||||
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||
@ -271,7 +240,7 @@ doxygen in_place_factory_reference
|
||||
# Generate XML doxygen reference for result_of component in result_of_reference.xml
|
||||
doxygen result_of_reference
|
||||
:
|
||||
../include/boost/utility/result_of.hpp
|
||||
$(INCLUDES)/boost/utility/result_of.hpp
|
||||
:
|
||||
<location>tmp
|
||||
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||
@ -315,7 +284,7 @@ doxygen result_of_reference
|
||||
# Generate XML doxygen reference for string_view component in string_view_reference.xml
|
||||
doxygen string_view_reference
|
||||
:
|
||||
../include/boost/utility/string_view.hpp
|
||||
$(INCLUDES)/boost/utility/string_view.hpp
|
||||
:
|
||||
<location>tmp
|
||||
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||
@ -359,7 +328,7 @@ doxygen string_view_reference
|
||||
# Generate XML doxygen reference for value_init component in value_init_reference.xml
|
||||
doxygen value_init_reference
|
||||
:
|
||||
../include/boost/utility/value_init.hpp
|
||||
$(INCLUDES)/boost/utility/value_init.hpp
|
||||
:
|
||||
<location>tmp
|
||||
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||
@ -440,6 +409,5 @@ boostbook standalone_main
|
||||
alias boostdoc ;
|
||||
explicit boostdoc ;
|
||||
|
||||
alias boostrelease :
|
||||
standalone_main ;
|
||||
alias boostrelease : standalone_main ;
|
||||
explicit boostrelease ;
|
||||
|
@ -112,7 +112,7 @@ type does not need to concern itself with the integer.
|
||||
#endif
|
||||
|
||||
template < typename MemberType, int UniqueID = 0 >
|
||||
class __boost_base_from_member__
|
||||
class __base_from_member__
|
||||
{
|
||||
protected:
|
||||
MemberType member;
|
||||
@ -192,7 +192,6 @@ maintain the same maximum size. (Example code would be a class that uses
|
||||
this class template as a base class for a member with a flexible set of
|
||||
constructors.) This constant is ignored when C++11 features are present.
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Basic Usage]
|
||||
@ -237,7 +236,6 @@ safe to use in the latter sub-object's construction. Since the `fdoutbuf`
|
||||
sub-object of the final type is the only sub-object with the name `member`
|
||||
that name can be used unqualified within the final class.
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Multiple Sub-Objects]
|
||||
@ -322,8 +320,8 @@ type. Using `typedef`s ease mentioning the base types.
|
||||
|
||||
However, the fix introduces a new problem when a pointer is needed. Using the
|
||||
address operator with a sub-object qualified with its class's name results in a
|
||||
pointer-to-member (here, having a type of `an_int __boost_base_from_member__<an_int, 0>:: *`)
|
||||
instead of a pointer to the member (having a type of `an_int *`).
|
||||
pointer-to-member (here, having a type of `an_int __boost_base_from_member__<an_int, 0>::*`)
|
||||
instead of a pointer to the member (having a type of `an_int*`).
|
||||
The new problem is fixed by qualifying the sub-object with `this->` and is needed
|
||||
just for pointers, and not for references or values.
|
||||
|
||||
@ -338,9 +336,9 @@ C++ always interprets such code as an integer when it has overloads that can
|
||||
take either an integer or a pointer.
|
||||
|
||||
The last conversion is necessary for the compiler to call a constructor form
|
||||
with the exact pointer type used in `switcher`'s constructor. (If C++11's
|
||||
__nullptr__ is used, it still needs a conversion if multiple pointer types can
|
||||
be accepted in a constructor call but `__std_nullptr_t__` cannot.)
|
||||
with the exact pointer type used in `switcher`'s constructor. (If C++11's
|
||||
__nullptr__ is used, it still needs a conversion if multiple pointer types can
|
||||
be accepted in a constructor call but `__std_nullptr_t__` cannot.)
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -355,25 +353,24 @@ Author: Walker, Daryle
|
||||
Copyright 2001, 2003, 2004, 2012 Daryle Walker
|
||||
|
||||
* [@http://www.boost.org/people/ed_brey.htm Ed Brey] suggested some interface
|
||||
changes.
|
||||
changes.
|
||||
|
||||
* [@http://www.moocat.org R. Samuel Klatchko] ([@mailto:rsk@moocat.org
|
||||
rsk@moocat.org], [@mailto:rsk@brightmail.com rsk@brightmail.com]) invented
|
||||
the idiom of how to use a class member for initializing a base class.
|
||||
rsk@moocat.org], [@mailto:rsk@brightmail.com rsk@brightmail.com]) invented
|
||||
the idiom of how to use a class member for initializing a base class.
|
||||
|
||||
* [@http://www.boost.org/people/dietmar_kuehl.htm Dietmar Kuehl] popularized the
|
||||
base-from-member idiom in his [@http://www.informatik.uni-konstanz.de/~kuehl/c++/iostream/
|
||||
base-from-member idiom in his [@http://www.informatik.uni-konstanz.de/~kuehl/c++/iostream/
|
||||
IOStream example classes].
|
||||
|
||||
* Jonathan Turkanis supplied an implementation of generating the constructor
|
||||
templates that can be controlled and automated with macros. The
|
||||
implementation uses the [@boost:/doc/html/preprocessor/index.html Preprocessor library].
|
||||
templates that can be controlled and automated with macros. The
|
||||
implementation uses the [@boost:/libs/preprocessor/index.html Preprocessor library].
|
||||
|
||||
* [@http://www.boost.org/people/daryle_walker.html">Daryle Walker] started the
|
||||
library. Contributed the test file [@../../../test/base_from_member_test.cpp
|
||||
base_from_member_test.cpp].
|
||||
library. Contributed the test file [@../../../test/base_from_member_test.cpp
|
||||
base_from_member_test.cpp].
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
[section Introduction]
|
||||
|
||||
All of the contents of [@../../../include/boost/call_traits.hpp `<boost/call_traits.hpp>`] are
|
||||
All of the contents of [@../../../../boost/call_traits.hpp `<boost/call_traits.hpp>`] are
|
||||
defined inside `namespace boost`.
|
||||
|
||||
The template class __call_traits_T__ encapsulates the
|
||||
@ -159,7 +159,7 @@ various types.
|
||||
[[From `int&`] [`int&`] [`int&`] [`const int&`] [`int&`] [All reference types]]
|
||||
[[From `const int&`] [`const int&`] [`const int&`] [`const int&`] [`const int&`] [All constant reference types]]
|
||||
[[From `int[3]`] [`const int*`] [`int(&)[3]`] [`const int(&)[3]`] [`const int* const`] [All array types]]
|
||||
[[From `const int[3]`] [`const int*`] [`const int(&)[3]`] [`const int(&)[3]`] [`const int *const`] [All constant array types]]
|
||||
[[From `const int[3]`] [`const int*`] [`const int(&)[3]`] [`const int(&)[3]`] [`const int* const`] [All constant array types]]
|
||||
]
|
||||
|
||||
The table assumes the compiler supports partial
|
||||
@ -284,7 +284,7 @@ The __call_traits__ template will "optimize" the passing
|
||||
of a small built-in type as a function parameter. This mainly has
|
||||
an effect when the parameter is used within a loop body.
|
||||
|
||||
In the following example (see [@boost:/doc/html/type_traits/examples/fill_example.cpp `fill_example.cpp`]),
|
||||
In the following example (see [@boost:/libs/type_traits/examples/fill_example.cpp `fill_example.cpp`]),
|
||||
a version of __std_fill__ is optimized in two ways: if the type
|
||||
passed is a single byte built-in type then __std_memset__ is used to
|
||||
effect the fill, otherwise a conventional C++ implementation is
|
||||
@ -441,8 +441,3 @@ specialisation.
|
||||
[/===============]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
[section Introduction]
|
||||
|
||||
All of the contents of [@../../../include/boost/compressed_pair.hpp `<boost/compressed_pair.hpp>`] are defined inside
|
||||
All of the contents of [@../../../../boost/compressed_pair.hpp `<boost/compressed_pair.hpp>`] are defined inside
|
||||
`namespace boost`.
|
||||
|
||||
The class __compressed_pair__ is very similar to __std_pair__. However, if either of
|
||||
@ -71,8 +71,8 @@ a default value.
|
||||
|
||||
Note that __compressed_pair__ can not be instantiated if either of the
|
||||
template arguments is a union type, unless there is compiler support for
|
||||
[@boost:/doc/html/type_traits/index.html `boost::is_union`], or
|
||||
if [@boost:/doc/html/type_traits/index.html `boost::is_union`] is
|
||||
[@boost:/libs/type_traits/index.html `boost::is_union`], or
|
||||
if [@boost:/libs/type_traits/index.html `boost::is_union`] is
|
||||
specialised for the union type.
|
||||
|
||||
Finally, a word of caution for Visual C++ 6 users: if either argument is an
|
||||
|
@ -18,7 +18,7 @@ Suppose we have a class
|
||||
```
|
||||
struct X
|
||||
{
|
||||
X ( int, _std__string_ ) ;
|
||||
X ( int, __std_string__ ) ;
|
||||
};
|
||||
```
|
||||
|
||||
@ -70,7 +70,7 @@ struct C
|
||||
{
|
||||
C() : contained_(0) {}
|
||||
C ( X const& v ) : contained_ ( new X(v) ) {}
|
||||
C ( int a0, std::string a1 ) : contained_ ( new X(a0,a1) ) {}
|
||||
C ( int a0, __std_string__ a1 ) : contained_ ( new X(a0,a1) ) {}
|
||||
~C() { delete contained_ ; }
|
||||
X* contained_ ;
|
||||
};
|
||||
@ -100,8 +100,8 @@ correctly aligned and sized. Naturally, the container will typically support uni
|
||||
in-place construction to override a fully-constructed object, as this would defeat the purpose of in-place construction.
|
||||
|
||||
For this purpose, the framework provides two concepts called: InPlaceFactories and TypedInPlaceFactories.
|
||||
Helpers to declare these classes are declared in [@../../../include/boost/utility/in_place_factory.hpp `<boost/utility/in_place_factory.hpp>`]
|
||||
and [@../../../include/boost/utility/typed_in_place_factory.hpp `<boost/utility/typed_in_place_factory.hpp>`].
|
||||
Helpers to declare these classes are declared in [@../../../../boost/utility/in_place_factory.hpp `<boost/utility/in_place_factory.hpp>`]
|
||||
and [@../../../../boost/utility/typed_in_place_factory.hpp `<boost/utility/typed_in_place_factory.hpp>`].
|
||||
|
||||
Essentially, these classes hold a sequence of actual parameters and a method to construct an object in place using these parameters.
|
||||
Each member of the family differs only in the number and type of the parameter list. The first family
|
||||
@ -214,11 +214,11 @@ As you can see, the `in_place_factory` and `typed_in_place_factory` template cla
|
||||
the target type: in the first family, the type is given as a template argument to the apply member function while in the
|
||||
second it is given directly as part of the factory class.
|
||||
|
||||
When the container holds a unique non-polymorphic type, such as the case of [@boost:/doc/html/optional/index.html Boost.Optional],
|
||||
When the container holds a unique non-polymorphic type, such as the case of [@boost:/libs/optional/index.html Boost.Optional],
|
||||
it knows the exact dynamic-type of the contained object and can pass it to the `apply()` method of a non-typed factory.
|
||||
In this case, end users can use an `in_place_factory` instance which can be constructed without the type of the object to construct.
|
||||
|
||||
However, if the container holds heterogeneous or polymorphic objects, such as the case of [@boost:/doc/html/variant/index.html Boost.Variant],
|
||||
However, if the container holds heterogeneous or polymorphic objects, such as the case of [@boost:/libs/variant/index.html Boost.Variant],
|
||||
the dynamic-type of the object to be constructed must be known by the factory. In this case, end users must use a `typed_in_place_factory`
|
||||
instead.
|
||||
|
||||
@ -236,7 +236,7 @@ The correct function overload must be based on the only distinctive and common
|
||||
characteristic of all the classes in each family: the base class.
|
||||
|
||||
Depending on the container class, you can use `enable_if` to generate the right overload, or use the following
|
||||
dispatch technique, which is used in the [@boost:/doc/html/optional/index.html Boost.Optional] class:
|
||||
dispatch technique, which is used in the [@boost:/libs/optional/index.html Boost.Optional] class:
|
||||
|
||||
|
||||
```
|
||||
@ -306,7 +306,3 @@ Copyright Fernando Luis Cacciola Carballal, 2004
|
||||
|
||||
[endsect]
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
|
||||
|
12
doc/main.qbk
12
doc/main.qbk
@ -26,12 +26,16 @@
|
||||
[category generic]
|
||||
]
|
||||
|
||||
[template mdash[] '''— ''']
|
||||
[template indexterm1[term1] '''<indexterm><primary>'''[term1]'''</primary></indexterm>''']
|
||||
[template indexterm2[term1 term2] '''<indexterm><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
|
||||
[template mdash[]'''—''']
|
||||
[template ndash[]'''–''']
|
||||
[template sect[]'''§''']
|
||||
[template hellip[]'''…''']
|
||||
|
||||
[template indexterm1[term1]'''<indexterm><primary>'''[term1]'''</primary></indexterm>''']
|
||||
[template indexterm2[term1 term2]'''<indexterm><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
|
||||
|
||||
[template include_file[path][^<'''<ulink url="https://github.com/boostorg/utility/blob/master/include/'''[path]'''">'''[path]'''</ulink>'''>]]
|
||||
[template issue[n] '''<ulink url="https://github.com/boostorg/utility/issues/'''[n]'''">#'''[n]'''</ulink>''']
|
||||
[template issue[n]'''<ulink url="https://github.com/boostorg/utility/issues/'''[n]'''">#'''[n]'''</ulink>''']
|
||||
|
||||
[/ Named Requirements ]
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
[section Introduction]
|
||||
|
||||
The header [@../../../include/boost/operators.hpp `<boost/operators.hpp>`] supplies
|
||||
The header [@../../../../boost/operators.hpp `<boost/operators.hpp>`] supplies
|
||||
several sets of class templates in `namespace boost`. These templates define
|
||||
operators at namespace scope in terms of a minimal number of fundamental
|
||||
operators provided by the class.
|
||||
@ -32,7 +32,7 @@ related operators can be defined in terms of others (e.g. `x >= y`
|
||||
is equivalent to `!(x < y)`).
|
||||
|
||||
Replicating this boilerplate for multiple classes is both tedious and
|
||||
error-prone. The [@../../../include/boost/operators.hpp `<boost/operators.hpp>`] templates
|
||||
error-prone. The [@../../../../boost/operators.hpp `<boost/operators.hpp>`] templates
|
||||
help by generating operators for you at namespace scope based on other
|
||||
operators you have defined in your class.
|
||||
|
||||
@ -291,11 +291,12 @@ are:
|
||||
* [link table:indexable `indexable<>`]
|
||||
* Any composite operator template that includes at least one of the above
|
||||
|
||||
As Daniel Krugler pointed out, this technique violates 14.6.5/2 and is thus
|
||||
non-portable. The reasoning is, that the operators injected by the instantiation
|
||||
As Daniel Krugler pointed out, this technique violates C++11 [sect]14.6.5/2 \[temp.inject\]
|
||||
and is thus non-portable. The reasoning is, that the operators injected by the instantiation
|
||||
of e.g. `less_than_comparable<my_class>` can not be found by ADL according to the
|
||||
rules given by 3.4.2/2, since `my_class` is not an associated class of
|
||||
`less_than_comparable<my_class>`. Thus only use this technique if all else fails.
|
||||
rules given by C++11 [sect]3.4.2/2 \[basic.lookup.argdep\], since `my_class` is not
|
||||
an associated class of `less_than_comparable<my_class>`. Thus only use this technique
|
||||
if all else fails.
|
||||
|
||||
[#sec:portability]
|
||||
[h5 Requirement Portability]
|
||||
@ -1098,22 +1099,26 @@ function return value (which is another unnamed object of type
|
||||
`T`). The standard doesn't generally allow the intermediate
|
||||
object to be optimized away:
|
||||
|
||||
["3.7.2/2: Automatic storage duration: If a named automatic object has initialization or a destructor with
|
||||
side effects, it shall not be destroyed before the end of its block,
|
||||
nor shall it be eliminated as an optimization even if it appears to be
|
||||
unused, except that a class object or its copy may be eliminated as
|
||||
specified in 12.8.]
|
||||
[:['C++11 [sect]3.7.3/3 \[basic.stc.auto\]: Automatic storage duration:] If a variable with automatic storage
|
||||
duration has initialization or a destructor with side effects, it shall not be destroyed before the end of
|
||||
its block, nor shall it be eliminated as an optimization even if it appears to be unused, except that a class
|
||||
object or its copy/move may be eliminated as specified in 12.8.]
|
||||
|
||||
The reference to 12.8 is important for us:
|
||||
The reference to [sect]12.8 is important for us:
|
||||
|
||||
["12.8/15: Copying class objects: (...) For a function with a class return type, if the expression in the
|
||||
return statement is the name of a local object, and the cv-unqualified
|
||||
type of the local object is the same as the function return type, an
|
||||
implementation is permitted to omit creating the temporary object to
|
||||
hold the function return value, even if the class copy constructor or
|
||||
destructor has side effects.]
|
||||
[:['C++11 [sect]12.8/31 \[class.copy\]: Copying and moving class objects:] When certain criteria are met, an implementation is allowed to omit the copy/move construction of a class
|
||||
object, even if the copy/move constructor and/or destructor for the object have side effects. ([hellip]) This elision of copy/move
|
||||
operations, called ['copy elision], is permitted in the following circumstances (which may be combined to
|
||||
eliminate multiple copies):
|
||||
|
||||
This optimization is known as the named return value optimization (NRVO),
|
||||
[mdash] in a `return` statement in a function with a class return type, when the expression is the name of a
|
||||
non-volatile automatic object (other than a function or catch-clause parameter) with the same cv-
|
||||
unqualified type as the function return type, the copy/move operation can be omitted by constructing
|
||||
the automatic object directly into the function's return value
|
||||
|
||||
([hellip])]
|
||||
|
||||
This optimization is known as the named return value optimization ([@https://en.cppreference.com/w/cpp/language/copy_elision#Non-mandatory_elision_of_copy.2Fmove_.28since_C.2B.2B11.29_operations NRVO]),
|
||||
which leads us to the following implementation for `operator+`:
|
||||
|
||||
```
|
||||
@ -1142,14 +1147,15 @@ T operator+( T lhs, const T& rhs )
|
||||
The difference to the first implementation is that `lhs` is
|
||||
not taken as a constant reference used to create a copy; instead,
|
||||
`lhs` is a by-value parameter, thus it is already the copy
|
||||
needed. This allows another optimization (12.2/2) for some cases.
|
||||
needed. This allows another optimization (C++11 [sect]12.2/2 \[class.temporary\])
|
||||
for some cases.
|
||||
|
||||
Consider `a + b + c` where the result of `a + b` is not copied when
|
||||
used as `lhs` when adding `c`. This is more efficient than the original
|
||||
code, but not as efficient as a compiler using the NRVO. For most people,
|
||||
it is still preferable for compilers that don't implement the NRVO, but
|
||||
the `operator+` now has a different function signature. Also,
|
||||
the number of objects created differs for `(a + b ) + c` and `a + ( b + c )`.
|
||||
the number of objects created differs for `(a + b) + c` and `a + (b + c)`.
|
||||
|
||||
Most probably, this won't be a problem for you, but if your code relies on the function
|
||||
signature or a strict symmetric behaviour, you should set
|
||||
@ -1835,16 +1841,16 @@ such as `iterator_category` and `value_type`.
|
||||
|
||||
# [#note:1] Unlike other iterator helpers templates, __output_iterator_helper__ takes only one template parameter -
|
||||
the type of its target class. Although to some it might seem like an unnecessary restriction, the standard requires
|
||||
`difference_type` and `value_type` of any output iterator to be `void` (24.3.1 [lib.iterator.traits]), and
|
||||
`difference_type` and `value_type` of any output iterator to be `void` (C++11 [sect]24.4.1 \[lib.iterator.traits\]), and
|
||||
__output_iterator_helper__ template respects this requirement. Also, output iterators in the standard have void `pointer` and
|
||||
`reference` types, so the __output_iterator_helper__ does the same.
|
||||
# [#note:2] As self-proxying is the easiest and most common way to implement output iterators (see,
|
||||
for example, insert [24.4.2] and stream iterators [24.5] in the standard library),
|
||||
for example, insert (C++11 [sect]24.5.2 \[insert.iterators\]) and stream iterators (C++11 [sect]24.6 \[stream.iterators\]) in the standard library),
|
||||
__output_iterator_helper__ supports the idiom by defining `operator*` and `operator++` member functions which
|
||||
just return a non-const reference to the iterator itself. Support for self-proxying allows us, in many cases,
|
||||
to reduce the task of writing an output iterator to writing just two member functions - an appropriate
|
||||
constructor and a copy-assignment operator. For example, here is a possible implementation of
|
||||
[@boost:/doc/html/iterator/doc/function_output_iterator.html `boost::function_output_iterator`] adaptor:
|
||||
[@boost:/libs/iterator/doc/function_output_iterator.html `boost::function_output_iterator`] adaptor:
|
||||
|
||||
```
|
||||
template<class UnaryFunction>
|
||||
@ -1936,11 +1942,11 @@ classes themselves have no state. For instance, the size of
|
||||
above was 12-24 bytes on various compilers for the Win32 platform,
|
||||
instead of the expected 8 bytes.
|
||||
|
||||
Strictly speaking, it was not the library's fault -- the language rules
|
||||
allow the compiler to apply the empty base class optimization in that
|
||||
situation. In principle an arbitrary number of empty base classes can be
|
||||
allocated at the same offset, provided that none of them have a common
|
||||
ancestor (see section 10.5 [class.derived] paragraph 5 of the standard).
|
||||
Strictly speaking, it was not the library's fault [ndash] the language rules
|
||||
allow the compiler to apply the [@https://en.cppreference.com/w/cpp/language/ebo empty base class optimization]
|
||||
in that situation. In principle an arbitrary number of empty base classes can
|
||||
be allocated at the same offset, provided that none of them have a common
|
||||
ancestor (see [sect]10 \[class.derived\] paragraph 8 of the C++11 standard).
|
||||
|
||||
But the language definition also does not ['require] implementations
|
||||
to do the optimization, and few if any of today's compilers implement it
|
||||
@ -1949,7 +1955,7 @@ that implementors will adopt it as a future enhancement to existing
|
||||
compilers, because it would break binary compatibility between code
|
||||
generated by two different versions of the same compiler. As Matt Austern
|
||||
said, "One of the few times when you have the freedom to do this sort of
|
||||
thing is when you are targeting a new architecture...". On the other hand,
|
||||
thing is when you are targeting a new architecture[hellip]". On the other hand,
|
||||
many common compilers will use the empty base optimization for single
|
||||
inheritance hierarchies.
|
||||
|
||||
@ -1971,11 +1977,11 @@ library to remain backward-compatible.
|
||||
|
||||
* [@http://www.boost.org/people/dave_abrahams.htm Dave Abrahams]:
|
||||
Started the library and contributed the arithmetic operators in
|
||||
[@../../../include/boost/operators.hpp `boost/operators.hpp`].
|
||||
[@../../../../boost/operators.hpp `boost/operators.hpp`].
|
||||
|
||||
* [@http://www.boost.org/people/jeremy_siek.htm Jeremy Siek]:
|
||||
Contributed the [link sec:deref dereference operators and iterator
|
||||
helpers] in [@../../../include/boost/operators.hpp boost/operators.hpp].
|
||||
helpers] in [@../../../../boost/operators.hpp boost/operators.hpp].
|
||||
Also contributed [@../../../test/iterators_test.cpp iterators_test.cpp].
|
||||
|
||||
* [@http://www.boost.org/people/aleksey_gurtovoy.htm Aleksey Gurtovoy]:
|
||||
|
@ -11,20 +11,19 @@
|
||||
|
||||
Some utilities have been moved from Boost.Utilities to more appropriate Boost libraries:
|
||||
|
||||
# Moved to [@boost:/doc/html/core/index.html Boost.Core]
|
||||
# [@boost:/doc/html/core/doc/html/core/addressof.html addressof]
|
||||
# [@boost:/doc/html/core/doc/html/core/checked_delete.html checked_delete]
|
||||
# [@boost:/doc/html/core/doc/html/core/enable_if.html enable_if]
|
||||
# [@boost:/doc/html/core/doc/html/core/noncopyable.html noncopyable]
|
||||
# Moved to [@boost:/doc/html/type_traits/index.html Boost.TypeTraits]
|
||||
# [@boost:/doc/html/type_traits/doc/html/boost_typetraits/reference/declval.html declval]
|
||||
# Moved to [@boost:/doc/html/iterator/index.html Boost.Iterator]
|
||||
# [@boost:/doc/html/iterator/doc/generator_iterator.htm generator iterator adaptors]
|
||||
# [@boost:/doc/html/iterator/doc/html/iterator/algorithms/next_prior.html next/prior]
|
||||
# Moved to [@boost:/doc/html/io/index.html Boost.IO]
|
||||
# [@boost:/doc/html/io/doc/html/io.html ostream_string]
|
||||
# Moved to [@boost:/doc/html/throw_exception/index.html Boost.ThrowException]
|
||||
# [@boost:/doc/html/throw_exception/doc/html/throw_exception.html#using_boost_throw_exception throw_exception]
|
||||
# Moved to [@boost:/libs/core/index.html Boost.Core]
|
||||
# [@boost:/libs/core/doc/html/core/addressof.html addressof]
|
||||
# [@boost:/libs/core/doc/html/core/checked_delete.html checked_delete]
|
||||
# [@boost:/libs/core/doc/html/core/enable_if.html enable_if]
|
||||
# [@boost:/libs/core/doc/html/core/noncopyable.html noncopyable]
|
||||
# Moved to [@boost:/libs/type_traits/index.html Boost.TypeTraits]
|
||||
# [@boost:/libs/type_traits/doc/html/boost_typetraits/reference/declval.html declval]
|
||||
# Moved to [@boost:/libs/iterator/index.html Boost.Iterator]
|
||||
# [@boost:/libs/iterator/doc/generator_iterator.htm generator iterator adaptors]
|
||||
# [@boost:/libs/iterator/doc/html/iterator/algorithms/next_prior.html next/prior]
|
||||
# Moved to [@boost:/libs/io/index.html Boost.IO]
|
||||
# [@boost:/libs/io/doc/html/io.html ostream_string]
|
||||
# Moved to [@boost:/libs/throw_exception/index.html Boost.ThrowException]
|
||||
# [@boost:/libs/throw_exception/doc/html/throw_exception.html#using_boost_throw_exception throw_exception]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -22,24 +22,24 @@ in other libraries.
|
||||
|
||||
[table:id Components
|
||||
[[Boost.Utility] [Moved to Boost] [C++ Standard variant]]
|
||||
[[[@boost:/doc/html/core/doc/html/core/addressof.html `addressof`]] [[@boost:/doc/html/core/index.html Boost.Core]] [C++11 __std_addressof__]]
|
||||
[[[@boost:/libs/core/doc/html/core/addressof.html `addressof`]] [[@boost:/libs/core/index.html Boost.Core]] [C++11 __std_addressof__]]
|
||||
[[__base_from_member__] [] []]
|
||||
[[__BOOST_BINARY__] [] [C++14 [@https://en.cppreference.com/w/cpp/language/integer_literal Binary integer literal]]]
|
||||
[[__call_traits__] [] []]
|
||||
[[[@boost:/doc/html/core/doc/html/core/checked_delete.html `checked_delete`]] [[@boost:/doc/html/core/index.html Boost.Core]] []]
|
||||
[[[@boost:/libs/core/doc/html/core/checked_delete.html `checked_delete`]] [[@boost:/libs/core/index.html Boost.Core]] []]
|
||||
[[__compressed_pair__] [] []]
|
||||
[[[@boost:/doc/html/type_traits/doc/html/boost_typetraits/reference/declval.html `declval`]] [[@boost:/doc/html/type_traits/index.html Boost.TypeTraits]] [C++11 __std_declval__]]
|
||||
[[[@boost:/doc/html/core/doc/html/core/enable_if.html `enable_if`]] [[@boost:/doc/html/core/index.html Boost.Core]] [C++11 __std_enable_if__]]
|
||||
[[[@boost:/doc/html/iterator/doc/generator_iterator.htm generator iterator adaptors]] [[@boost:/doc/html/iterator/index.html Boost.Iterator]] []]
|
||||
[[[@boost:/libs/type_traits/doc/html/boost_typetraits/reference/declval.html `declval`]] [[@boost:/libs/type_traits/index.html Boost.TypeTraits]] [C++11 __std_declval__]]
|
||||
[[[@boost:/libs/core/doc/html/core/enable_if.html `enable_if`]] [[@boost:/libs/core/index.html Boost.Core]] [C++11 __std_enable_if__]]
|
||||
[[[@boost:/libs/iterator/doc/generator_iterator.htm generator iterator adaptors]] [[@boost:/libs/iterator/index.html Boost.Iterator]] []]
|
||||
[[__in_place_factory__] [] []]
|
||||
[[[@boost:/doc/html/iterator/index.html `iterator_adaptors`]] [[@boost:/doc/html/iterator/index.html Boost.Iterator]] []]
|
||||
[[[@boost:/doc/html/iterator/doc/html/iterator/algorithms/next_prior.html `next` / `prior`]] [[@boost:/doc/html/iterator/index.html Boost.Iterator]] [C++11 __std_next__ / __std_prev__]]
|
||||
[[[@boost:/doc/html/core/doc/html/core/noncopyable.html `noncopyable`]] [[@boost:/doc/html/core/index.html Boost.Core]] []]
|
||||
[[[@boost:/libs/iterator/index.html `iterator_adaptors`]] [[@boost:/libs/iterator/index.html Boost.Iterator]] []]
|
||||
[[[@boost:/libs/iterator/doc/html/iterator/algorithms/next_prior.html `next` / `prior`]] [[@boost:/libs/iterator/index.html Boost.Iterator]] [C++11 __std_next__ / __std_prev__]]
|
||||
[[[@boost:/libs/core/doc/html/core/noncopyable.html `noncopyable`]] [[@boost:/libs/core/index.html Boost.Core]] []]
|
||||
[[[link sec:operators `operators`]] [] []]
|
||||
[[[@boost:/doc/html/io/doc/html/io.html `ostream_string`]] [[@boost:/doc/html/io/index.html Boost.IO]] []]
|
||||
[[[@boost:/libs/io/doc/html/io.html `ostream_string`]] [[@boost:/libs/io/index.html Boost.IO]] []]
|
||||
[[__result_of__] [] [C++11 __std_result_of__]]
|
||||
[[__string_view__] [] [C++17 __std_string_view__]]
|
||||
[[[@boost:/doc/html/throw_exception/doc/html/throw_exception.html#using_boost_throw_exception `throw_exception`]] [[@boost:/doc/html/throw_exception/index.html Boost.ThrowException]] []]
|
||||
[[[@boost:/libs/throw_exception/doc/html/throw_exception.html#using_boost_throw_exception `throw_exception`]] [[@boost:/libs/throw_exception/index.html Boost.ThrowException]] []]
|
||||
[[[link sec:value_init `value_init`]] [] [C++11 [@https://en.cppreference.com/w/cpp/language/list_initialization List initialization]]]
|
||||
]
|
||||
|
||||
|
@ -23,7 +23,7 @@ function reference, member function pointer, or class type. By default,
|
||||
N may be any value between 0 and 16. To change the upper limit, define
|
||||
the macro `BOOST_RESULT_OF_NUM_ARGS` to the maximum value for N. Class
|
||||
template __result_of__ resides in the header
|
||||
[@../../../include/boost/utility/result_of.hpp `<boost/utility/result_of.hpp>`].
|
||||
[@../../../../boost/utility/result_of.hpp `<boost/utility/result_of.hpp>`].
|
||||
|
||||
If your compiler's support for __decltype__ is adequate, __result_of__
|
||||
automatically uses it to deduce the type of the call expression, in
|
||||
@ -419,5 +419,3 @@ Created by Doug Gregor. Contributions from Daniel Walker, Eric Niebler, Michel M
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
@ -37,17 +37,17 @@ Boost.Utility also includes the class __string_ref__:
|
||||
- __string_ref__ is the initial implementation of Jeffrey Yaskin's [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html N3442:
|
||||
string_ref: a non-owning reference to a string].
|
||||
|
||||
- __string_view__ is an updated implementation to reflect the Library Fundamentals TS [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4480.html N4480: \[string.view\]]
|
||||
- __string_view__ is an updated implementation to reflect the Library Fundamentals TS [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4480.html N4480: \[string.view\]].
|
||||
|
||||
Please prefer __string_view__ / __basic_string_view__ over __string_ref__ / __basic_string_ref__:
|
||||
|
||||
- The __basic_string_view__ class better matches __std_basic_string_view__
|
||||
- The __basic_string_view__ class better matches __std_basic_string_view__.
|
||||
|
||||
- __basic_string_view__ has WAY more constexpr support.
|
||||
|
||||
- Code that uses __basic_string_ref__ should continue to work.
|
||||
|
||||
- No much code depends on __basic_string_ref__ anymore
|
||||
- Not much code depends on __basic_string_ref__ anymore.
|
||||
|
||||
|
||||
]
|
||||
@ -93,7 +93,7 @@ No memory allocations. No copying of character data. No changes to the code othe
|
||||
[section:reference Synopsis]
|
||||
[/=================]
|
||||
|
||||
The header file [@../../../include/boost/utility/string_view.hpp `<boost/utility/string_view.hpp>`] defines a template __boost_basic_string_view__, and four specializations __string_view__, __wstring_view__, __u16string_view__, __u32string_view__ - for `char` / `wchar_t` / `char16_t` / `char32_t`.
|
||||
The header file [@../../../../boost/utility/string_view.hpp `<boost/utility/string_view.hpp>`] defines a template __boost_basic_string_view__, and four specializations __string_view__, __wstring_view__, __u16string_view__, __u32string_view__ - for `char` / `wchar_t` / `char16_t` / `char32_t`.
|
||||
|
||||
`#include <boost/utility/string_view.hpp>`
|
||||
|
||||
@ -207,4 +207,3 @@ Copyright 2012 Marshall Clow
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -13,14 +13,12 @@ The entire contents of Boost.Utility are in `namespace boost`.
|
||||
|
||||
[warning
|
||||
|
||||
Direct use of the header [@../../../include/boost/utility.hpp `<boost/utility.hpp>`] is discouraged and it will be deprecated.
|
||||
Direct use of the header [@../../../../boost/utility.hpp `<boost/utility.hpp>`] is discouraged and it will be deprecated.
|
||||
|
||||
Please include the headers relative to individual components instead.
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
[include base_from_member.qbk]
|
||||
[include BOOST_BINARY.qbk]
|
||||
[include call_traits.qbk]
|
||||
@ -32,4 +30,3 @@ Please include the headers relative to individual components instead.
|
||||
[include value_init.qbk]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -109,14 +109,14 @@ but robust against the aforementioned compiler issues.
|
||||
The C++ standard \[[link sec:references 3]\] contains the definitions
|
||||
of `zero-initialization` and `default-initialization`. Informally, zero-initialization
|
||||
means that the object is given the initial value `0` converted to the type and
|
||||
default-initialization means that POD \[[link sec:references 4]\] types are zero-initialized,
|
||||
default-initialization means that [@https://en.cppreference.com/w/cpp/named_req/PODType POD] \[[link sec:references 4]\] types are zero-initialized,
|
||||
while non-POD class types are initialized with their corresponding default constructors.
|
||||
|
||||
A ['declaration] can contain an ['initializer], which specifies the
|
||||
object's initial value. The initializer can be just '()', which states that
|
||||
the object shall be value-initialized (but see below). However, if a ['declaration]
|
||||
has no ['initializer] and it is of a non-`const`, non-`static` POD type, the
|
||||
initial value is indeterminate: (see §8.5, [dcl.init], for the
|
||||
initial value is indeterminate: (see [sect]8.5, \[dcl.init\], for the
|
||||
accurate definitions).
|
||||
|
||||
```
|
||||
@ -262,7 +262,7 @@ is fixed.
|
||||
New versions of __value_initialized__ (Boost release version 1.35 or higher) offer a workaround to these
|
||||
issues: __value_initialized__ may now clear its internal data, prior to constructing the object that it
|
||||
contains. It will do so for those compilers that need to have such a workaround, based on the
|
||||
[@boost:/doc/html/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_defects
|
||||
[@boost:/libs/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_defects
|
||||
compiler defect macro] `BOOST_NO_COMPLETE_VALUE_INITIALIZATION`.
|
||||
|
||||
[endsect]
|
||||
@ -553,7 +553,7 @@ compiler-generated functions you do not want], [@http://www.aristeia.com/books.h
|
||||
|
||||
# The C++ Standard, Second edition (2003), ISO/IEC 14882:2003
|
||||
|
||||
# POD stands for "Plain Old Data"
|
||||
# POD stands for [@https://en.cppreference.com/w/cpp/named_req/PODType "Plain Old Data"]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -119,8 +119,8 @@ template<typename F> struct cpp0x_result_of;
|
||||
|
||||
// There doesn't seem to be any other way to turn this off such that the presence of
|
||||
// the user-defined operator,() below doesn't cause spurious warning all over the place,
|
||||
// so unconditionally turn it off.
|
||||
#if BOOST_MSVC
|
||||
// so unconditionally and globally turn it off. (https://svn.boost.org/trac10/ticket/7663)
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(disable: 4913) // user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used
|
||||
#endif
|
||||
|
||||
@ -134,12 +134,19 @@ template<typename T>
|
||||
result_of_no_type result_of_is_private_type(T const &);
|
||||
result_of_yes_type result_of_is_private_type(result_of_private_type);
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512) // assignment operator could not be generated.
|
||||
#endif
|
||||
template<typename C>
|
||||
struct result_of_callable_class : C {
|
||||
result_of_callable_class();
|
||||
typedef result_of_private_type const &(*pfn_t)(...);
|
||||
operator pfn_t() const volatile;
|
||||
};
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template<typename C>
|
||||
struct result_of_wrap_callable_class {
|
||||
|
@ -128,13 +128,13 @@ namespace boost {
|
||||
// capacity
|
||||
BOOST_CONSTEXPR size_type size() const { return len_; }
|
||||
BOOST_CONSTEXPR size_type length() const { return len_; }
|
||||
BOOST_CONSTEXPR size_type max_size() const { return len_; }
|
||||
BOOST_CONSTEXPR size_type max_size() const { return ~static_cast<size_type>(0) / (sizeof(value_type) * 2u); }
|
||||
BOOST_CONSTEXPR bool empty() const { return len_ == 0; }
|
||||
|
||||
// element access
|
||||
BOOST_CONSTEXPR const charT& operator[](size_type pos) const { return ptr_[pos]; }
|
||||
|
||||
const charT& at(size_t pos) const {
|
||||
const charT& at(size_type pos) const {
|
||||
if ( pos >= len_ )
|
||||
BOOST_THROW_EXCEPTION( std::out_of_range ( "boost::string_ref::at" ) );
|
||||
return ptr_[pos];
|
||||
@ -161,6 +161,10 @@ namespace boost {
|
||||
|
||||
|
||||
// basic_string_ref string operations
|
||||
basic_string_ref substr() const {
|
||||
return basic_string_ref(data(), size());
|
||||
}
|
||||
|
||||
basic_string_ref substr(size_type pos, size_type n=npos) const {
|
||||
if ( pos > size())
|
||||
BOOST_THROW_EXCEPTION( std::out_of_range ( "string_ref::substr" ) );
|
||||
|
@ -122,13 +122,13 @@ namespace boost {
|
||||
// capacity
|
||||
BOOST_CONSTEXPR size_type size() const BOOST_NOEXCEPT { return len_; }
|
||||
BOOST_CONSTEXPR size_type length() const BOOST_NOEXCEPT { return len_; }
|
||||
BOOST_CONSTEXPR size_type max_size() const BOOST_NOEXCEPT { return len_; }
|
||||
BOOST_CONSTEXPR size_type max_size() const BOOST_NOEXCEPT { return ~static_cast<size_type>(0) / (sizeof(value_type) * 2u); }
|
||||
BOOST_CONSTEXPR bool empty() const BOOST_NOEXCEPT { return len_ == 0; }
|
||||
|
||||
// element access
|
||||
BOOST_CONSTEXPR const_reference operator[](size_type pos) const BOOST_NOEXCEPT { return ptr_[pos]; }
|
||||
|
||||
BOOST_CONSTEXPR const_reference at(size_t pos) const {
|
||||
BOOST_CONSTEXPR const_reference at(size_type pos) const {
|
||||
return pos >= len_ ? BOOST_THROW_EXCEPTION(std::out_of_range("boost::string_view::at")), ptr_[0] : ptr_[pos];
|
||||
}
|
||||
|
||||
@ -189,6 +189,10 @@ namespace boost {
|
||||
return rlen;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR basic_string_view substr() const {
|
||||
return basic_string_view(data(), size());
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR basic_string_view substr(size_type pos, size_type n=npos) const {
|
||||
if ( pos > size())
|
||||
BOOST_THROW_EXCEPTION( std::out_of_range ( "string_view::substr" ) );
|
||||
@ -201,7 +205,7 @@ namespace boost {
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string_view x)
|
||||
const BOOST_NOEXCEPT {
|
||||
const {
|
||||
return substr(pos1, n1).compare(x);
|
||||
}
|
||||
|
||||
@ -241,6 +245,18 @@ namespace boost {
|
||||
traits::compare(ptr_ + len_ - x.len_, x.ptr_, x.len_) == 0;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR bool contains(basic_string_view s) const BOOST_NOEXCEPT {
|
||||
return find(s) != npos;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR bool contains(charT c) const BOOST_NOEXCEPT {
|
||||
return find(c) != npos;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR bool contains(const charT* s) const BOOST_NOEXCEPT {
|
||||
return find(s) != npos;
|
||||
}
|
||||
|
||||
// find
|
||||
BOOST_CXX14_CONSTEXPR size_type find(basic_string_view s, size_type pos = 0) const BOOST_NOEXCEPT {
|
||||
if (pos > size())
|
||||
|
@ -23,7 +23,7 @@
|
||||
// contains. More details on these issues are at libs/utility/value_init.htm
|
||||
|
||||
#include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION.
|
||||
#include <boost/swap.hpp>
|
||||
#include <boost/core/swap.hpp>
|
||||
#include <cstring>
|
||||
#include <cstddef>
|
||||
|
||||
|
@ -107,7 +107,7 @@
|
||||
},
|
||||
{
|
||||
"key": "utility/string_ref",
|
||||
"name": "string_ref",
|
||||
"name": "String Ref",
|
||||
"description": "String view templates.",
|
||||
"documentation": "doc/html/string_ref.html",
|
||||
"category": [
|
||||
|
@ -7,6 +7,7 @@
|
||||
For more information, see http://www.boost.org
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
@ -41,30 +42,30 @@ void null_tests ( const char *p ) {
|
||||
|
||||
// make sure that substrings work just like strings
|
||||
void test_substr ( const std::string &str ) {
|
||||
const size_t sz = str.size ();
|
||||
const std::size_t sz = str.size ();
|
||||
string_ref ref ( str );
|
||||
|
||||
// Substrings at the end
|
||||
for ( size_t i = 0; i <= sz; ++ i )
|
||||
for ( std::size_t i = 0; i <= sz; ++ i )
|
||||
interop ( str.substr ( i ), ref.substr ( i ));
|
||||
|
||||
// Substrings at the beginning
|
||||
for ( size_t i = 0; i <= sz; ++ i )
|
||||
for ( std::size_t i = 0; i <= sz; ++ i )
|
||||
interop ( str.substr ( 0, i ), ref.substr ( 0, i ));
|
||||
|
||||
// All possible substrings
|
||||
for ( size_t i = 0; i < sz; ++i )
|
||||
for ( size_t j = i; j < sz; ++j )
|
||||
for ( std::size_t i = 0; i < sz; ++i )
|
||||
for ( std::size_t j = i; j < sz; ++j )
|
||||
interop ( str.substr ( i, j ), ref.substr ( i, j ));
|
||||
}
|
||||
|
||||
// make sure that removing prefixes and suffixes work just like strings
|
||||
void test_remove ( const std::string &str ) {
|
||||
const size_t sz = str.size ();
|
||||
const std::size_t sz = str.size ();
|
||||
std::string work;
|
||||
string_ref ref;
|
||||
|
||||
for ( size_t i = 1; i <= sz; ++i ) {
|
||||
for ( std::size_t i = 1; i <= sz; ++i ) {
|
||||
work = str;
|
||||
ref = str;
|
||||
while ( ref.size () >= i ) {
|
||||
@ -74,7 +75,7 @@ void test_remove ( const std::string &str ) {
|
||||
}
|
||||
}
|
||||
|
||||
for ( size_t i = 1; i < sz; ++ i ) {
|
||||
for ( std::size_t i = 1; i < sz; ++ i ) {
|
||||
work = str;
|
||||
ref = str;
|
||||
while ( ref.size () >= i ) {
|
||||
|
@ -7,8 +7,11 @@
|
||||
For more information, see http://www.boost.org
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <cstring> // for std::strchr
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/utility/string_ref.hpp>
|
||||
|
||||
@ -17,7 +20,7 @@
|
||||
typedef boost::string_ref string_ref;
|
||||
|
||||
void ends_with ( const char *arg ) {
|
||||
const size_t sz = std::strlen ( arg );
|
||||
const std::size_t sz = std::strlen ( arg );
|
||||
string_ref sr ( arg );
|
||||
string_ref sr2 ( arg );
|
||||
const char *p = arg;
|
||||
@ -41,20 +44,19 @@ void ends_with ( const char *arg ) {
|
||||
char ch = sz == 0 ? '\0' : arg [ sz - 1 ];
|
||||
sr2 = arg;
|
||||
if ( sz > 0 )
|
||||
BOOST_TEST ( sr2.ends_with ( ch ));
|
||||
BOOST_TEST ( sr2.ends_with ( ch ));
|
||||
BOOST_TEST ( !sr2.ends_with ( ++ch ));
|
||||
BOOST_TEST ( sr2.ends_with ( string_ref ()));
|
||||
}
|
||||
|
||||
void starts_with ( const char *arg ) {
|
||||
const size_t sz = std::strlen ( arg );
|
||||
const std::size_t sz = std::strlen ( arg );
|
||||
string_ref sr ( arg );
|
||||
string_ref sr2 ( arg );
|
||||
const char *p = arg + std::strlen ( arg ) - 1;
|
||||
while ( p >= arg ) {
|
||||
std::string foo ( arg, p + 1 );
|
||||
std::string foo ( arg );
|
||||
while ( !foo.empty ()) {
|
||||
BOOST_TEST ( sr.starts_with ( foo ));
|
||||
--p;
|
||||
foo.erase ( foo.end () - 1 );
|
||||
}
|
||||
|
||||
while ( !sr2.empty ()) {
|
||||
@ -64,8 +66,8 @@ void starts_with ( const char *arg ) {
|
||||
|
||||
char ch = *arg;
|
||||
sr2 = arg;
|
||||
if ( sz > 0 )
|
||||
BOOST_TEST ( sr2.starts_with ( ch ));
|
||||
if ( sz > 0 )
|
||||
BOOST_TEST ( sr2.starts_with ( ch ));
|
||||
BOOST_TEST ( !sr2.starts_with ( ++ch ));
|
||||
BOOST_TEST ( sr2.starts_with ( string_ref ()));
|
||||
}
|
||||
@ -93,7 +95,7 @@ void find ( const char *arg ) {
|
||||
string_ref sr2;
|
||||
const char *p;
|
||||
|
||||
// When we search for the empty string, we find it at position 0
|
||||
// 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 );
|
||||
|
||||
@ -207,7 +209,7 @@ void find ( const char *arg ) {
|
||||
string_ref::size_type pos2 = sr1.find_first_not_of(*p);
|
||||
BOOST_TEST ( pos1 != string_ref::npos && pos1 < sr1.size () && pos1 <= ptr_diff ( p, arg ));
|
||||
if ( pos2 != string_ref::npos ) {
|
||||
for ( size_t i = 0 ; i < pos2; ++i )
|
||||
for ( std::size_t i = 0 ; i < pos2; ++i )
|
||||
BOOST_TEST ( sr1[i] == *p );
|
||||
BOOST_TEST ( sr1 [ pos2 ] != *p );
|
||||
}
|
||||
@ -233,7 +235,7 @@ void find ( const char *arg ) {
|
||||
BOOST_TEST ( pos1 != string_ref::npos && pos1 < sr1.size () && pos1 >= ptr_diff ( p, arg ));
|
||||
BOOST_TEST ( pos2 == string_ref::npos || pos1 < sr1.size ());
|
||||
if ( pos2 != string_ref::npos ) {
|
||||
for ( size_t i = sr1.size () -1 ; i > pos2; --i )
|
||||
for ( std::size_t i = sr1.size () -1 ; i > pos2; --i )
|
||||
BOOST_TEST ( sr1[i] == *p );
|
||||
BOOST_TEST ( sr1 [ pos2 ] != *p );
|
||||
}
|
||||
|
@ -30,12 +30,12 @@ struct constexpr_char_traits
|
||||
static constexpr bool eq(char_type c1, char_type c2) noexcept { return c1 == c2; }
|
||||
static constexpr bool lt(char_type c1, char_type c2) noexcept { return c1 < c2; }
|
||||
|
||||
static constexpr int compare(const char_type* s1, const char_type* s2, size_t n) noexcept;
|
||||
static constexpr size_t length(const char_type* s) noexcept;
|
||||
static constexpr const char_type* find(const char_type* s, size_t n, const char_type& a) noexcept;
|
||||
static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n) noexcept;
|
||||
static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n) noexcept;
|
||||
static constexpr char_type* assign(char_type* s, size_t n, char_type a) noexcept;
|
||||
static constexpr int compare(const char_type* s1, const char_type* s2, std::size_t n) noexcept;
|
||||
static constexpr std::size_t length(const char_type* s) noexcept;
|
||||
static constexpr const char_type* find(const char_type* s, std::size_t n, const char_type& a) noexcept;
|
||||
static constexpr char_type* move(char_type* s1, const char_type* s2, std::size_t n) noexcept;
|
||||
static constexpr char_type* copy(char_type* s1, const char_type* s2, std::size_t n) noexcept;
|
||||
static constexpr char_type* assign(char_type* s, std::size_t n, char_type a) noexcept;
|
||||
|
||||
static constexpr int_type not_eof(int_type c) noexcept { return eq_int_type(c, eof()) ? ~eof() : c; }
|
||||
static constexpr char_type to_char_type(int_type c) noexcept { return char_type(c); }
|
||||
@ -49,7 +49,7 @@ struct constexpr_char_traits
|
||||
// else, a negative value if, for some j in [0,n), X::lt(s1[j],s2[j]) is true and
|
||||
// for each i in [0,j) X::eq(s2[i],s2[i]) is true;
|
||||
// else a positive value.
|
||||
constexpr int constexpr_char_traits::compare(const char_type* s1, const char_type* s2, size_t n) noexcept
|
||||
constexpr int constexpr_char_traits::compare(const char_type* s1, const char_type* s2, std::size_t n) noexcept
|
||||
{
|
||||
for (; n != 0; --n, ++s1, ++s2)
|
||||
{
|
||||
@ -61,10 +61,10 @@ constexpr int constexpr_char_traits::compare(const char_type* s1, const char_typ
|
||||
return 0;
|
||||
}
|
||||
|
||||
// yields: the smallest i such that X::eq(s[i],charT()) is true.
|
||||
constexpr size_t constexpr_char_traits::length(const char_type* s) noexcept
|
||||
// yields: the smallest i such that X::eq(s[i],charT()) is true.
|
||||
constexpr std::size_t constexpr_char_traits::length(const char_type* s) noexcept
|
||||
{
|
||||
size_t len = 0;
|
||||
std::size_t len = 0;
|
||||
for (; !eq(*s, char_type(0)); ++s)
|
||||
++len;
|
||||
return len;
|
||||
@ -76,7 +76,7 @@ int main()
|
||||
{
|
||||
constexpr string_view sv1;
|
||||
constexpr string_view sv2{"abc", 3}; // ptr, len
|
||||
constexpr string_view sv3{"def"}; // ptr
|
||||
constexpr string_view sv3{"def"}; // ptr
|
||||
|
||||
constexpr const char *s1 = "";
|
||||
constexpr const char *s2 = "abc";
|
||||
|
@ -7,6 +7,7 @@
|
||||
For more information, see http://www.boost.org
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
@ -42,30 +43,30 @@ void null_tests ( const char *p ) {
|
||||
|
||||
// make sure that substrings work just like strings
|
||||
void test_substr ( const std::string &str ) {
|
||||
const size_t sz = str.size ();
|
||||
const std::size_t sz = str.size ();
|
||||
string_view ref ( str );
|
||||
|
||||
// Substrings at the end
|
||||
for ( size_t i = 0; i <= sz; ++ i )
|
||||
for ( std::size_t i = 0; i <= sz; ++ i )
|
||||
interop ( str.substr ( i ), ref.substr ( i ));
|
||||
|
||||
// Substrings at the beginning
|
||||
for ( size_t i = 0; i <= sz; ++ i )
|
||||
for ( std::size_t i = 0; i <= sz; ++ i )
|
||||
interop ( str.substr ( 0, i ), ref.substr ( 0, i ));
|
||||
|
||||
// All possible substrings
|
||||
for ( size_t i = 0; i < sz; ++i )
|
||||
for ( size_t j = i; j < sz; ++j )
|
||||
for ( std::size_t i = 0; i < sz; ++i )
|
||||
for ( std::size_t j = i; j < sz; ++j )
|
||||
interop ( str.substr ( i, j ), ref.substr ( i, j ));
|
||||
}
|
||||
|
||||
// make sure that removing prefixes and suffixes work just like strings
|
||||
void test_remove ( const std::string &str ) {
|
||||
const size_t sz = str.size ();
|
||||
const std::size_t sz = str.size ();
|
||||
std::string work;
|
||||
string_view ref;
|
||||
|
||||
for ( size_t i = 1; i <= sz; ++i ) {
|
||||
for ( std::size_t i = 1; i <= sz; ++i ) {
|
||||
work = str;
|
||||
ref = str;
|
||||
while ( ref.size () >= i ) {
|
||||
@ -75,7 +76,7 @@ void test_remove ( const std::string &str ) {
|
||||
}
|
||||
}
|
||||
|
||||
for ( size_t i = 1; i < sz; ++ i ) {
|
||||
for ( std::size_t i = 1; i < sz; ++ i ) {
|
||||
work = str;
|
||||
ref = str;
|
||||
while ( ref.size () >= i ) {
|
||||
|
@ -8,9 +8,11 @@
|
||||
*/
|
||||
|
||||
#include <new> // for placement new
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <algorithm> // for std::equal
|
||||
#include <cstddef> // for NULL, std::size_t, std::ptrdiff_t
|
||||
#include <cstring> // for std::strchr and std::strcmp
|
||||
#include <cstring> // for std::strlen, std::strchr and std::strcmp
|
||||
#include <cstdlib> // for std::malloc and std::free
|
||||
|
||||
#include <boost/utility/string_view.hpp>
|
||||
@ -21,7 +23,7 @@
|
||||
typedef boost::string_view string_view;
|
||||
|
||||
void ends_with ( const char *arg ) {
|
||||
const size_t sz = std::strlen ( arg );
|
||||
const std::size_t sz = std::strlen ( arg );
|
||||
string_view sr ( arg );
|
||||
string_view sr2 ( arg );
|
||||
const char *p = arg;
|
||||
@ -45,20 +47,19 @@ void ends_with ( const char *arg ) {
|
||||
char ch = sz == 0 ? '\0' : arg [ sz - 1 ];
|
||||
sr2 = arg;
|
||||
if ( sz > 0 )
|
||||
BOOST_TEST ( sr2.ends_with ( ch ));
|
||||
BOOST_TEST ( sr2.ends_with ( ch ));
|
||||
BOOST_TEST ( !sr2.ends_with ( ++ch ));
|
||||
BOOST_TEST ( sr2.ends_with ( string_view()));
|
||||
}
|
||||
|
||||
void starts_with ( const char *arg ) {
|
||||
const size_t sz = std::strlen ( arg );
|
||||
const std::size_t sz = std::strlen ( arg );
|
||||
string_view sr ( arg );
|
||||
string_view sr2 ( arg );
|
||||
const char *p = arg + std::strlen ( arg ) - 1;
|
||||
while ( p >= arg ) {
|
||||
std::string foo ( arg, p + 1 );
|
||||
std::string foo ( arg );
|
||||
while ( !foo.empty ()) {
|
||||
BOOST_TEST ( sr.starts_with ( foo ));
|
||||
--p;
|
||||
foo.erase ( foo.end () - 1 );
|
||||
}
|
||||
|
||||
while ( !sr2.empty ()) {
|
||||
@ -68,12 +69,40 @@ void starts_with ( const char *arg ) {
|
||||
|
||||
char ch = *arg;
|
||||
sr2 = arg;
|
||||
if ( sz > 0 )
|
||||
BOOST_TEST ( sr2.starts_with ( ch ));
|
||||
if ( sz > 0 )
|
||||
BOOST_TEST ( sr2.starts_with ( ch ));
|
||||
BOOST_TEST ( !sr2.starts_with ( ++ch ));
|
||||
BOOST_TEST ( sr2.starts_with ( string_view ()));
|
||||
}
|
||||
|
||||
void contains ( const char *arg ) {
|
||||
const std::size_t sz = std::strlen ( arg );
|
||||
string_view sr ( arg );
|
||||
string_view sr2 ( arg );
|
||||
std::string foo ( arg );
|
||||
while ( !foo.empty ()) {
|
||||
BOOST_TEST ( sr.contains ( foo ));
|
||||
if ( ( foo.size () & 1u ) != 0u )
|
||||
foo.erase ( foo.end () - 1 );
|
||||
else
|
||||
foo.erase ( foo.begin () );
|
||||
}
|
||||
|
||||
while ( !sr2.empty ()) {
|
||||
BOOST_TEST ( sr.contains ( sr2 ));
|
||||
if ( ( sr2.size () & 1u ) != 0u )
|
||||
sr2.remove_suffix (1);
|
||||
else
|
||||
sr2.remove_prefix (1);
|
||||
}
|
||||
|
||||
sr2 = arg;
|
||||
for ( std::size_t i = 0; i < sz; ++i )
|
||||
BOOST_TEST ( sr2.contains ( arg[i] ));
|
||||
BOOST_TEST ( !sr2.contains ( '\a' ));
|
||||
BOOST_TEST ( sr2.contains ( string_view ()));
|
||||
}
|
||||
|
||||
void reverse ( const char *arg ) {
|
||||
// Round trip
|
||||
string_view sr1 ( arg );
|
||||
@ -97,7 +126,7 @@ void find ( const char *arg ) {
|
||||
string_view sr2;
|
||||
const char *p;
|
||||
|
||||
// When we search for the empty string, we find it at position 0
|
||||
// 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 );
|
||||
|
||||
@ -211,7 +240,7 @@ void find ( const char *arg ) {
|
||||
string_view::size_type pos2 = sr1.find_first_not_of(*p);
|
||||
BOOST_TEST ( pos1 != string_view::npos && pos1 < sr1.size () && pos1 <= ptr_diff ( p, arg ));
|
||||
if ( pos2 != string_view::npos ) {
|
||||
for ( size_t i = 0 ; i < pos2; ++i )
|
||||
for ( string_view::size_type i = 0 ; i < pos2; ++i )
|
||||
BOOST_TEST ( sr1[i] == *p );
|
||||
BOOST_TEST ( sr1 [ pos2 ] != *p );
|
||||
}
|
||||
@ -237,7 +266,7 @@ void find ( const char *arg ) {
|
||||
BOOST_TEST ( pos1 != string_view::npos && pos1 < sr1.size () && pos1 >= ptr_diff ( p, arg ));
|
||||
BOOST_TEST ( pos2 == string_view::npos || pos1 < sr1.size ());
|
||||
if ( pos2 != string_view::npos ) {
|
||||
for ( size_t i = sr1.size () -1 ; i > pos2; --i )
|
||||
for ( string_view::size_type i = sr1.size () -1 ; i > pos2; --i )
|
||||
BOOST_TEST ( sr1[i] == *p );
|
||||
BOOST_TEST ( sr1 [ pos2 ] != *p );
|
||||
}
|
||||
@ -398,12 +427,13 @@ int main()
|
||||
while ( *p != NULL ) {
|
||||
starts_with ( *p );
|
||||
ends_with ( *p );
|
||||
contains ( *p );
|
||||
reverse ( *p );
|
||||
find ( *p );
|
||||
to_string ( *p );
|
||||
compare ( *p );
|
||||
|
||||
p++;
|
||||
++p;
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
Reference in New Issue
Block a user