Copyright © 2019, 2020 Krystian Stasiowski
Copyright © 2016-2019 Vinnie Falco
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)
This library provides a dynamically resizable string of characters with compile-time
fixed capacity and contiguous embedded storage in which the characters are placed
within the string object itself. Its API closely resembles that of
A fixed capacity string is useful when:
memcpyfor serialization purposes).
The library is usable in two different modes: standalone and Boost dependent. This library defaults to Boost dependent mode; standalone mode is opt-in through the use of a configuration macro.
When in Boost dependent mode, the library requires the use of at least C++11, in addition to Boost.Core, Boost.Utility, and Boost.ContainerHash. In standalone mode, C++17 is required but no libraries except for the standard library are needed.
The over-arching design goal is to resemble the interface and behavior of
as much as possible. When any operation would exceed the maximum allowed size
of the string,
std::length_error is thrown if exceptions are enabled.
All algorithms which throw exceptions provide the strong exception safety guarantee.
This is intended to be a drop in replacement for
The API of
std::string in few places, one of which is the addition
subview function, for
which this implementation returns a string view instead of
and certain functions that will never throw are marked as
which diverges from those of
available overloads for
are identical to those of
The iterator invalidation rules differ from those of
static_stringinvalidates all iterators
static_strings invalidates all iterators
Depending on the character type and size used for a specialization of
static_string, certain optimizations are used
to reduce the size of the class type. Given the name of a specialization of the
basic_static_string<N, CharT, Traits>:
Nis 0, then the class has no non-static data members. Given two objects
basic_static_string<0, T, Traits>and
static_string<0, U, Traits>respectively, the pointer value returned by
data()will be the same if
Uare the same.
static_stringwill be the smallest standard unsigned integer type that can represent the value
Certain features can be enabled and disabled though defining configuration macros. The macros and the associated feature they control are:
BOOST_STATIC_STRING_STANDALONE: When defined, the library is put into standalone mode.
The development of this library is sponsored by The C++ Alliance.
Defined in namespace
Last revised: December 03, 2020 at 05:04:21 GMT