Changed ctor briefs, and guarded macros

This commit is contained in:
Krystian Stasiowski
2019-11-08 21:36:21 -05:00
parent 4c0a93d679
commit e15336de60
2 changed files with 58 additions and 13 deletions

View File

@ -42,14 +42,26 @@
// Boost and non-Boost versions of utilities // Boost and non-Boost versions of utilities
#ifdef BOOST_FIXED_STRING_USE_BOOST #ifdef BOOST_FIXED_STRING_USE_BOOST
#ifndef BOOST_FIXED_STRING_THROW
#define BOOST_FIXED_STRING_THROW(ex) BOOST_THROW_EXCEPTION(ex) #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) #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) #define BOOST_FIXED_STRING_ASSERT(cond) BOOST_ASSERT(cond)
#endif
#else #else
#ifndef BOOST_FIXED_STRING_THROW
#define BOOST_FIXED_STRING_THROW(ex) throw ex #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) #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) #define BOOST_FIXED_STRING_ASSERT(cond) assert(cond)
#endif #endif
#endif
namespace boost { namespace boost {
namespace fixed_string { namespace fixed_string {

View File

@ -97,10 +97,15 @@ public:
// //
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/// Construct an empty string /** Construct a `fixed_string`.
Construct an empty string
*/
fixed_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` The behavior is undefined if `count >= npos`
*/ */
@ -108,29 +113,44 @@ public:
size_type count, size_type count,
CharT ch); 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<std::size_t M> template<std::size_t M>
fixed_string( fixed_string(
fixed_string<M, CharT, Traits> const& other, fixed_string<M, CharT, Traits> const& other,
size_type pos); size_type pos);
/// Construct with a substring (pos, count) of `other`. /** Construct a `fixed_string`.
Construct with a substring (pos, count) of `other`.
*/
template<std::size_t M> template<std::size_t M>
fixed_string( fixed_string(
fixed_string<M, CharT, Traits> const& other, fixed_string<M, CharT, Traits> const& other,
size_type pos, size_type pos,
size_type count); 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( fixed_string(
CharT const* s, CharT const* s,
size_type count); size_type count);
/// Construct from a null terminated string. /** Construct a `fixed_string`.
Construct from a null terminated string.
*/
fixed_string( fixed_string(
CharT const* s); CharT const* s);
/// Construct from a range of characters /** Construct a `fixed_string`.
Construct from a range of characters
*/
template<class InputIterator> template<class InputIterator>
fixed_string( fixed_string(
InputIterator first, InputIterator first,
@ -142,26 +162,39 @@ public:
#endif #endif
); );
/// Copy constructor. /** Construct a `fixed_string`.
Copy constructor.
*/
fixed_string( fixed_string(
fixed_string const& other); fixed_string const& other);
/// Copy constructor. /** Construct a `fixed_string`.
Copy constructor.
*/
template<std::size_t M> template<std::size_t M>
fixed_string( fixed_string(
fixed_string<M, CharT, Traits> const& other); fixed_string<M, CharT, Traits> const& other);
/// Construct from an initializer list /** Construct a `fixed_string`.
Construct from an initializer list
*/
fixed_string( fixed_string(
std::initializer_list<CharT> init); std::initializer_list<CharT> init);
/// Construct from a `string_view` /** Construct a `fixed_string`.
Construct from a `string_view`
*/
explicit explicit
fixed_string( fixed_string(
string_view_type sv); 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 The range (pos, n) is extracted from the value
obtained by converting `t` to `string_view_type`, obtained by converting `t` to `string_view_type`,