mirror of
https://github.com/boostorg/static_string.git
synced 2025-07-28 11:37:36 +02:00
Renamed from fixed_string to static_string, added aliases
This commit is contained in:
@ -4,7 +4,7 @@
|
|||||||
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#
|
#
|
||||||
# Official repository: https://github.com/boostorg/fixed_string
|
# Official repository: https://github.com/boostorg/static_string
|
||||||
#
|
#
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 3.5.1)
|
cmake_minimum_required (VERSION 3.5.1)
|
||||||
@ -36,11 +36,11 @@ endfunction()
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# FixedString
|
# StaticString
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
project (FixedString VERSION 1)
|
project (StaticString VERSION 1)
|
||||||
|
|
||||||
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
@ -145,8 +145,8 @@ endif()
|
|||||||
#include_directories (.)
|
#include_directories (.)
|
||||||
|
|
||||||
file (GLOB_RECURSE PROJECT_FILES
|
file (GLOB_RECURSE PROJECT_FILES
|
||||||
${PROJECT_SOURCE_DIR}/include/boost/fixed_string/*.hpp
|
${PROJECT_SOURCE_DIR}/include/boost/static_string/*.hpp
|
||||||
${PROJECT_SOURCE_DIR}/include/boost/fixed_string/*.ipp
|
${PROJECT_SOURCE_DIR}/include/boost/static_string/*.ipp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory (test)
|
add_subdirectory (test)
|
||||||
|
2
Jamfile
2
Jamfile
@ -4,7 +4,7 @@
|
|||||||
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#
|
#
|
||||||
# Official repository: https://github.com/boostorg/fixed_string
|
# Official repository: https://github.com/boostorg/static_string
|
||||||
#
|
#
|
||||||
|
|
||||||
build-project test ;
|
build-project test ;
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
Branch | Travis | Appveyor | Azure Pipelines | codecov.io | Docs | Matrix |
|
Branch | Travis | Appveyor | Azure Pipelines | codecov.io | Docs | Matrix |
|
||||||
:-------------: | ------ | -------- | --------------- | ---------- | ---- | ------ |
|
:-------------: | ------ | -------- | --------------- | ---------- | ---- | ------ |
|
||||||
[`master`](https://github.com/18/static_string/tree/master) | [](https://travis-ci.org/18/static_string) | [](https://ci.appveyor.com/project/1847325/fixed-string/branch/master) | [](https://dev.azure.com/vinniefalco/fixed-string/_build/latest?definitionId=6&branchName=master) | [](https://codecov.io/gh/18/static_string/branch/master) | [](https://18.github.io/doc/static_string) | [](http://www.boost.org/development/tests/master/developer/static_string.html)
|
[`master`](https://github.com/18/static_string/tree/master) | [](https://travis-ci.org/18/static_string) | [](https://ci.appveyor.com/project/1847325/static-string/branch/master) | [](https://dev.azure.com/vinniefalco/fixed-string/_build/latest?definitionId=6&branchName=master) | [](https://codecov.io/gh/18/static_string/branch/master) | [](https://18.github.io/doc/static_string) | [](http://www.boost.org/development/tests/master/developer/static_string.html)
|
||||||
[`develop`](https://github.com/18/static_string/tree/develop) | [](https://travis-ci.org/18/static_string) | [](https://ci.appveyor.com/project/1847325/fixed-string/branch/develop) | [](https://dev.azure.com/vinniefalco/fixed-string/_build/latest?definitionId=6&branchName=master) | [](https://codecov.io/gh/18/static_string/branch/develop) | [](http://www.boost.org/doc/libs/develop/doc/html/static_string.html) | [](http://www.boost.org/development/tests/develop/developer/static_string.html)
|
[`develop`](https://github.com/18/static_string/tree/develop) | [](https://travis-ci.org/18/static_string) | [](https://ci.appveyor.com/project/1847325/static-string/branch/develop) | [](https://dev.azure.com/vinniefalco/fixed-string/_build/latest?definitionId=6&branchName=master) | [](https://codecov.io/gh/18/static_string/branch/develop) | [](http://www.boost.org/doc/libs/develop/doc/html/static_string.html) | [](http://www.boost.org/development/tests/develop/developer/static_string.html)
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
16
doc/Jamfile
16
doc/Jamfile
@ -5,7 +5,7 @@
|
|||||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#
|
#
|
||||||
|
|
||||||
project fixed_string/doc ;
|
project static_string/doc ;
|
||||||
|
|
||||||
import os ;
|
import os ;
|
||||||
import path ;
|
import path ;
|
||||||
@ -23,7 +23,7 @@ import saxonhe ;
|
|||||||
# docs can be rebuild if any of the header files change.
|
# docs can be rebuild if any of the header files change.
|
||||||
#
|
#
|
||||||
|
|
||||||
local sources = [ path.glob-tree ../include/boost/fixed_string : *.hpp *.ipp : detail impl ] ;
|
local sources = [ path.glob-tree ../include/boost/static_string : *.hpp *.ipp : detail impl ] ;
|
||||||
|
|
||||||
# Get the configured paths to doxygen and xsltproc
|
# Get the configured paths to doxygen and xsltproc
|
||||||
|
|
||||||
@ -148,12 +148,12 @@ install qbk : reference.qbk ;
|
|||||||
install images
|
install images
|
||||||
:
|
:
|
||||||
:
|
:
|
||||||
<location>html/fixed_string/images
|
<location>html/static_string/images
|
||||||
;
|
;
|
||||||
|
|
||||||
explicit images ;
|
explicit images ;
|
||||||
|
|
||||||
xml fixed_string_doc
|
xml static_string_doc
|
||||||
:
|
:
|
||||||
qbk/main.qbk
|
qbk/main.qbk
|
||||||
:
|
:
|
||||||
@ -161,7 +161,7 @@ xml fixed_string_doc
|
|||||||
<dependency>qbk
|
<dependency>qbk
|
||||||
;
|
;
|
||||||
|
|
||||||
explicit fixed_string_doc ;
|
explicit static_string_doc ;
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -169,9 +169,9 @@ explicit fixed_string_doc ;
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
boostbook fixed_string
|
boostbook static_string
|
||||||
:
|
:
|
||||||
fixed_string_doc
|
static_string_doc
|
||||||
:
|
:
|
||||||
<xsl:param>boost.root=../../../..
|
<xsl:param>boost.root=../../../..
|
||||||
<xsl:param>chapter.autolabel=1
|
<xsl:param>chapter.autolabel=1
|
||||||
@ -195,5 +195,5 @@ boostbook fixed_string
|
|||||||
alias boostdoc ;
|
alias boostdoc ;
|
||||||
explicit boostdoc ;
|
explicit boostdoc ;
|
||||||
|
|
||||||
alias boostrelease : fixed_string ;
|
alias boostrelease : static_string ;
|
||||||
explicit boostrelease ;
|
explicit boostrelease ;
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
Official repository: https://github.com/boostorg/fixed_string
|
Official repository: https://github.com/boostorg/static_string
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<section id="fixed_string.index">
|
<section id="static_string.index">
|
||||||
<title>Index</title>
|
<title>Index</title>
|
||||||
<index/>
|
<index/>
|
||||||
</section>
|
</section>
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
Official repository: https://github.com/boostorg/fixed_string
|
Official repository: https://github.com/boostorg/static_string
|
||||||
]
|
]
|
||||||
|
|
||||||
[library Boost.FixedString
|
[library Boost.StaticString
|
||||||
[id fixed_string]
|
[id static_string]
|
||||||
[quickbook 1.6]
|
[quickbook 1.6]
|
||||||
[copyright 2016 - 2019 Vinnie Falco]
|
[copyright 2016 - 2019 Vinnie Falco]
|
||||||
[copyright 2019 Krystian Stasiowski]
|
[copyright 2019 Krystian Stasiowski]
|
||||||
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
[template path_link[path name] '''<ulink url="../../'''[path]'''">'''[name]'''</ulink>''']
|
[template path_link[path name] '''<ulink url="../../'''[path]'''">'''[name]'''</ulink>''']
|
||||||
[template include_file[path][^<'''<ulink url="../../../../'''[path]'''">'''[path]'''</ulink>'''>]]
|
[template include_file[path][^<'''<ulink url="../../../../'''[path]'''">'''[path]'''</ulink>'''>]]
|
||||||
[template issue[n] '''<ulink url="https://github.com/boostorg/beast/issues/'''[n]'''">#'''[n]'''</ulink>''']
|
|
||||||
|
|
||||||
[def __InputIterator__ [@https://en.cppreference.com/w/cpp/named_req/InputIterator ['InputIterator]]]
|
[def __InputIterator__ [@https://en.cppreference.com/w/cpp/named_req/InputIterator ['InputIterator]]]
|
||||||
|
|
||||||
@ -73,16 +72,16 @@ The over-arching design goal is to resemble the interface and behavior of
|
|||||||
maximum allowed size of the string, `std::length_error` is thrown. All
|
maximum allowed size of the string, `std::length_error` is thrown. All
|
||||||
algorithms which throw exceptions provide the strong exception safety
|
algorithms which throw exceptions provide the strong exception safety
|
||||||
guarantee. This is intended to be a drop in replacement for `std::string`.
|
guarantee. This is intended to be a drop in replacement for `std::string`.
|
||||||
All the operations for `fixed_string` work when the source is within the string itself.
|
All the operations for `static_string` work when the source is within the string itself.
|
||||||
|
|
||||||
The API of `fixed_string` only diverges from `std::string` in few places,
|
The API of `static_string` only diverges from `std::string` in few places,
|
||||||
being `substr` for which this implementation returns a string view instead of `fixed_string`,
|
being `substr` for which this implementation returns a string view instead of `static_string`,
|
||||||
and certain functions that will never throw are marked as `noexcept`, which diverges from
|
and certain functions that will never throw are marked as `noexcept`, which diverges from
|
||||||
those of `std::string`. Every function that is in the C++20 specification of `std::string` is
|
those of `std::string`. Every function that is in the C++20 specification of `std::string` is
|
||||||
present in this implementation, with the only difference being the lack of `constexpr`
|
present in this implementation, with the only difference being the lack of `constexpr`
|
||||||
for the time being. The avaliable overloads for `fixed_string` are identical to those
|
for the time being. The avaliable overloads for `static_string` are identical to those
|
||||||
of `std::string`, except for `operator+` which is explicitly deleted as no reasonable implementation
|
of `std::string`, except for `operator+` which is explicitly deleted as no reasonable implementation
|
||||||
would be possible, due to the difficulty in determining the size of the resulting `fixed_string`.
|
would be possible, due to the difficulty in determining the size of the resulting `static_string`.
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
Official repository: https://github.com/boostorg/fixed_string
|
Official repository: https://github.com/boostorg/static_string
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
INPUT = \
|
INPUT = \
|
||||||
$(LIB_DIR)/include/boost/fixed_string
|
$(LIB_DIR)/include/boost/static_string
|
||||||
|
|
||||||
ALIASES += esafe="@par Exception Safety"
|
ALIASES += esafe="@par Exception Safety"
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ SKIP_FUNCTION_MACROS = YES
|
|||||||
# Project related configuration options
|
# Project related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
DOXYFILE_ENCODING = UTF-8
|
DOXYFILE_ENCODING = UTF-8
|
||||||
PROJECT_NAME = "FixedString"
|
PROJECT_NAME = "StaticString"
|
||||||
PROJECT_NUMBER =
|
PROJECT_NUMBER =
|
||||||
PROJECT_BRIEF = String Library
|
PROJECT_BRIEF = String Library
|
||||||
PROJECT_LOGO =
|
PROJECT_LOGO =
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<!-- Variables (Edit for your project) -->
|
<!-- Variables (Edit for your project) -->
|
||||||
<xsl:variable name="doc-ref" select="'fixed_string.ref.'"/>
|
<xsl:variable name="doc-ref" select="'static_string.ref.'"/>
|
||||||
<xsl:variable name="doc-ns" select="'boost::fixed_string'"/>
|
<xsl:variable name="doc-ns" select="'boost::static_string'"/>
|
||||||
<xsl:variable name="debug" select="0"/>
|
<xsl:variable name="debug" select="0"/>
|
||||||
<xsl:variable name="private" select="0"/>
|
<xsl:variable name="private" select="0"/>
|
||||||
<!-- End Variables -->
|
<!-- End Variables -->
|
||||||
|
@ -1,117 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
|
||||||
// Copyright (c) 2019 Krystian Stasiowski (sdkrystian at gmail dot 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)
|
|
||||||
//
|
|
||||||
// Official repository: https://github.com/boostorg/fixed_string
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef BOOST_FIXED_STRING_CONFIG_HPP
|
|
||||||
#define BOOST_FIXED_STRING_CONFIG_HPP
|
|
||||||
|
|
||||||
// Are we dependent on Boost?
|
|
||||||
// #define BOOST_FIXED_STRING_STANDALONE
|
|
||||||
|
|
||||||
// Can we have deduction guides?
|
|
||||||
#ifdef __cpp_deduction_guides
|
|
||||||
#define BOOST_FIXED_STRING_USE_DEDUCT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Can we use [[nodiscard]]?
|
|
||||||
#ifdef __has_attribute
|
|
||||||
#if __has_attribute(nodiscard)
|
|
||||||
#define BOOST_FIXED_STRING_NODISCARD [[nodiscard]]
|
|
||||||
#else
|
|
||||||
#define BOOST_FIXED_STRING_NODISCARD
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define BOOST_FIXED_STRING_NODISCARD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#undef _<>_<EFBFBD>cplusplus
|
|
||||||
//#define _<>_<EFBFBD>cplusplus 201703L
|
|
||||||
|
|
||||||
#if __cplusplus > 201703L
|
|
||||||
#define BOOST_FIXED_STRING_CPP20_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP17_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP14_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP11_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP20_CXPER_USED
|
|
||||||
#define BOOST_FIXED_STRING_CPP17_CXPER_USED
|
|
||||||
#define BOOST_FIXED_STRING_CPP14_CXPER_USED
|
|
||||||
#define BOOST_FIXED_STRING_CPP11_CXPER_USED
|
|
||||||
#define BOOST_FIXED_STRING_ALLOW_UNINIT_MEM
|
|
||||||
#elif __cplusplus >= 201703L
|
|
||||||
#define BOOST_FIXED_STRING_CPP20_CXPER
|
|
||||||
#define BOOST_FIXED_STRING_CPP17_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP14_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP11_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP17_CXPER_USED
|
|
||||||
#define BOOST_FIXED_STRING_CPP14_CXPER_USED
|
|
||||||
#define BOOST_FIXED_STRING_CPP11_CXPER_USED
|
|
||||||
#elif __cplusplus >= 201402L
|
|
||||||
#define BOOST_FIXED_STRING_CPP20_CXPER
|
|
||||||
#define BOOST_FIXED_STRING_CPP17_CXPER
|
|
||||||
#define BOOST_FIXED_STRING_CPP14_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP11_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP14_CXPER_USED
|
|
||||||
#define BOOST_FIXED_STRING_CPP11_CXPER_USED
|
|
||||||
#else
|
|
||||||
#define BOOST_FIXED_STRING_CPP20_CXPER
|
|
||||||
#define BOOST_FIXED_STRING_CPP17_CXPER
|
|
||||||
#define BOOST_FIXED_STRING_CPP14_CXPER
|
|
||||||
#define BOOST_FIXED_STRING_CPP11_CXPER constexpr
|
|
||||||
#define BOOST_FIXED_STRING_CPP11_CXPER_USED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BOOST_FIXED_STRING_STANDALONE
|
|
||||||
#include <boost/utility/string_view.hpp>
|
|
||||||
#include <boost/container_hash/hash.hpp>
|
|
||||||
#include <boost/assert.hpp>
|
|
||||||
#include <boost/static_assert.hpp>
|
|
||||||
#include <boost/throw_exception.hpp>
|
|
||||||
#else
|
|
||||||
#include <cassert>
|
|
||||||
#include <string_view>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Boost and non-Boost versions of utilities
|
|
||||||
#ifndef BOOST_FIXED_STRING_STANDALONE
|
|
||||||
#ifndef BOOST_FIXED_STRING_THROW
|
|
||||||
#define BOOST_FIXED_STRING_THROW(ex) BOOST_THROW_EXCEPTION(ex)
|
|
||||||
#endif
|
|
||||||
#ifndef BOOST_FIXED_STRING_STATIC_ASSERT
|
|
||||||
#define BOOST_FIXED_STRING_STATIC_ASSERT(cond, msg) BOOST_STATIC_ASSERT_MSG(cond, msg)
|
|
||||||
#endif
|
|
||||||
#ifndef BOOST_FIXED_STRING_ASSERT
|
|
||||||
#define BOOST_FIXED_STRING_ASSERT(cond) BOOST_ASSERT(cond)
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifndef BOOST_FIXED_STRING_THROW
|
|
||||||
#define BOOST_FIXED_STRING_THROW(ex) throw ex
|
|
||||||
#endif
|
|
||||||
#ifndef BOOST_FIXED_STRING_STATIC_ASSERT
|
|
||||||
#define BOOST_FIXED_STRING_STATIC_ASSERT(cond, msg) static_assert(cond, msg)
|
|
||||||
#endif
|
|
||||||
#ifndef BOOST_FIXED_STRING_ASSERT
|
|
||||||
#define BOOST_FIXED_STRING_ASSERT(cond) assert(cond)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace fixed_string {
|
|
||||||
|
|
||||||
/// The type of `basic_string_view` used by the library
|
|
||||||
template<typename CharT, typename Traits>
|
|
||||||
using basic_string_view =
|
|
||||||
#ifndef BOOST_FIXED_STRING_STANDALONE
|
|
||||||
boost::basic_string_view<CharT, Traits>;
|
|
||||||
#else
|
|
||||||
std::basic_string_view<CharT, Traits>;
|
|
||||||
#endif
|
|
||||||
} // fixed_string
|
|
||||||
} // boost
|
|
||||||
|
|
||||||
#endif
|
|
117
include/boost/static_string/config.hpp
Normal file
117
include/boost/static_string/config.hpp
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||||
|
// Copyright (c) 2019 Krystian Stasiowski (sdkrystian at gmail dot 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)
|
||||||
|
//
|
||||||
|
// Official repository: https://github.com/boostorg/static_string
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef BOOST_STATIC_STRING_CONFIG_HPP
|
||||||
|
#define BOOST_STATIC_STRING_CONFIG_HPP
|
||||||
|
|
||||||
|
// Are we dependent on Boost?
|
||||||
|
// #define BOOST_STATIC_STRING_STANDALONE
|
||||||
|
|
||||||
|
// Can we have deduction guides?
|
||||||
|
#ifdef __cpp_deduction_guides
|
||||||
|
#define BOOST_STATIC_STRING_USE_DEDUCT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Can we use [[nodiscard]]?
|
||||||
|
#ifdef __has_attribute
|
||||||
|
#if __has_attribute(nodiscard)
|
||||||
|
#define BOOST_STATIC_STRING_NODISCARD [[nodiscard]]
|
||||||
|
#else
|
||||||
|
#define BOOST_STATIC_STRING_NODISCARD
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define BOOST_STATIC_STRING_NODISCARD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#undef _<>_<EFBFBD>cplusplus
|
||||||
|
//#define _<>_<EFBFBD>cplusplus 201703L
|
||||||
|
|
||||||
|
#if __cplusplus > 201703L
|
||||||
|
#define BOOST_STATIC_STRING_CPP20_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP20_CONSTEXPR_USED
|
||||||
|
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR_USED
|
||||||
|
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR_USED
|
||||||
|
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR_USED
|
||||||
|
#define BOOST_STATIC_STRING_ALLOW_UNINIT_MEM
|
||||||
|
#elif __cplusplus >= 201703L
|
||||||
|
#define BOOST_STATIC_STRING_CPP20_CONSTEXPR
|
||||||
|
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR_USED
|
||||||
|
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR_USED
|
||||||
|
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR_USED
|
||||||
|
#elif __cplusplus >= 201402L
|
||||||
|
#define BOOST_STATIC_STRING_CPP20_CONSTEXPR
|
||||||
|
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR
|
||||||
|
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR_USED
|
||||||
|
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR_USED
|
||||||
|
#else
|
||||||
|
#define BOOST_STATIC_STRING_CPP20_CONSTEXPR
|
||||||
|
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR
|
||||||
|
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
|
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR constexpr
|
||||||
|
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR_USED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BOOST_STATIC_STRING_STANDALONE
|
||||||
|
#include <boost/utility/string_view.hpp>
|
||||||
|
#include <boost/container_hash/hash.hpp>
|
||||||
|
#include <boost/assert.hpp>
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
#include <boost/throw_exception.hpp>
|
||||||
|
#else
|
||||||
|
#include <cassert>
|
||||||
|
#include <string_view>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Boost and non-Boost versions of utilities
|
||||||
|
#ifndef BOOST_STATIC_STRING_STANDALONE
|
||||||
|
#ifndef BOOST_STATIC_STRING_THROW
|
||||||
|
#define BOOST_STATIC_STRING_THROW(ex) BOOST_THROW_EXCEPTION(ex)
|
||||||
|
#endif
|
||||||
|
#ifndef BOOST_STATIC_STRING_STATIC_ASSERT
|
||||||
|
#define BOOST_STATIC_STRING_STATIC_ASSERT(cond, msg) BOOST_STATIC_ASSERT_MSG(cond, msg)
|
||||||
|
#endif
|
||||||
|
#ifndef BOOST_STATIC_STRING_ASSERT
|
||||||
|
#define BOOST_STATIC_STRING_ASSERT(cond) BOOST_ASSERT(cond)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#ifndef BOOST_STATIC_STRING_THROW
|
||||||
|
#define BOOST_STATIC_STRING_THROW(ex) throw ex
|
||||||
|
#endif
|
||||||
|
#ifndef BOOST_STATIC_STRING_STATIC_ASSERT
|
||||||
|
#define BOOST_STATIC_STRING_STATIC_ASSERT(cond, msg) static_assert(cond, msg)
|
||||||
|
#endif
|
||||||
|
#ifndef BOOST_STATIC_STRING_ASSERT
|
||||||
|
#define BOOST_STATIC_STRING_ASSERT(cond) assert(cond)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace static_string {
|
||||||
|
|
||||||
|
/// The type of `basic_string_view` used by the library
|
||||||
|
template<typename CharT, typename Traits>
|
||||||
|
using basic_string_view =
|
||||||
|
#ifndef BOOST_STATIC_STRING_STANDALONE
|
||||||
|
boost::basic_string_view<CharT, Traits>;
|
||||||
|
#else
|
||||||
|
std::basic_string_view<CharT, Traits>;
|
||||||
|
#endif
|
||||||
|
} // static_string
|
||||||
|
} // boost
|
||||||
|
|
||||||
|
#endif
|
@ -5,23 +5,23 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
// Official repository: https://github.com/boostorg/fixed_string
|
// Official repository: https://github.com/boostorg/static_string
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef BOOST_FIXED_STRING_DETAIL_FIXED_STRING_HPP
|
#ifndef BOOST_STATIC_STRING_DETAIL_STATIC_STRING_HPP
|
||||||
#define BOOST_FIXED_STRING_DETAIL_FIXED_STRING_HPP
|
#define BOOST_STATIC_STRING_DETAIL_STATIC_STRING_HPP
|
||||||
|
|
||||||
#include <boost/fixed_string/config.hpp>
|
#include <boost/static_string/config.hpp>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace fixed_string {
|
namespace static_string {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<std::size_t, typename, typename>
|
template<std::size_t, typename, typename>
|
||||||
class fixed_string;
|
class basic_static_string;
|
||||||
|
|
||||||
// At minimum an integral type shall not qualify as an iterator (Agustin Berge)
|
// At minimum an integral type shall not qualify as an iterator (Agustin Berge)
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -41,44 +41,44 @@ using smallest_width =
|
|||||||
|
|
||||||
// Optimization for using the smallest possible type
|
// Optimization for using the smallest possible type
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
class fixed_string_base_zero
|
class static_string_base_zero
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BOOST_FIXED_STRING_CPP11_CXPER
|
BOOST_STATIC_STRING_CPP11_CONSTEXPR
|
||||||
fixed_string_base_zero() noexcept { };
|
static_string_base_zero() noexcept { };
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP11_CXPER
|
BOOST_STATIC_STRING_CPP11_CONSTEXPR
|
||||||
fixed_string_base_zero(std::size_t n) noexcept : size_(n) { }
|
static_string_base_zero(std::size_t n) noexcept : size_(n) { }
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
CharT*
|
CharT*
|
||||||
data_impl() noexcept
|
data_impl() noexcept
|
||||||
{
|
{
|
||||||
return data_;
|
return data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
CharT const*
|
CharT const*
|
||||||
data_impl() const noexcept
|
data_impl() const noexcept
|
||||||
{
|
{
|
||||||
return data_;
|
return data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP11_CXPER
|
BOOST_STATIC_STRING_CPP11_CONSTEXPR
|
||||||
std::size_t
|
std::size_t
|
||||||
size_impl() const noexcept
|
size_impl() const noexcept
|
||||||
{
|
{
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
std::size_t
|
std::size_t
|
||||||
set_size(std::size_t n) noexcept
|
set_size(std::size_t n) noexcept
|
||||||
{
|
{
|
||||||
return size_ = n;
|
return size_ = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
term_impl() noexcept
|
term_impl() noexcept
|
||||||
{
|
{
|
||||||
@ -86,7 +86,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
smallest_width<N> size_{0};
|
smallest_width<N> size_{0};
|
||||||
#ifdef BOOST_FIXED_STRING_ALLOW_UNINIT_MEM
|
#ifdef BOOST_STATIC_STRING_ALLOW_UNINIT_MEM
|
||||||
CharT data_[N + 1];
|
CharT data_[N + 1];
|
||||||
#else
|
#else
|
||||||
CharT data_[N + 1]{};
|
CharT data_[N + 1]{};
|
||||||
@ -95,14 +95,14 @@ public:
|
|||||||
|
|
||||||
// Optimization for when the size is 0
|
// Optimization for when the size is 0
|
||||||
template<typename CharT, typename Traits>
|
template<typename CharT, typename Traits>
|
||||||
class fixed_string_base_zero<0, CharT, Traits>
|
class static_string_base_zero<0, CharT, Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BOOST_FIXED_STRING_CPP11_CXPER
|
BOOST_STATIC_STRING_CPP11_CONSTEXPR
|
||||||
fixed_string_base_zero() noexcept { }
|
static_string_base_zero() noexcept { }
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP11_CXPER
|
BOOST_STATIC_STRING_CPP11_CONSTEXPR
|
||||||
fixed_string_base_zero(std::size_t) noexcept { }
|
static_string_base_zero(std::size_t) noexcept { }
|
||||||
|
|
||||||
// not possible to constexpr with the static there
|
// not possible to constexpr with the static there
|
||||||
CharT*
|
CharT*
|
||||||
@ -112,21 +112,21 @@ public:
|
|||||||
return &null;
|
return &null;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP11_CXPER
|
BOOST_STATIC_STRING_CPP11_CONSTEXPR
|
||||||
std::size_t
|
std::size_t
|
||||||
size_impl() const noexcept
|
size_impl() const noexcept
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP11_CXPER
|
BOOST_STATIC_STRING_CPP11_CONSTEXPR
|
||||||
std::size_t
|
std::size_t
|
||||||
set_size(std::size_t) noexcept
|
set_size(std::size_t) noexcept
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
term_impl() noexcept
|
term_impl() noexcept
|
||||||
{
|
{
|
||||||
@ -136,58 +136,58 @@ public:
|
|||||||
|
|
||||||
// Optimization for storing the size in the last element
|
// Optimization for storing the size in the last element
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
class fixed_string_base_null
|
class static_string_base_null
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string_base_null() noexcept { set_size(0); }
|
static_string_base_null() noexcept { set_size(0); }
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string_base_null(std::size_t n) noexcept { set_size(n); }
|
static_string_base_null(std::size_t n) noexcept { set_size(n); }
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
CharT*
|
CharT*
|
||||||
data_impl() noexcept
|
data_impl() noexcept
|
||||||
{
|
{
|
||||||
return data_;
|
return data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
CharT const*
|
CharT const*
|
||||||
data_impl() const noexcept
|
data_impl() const noexcept
|
||||||
{
|
{
|
||||||
return data_;
|
return data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP11_CXPER
|
BOOST_STATIC_STRING_CPP11_CONSTEXPR
|
||||||
std::size_t
|
std::size_t
|
||||||
size_impl() const noexcept
|
size_impl() const noexcept
|
||||||
{
|
{
|
||||||
return N - data_[N];
|
return N - data_[N];
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
std::size_t
|
std::size_t
|
||||||
set_size(std::size_t n) noexcept
|
set_size(std::size_t n) noexcept
|
||||||
{
|
{
|
||||||
return data_[N] = (N - n);
|
return data_[N] = (N - n);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
term_impl() noexcept
|
term_impl() noexcept
|
||||||
{
|
{
|
||||||
Traits::assign(data_[size_impl()], 0);
|
Traits::assign(data_[size_impl()], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOOST_FIXED_STRING_ALLOW_UNINIT_MEM
|
#ifdef BOOST_STATIC_STRING_ALLOW_UNINIT_MEM
|
||||||
CharT data_[N + 1];
|
CharT data_[N + 1];
|
||||||
#else
|
#else
|
||||||
CharT data_[N + 1]{};
|
CharT data_[N + 1]{};
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
//#define BOOST_FIXED_STRING_NO_NULL_OPTIMIZATION
|
//#define BOOST_STATIC_STRING_NO_NULL_OPTIMIZATION
|
||||||
|
|
||||||
// Decides which size optimization to use
|
// Decides which size optimization to use
|
||||||
// If the size is zero, the object will have no members
|
// If the size is zero, the object will have no members
|
||||||
@ -195,12 +195,12 @@ public:
|
|||||||
// Otherwise, store the size of the string using a member of the smallest type possible
|
// Otherwise, store the size of the string using a member of the smallest type possible
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
using optimization_base =
|
using optimization_base =
|
||||||
#ifndef BOOST_FIXED_STRING_NO_NULL_OPTIMIZATION
|
#ifndef BOOST_STATIC_STRING_NO_NULL_OPTIMIZATION
|
||||||
typename std::conditional<(N <= (std::numeric_limits<CharT>::max)()) && (N != 0),
|
typename std::conditional<(N <= (std::numeric_limits<CharT>::max)()) && (N != 0),
|
||||||
fixed_string_base_null<N, CharT, Traits>,
|
static_string_base_null<N, CharT, Traits>,
|
||||||
fixed_string_base_zero<N, CharT, Traits>>::type;
|
static_string_base_zero<N, CharT, Traits>>::type;
|
||||||
#else
|
#else
|
||||||
fixed_string_base_zero<N, CharT, Traits>;
|
static_string_base_zero<N, CharT, Traits>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<typename CharT, typename Traits>
|
template<typename CharT, typename Traits>
|
||||||
@ -234,7 +234,7 @@ template<std::size_t N, typename CharT, typename Traits >
|
|||||||
inline
|
inline
|
||||||
int
|
int
|
||||||
lexicographical_compare(
|
lexicographical_compare(
|
||||||
const fixed_string<N, CharT, Traits>& s1,
|
const basic_static_string<N, CharT, Traits>& s1,
|
||||||
CharT const* s2, std::size_t n2)
|
CharT const* s2, std::size_t n2)
|
||||||
{
|
{
|
||||||
return detail::lexicographical_compare<
|
return detail::lexicographical_compare<
|
||||||
@ -256,8 +256,8 @@ template<std::size_t N, std::size_t M, typename CharT, typename Traits>
|
|||||||
inline
|
inline
|
||||||
int
|
int
|
||||||
lexicographical_compare(
|
lexicographical_compare(
|
||||||
const fixed_string<N, CharT, Traits>& s1,
|
const basic_static_string<N, CharT, Traits>& s1,
|
||||||
const fixed_string<M, CharT, Traits>& s2)
|
const basic_static_string<M, CharT, Traits>& s2)
|
||||||
{
|
{
|
||||||
return detail::lexicographical_compare<CharT, Traits>(
|
return detail::lexicographical_compare<CharT, Traits>(
|
||||||
s1.data(), s1.size(), s2.data(), s2.size());
|
s1.data(), s1.size(), s2.data(), s2.size());
|
||||||
@ -326,7 +326,7 @@ inline
|
|||||||
CharT*
|
CharT*
|
||||||
raw_to_string(CharT* last, std::size_t size, Integer i)
|
raw_to_string(CharT* last, std::size_t size, Integer i)
|
||||||
{
|
{
|
||||||
BOOST_FIXED_STRING_ASSERT(size >= max_digits(sizeof(Integer)));
|
BOOST_STATIC_STRING_ASSERT(size >= max_digits(sizeof(Integer)));
|
||||||
return raw_to_string<CharT, Integer, Traits>(
|
return raw_to_string<CharT, Integer, Traits>(
|
||||||
last, i, std::is_signed<Integer>{});
|
last, i, std::is_signed<Integer>{});
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ find_not_of(
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // detail
|
} // detail
|
||||||
} // fixed_string
|
} // static_string
|
||||||
} // boost
|
} // boost
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -5,17 +5,17 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
// Official repository: https://github.com/boostorg/fixed_string
|
// Official repository: https://github.com/boostorg/static_string
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef BOOST_FIXED_STRING_IMPL_FIXED_STRING_HPP
|
#ifndef BOOST_STATIC_STRING_IMPL_STATIC_STRING_HPP
|
||||||
#define BOOST_FIXED_STRING_IMPL_FIXED_STRING_HPP
|
#define BOOST_STATIC_STRING_IMPL_STATIC_STRING_HPP
|
||||||
|
|
||||||
#include <boost/fixed_string/config.hpp>
|
#include <boost/static_string/config.hpp>
|
||||||
#include <boost/fixed_string/detail/fixed_string.hpp>
|
#include <boost/static_string/detail/static_string.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace fixed_string {
|
namespace static_string {
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@ -24,28 +24,28 @@ namespace fixed_string {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP11_CXPER
|
BOOST_STATIC_STRING_CPP11_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string() noexcept
|
basic_static_string() noexcept
|
||||||
{
|
{
|
||||||
#ifdef BOOST_FIXED_STRING_CPP20_CXPER_USED
|
#ifdef BOOST_STATIC_STRING_CPP20_CONSTEXPR_USED
|
||||||
term();
|
term();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(size_type count, CharT ch)
|
basic_static_string(size_type count, CharT ch)
|
||||||
{
|
{
|
||||||
assign(count, ch);
|
assign(count, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<std::size_t M>
|
template<std::size_t M>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(fixed_string<M, CharT, Traits> const& other,
|
basic_static_string(basic_static_string<M, CharT, Traits> const& other,
|
||||||
size_type pos)
|
size_type pos)
|
||||||
{
|
{
|
||||||
assign(other, pos);
|
assign(other, pos);
|
||||||
@ -53,10 +53,10 @@ fixed_string(fixed_string<M, CharT, Traits> const& other,
|
|||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<std::size_t M>
|
template<std::size_t M>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(
|
basic_static_string(
|
||||||
fixed_string<M, CharT, Traits> const& other,
|
basic_static_string<M, CharT, Traits> const& other,
|
||||||
size_type pos,
|
size_type pos,
|
||||||
size_type count)
|
size_type count)
|
||||||
{
|
{
|
||||||
@ -64,21 +64,21 @@ fixed_string(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(CharT const* s, size_type count)
|
basic_static_string(CharT const* s, size_type count)
|
||||||
{
|
{
|
||||||
assign(s, count);
|
assign(s, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(CharT const* s)
|
basic_static_string(CharT const* s)
|
||||||
{
|
{
|
||||||
auto const count = Traits::length(s);
|
auto const count = Traits::length(s);
|
||||||
if(count > max_size())
|
if(count > max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"count > max_size()"});
|
"count > max_size()"});
|
||||||
this->set_size(count);
|
this->set_size(count);
|
||||||
Traits::copy(data(), s, size() + 1);
|
Traits::copy(data(), s, size() + 1);
|
||||||
@ -86,9 +86,9 @@ fixed_string(CharT const* s)
|
|||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(
|
basic_static_string(
|
||||||
InputIterator first,
|
InputIterator first,
|
||||||
InputIterator last,
|
InputIterator last,
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
@ -99,45 +99,45 @@ fixed_string(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(
|
basic_static_string(
|
||||||
fixed_string const& s) noexcept
|
basic_static_string const& s) noexcept
|
||||||
{
|
{
|
||||||
assign(s);
|
assign(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<std::size_t M>
|
template<std::size_t M>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(
|
basic_static_string(
|
||||||
fixed_string<M, CharT, Traits> const& s)
|
basic_static_string<M, CharT, Traits> const& s)
|
||||||
{
|
{
|
||||||
assign(s);
|
assign(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(std::initializer_list<CharT> init)
|
basic_static_string(std::initializer_list<CharT> init)
|
||||||
{
|
{
|
||||||
assign(init.begin(), init.end());
|
assign(init.begin(), init.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(string_view_type sv)
|
basic_static_string(string_view_type sv)
|
||||||
{
|
{
|
||||||
assign(sv);
|
assign(sv);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<class T, class>
|
template<class T, class>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
fixed_string(T const& t, size_type pos, size_type n)
|
basic_static_string(T const& t, size_type pos, size_type n)
|
||||||
{
|
{
|
||||||
assign(t, pos, n);
|
assign(t, pos, n);
|
||||||
}
|
}
|
||||||
@ -149,16 +149,16 @@ fixed_string(T const& t, size_type pos, size_type n)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
assign(
|
assign(
|
||||||
size_type count,
|
size_type count,
|
||||||
CharT ch) ->
|
CharT ch) ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
if(count > max_size())
|
if(count > max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"count > max_size()"});
|
"count > max_size()"});
|
||||||
this->set_size(count);
|
this->set_size(count);
|
||||||
Traits::assign(data(), size(), ch);
|
Traits::assign(data(), size(), ch);
|
||||||
@ -167,12 +167,12 @@ assign(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
assign(
|
assign(
|
||||||
fixed_string const& s) noexcept ->
|
basic_static_string const& s) noexcept ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
if(this == &s)
|
if(this == &s)
|
||||||
return *this;
|
return *this;
|
||||||
@ -186,30 +186,30 @@ assign(
|
|||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<std::size_t M>
|
template<std::size_t M>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
assign(
|
assign(
|
||||||
fixed_string<M, CharT, Traits> const& s,
|
basic_static_string<M, CharT, Traits> const& s,
|
||||||
size_type pos,
|
size_type pos,
|
||||||
size_type count) ->
|
size_type count) ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
auto const ss = s.subview(pos, count);
|
auto const ss = s.subview(pos, count);
|
||||||
return assign(ss.data(), ss.size());
|
return assign(ss.data(), ss.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
assign(
|
assign(
|
||||||
CharT const* s,
|
CharT const* s,
|
||||||
size_type count) ->
|
size_type count) ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
if(count > max_size())
|
if(count > max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"count > max_size()"});
|
"count > max_size()"});
|
||||||
this->set_size(count);
|
this->set_size(count);
|
||||||
Traits::move(data(), s, size());
|
Traits::move(data(), s, size());
|
||||||
@ -219,19 +219,19 @@ assign(
|
|||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
assign(
|
assign(
|
||||||
InputIterator first,
|
InputIterator first,
|
||||||
InputIterator last) ->
|
InputIterator last) ->
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
detail::is_input_iterator<InputIterator>::value,
|
detail::is_input_iterator<InputIterator>::value,
|
||||||
fixed_string&>::type
|
basic_static_string&>::type
|
||||||
{
|
{
|
||||||
std::size_t const n = std::distance(first, last);
|
std::size_t const n = std::distance(first, last);
|
||||||
if(n > max_size())
|
if(n > max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"n > max_size()"});
|
"n > max_size()"});
|
||||||
this->set_size(n);
|
this->set_size(n);
|
||||||
for(auto it = data(); first != last; ++it, ++first)
|
for(auto it = data(); first != last; ++it, ++first)
|
||||||
@ -247,27 +247,27 @@ assign(
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
at(size_type pos) ->
|
at(size_type pos) ->
|
||||||
reference
|
reference
|
||||||
{
|
{
|
||||||
if(pos >= size())
|
if(pos >= size())
|
||||||
BOOST_FIXED_STRING_THROW(std::out_of_range{
|
BOOST_STATIC_STRING_THROW(std::out_of_range{
|
||||||
"pos >= size()"});
|
"pos >= size()"});
|
||||||
return data()[pos];
|
return data()[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
at(size_type pos) const ->
|
at(size_type pos) const ->
|
||||||
const_reference
|
const_reference
|
||||||
{
|
{
|
||||||
if(pos >= size())
|
if(pos >= size())
|
||||||
BOOST_FIXED_STRING_THROW(std::out_of_range{
|
BOOST_STATIC_STRING_THROW(std::out_of_range{
|
||||||
"pos >= size()"});
|
"pos >= size()"});
|
||||||
return data()[pos];
|
return data()[pos];
|
||||||
}
|
}
|
||||||
@ -279,13 +279,13 @@ at(size_type pos) const ->
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
reserve(std::size_t n)
|
reserve(std::size_t n)
|
||||||
{
|
{
|
||||||
if(n > max_size())
|
if(n > max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"n > max_size()"});
|
"n > max_size()"});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,9 +296,9 @@ reserve(std::size_t n)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
clear() noexcept
|
clear() noexcept
|
||||||
{
|
{
|
||||||
this->set_size(0);
|
this->set_size(0);
|
||||||
@ -308,39 +308,39 @@ clear() noexcept
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
insert(
|
insert(
|
||||||
size_type index,
|
size_type index,
|
||||||
size_type count,
|
size_type count,
|
||||||
CharT ch) ->
|
CharT ch) ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
if(index > size())
|
if(index > size())
|
||||||
BOOST_FIXED_STRING_THROW(std::out_of_range{
|
BOOST_STATIC_STRING_THROW(std::out_of_range{
|
||||||
"index > size()"});
|
"index > size()"});
|
||||||
insert(begin() + index, count, ch);
|
insert(begin() + index, count, ch);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
insert(
|
insert(
|
||||||
size_type index,
|
size_type index,
|
||||||
CharT const* s,
|
CharT const* s,
|
||||||
size_type count) ->
|
size_type count) ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
const auto curr_data = data();
|
const auto curr_data = data();
|
||||||
if(index > curr_size)
|
if(index > curr_size)
|
||||||
BOOST_FIXED_STRING_THROW(std::out_of_range{
|
BOOST_STATIC_STRING_THROW(std::out_of_range{
|
||||||
"index > size()"});
|
"index > size()"});
|
||||||
if(count > max_size() - curr_size)
|
if(count > max_size() - curr_size)
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"size() + count > max_size()"});
|
"size() + count > max_size()"});
|
||||||
const bool inside = s <= &curr_data[curr_size] && s >= curr_data;
|
const bool inside = s <= &curr_data[curr_size] && s >= curr_data;
|
||||||
if (!inside || (inside && ((s - curr_data) + count <= index)))
|
if (!inside || (inside && ((s - curr_data) + count <= index)))
|
||||||
@ -368,9 +368,9 @@ insert(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
insert(
|
insert(
|
||||||
const_iterator pos,
|
const_iterator pos,
|
||||||
size_type count,
|
size_type count,
|
||||||
@ -380,7 +380,7 @@ insert(
|
|||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
const auto curr_data = data();
|
const auto curr_data = data();
|
||||||
if(count > max_size() - curr_size)
|
if(count > max_size() - curr_size)
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"size() + count() > max_size()"});
|
"size() + count() > max_size()"});
|
||||||
auto const index = pos - curr_data;
|
auto const index = pos - curr_data;
|
||||||
Traits::move(&curr_data[index + count], &curr_data[index], curr_size - index);
|
Traits::move(&curr_data[index + count], &curr_data[index], curr_size - index);
|
||||||
@ -392,9 +392,9 @@ insert(
|
|||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
insert(
|
insert(
|
||||||
const_iterator pos,
|
const_iterator pos,
|
||||||
InputIterator first,
|
InputIterator first,
|
||||||
@ -409,9 +409,9 @@ insert(
|
|||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
insert(
|
insert(
|
||||||
size_type index,
|
size_type index,
|
||||||
T const & t) ->
|
T const & t) ->
|
||||||
@ -419,7 +419,7 @@ insert(
|
|||||||
std::is_convertible<
|
std::is_convertible<
|
||||||
T const&, string_view_type>::value &&
|
T const&, string_view_type>::value &&
|
||||||
! std::is_convertible<
|
! std::is_convertible<
|
||||||
T const&, CharT const*>::value, fixed_string&
|
T const&, CharT const*>::value, basic_static_string&
|
||||||
>::type
|
>::type
|
||||||
{
|
{
|
||||||
return insert(index, t, 0, npos);
|
return insert(index, t, 0, npos);
|
||||||
@ -427,9 +427,9 @@ insert(
|
|||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
insert(
|
insert(
|
||||||
size_type index,
|
size_type index,
|
||||||
T const & t,
|
T const & t,
|
||||||
@ -439,7 +439,7 @@ insert(
|
|||||||
std::is_convertible<
|
std::is_convertible<
|
||||||
T const&, string_view_type>::value &&
|
T const&, string_view_type>::value &&
|
||||||
! std::is_convertible<
|
! std::is_convertible<
|
||||||
T const&, CharT const*>::value, fixed_string&
|
T const&, CharT const*>::value, basic_static_string&
|
||||||
>::type
|
>::type
|
||||||
{
|
{
|
||||||
auto const s =
|
auto const s =
|
||||||
@ -450,18 +450,18 @@ insert(
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
erase(
|
erase(
|
||||||
size_type index,
|
size_type index,
|
||||||
size_type count) ->
|
size_type count) ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
const auto curr_data = data();
|
const auto curr_data = data();
|
||||||
if(index > curr_size)
|
if(index > curr_size)
|
||||||
BOOST_FIXED_STRING_THROW(std::out_of_range{
|
BOOST_STATIC_STRING_THROW(std::out_of_range{
|
||||||
"index > size()"});
|
"index > size()"});
|
||||||
auto const n = (std::min)(count, curr_size - index);
|
auto const n = (std::min)(count, curr_size - index);
|
||||||
Traits::move(&curr_data[index], &curr_data[index + n], curr_size - (index + n) + 1);
|
Traits::move(&curr_data[index], &curr_data[index + n], curr_size - (index + n) + 1);
|
||||||
@ -470,9 +470,9 @@ erase(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
erase(
|
erase(
|
||||||
const_iterator pos) ->
|
const_iterator pos) ->
|
||||||
iterator
|
iterator
|
||||||
@ -482,9 +482,9 @@ erase(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
erase(
|
erase(
|
||||||
const_iterator first,
|
const_iterator first,
|
||||||
const_iterator last) ->
|
const_iterator last) ->
|
||||||
@ -496,15 +496,15 @@ erase(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
push_back(
|
push_back(
|
||||||
CharT ch)
|
CharT ch)
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
if(curr_size >= max_size())
|
if(curr_size >= max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"size() >= max_size()"});
|
"size() >= max_size()"});
|
||||||
Traits::assign(data()[curr_size], ch);
|
Traits::assign(data()[curr_size], ch);
|
||||||
this->set_size(curr_size + 1);
|
this->set_size(curr_size + 1);
|
||||||
@ -512,17 +512,17 @@ push_back(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
append(
|
append(
|
||||||
CharT const* s,
|
CharT const* s,
|
||||||
size_type count) ->
|
size_type count) ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
if(count > max_size() - curr_size)
|
if(count > max_size() - curr_size)
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"size() + count > max_size()"});
|
"size() + count > max_size()"});
|
||||||
Traits::copy(&data()[curr_size], s, count);
|
Traits::copy(&data()[curr_size], s, count);
|
||||||
this->set_size(curr_size + count);
|
this->set_size(curr_size + count);
|
||||||
@ -531,35 +531,35 @@ append(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
substr(size_type pos, size_type count) const ->
|
substr(size_type pos, size_type count) const ->
|
||||||
fixed_string
|
basic_static_string
|
||||||
{
|
{
|
||||||
if(pos > size())
|
if(pos > size())
|
||||||
BOOST_FIXED_STRING_THROW(std::out_of_range{
|
BOOST_STATIC_STRING_THROW(std::out_of_range{
|
||||||
"pos > size()"});
|
"pos > size()"});
|
||||||
return {&data()[pos], (std::min)(count, size() - pos)};
|
return {&data()[pos], (std::min)(count, size() - pos)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
subview(size_type pos, size_type count) const ->
|
subview(size_type pos, size_type count) const ->
|
||||||
string_view_type
|
string_view_type
|
||||||
{
|
{
|
||||||
if (pos > size())
|
if (pos > size())
|
||||||
BOOST_FIXED_STRING_THROW(std::out_of_range{
|
BOOST_STATIC_STRING_THROW(std::out_of_range{
|
||||||
"pos > size()"});
|
"pos > size()"});
|
||||||
return {&data()[pos], (std::min)(count, size() - pos)};
|
return {&data()[pos], (std::min)(count, size() - pos)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
copy(CharT* dest, size_type count, size_type pos) const noexcept ->
|
copy(CharT* dest, size_type count, size_type pos) const noexcept ->
|
||||||
size_type
|
size_type
|
||||||
{
|
{
|
||||||
@ -569,14 +569,14 @@ copy(CharT* dest, size_type count, size_type pos) const noexcept ->
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
resize(std::size_t n)
|
resize(std::size_t n)
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
if(n > max_size())
|
if(n > max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"n > max_size()"});
|
"n > max_size()"});
|
||||||
if(n > curr_size)
|
if(n > curr_size)
|
||||||
Traits::assign(&data()[curr_size], n - curr_size, CharT{});
|
Traits::assign(&data()[curr_size], n - curr_size, CharT{});
|
||||||
@ -585,14 +585,14 @@ resize(std::size_t n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
resize(std::size_t n, CharT c)
|
resize(std::size_t n, CharT c)
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
if(n > max_size())
|
if(n > max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"n > max_size()"});
|
"n > max_size()"});
|
||||||
if(n > curr_size)
|
if(n > curr_size)
|
||||||
Traits::assign(&data()[curr_size], n - curr_size, c);
|
Traits::assign(&data()[curr_size], n - curr_size, c);
|
||||||
@ -601,13 +601,13 @@ resize(std::size_t n, CharT c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
swap(fixed_string& s) noexcept
|
swap(basic_static_string& s) noexcept
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
fixed_string tmp(s);
|
basic_static_string tmp(s);
|
||||||
s.set_size(curr_size);
|
s.set_size(curr_size);
|
||||||
Traits::copy(&s.data()[0], data(), curr_size + 1);
|
Traits::copy(&s.data()[0], data(), curr_size + 1);
|
||||||
this->set_size(tmp.size());
|
this->set_size(tmp.size());
|
||||||
@ -616,19 +616,19 @@ swap(fixed_string& s) noexcept
|
|||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
template<std::size_t M>
|
template<std::size_t M>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
void
|
void
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
swap(fixed_string<M, CharT, Traits>& s)
|
swap(basic_static_string<M, CharT, Traits>& s)
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
if(curr_size > s.max_size())
|
if(curr_size > s.max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"size() > s.max_size()"});
|
"size() > s.max_size()"});
|
||||||
if(s.size() > max_size())
|
if(s.size() > max_size())
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"s.size() > max_size()"});
|
"s.size() > max_size()"});
|
||||||
fixed_string tmp(s);
|
basic_static_string tmp(s);
|
||||||
s.set_size(curr_size);
|
s.set_size(curr_size);
|
||||||
Traits::copy(&s.data()[0], data(), curr_size + 1);
|
Traits::copy(&s.data()[0], data(), curr_size + 1);
|
||||||
this->set_size(tmp.size());
|
this->set_size(tmp.size());
|
||||||
@ -636,22 +636,22 @@ swap(fixed_string<M, CharT, Traits>& s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
replace(
|
replace(
|
||||||
size_type pos,
|
size_type pos,
|
||||||
size_type n1,
|
size_type n1,
|
||||||
const CharT* s,
|
const CharT* s,
|
||||||
size_type n2) -> fixed_string<N, CharT, Traits>&
|
size_type n2) -> basic_static_string<N, CharT, Traits>&
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
const auto curr_data = data();
|
const auto curr_data = data();
|
||||||
if (pos > curr_size)
|
if (pos > curr_size)
|
||||||
BOOST_FIXED_STRING_THROW(std::out_of_range{
|
BOOST_STATIC_STRING_THROW(std::out_of_range{
|
||||||
"pos > size()"});
|
"pos > size()"});
|
||||||
if (curr_size - (std::min)(n1, curr_size - pos) >= max_size() - n2)
|
if (curr_size - (std::min)(n1, curr_size - pos) >= max_size() - n2)
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"replaced string exceeds max_size()"});
|
"replaced string exceeds max_size()"});
|
||||||
if (pos + n1 >= curr_size)
|
if (pos + n1 >= curr_size)
|
||||||
n1 = curr_size - pos;
|
n1 = curr_size - pos;
|
||||||
@ -693,22 +693,22 @@ replace(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
replace(
|
replace(
|
||||||
size_type pos,
|
size_type pos,
|
||||||
size_type n1,
|
size_type n1,
|
||||||
size_type n2,
|
size_type n2,
|
||||||
CharT c) -> fixed_string<N, CharT, Traits> &
|
CharT c) -> basic_static_string<N, CharT, Traits> &
|
||||||
{
|
{
|
||||||
const auto curr_size = size();
|
const auto curr_size = size();
|
||||||
const auto curr_data = data();
|
const auto curr_data = data();
|
||||||
if (pos > curr_size)
|
if (pos > curr_size)
|
||||||
BOOST_FIXED_STRING_THROW(std::out_of_range{
|
BOOST_STATIC_STRING_THROW(std::out_of_range{
|
||||||
"pos > size()"});
|
"pos > size()"});
|
||||||
if (curr_size - (std::min)(n1, curr_size - pos) >= max_size() - n2)
|
if (curr_size - (std::min)(n1, curr_size - pos) >= max_size() - n2)
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"replaced string exceeds max_size()"});
|
"replaced string exceeds max_size()"});
|
||||||
if (pos + n1 >= curr_size)
|
if (pos + n1 >= curr_size)
|
||||||
n1 = curr_size - pos;
|
n1 = curr_size - pos;
|
||||||
@ -719,9 +719,9 @@ replace(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
find(
|
find(
|
||||||
const CharT* s,
|
const CharT* s,
|
||||||
size_type pos,
|
size_type pos,
|
||||||
@ -738,9 +738,9 @@ find(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
rfind(
|
rfind(
|
||||||
const CharT* s,
|
const CharT* s,
|
||||||
size_type pos,
|
size_type pos,
|
||||||
@ -762,9 +762,9 @@ rfind(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
find_first_of(
|
find_first_of(
|
||||||
const CharT* s,
|
const CharT* s,
|
||||||
size_type pos,
|
size_type pos,
|
||||||
@ -779,9 +779,9 @@ find_first_of(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
find_last_of(
|
find_last_of(
|
||||||
const CharT* s,
|
const CharT* s,
|
||||||
size_type pos,
|
size_type pos,
|
||||||
@ -800,9 +800,9 @@ find_last_of(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
find_first_not_of(
|
find_first_not_of(
|
||||||
const CharT* s,
|
const CharT* s,
|
||||||
size_type pos,
|
size_type pos,
|
||||||
@ -818,9 +818,9 @@ find_first_not_of(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
find_last_not_of(
|
find_last_not_of(
|
||||||
const CharT* s,
|
const CharT* s,
|
||||||
size_type pos,
|
size_type pos,
|
||||||
@ -838,11 +838,11 @@ find_last_not_of(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
BOOST_FIXED_STRING_CPP14_CXPER
|
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
assign_char(CharT ch, std::true_type) noexcept ->
|
assign_char(CharT ch, std::true_type) noexcept ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
this->set_size(1);
|
this->set_size(1);
|
||||||
Traits::assign(data()[0], ch);
|
Traits::assign(data()[0], ch);
|
||||||
@ -852,27 +852,27 @@ assign_char(CharT ch, std::true_type) noexcept ->
|
|||||||
|
|
||||||
template<std::size_t N, typename CharT, typename Traits>
|
template<std::size_t N, typename CharT, typename Traits>
|
||||||
auto
|
auto
|
||||||
fixed_string<N, CharT, Traits>::
|
basic_static_string<N, CharT, Traits>::
|
||||||
assign_char(CharT, std::false_type) ->
|
assign_char(CharT, std::false_type) ->
|
||||||
fixed_string&
|
basic_static_string&
|
||||||
{
|
{
|
||||||
BOOST_FIXED_STRING_THROW(std::length_error{
|
BOOST_STATIC_STRING_THROW(std::length_error{
|
||||||
"max_size() == 0"});
|
"max_size() == 0"});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Integer, class>
|
template<class Integer, class>
|
||||||
inline
|
inline
|
||||||
fixed_string<detail::max_digits(sizeof(Integer))>
|
basic_static_string<detail::max_digits(sizeof(Integer)), char>
|
||||||
to_fixed_string(Integer x)
|
to_static_string(Integer x)
|
||||||
{
|
{
|
||||||
using CharT = char;
|
using CharT = char;
|
||||||
using Traits = std::char_traits<CharT>;
|
using Traits = std::char_traits<CharT>;
|
||||||
BOOST_FIXED_STRING_STATIC_ASSERT(std::is_integral<Integer>::value, "Integer must be an integral type");
|
BOOST_STATIC_STRING_STATIC_ASSERT(std::is_integral<Integer>::value, "Integer must be an integral type");
|
||||||
char buf[detail::max_digits(sizeof(Integer))];
|
char buf[detail::max_digits(sizeof(Integer))];
|
||||||
auto last = buf + sizeof(buf);
|
auto last = buf + sizeof(buf);
|
||||||
auto it = detail::raw_to_string<
|
auto it = detail::raw_to_string<
|
||||||
CharT, Integer, Traits>(last, sizeof(buf), x);
|
CharT, Integer, Traits>(last, sizeof(buf), x);
|
||||||
fixed_string<detail::max_digits(sizeof(Integer))> s;
|
basic_static_string<detail::max_digits(sizeof(Integer)), char> s;
|
||||||
s.resize(static_cast<std::size_t>(last - it));
|
s.resize(static_cast<std::size_t>(last - it));
|
||||||
auto p = s.data();
|
auto p = s.data();
|
||||||
while(it < last)
|
while(it < last)
|
||||||
@ -880,7 +880,7 @@ to_fixed_string(Integer x)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // fixed_string
|
} // static_string
|
||||||
} // boost
|
} // boost
|
||||||
|
|
||||||
#endif
|
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,14 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Boost.FixedString</title>
|
<title>Boost.StaticString</title>
|
||||||
<meta http-equiv="refresh" content="0; URL=https://18.github.io/doc/fixed_string/">
|
<meta http-equiv="refresh" content="0; URL=https://18.github.io/doc/static_string/">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Automatic redirection failed, please go to
|
Automatic redirection failed, please go to
|
||||||
<a href="https://18.github.io/doc/fixed_string/">https://18.github.io/doc/fixed_string/</a>
|
<a href="https://18.github.io/doc/static_string/">https://18.github.io/doc/static_string/</a>
|
||||||
<hr>
|
<hr>
|
||||||
<tt>
|
<tt>
|
||||||
Boost.FixedString<br>
|
Boost.StaticString<br>
|
||||||
<br>
|
<br>
|
||||||
Copyright (C) 2019 Vinnie Falco<br>
|
Copyright (C) 2019 Vinnie Falco<br>
|
||||||
Copyright (C) 2019 Krystian Stasiowski<br>
|
Copyright (C) 2019 Krystian Stasiowski<br>
|
||||||
|
@ -4,16 +4,16 @@
|
|||||||
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#
|
#
|
||||||
# Official repository: https://github.com/boostorg/fixed_string
|
# Official repository: https://github.com/boostorg/static_string
|
||||||
#
|
#
|
||||||
|
|
||||||
GroupSources (include/boost/fixed_string fixed_string)
|
GroupSources (include/boost/static_string static_string)
|
||||||
GroupSources (test "/")
|
GroupSources (test "/")
|
||||||
|
|
||||||
add_executable (tests
|
add_executable (tests
|
||||||
${PROJECT_FILES}
|
${PROJECT_FILES}
|
||||||
Jamfile
|
Jamfile
|
||||||
fixed_string.cpp
|
static_string.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(tests
|
target_link_libraries(tests
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#
|
#
|
||||||
# Official repository: https://github.com/boostorg/fixed_string
|
# Official repository: https://github.com/boostorg/static_string
|
||||||
#
|
#
|
||||||
|
|
||||||
import testing ;
|
import testing ;
|
||||||
@ -22,4 +22,4 @@ local defines =
|
|||||||
|
|
||||||
project : requirements $(defines) ;
|
project : requirements $(defines) ;
|
||||||
|
|
||||||
run fixed_string.cpp ;
|
run static_string.cpp ;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user