From e15336de6032b8f35322e73eb450f4fec95c2f1a Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Fri, 8 Nov 2019 21:36:21 -0500 Subject: [PATCH] Changed ctor briefs, and guarded macros --- include/boost/fixed_string/config.hpp | 12 +++++ include/boost/fixed_string/fixed_string.hpp | 59 ++++++++++++++++----- 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/include/boost/fixed_string/config.hpp b/include/boost/fixed_string/config.hpp index d8c55d2..99a2f90 100644 --- a/include/boost/fixed_string/config.hpp +++ b/include/boost/fixed_string/config.hpp @@ -42,14 +42,26 @@ // Boost and non-Boost versions of utilities #ifdef BOOST_FIXED_STRING_USE_BOOST +#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 { diff --git a/include/boost/fixed_string/fixed_string.hpp b/include/boost/fixed_string/fixed_string.hpp index d0cb8ff..fb3404c 100644 --- a/include/boost/fixed_string/fixed_string.hpp +++ b/include/boost/fixed_string/fixed_string.hpp @@ -97,10 +97,15 @@ public: // //-------------------------------------------------------------------------- - /// Construct an empty string + /** Construct a `fixed_string`. + + Construct an empty string + */ fixed_string(); - /** Construct the string with `count` copies of character `ch`. + /** Construct a `fixed_string`. + + Construct the string with `count` copies of character `ch`. The behavior is undefined if `count >= npos` */ @@ -108,29 +113,44 @@ public: size_type count, CharT ch); - /// Construct with a substring (pos, other.size()) of `other`. + /** Construct a `fixed_string`. + + Construct with a substring (pos, other.size()) of `other`. + */ template fixed_string( fixed_string const& other, size_type pos); - /// Construct with a substring (pos, count) of `other`. + /** Construct a `fixed_string`. + + Construct with a substring (pos, count) of `other`. + */ template fixed_string( fixed_string const& other, size_type pos, size_type count); - /// Construct with the first `count` characters of `s`, including nulls. + /** Construct a `fixed_string`. + + Construct with the first `count` characters of `s`, including nulls. + */ fixed_string( CharT const* s, size_type count); - /// Construct from a null terminated string. + /** Construct a `fixed_string`. + + Construct from a null terminated string. + */ fixed_string( CharT const* s); - /// Construct from a range of characters + /** Construct a `fixed_string`. + + Construct from a range of characters + */ template fixed_string( InputIterator first, @@ -142,26 +162,39 @@ public: #endif ); - /// Copy constructor. + /** Construct a `fixed_string`. + + Copy constructor. + */ fixed_string( fixed_string const& other); - /// Copy constructor. + /** Construct a `fixed_string`. + + Copy constructor. + */ template fixed_string( fixed_string const& other); - /// Construct from an initializer list + /** Construct a `fixed_string`. + + Construct from an initializer list + */ fixed_string( std::initializer_list init); - /// Construct from a `string_view` - + /** Construct a `fixed_string`. + + Construct from a `string_view` + */ explicit fixed_string( string_view_type sv); - /** Construct from any object convertible to `string_view_type`. + /** Construct a `fixed_string`. + + Construct from any object convertible to `string_view_type`. The range (pos, n) is extracted from the value obtained by converting `t` to `string_view_type`,