proxygen
folly::BasicFixedString< Char, N > Class Template Reference

A class for holding up to N characters of type Char that is amenable to constexpr string manipulation. It is guaranteed to not perform any dynamic allocation. More...

#include <FixedString.h>

Inheritance diagram for folly::BasicFixedString< Char, N >:
folly::detail::fixedstring::FixedStringBase_< class >

Public Types

using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using reference = Char &
 
using const_reference = const Char &
 
using pointer = Char *
 
using const_pointer = const Char *
 
using iterator = Char *
 
using const_iterator = const Char *
 
using reverse_iterator = detail::fixedstring::ReverseIterator< Char >
 
using const_reverse_iterator = detail::fixedstring::ReverseIterator< const Char >
 

Public Member Functions

constexpr BasicFixedString ()
 
constexpr BasicFixedString (const BasicFixedString &)=default
 
template<std::size_t M>
constexpr BasicFixedString (const BasicFixedString< Char, M > &that) noexcept(M<=N)
 
template<std::size_t M>
constexpr BasicFixedString (const BasicFixedString< Char, M > &that, std::size_t pos) noexcept(false)=delete
 
template<std::size_t M>
constexpr BasicFixedString (const BasicFixedString< Char, M > &that, std::size_t pos, std::size_t count) noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString (const Char(&that)[M]) noexcept
 
constexpr BasicFixedString (const Char *that, std::size_t count) noexcept(false)
 
constexpr BasicFixedString (std::size_t count, Char ch) noexcept(false)
 
constexpr BasicFixedString (std::initializer_list< Char > il) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringoperator= (const BasicFixedString &) noexcept=default
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringoperator= (const BasicFixedString< Char, M > &that) noexcept(M<=N)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringoperator= (const Char(&that)[M]) noexcept
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringoperator= (std::initializer_list< Char > il) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR Range< Char * > toRange () noexcept
 
constexpr Range< const Char * > toRange () const noexcept
 
 operator std::basic_string< Char > () const noexcept(false)
 
std::basic_string< Char > toStdString () const noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringassign (std::size_t count, Char ch) noexcept(false)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringassign (const BasicFixedString< Char, M > &that) noexcept(M<=N)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringassign (const BasicFixedString< Char, M > &that, std::size_t pos) noexcept(false)=delete
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringassign (const BasicFixedString< Char, M > &that, std::size_t pos, std::size_t count) noexcept(false)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringassign (const Char(&that)[M]) noexcept
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringassign (const Char *that, std::size_t count) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR void swap (BasicFixedString &that) noexcept
 
FOLLY_CPP14_CONSTEXPR Char * data () noexcept
 
constexpr const Char * data () const noexcept
 
constexpr const Char * c_str () const noexcept
 
FOLLY_CPP14_CONSTEXPR Char * begin () noexcept
 
constexpr const Char * begin () const noexcept
 
constexpr const Char * cbegin () const noexcept
 
FOLLY_CPP14_CONSTEXPR Char * end () noexcept
 
constexpr const Char * end () const noexcept
 
constexpr const Char * cend () const noexcept
 
FOLLY_CPP14_CONSTEXPR reverse_iterator rbegin () noexcept
 
constexpr const_reverse_iterator rbegin () const noexcept
 
constexpr const_reverse_iterator crbegin () const noexcept
 
FOLLY_CPP14_CONSTEXPR reverse_iterator rend () noexcept
 
constexpr const_reverse_iterator rend () const noexcept
 
constexpr const_reverse_iterator crend () const noexcept
 
constexpr std::size_t size () const noexcept
 
constexpr std::size_t length () const noexcept
 
constexpr bool empty () const noexcept
 
std::uint32_t hash () const noexcept
 
FOLLY_CPP14_CONSTEXPR Char & at (std::size_t i) noexcept(false)
 
constexpr const Char & at (std::size_t i) const noexcept(false)
 
FOLLY_CPP14_CONSTEXPR Char & operator[] (std::size_t i) noexcept
 
constexpr const Char & operator[] (std::size_t i) const noexcept
 
FOLLY_CPP14_CONSTEXPR Char & front () noexcept
 
constexpr const Char & front () const noexcept
 
FOLLY_CPP14_CONSTEXPR Char & back () noexcept
 
constexpr const Char & back () const noexcept
 
FOLLY_CPP14_CONSTEXPR void clear () noexcept
 
FOLLY_CPP14_CONSTEXPR void push_back (Char ch) noexcept(false)
 
constexpr BasicFixedString< Char, N+1u > cpush_back (Char ch) const noexcept
 
FOLLY_CPP14_CONSTEXPR void pop_back () noexcept(false)
 
constexpr BasicFixedString< Char, N-1u > cpop_back () const noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringappend (std::size_t count, Char ch) noexcept(false)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringappend (const BasicFixedString< Char, M > &that) noexcept(false)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringappend (const BasicFixedString< Char, M > &that, std::size_t pos) noexcept(false)=delete
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringappend (const BasicFixedString< Char, M > &that, std::size_t pos, std::size_t count) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringappend (const Char *that) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringappend (const Char *that, std::size_t count) noexcept(false)
 
constexpr BasicFixedString< Char, N+1u > cappend (Char ch) const noexcept
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+Mcappend (const BasicFixedString< Char, M > &that) const noexcept
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+Mcappend (const BasicFixedString< Char, M > &that, std::size_t pos) const noexcept(false)=delete
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+Mcappend (const BasicFixedString< Char, M > &that, std::size_t pos, std::size_t count) const noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+M-1u > cappend (const Char(&that)[M]) const noexcept
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+M-1u > cappend (const Char(&that)[M], std::size_t pos) const noexcept(false)=delete
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+M-1u > cappend (const Char(&that)[M], std::size_t pos, std::size_t count) const noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringoperator+= (const Char *that) noexcept(false)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringoperator+= (const BasicFixedString< Char, M > &that) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringoperator+= (Char ch) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringoperator+= (std::initializer_list< Char > il) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringerase () noexcept
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringerase (std::size_t pos, std::size_t count=npos) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR Char * erase (const Char *first) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR Char * erase (const Char *first, const Char *last) noexcept(false)
 
constexpr BasicFixedString< Char, 0u > cerase () const noexcept
 
constexpr BasicFixedString cerase (std::size_t pos, std::size_t count=npos) const noexcept(false)
 
template<std::size_t M>
constexpr int compare (const BasicFixedString< Char, M > &that) const noexcept
 
template<std::size_t M>
constexpr int compare (std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that) const noexcept(false)
 
template<std::size_t M>
constexpr int compare (std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos, std::size_t that_count) const noexcept(false)
 
constexpr int compare (const Char *that) const noexcept
 
constexpr int compare (Range< const Char * > that) const noexcept
 
constexpr int compare (std::size_t this_pos, std::size_t this_count, const Char *that) const noexcept(false)
 
constexpr int compare (std::size_t this_pos, std::size_t this_count, Range< const Char * > that) const noexcept(false)
 
constexpr int compare (std::size_t this_pos, std::size_t this_count, const Char *that, std::size_t that_count) const noexcept(false)
 
constexpr int compare (std::size_t this_pos, std::size_t this_count, Range< const Char * > that, std::size_t that_count) const noexcept(false)
 
constexpr BasicFixedString substr (std::size_t pos) const noexcept(false)
 
constexpr BasicFixedString substr (std::size_t pos, std::size_t count) const noexcept(false)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringreplace (const Char *first, const Char *last, const BasicFixedString< Char, M > &that) noexcept(false)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringreplace (std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) noexcept(false)
 
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedStringreplace (std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos, std::size_t that_count) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringreplace (std::size_t this_pos, std::size_t this_count, const Char *that) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringreplace (const Char *first, const Char *last, const Char *that) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringreplace (std::size_t this_pos, std::size_t this_count, const Char *that, std::size_t that_count) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringreplace (std::size_t this_pos, std::size_t this_count, std::size_t that_count, Char ch) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringreplace (const Char *first, const Char *last, std::size_t that_count, Char ch) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR BasicFixedStringreplace (const Char *first, const Char *last, std::initializer_list< Char > il) noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+Mcreplace (std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+Mcreplace (std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos, std::size_t that_count) const noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+Mcreplace (const Char *first, const Char *last, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+Mcreplace (const Char *first, const Char *last, const BasicFixedString< Char, M > &that, std::size_t that_pos, std::size_t that_count) const noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+M-1u > creplace (std::size_t this_pos, std::size_t this_count, const Char(&that)[M]) const noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+M-1u > creplace (std::size_t this_pos, std::size_t this_count, const Char(&that)[M], std::size_t that_pos, std::size_t that_count) const noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+M-1u > creplace (const Char *first, const Char *last, const Char(&that)[M]) const noexcept(false)
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+M-1u > creplace (const Char *first, const Char *last, const Char(&that)[M], std::size_t that_pos, std::size_t that_count) const noexcept(false)
 
FOLLY_CPP14_CONSTEXPR std::size_t copy (Char *dest, std::size_t count) const noexcept
 
FOLLY_CPP14_CONSTEXPR std::size_t copy (Char *dest, std::size_t count, std::size_t pos) const noexcept(false)
 
FOLLY_CPP14_CONSTEXPR void resize (std::size_t count) noexcept(false)
 
FOLLY_CPP14_CONSTEXPR void resize (std::size_t count, Char ch) noexcept(false)
 
template<std::size_t M>
constexpr std::size_t find (const BasicFixedString< Char, M > &that) const noexcept
 
template<std::size_t M>
constexpr std::size_t find (const BasicFixedString< Char, M > &that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find (const Char *that) const noexcept
 
constexpr std::size_t find (const Char *that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find (const Char *that, std::size_t pos, std::size_t count) const noexcept(false)
 
constexpr std::size_t find (Char ch) const noexcept
 
constexpr std::size_t find (Char ch, std::size_t pos) const noexcept(false)
 
template<std::size_t M>
constexpr std::size_t rfind (const BasicFixedString< Char, M > &that) const noexcept
 
template<std::size_t M>
constexpr std::size_t rfind (const BasicFixedString< Char, M > &that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t rfind (const Char *that) const noexcept
 
constexpr std::size_t rfind (const Char *that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t rfind (const Char *that, std::size_t pos, std::size_t count) const noexcept(false)
 
constexpr std::size_t rfind (Char ch) const noexcept
 
constexpr std::size_t rfind (Char ch, std::size_t pos) const noexcept(false)
 
template<std::size_t M>
constexpr std::size_t find_first_of (const BasicFixedString< Char, M > &that) const noexcept
 
template<std::size_t M>
constexpr std::size_t find_first_of (const BasicFixedString< Char, M > &that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find_first_of (const Char *that) const noexcept
 
constexpr std::size_t find_first_of (const Char *that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find_first_of (const Char *that, std::size_t pos, std::size_t count) const noexcept(false)
 
constexpr std::size_t find_first_of (Char ch) const noexcept
 
constexpr std::size_t find_first_of (Char ch, std::size_t pos) const noexcept(false)
 
template<std::size_t M>
constexpr std::size_t find_first_not_of (const BasicFixedString< Char, M > &that) const noexcept
 
template<std::size_t M>
constexpr std::size_t find_first_not_of (const BasicFixedString< Char, M > &that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find_first_not_of (const Char *that) const noexcept
 
constexpr std::size_t find_first_not_of (const Char *that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find_first_not_of (const Char *that, std::size_t pos, std::size_t count) const noexcept(false)
 
constexpr std::size_t find_first_not_of (Char ch) const noexcept
 
constexpr std::size_t find_first_not_of (Char ch, std::size_t pos) const noexcept(false)
 
template<std::size_t M>
constexpr std::size_t find_last_of (const BasicFixedString< Char, M > &that) const noexcept
 
template<std::size_t M>
constexpr std::size_t find_last_of (const BasicFixedString< Char, M > &that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find_last_of (const Char *that) const noexcept
 
constexpr std::size_t find_last_of (const Char *that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find_last_of (const Char *that, std::size_t pos, std::size_t count) const noexcept(false)
 
constexpr std::size_t find_last_of (Char ch) const noexcept
 
constexpr std::size_t find_last_of (Char ch, std::size_t pos) const noexcept(false)
 
template<std::size_t M>
constexpr std::size_t find_last_not_of (const BasicFixedString< Char, M > &that) const noexcept
 
template<std::size_t M>
constexpr std::size_t find_last_not_of (const BasicFixedString< Char, M > &that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find_last_not_of (const Char *that) const noexcept
 
constexpr std::size_t find_last_not_of (const Char *that, std::size_t pos) const noexcept(false)
 
constexpr std::size_t find_last_not_of (const Char *that, std::size_t pos, std::size_t count) const noexcept(false)
 
constexpr std::size_t find_last_not_of (Char ch) const noexcept
 
constexpr std::size_t find_last_not_of (Char ch, std::size_t pos) const noexcept(false)
 

Static Public Member Functions

static constexpr std::size_t capacity () noexcept
 
static constexpr std::size_t max_size () noexcept
 

Private Types

using Indices = folly::make_index_sequence< N >
 

Private Member Functions

template<class That , std::size_t... Is>
constexpr BasicFixedString (const That &that, std::size_t size, folly::index_sequence< Is... >, std::size_t pos=0, std::size_t count=npos) noexcept
 
template<std::size_t... Is>
constexpr BasicFixedString (std::size_t count, Char ch, folly::index_sequence< Is... >) noexcept
 
template<class Left , class Right , std::size_t... Is>
constexpr BasicFixedString (const Left &left, std::size_t left_size, const Right &right, std::size_t right_size, folly::index_sequence< Is... >) noexcept
 
template<class Left , class Right , std::size_t... Is>
constexpr BasicFixedString (const Left &left, std::size_t left_size, std::size_t left_pos, std::size_t left_count, const Right &right, std::size_t right_pos, std::size_t right_count, folly::index_sequence< Is... >) noexcept
 

Private Attributes

Char data_ [N+1u]
 
std::size_t size_
 

Friends

template<class , std::size_t >
class BasicFixedString
 
struct detail::fixedstring::Helper
 
constexpr bool operator== (const Char *a, const BasicFixedString &b) noexcept
 
constexpr bool operator== (const BasicFixedString &a, const Char *b) noexcept
 
constexpr bool operator== (Range< const Char * > a, const BasicFixedString &b) noexcept
 
constexpr bool operator== (const BasicFixedString &a, Range< const Char * > b) noexcept
 
constexpr bool operator!= (const Char *a, const BasicFixedString &b) noexcept
 
constexpr bool operator!= (const BasicFixedString &a, const Char *b) noexcept
 
constexpr bool operator!= (Range< const Char * > a, const BasicFixedString &b) noexcept
 
constexpr bool operator!= (const BasicFixedString &a, Range< const Char * > b) noexcept
 
constexpr bool operator< (const Char *a, const BasicFixedString &b) noexcept
 
constexpr bool operator< (const BasicFixedString &a, const Char *b) noexcept
 
constexpr bool operator< (Range< const Char * > a, const BasicFixedString &b) noexcept
 
constexpr bool operator< (const BasicFixedString &a, Range< const Char * > b) noexcept
 
constexpr bool operator> (const Char *a, const BasicFixedString &b) noexcept
 
constexpr bool operator> (const BasicFixedString &a, const Char *b) noexcept
 
constexpr bool operator> (Range< const Char * > a, const BasicFixedString &b) noexcept
 
constexpr bool operator> (const BasicFixedString &a, Range< const Char * > b) noexcept
 
constexpr bool operator<= (const Char *a, const BasicFixedString &b) noexcept
 
constexpr bool operator<= (const BasicFixedString &a, const Char *b) noexcept
 
constexpr bool operator<= (Range< const Char * > const &a, const BasicFixedString &b) noexcept
 
constexpr bool operator<= (const BasicFixedString &a, Range< const Char * > b) noexcept
 
constexpr bool operator>= (const Char *a, const BasicFixedString &b) noexcept
 
constexpr bool operator>= (const BasicFixedString &a, const Char *b) noexcept
 
constexpr bool operator>= (Range< const Char * > a, const BasicFixedString &b) noexcept
 
constexpr bool operator>= (const BasicFixedString &a, Range< const Char * > const &b) noexcept
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+M-1u > operator+ (const Char(&a)[M], const BasicFixedString &b) noexcept
 
template<std::size_t M>
constexpr BasicFixedString< Char, N+M-1u > operator+ (const BasicFixedString &a, const Char(&b)[M]) noexcept
 
constexpr BasicFixedString< Char, N+1u > operator+ (Char a, const BasicFixedString &b) noexcept
 
constexpr BasicFixedString< Char, N+1u > operator+ (const BasicFixedString &a, Char b) noexcept
 

Additional Inherited Members

- Static Private Attributes inherited from folly::detail::fixedstring::FixedStringBase_< class >
static constexpr std::size_t npos = static_cast<std::size_t>(-1)
 

Detailed Description

template<class Char, std::size_t N>
class folly::BasicFixedString< Char, N >

A class for holding up to N characters of type Char that is amenable to constexpr string manipulation. It is guaranteed to not perform any dynamic allocation.


Template Parameters
CharThe character type. Must be a scalar type.
NThe capacity and max size of string instances of this type.

BasicFixedString is a std::string work-alike that stores characters in an internal buffer. It has minor interface differences that make it easy to work with strings in a constexpr context.

Example:
constexpr auto hello = makeFixedString("hello"); // a FixedString<5>
constexpr auto world = makeFixedString("world"); // a FixedString<5>
constexpr auto hello_world = hello + ' ' + world + '!'; // a FixedString<12>
static_assert(hello_world == "hello world!", "neato!");
FixedString<N> is an alias for BasicFixedString<char, N>.
Constexpr and In-place Mutation
On a C++14 compiler, BasicFixedString supports the full std::string interface as constexpr member functions. On a C++11 compiler, the mutating members are not constexpr, but non-mutating alternatives, which create a new string, can be used instead. For example, instead of this:
constexpr FixedString<10> replace_example_cpp14() {
FixedString<10> test{"****"};
test.replace(1, 2, "!!!!");
return test; // returns "*!!!!*"
}
You might write this instead:
constexpr FixedString<10> replace_example_cpp11() {
// GNU compilers have an extension that make it possible to create
// FixedString objects with a `""_fs` user-defined literal.
using namespace folly;
return makeFixedString("****").creplace(1, 2, "!!!!"); // "*!!!!*"
}
User-defined Literals
Instead of using the folly::makeFixedString helper function, you can use a user-defined literal to make FixedString instances. The UDL feature of C++ has some limitations that make this less than ideal; you must tell the compiler roughly how many characters are in the string. The suffixes _fs4, _fs8, _fs16, _fs32, _fs64, and _fs128 exist to create instances of types FixedString<4>, FixedString<8>, etc. For example:
using namespace folly::string_literals;
constexpr auto hello = "hello"_fs8; // A FixedString<8> containing "hello"
See Error Handling below for what to expect when you try to exceed the capacity of a FixedString by storing too many characters in it.
If your compiler supports GNU extensions, there is one additional suffix you can use: _fs. This suffix always creates FixedString objects of exactly the right size. For example:
using namespace folly::string_literals;
// NOTE: Only works on compilers with GNU extensions enabled. Clang and
// gcc support this (-Wgnu-string-literal-operator-template):
constexpr auto hello = "hello"_fs; // A FixedString<5> containing "hello"
Error Handling:
The capacity of a BasicFixedString is set at compile time. When the user asks the string to exceed its capacity, one of three things will happen, depending on the context:
  1. If the attempt is made while evaluating a constant expression, the program will fail to compile.
  2. Otherwise, if the program is being run in debug mode, it will assert.
  3. Otherwise, the failed operation will throw a std::out_of_range exception.
This is also the case if an invalid offset is passed to any member function, or if pop_back or cpop_back is called on an empty BasicFixedString.

Member functions documented as having preconditions will assert in Debug mode (!defined(NDEBUG)) on precondition failures. Those documented with Throws clauses will throw the specified exception on failure. Those with both a precondition and a Throws clause will assert in Debug and throw in Release mode.

Definition at line 42 of file FixedString.h.

Member Typedef Documentation

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::const_iterator = const Char*

Definition at line 599 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::const_pointer = const Char*

Definition at line 597 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::const_reference = const Char&

Definition at line 595 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::const_reverse_iterator = detail::fixedstring::ReverseIterator<const Char>

Definition at line 602 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::difference_type = std::ptrdiff_t

Definition at line 593 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::Indices = folly::make_index_sequence<N>
private

Definition at line 531 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::iterator = Char*

Definition at line 598 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::pointer = Char*

Definition at line 596 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::reference = Char&

Definition at line 594 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::reverse_iterator = detail::fixedstring::ReverseIterator<Char>

Definition at line 600 of file FixedString.h.

template<class Char, std::size_t N>
using folly::BasicFixedString< Char, N >::size_type = std::size_t

Definition at line 592 of file FixedString.h.

Constructor & Destructor Documentation

template<class Char, std::size_t N>
template<class That , std::size_t... Is>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( const That &  that,
std::size_t  size,
folly::index_sequence< Is... >  ,
std::size_t  pos = 0,
std::size_t  count = npos 
)
inlineprivatenoexcept

Definition at line 534 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), folly::constexpr_min(), count, and folly::size().

540  : data_{(Is < (size - pos) && Is < count ? that[Is + pos] : Char(0))...,
541  Char(0)},
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
int * count
constexpr std::size_t size() const noexcept
Definition: FixedString.h:1062
template<class Char, std::size_t N>
template<std::size_t... Is>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( std::size_t  count,
Char  ch,
folly::index_sequence< Is... >   
)
inlineprivatenoexcept

Definition at line 545 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), and count.

549  : data_{((Is < count) ? ch : Char(0))..., Char(0)}, size_{count} {}
auto ch
int * count
template<class Char, std::size_t N>
template<class Left , class Right , std::size_t... Is>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( const Left &  left,
std::size_t  left_size,
const Right &  right,
std::size_t  right_size,
folly::index_sequence< Is... >   
)
inlineprivatenoexcept

Definition at line 553 of file FixedString.h.

References testing::gmock_generated_actions_test::Char().

559  : data_{detail::fixedstring::char_at_<Char>(
560  left,
561  left_size,
562  right,
563  right_size,
564  Is)...,
565  Char(0)},
566  size_{left_size + right_size} {}
template<class Char, std::size_t N>
template<class Left , class Right , std::size_t... Is>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( const Left &  left,
std::size_t  left_size,
std::size_t  left_pos,
std::size_t  left_count,
const Right &  right,
std::size_t  right_pos,
std::size_t  right_count,
folly::index_sequence< Is... >   
)
inlineprivatenoexcept

Definition at line 570 of file FixedString.h.

References testing::gmock_generated_actions_test::Char().

579  : data_{detail::fixedstring::char_at_<Char>(
580  left,
581  left_size,
582  left_pos,
583  left_count,
584  right,
585  right_pos,
586  right_count,
587  Is)...,
588  Char(0)},
589  size_{left_size - left_count + right_count} {}
template<class Char, std::size_t N>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( )
inline

Default construct

Postcondition
size() == 0
at(0) == Char(0)

Definition at line 611 of file FixedString.h.

611 : data_{}, size_{} {}
template<class Char, std::size_t N>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( const BasicFixedString< Char, N > &  )
default

Copy construct

Postcondition
size() == that.size()
0 == strncmp(data(), that.data(), size())
at(size()) == Char(0)
template<class Char, std::size_t N>
template<std::size_t M>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( const BasicFixedString< Char, M > &  that)
inlinenoexcept

Construct from a differently-sized BasicFixedString

Precondition
that.size() <= N
Postcondition
size() == that.size()
0 == strncmp(data(), that.data(), size())
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen that.size() > N. When M <= N, this constructor will never throw.
Note
Conversions from larger-capacity BasicFixedString objects to smaller ones (M > N) are allowed as long as the size() of the source string is small enough.

Definition at line 634 of file FixedString.h.

References folly::pushmi::__adl::noexcept(), and folly::BasicFixedString< Char, N >::size_.

636  : BasicFixedString{that, 0u, that.size_} {}
constexpr BasicFixedString()
Definition: FixedString.h:611
template<class Char, std::size_t N>
template<std::size_t M>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
)
deletenoexcept
template<class Char, std::size_t N>
template<std::size_t M>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( const BasicFixedString< Char, M > &  that,
std::size_t  pos,
std::size_t  count 
)
inlinenoexcept

Construct from an BasicFixedString, an offset, and a count

Parameters
thatThe source string
posThe starting position in that
countThe number of characters to copy. If npos, count is taken to be that.size()-pos.
Precondition
pos <= that.size()
count <= that.size()-pos && count <= N
Postcondition
size() == count
0 == strncmp(data(), that.data()+pos, size())
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen pos+count > that.size(), or when count > N

Definition at line 660 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::checkOverflowOrNpos(), count, folly::BasicFixedString< Char, N >::data_, M, folly::BasicFixedString< Char, N >::size_, and type.

665  that.data_,
666  that.size_,
668  pos,
671  count,
672  that.size_ -
673  detail::fixedstring::checkOverflow(pos, that.size_)),
674  N)} {}
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max)
Definition: FixedString.h:76
make_integer_sequence< std::size_t, Size > make_index_sequence
Definition: Utility.h:209
constexpr BasicFixedString()
Definition: FixedString.h:611
int * count
template<class Char, std::size_t N>
template<std::size_t M>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( const Char(&)  that[M])
inlinenoexcept

Construct from a string literal

Precondition
M-1 <= N
that[M-1] == Char(0)
Postcondition
0 == strncmp(data(), that, M-1)
size() == M-1
at(size()) == Char(0)

Definition at line 685 of file FixedString.h.

References folly::detail::fixedstring::checkNullTerminated().

687  M - 1u,
688  folly::make_index_sequence<M - 1u>{}} {}
constexpr const Char(& checkNullTerminated(const Char(&a)[N]) noexcept)[N]
Definition: FixedString.h:92
make_integer_sequence< std::size_t, Size > make_index_sequence
Definition: Utility.h:209
constexpr BasicFixedString()
Definition: FixedString.h:611
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<class Char, std::size_t N>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( const Char *  that,
std::size_t  count 
)
inlinenoexcept

Construct from a const Char* and count

Precondition
that points to an array of at least count characters.
count <= N
Postcondition
size() == count
0 == strncmp(data(), that, size())
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen count > N

Definition at line 699 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), and count.

701  : BasicFixedString{that,
703  Indices{}} {}
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
folly::make_index_sequence< N > Indices
Definition: FixedString.h:531
constexpr BasicFixedString()
Definition: FixedString.h:611
int * count
template<class Char, std::size_t N>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( std::size_t  count,
Char  ch 
)
inlinenoexcept

Construct an BasicFixedString that contains count characters, all of which are ch.

Precondition
count <= N
Postcondition
size() == count
npos == find_first_not_of(ch)
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen count > N

Definition at line 714 of file FixedString.h.

References ch, folly::detail::fixedstring::checkOverflow(), and count.

716  ch,
717  Indices{}} {}
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
folly::make_index_sequence< N > Indices
Definition: FixedString.h:531
auto ch
constexpr BasicFixedString()
Definition: FixedString.h:611
int * count
template<class Char, std::size_t N>
constexpr folly::BasicFixedString< Char, N >::BasicFixedString ( std::initializer_list< Char >  il)
inlinenoexcept

Construct an BasicFixedString from a std::initializer_list of characters.

Precondition
il.size() <= N
Postcondition
size() == count
0 == strncmp(data(), il.begin(), size())
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen il.size() > N

Definition at line 728 of file FixedString.h.

References folly::BasicFixedString< Char, N >::begin(), FOLLY_CPP14_CONSTEXPR, and folly::pushmi::__adl::noexcept().

729  : BasicFixedString{il.begin(), il.size()} {}
constexpr BasicFixedString()
Definition: FixedString.h:611

Member Function Documentation

template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::append ( std::size_t  count,
Char  ch 
)
inlinenoexcept

Appends count copies of ch to this string.

Precondition
count + old_size <= N
Postcondition
The first old_size characters of the string are unmodified.
size() == old_size + count
Exceptions
std::out_of_rangeif count > N - size().

Definition at line 1240 of file FixedString.h.

References ch, testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), count, and i.

1242  {
1244  for (std::size_t i = 0u; i < count; ++i) {
1245  data_[size_ + i] = ch;
1246  }
1247  size_ += count;
1248  data_[size_] = Char(0);
1249  return *this;
1250  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
auto ch
int * count
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::append ( const BasicFixedString< Char, M > &  that)
inlinenoexcept
Note
Equivalent to append(*this, 0, that.size()).

Definition at line 1256 of file FixedString.h.

References append(), FOLLY_CPP14_CONSTEXPR, folly::pushmi::__adl::noexcept(), and folly::BasicFixedString< Char, N >::size_.

1257  {
1258  return append(that, 0u, that.size_);
1259  }
FOLLY_CPP14_CONSTEXPR BasicFixedString & append(std::size_t count, Char ch) noexcept(false)
Definition: FixedString.h:1240
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::append ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
)
deletenoexcept
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::append ( const BasicFixedString< Char, M > &  that,
std::size_t  pos,
std::size_t  count 
)
inlinenoexcept

Appends count characters from another string to this one, starting at a given offset, pos.

Parameters
thatThe source string.
posThe starting position in the source string.
countThe number of characters to append. If npos, count is taken to be that.size()-pos.
Precondition
pos <= that.size()
count <= that.size() - pos
old_size + count <= N
Postcondition
The first old_size characters of the string are unmodified.
size() == old_size + count
at(size()) == Char(0)
Exceptions
std::out_of_rangeif pos + count > that.size() or if old_size + count > N.

Definition at line 1286 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::checkOverflowOrNpos(), count, folly::BasicFixedString< Char, N >::data_, i, and folly::BasicFixedString< Char, N >::size_.

1289  {
1290  detail::fixedstring::checkOverflow(pos, that.size_);
1293  for (std::size_t i = 0u; i < count; ++i) {
1294  data_[size_ + i] = that.data_[pos + i];
1295  }
1296  size_ += count;
1297  data_[size_] = Char(0);
1298  return *this;
1299  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max)
Definition: FixedString.h:76
int * count
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::append ( const Char *  that)
inlinenoexcept
Note
Equivalent to append(that, strlen(that)).

Definition at line 1304 of file FixedString.h.

References append(), and folly::constexpr_strlen().

1305  {
1306  return append(that, folly::constexpr_strlen(that));
1307  }
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
FOLLY_CPP14_CONSTEXPR BasicFixedString & append(std::size_t count, Char ch) noexcept(false)
Definition: FixedString.h:1240
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::append ( const Char *  that,
std::size_t  count 
)
inlinenoexcept

Appends count characters from the specified character array.

Precondition
that points to a range of at least count characters.
count + old_size <= N
Postcondition
The first old_size characters of the string are unmodified.
size() == old_size + count
at(size()) == Char(0)
Exceptions
std::out_of_rangeif old_size + count > N.

Definition at line 1318 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), count, and i.

1320  {
1322  for (std::size_t i = 0u; i < count; ++i) {
1323  data_[size_ + i] = that[i];
1324  }
1325  size_ += count;
1326  data_[size_] = Char(0);
1327  return *this;
1328  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
int * count
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::assign ( std::size_t  count,
Char  ch 
)
inlinenoexcept

Assigns a sequence of count characters of value ch.

Parameters
countThe count of characters.
ch
Precondition
count <= N
Postcondition
size() == count
npos == find_first_not_of(ch)
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen count > N
Returns
*this

Definition at line 844 of file FixedString.h.

References ch, testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), count, and i.

Referenced by TEST().

846  {
848  for (std::size_t i = 0u; i < count; ++i) {
849  data_[i] = ch;
850  }
851  size_ = count;
852  data_[size_] = Char(0);
853  return *this;
854  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
auto ch
int * count
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::assign ( const BasicFixedString< Char, M > &  that)
inlinenoexcept

Assigns characters from an BasicFixedString to this object.

Note
Equivalent to assign(that, 0, that.size())

Definition at line 861 of file FixedString.h.

References FOLLY_CPP14_CONSTEXPR, and folly::pushmi::__adl::noexcept().

862  {
863  return *this = that;
864  }
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::assign ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
)
deletenoexcept
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::assign ( const BasicFixedString< Char, M > &  that,
std::size_t  pos,
std::size_t  count 
)
inlinenoexcept

Assigns count characters from an BasicFixedString to this object, starting at position pos in the source object.

Parameters
thatThe source string.
posThe starting position in the source string.
countThe number of characters to copy. If npos, count is taken to be that.size()-pos.
Precondition
pos <= that.size()
count <= that.size()-pos
count <= N
Postcondition
size() == count
0 == strncmp(data(), that.begin() + pos, count)
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen pos > that.size() or count > that.size()-pos or count > N.
Returns
*this

Definition at line 893 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::checkOverflowOrNpos(), count, folly::BasicFixedString< Char, N >::data_, M, folly::BasicFixedString< Char, N >::size_, and type.

896  {
897  detail::fixedstring::checkOverflow(pos, that.size_);
898  return assign(
899  that.data_ + pos,
901  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max)
Definition: FixedString.h:76
FOLLY_CPP14_CONSTEXPR BasicFixedString & assign(std::size_t count, Char ch) noexcept(false)
Definition: FixedString.h:844
int * count
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::assign ( const Char(&)  that[M])
inlinenoexcept

Assigns characters from an BasicFixedString to this object.

Precondition
that contains no embedded nulls.
that[M-1] == Char(0)
Note
Equivalent to assign(that, M - 1)

Definition at line 910 of file FixedString.h.

References folly::detail::fixedstring::checkNullTerminated().

911  {
913  }
constexpr const Char(& checkNullTerminated(const Char(&a)[N]) noexcept)[N]
Definition: FixedString.h:92
FOLLY_CPP14_CONSTEXPR BasicFixedString & assign(std::size_t count, Char ch) noexcept(false)
Definition: FixedString.h:844
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::assign ( const Char *  that,
std::size_t  count 
)
inlinenoexcept

Assigns count characters from a range of characters to this object.

Parameters
thatA pointer to a range of characters.
countThe number of characters to copy.
Precondition
that points to at least count characters.
count <= N
Postcondition
size() == count
0 == strncmp(data(), that, count)
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen count > N
Returns
*this

Definition at line 927 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), count, and i.

929  {
931  for (std::size_t i = 0u; i < count; ++i) {
932  data_[i] = that[i];
933  }
934  size_ = count;
935  data_[size_] = Char(0);
936  return *this;
937  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
int * count
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Char& folly::BasicFixedString< Char, N >::at ( std::size_t  i)
inlinenoexcept
Note
at(size()) is allowed will return Char(0).
Returns
*(data() + i)
Exceptions
std::out_of_rangewhen i > size()

Definition at line 1105 of file FixedString.h.

References i.

1105  {
1106  return i <= size_ ? data_[i]
1107  : (throw_exception<std::out_of_range>(
1108  "Out of range in BasicFixedString::at"),
1109  data_[size_]);
1110  }
template<class Char, std::size_t N>
constexpr const Char& folly::BasicFixedString< Char, N >::at ( std::size_t  i) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1115 of file FixedString.h.

References i.

1115  {
1116  return i <= size_ ? data_[i]
1117  : (throw_exception<std::out_of_range>(
1118  "Out of range in BasicFixedString::at"),
1119  data_[size_]);
1120  }
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Char& folly::BasicFixedString< Char, N >::back ( )
inlinenoexcept
Note
Equivalent to at(size()-1)
Precondition
!empty()

Definition at line 1164 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow().

1164  {
1165 #ifdef NDEBUG
1166  return data_[size_ - 1u];
1167 #else
1169 #endif
1170  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
template<class Char, std::size_t N>
constexpr const Char& folly::BasicFixedString< Char, N >::back ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1175 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow().

1175  {
1176 #ifdef NDEBUG
1177  return data_[size_ - 1u];
1178 #else
1180 #endif
1181  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Char* folly::BasicFixedString< Char, N >::begin ( )
inlinenoexcept

Returns
data().

Definition at line 976 of file FixedString.h.

References data_.

Referenced by folly::BasicFixedString< Char, N >::BasicFixedString(), and folly::BasicFixedString< Char, N >::compare().

976  {
977  return data_;
978  }
template<class Char, std::size_t N>
constexpr const Char* folly::BasicFixedString< Char, N >::begin ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 983 of file FixedString.h.

References data_.

983  {
984  return data_;
985  }
template<class Char, std::size_t N>
constexpr const Char* folly::BasicFixedString< Char, N >::c_str ( ) const
inlinenoexcept

Returns
data().

Definition at line 969 of file FixedString.h.

References data_.

Referenced by TEST().

969  {
970  return data_;
971  }
template<class Char, std::size_t N>
static constexpr std::size_t folly::BasicFixedString< Char, N >::capacity ( )
inlinestaticnoexcept
Returns
N.

Definition at line 1083 of file FixedString.h.

1083  {
1084  return N;
1085  }
template<class Char, std::size_t N>
constexpr BasicFixedString<Char, N + 1u> folly::BasicFixedString< Char, N >::cappend ( Char  ch) const
inlinenoexcept

Creates a new string by appending a character to an existing string, which is left unmodified.

Note
Equivalent to *this + ch

Definition at line 1335 of file FixedString.h.

References ch.

1335  {
1336  return *this + ch;
1337  }
auto ch
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M> folly::BasicFixedString< Char, N >::cappend ( const BasicFixedString< Char, M > &  that) const
inlinenoexcept

Creates a new string by appending a string to an existing string, which is left unmodified.

Note
Equivalent to *this + ch

Definition at line 1345 of file FixedString.h.

References folly::pushmi::__adl::noexcept().

1346  {
1347  return *this + that;
1348  }
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M> folly::BasicFixedString< Char, N >::cappend ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
) const
deletenoexcept
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M> folly::BasicFixedString< Char, N >::cappend ( const BasicFixedString< Char, M > &  that,
std::size_t  pos,
std::size_t  count 
) const
inlinenoexcept

Creates a new string by appending characters from one string to another, which is left unmodified.

Note
Equivalent to *this + that.substr(pos, count)

Definition at line 1363 of file FixedString.h.

References count.

1366  {
1367  return creplace(size_, 0u, that, pos, count);
1368  }
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
int * count
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M - 1u> folly::BasicFixedString< Char, N >::cappend ( const Char(&)  that[M]) const
inlinenoexcept

Creates a new string by appending a string literal to a string, which is left unmodified.

Note
Equivalent to *this + that

Definition at line 1376 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), and folly::pushmi::__adl::noexcept().

1377  {
1378  return creplace(size_, 0u, that);
1379  }
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M - 1u> folly::BasicFixedString< Char, N >::cappend ( const Char(&)  that[M],
std::size_t  pos 
) const
deletenoexcept
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M - 1u> folly::BasicFixedString< Char, N >::cappend ( const Char(&)  that[M],
std::size_t  pos,
std::size_t  count 
) const
inlinenoexcept

Creates a new string by appending characters from one string to another, which is left unmodified.

Note
Equivalent to *this + makeFixedString(that).substr(pos, count)

Definition at line 1395 of file FixedString.h.

References count.

1396  {
1397  return creplace(size_, 0u, that, pos, count);
1398  }
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
int * count
template<class Char, std::size_t N>
constexpr const Char* folly::BasicFixedString< Char, N >::cbegin ( ) const
inlinenoexcept

Returns
data().

Definition at line 990 of file FixedString.h.

References folly::test::begin().

990  {
991  return begin();
992  }
FOLLY_CPP14_CONSTEXPR Char * begin() noexcept
Definition: FixedString.h:976
template<class Char, std::size_t N>
constexpr const Char* folly::BasicFixedString< Char, N >::cend ( ) const
inlinenoexcept

Returns
data() + size().

Definition at line 1011 of file FixedString.h.

References folly::test::end().

1011  {
1012  return end();
1013  }
FOLLY_CPP14_CONSTEXPR Char * end() noexcept
Definition: FixedString.h:997
template<class Char, std::size_t N>
constexpr BasicFixedString<Char, 0u> folly::BasicFixedString< Char, N >::cerase ( ) const
inlinenoexcept

Create a new string by erasing all the characters from this string.

Note
Equivalent to BasicFixedString<Char, 0>{}

Definition at line 1493 of file FixedString.h.

1493  {
1494  return {};
1495  }
template<class Char, std::size_t N>
constexpr BasicFixedString folly::BasicFixedString< Char, N >::cerase ( std::size_t  pos,
std::size_t  count = npos 
) const
inlinenoexcept

Create a new string by erasing all the characters after position pos from this string.

Note
Equivalent to creplace(pos, min(count, pos - size()), "")

Definition at line 1502 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::checkOverflowOrNpos(), and count.

1503  {
1504  using A = const Char[1];
1505  return creplace(
1506  pos,
1509  A{Char(0)});
1510  }
std::unique_ptr< int > A
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max)
Definition: FixedString.h:76
int * count
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR void folly::BasicFixedString< Char, N >::clear ( )
inlinenoexcept

Clears the contents of this string.

Postcondition
size() == 0u
at(size()) == Char(0)

Definition at line 1188 of file FixedString.h.

References testing::gmock_generated_actions_test::Char().

1188  {
1189  data_[0u] = Char(0);
1190  size_ = 0u;
1191  }
template<class Char, std::size_t N>
template<std::size_t M>
constexpr int folly::BasicFixedString< Char, N >::compare ( const BasicFixedString< Char, M > &  that) const
inlinenoexcept

Compare two strings for lexicographical ordering.

Note
Equivalent to compare(0, size(), that.data(), that.size())

Definition at line 1518 of file FixedString.h.

References folly::BasicFixedString< Char, N >::size_.

1518  {
1519  return compare(0u, size_, that, 0u, that.size_);
1520  }
constexpr int compare(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:1518
template<class Char, std::size_t N>
template<std::size_t M>
constexpr int folly::BasicFixedString< Char, N >::compare ( std::size_t  this_pos,
std::size_t  this_count,
const BasicFixedString< Char, M > &  that 
) const
inlinenoexcept

Compare two strings for lexicographical ordering.

Note
Equivalent to compare(this_pos, this_count, that.data(), that.size())

Definition at line 1528 of file FixedString.h.

References folly::BasicFixedString< Char, N >::size_.

1531  {
1532  return compare(this_pos, this_count, that, 0u, that.size_);
1533  }
constexpr int compare(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:1518
template<class Char, std::size_t N>
template<std::size_t M>
constexpr int folly::BasicFixedString< Char, N >::compare ( std::size_t  this_pos,
std::size_t  this_count,
const BasicFixedString< Char, M > &  that,
std::size_t  that_pos,
std::size_t  that_count 
) const
inlinenoexcept

Compare two strings for lexicographical ordering.

Note
Equivalent to compare(this_pos, this_count, that.data() + that_pos, that_count)

Definition at line 1541 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::compare_(), folly::BasicFixedString< Char, N >::data_, and folly::BasicFixedString< Char, N >::size_.

1546  {
1547  return static_cast<int>(detail::fixedstring::compare_(
1548  data_,
1550  detail::fixedstring::checkOverflow(this_count, size_ - this_pos) +
1551  this_pos,
1552  that.data_,
1553  detail::fixedstring::checkOverflow(that_pos, that.size_),
1554  detail::fixedstring::checkOverflow(that_count, that.size_ - that_pos) +
1555  that_pos));
1556  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr ordering compare_(const Left &left, std::size_t left_pos, std::size_t left_size, const Right &right, std::size_t right_pos, std::size_t right_size) noexcept
Definition: FixedString.h:111
template<class Char, std::size_t N>
constexpr int folly::BasicFixedString< Char, N >::compare ( const Char *  that) const
inlinenoexcept

Compare two strings for lexicographical ordering.

Note
Equivalent to compare(0, size(), that, strlen(that))

Definition at line 1562 of file FixedString.h.

References folly::constexpr_strlen().

1562  {
1563  return compare(0u, size_, that, folly::constexpr_strlen(that));
1564  }
constexpr int compare(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:1518
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr int folly::BasicFixedString< Char, N >::compare ( Range< const Char * >  that) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1569 of file FixedString.h.

References folly::BasicFixedString< Char, N >::begin(), and folly::BasicFixedString< Char, N >::size().

1569  {
1570  return compare(0u, size_, that.begin(), that.size());
1571  }
constexpr int compare(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:1518
template<class Char, std::size_t N>
constexpr int folly::BasicFixedString< Char, N >::compare ( std::size_t  this_pos,
std::size_t  this_count,
const Char *  that 
) const
inlinenoexcept

Compare two strings for lexicographical ordering.

Note
Equivalent to compare(this_pos, this_count, that, strlen(that))

Definition at line 1578 of file FixedString.h.

References folly::constexpr_strlen().

1581  {
1582  return compare(this_pos, this_count, that, folly::constexpr_strlen(that));
1583  }
constexpr int compare(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:1518
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr int folly::BasicFixedString< Char, N >::compare ( std::size_t  this_pos,
std::size_t  this_count,
Range< const Char * >  that 
) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1588 of file FixedString.h.

References folly::BasicFixedString< Char, N >::begin(), and folly::BasicFixedString< Char, N >::size().

1591  {
1592  return compare(this_pos, this_count, that.begin(), that.size());
1593  }
constexpr int compare(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:1518
template<class Char, std::size_t N>
constexpr int folly::BasicFixedString< Char, N >::compare ( std::size_t  this_pos,
std::size_t  this_count,
const Char *  that,
std::size_t  that_count 
) const
inlinenoexcept

Compare two strings for lexicographical ordering.

Let A be the the character sequence {(*this)[this_pos], ... (*this)[this_pos + this_count - 1]}. Let B be the character sequence {that[0], ...that[count - 1]}. Then...

Returns
  • < 0 if A is ordered before the B
  • > 0 if B is ordered before A
  • 0 if A equals B.
Exceptions
std::out_of_rangeif this_pos + this_count > size().

Definition at line 1610 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::checkOverflowOrNpos(), and folly::detail::fixedstring::compare_().

1614  {
1615  return static_cast<int>(detail::fixedstring::compare_(
1616  data_,
1618  detail::fixedstring::checkOverflowOrNpos(this_count, size_ - this_pos) +
1619  this_pos,
1620  that,
1621  0u,
1622  that_count));
1623  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max)
Definition: FixedString.h:76
constexpr ordering compare_(const Left &left, std::size_t left_pos, std::size_t left_size, const Right &right, std::size_t right_pos, std::size_t right_size) noexcept
Definition: FixedString.h:111
template<class Char, std::size_t N>
constexpr int folly::BasicFixedString< Char, N >::compare ( std::size_t  this_pos,
std::size_t  this_count,
Range< const Char * >  that,
std::size_t  that_count 
) const
inlinenoexcept

Definition at line 1625 of file FixedString.h.

References folly::BasicFixedString< Char, N >::begin(), folly::detail::fixedstring::checkOverflow(), and folly::BasicFixedString< Char, N >::size().

1629  {
1630  return compare(
1631  this_pos,
1632  this_count,
1633  that.begin(),
1634  detail::fixedstring::checkOverflow(that_count, that.size()));
1635  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr int compare(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:1518
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR std::size_t folly::BasicFixedString< Char, N >::copy ( Char *  dest,
std::size_t  count 
) const
inlinenoexcept

Copies min(count, size()) characters starting from offset 0 from this string into the buffer pointed to by dest.

Returns
The number of characters copied.

Definition at line 2016 of file FixedString.h.

References folly::copy(), count, upload::dest, and FOLLY_CPP14_CONSTEXPR.

Referenced by folly::BasicFixedString< Char, N >::operator=().

2017  {
2018  return copy(dest, count, 0u);
2019  }
FOLLY_CPP14_CONSTEXPR std::size_t copy(Char *dest, std::size_t count) const noexcept
Definition: FixedString.h:2016
dest
Definition: upload.py:394
int * count
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR std::size_t folly::BasicFixedString< Char, N >::copy ( Char *  dest,
std::size_t  count,
std::size_t  pos 
) const
inlinenoexcept

Copies min(count, size() - pos) characters starting from offset pos from this string into the buffer pointed to by dest.

Precondition
pos <= size()
Returns
The number of characters copied.
Exceptions
std::out_of_rangeif pos > size()

Definition at line 2029 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), count, upload::dest, and i.

2029  {
2031  for (std::size_t i = 0u; i < count; ++i) {
2032  if (i + pos == size_) {
2033  return size_;
2034  }
2035  dest[i] = data_[i + pos];
2036  }
2037  return count;
2038  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
dest
Definition: upload.py:394
int * count
template<class Char, std::size_t N>
constexpr BasicFixedString<Char, N - 1u> folly::BasicFixedString< Char, N >::cpop_back ( ) const
inlinenoexcept

Returns a new string with the first size()-1 characters from this string.

Precondition
!empty()
Note
Equivalent to BasicFixedString<Char, N-1u>{*this, 0u, size()-1u}
Exceptions
std::out_of_rangeif empty().

Definition at line 1229 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow().

1229  {
1230  return {*this, 0u, size_ - detail::fixedstring::checkOverflow(1u, size_)};
1231  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
template<class Char, std::size_t N>
constexpr BasicFixedString<Char, N + 1u> folly::BasicFixedString< Char, N >::cpush_back ( Char  ch) const
inlinenoexcept
Note
Equivalent to cappend(1u, ch).

Definition at line 1205 of file FixedString.h.

References ch.

1205  {
1206  return cappend(ch);
1207  }
auto ch
constexpr BasicFixedString< Char, N+1u > cappend(Char ch) const noexcept
Definition: FixedString.h:1335
template<class Char, std::size_t N>
constexpr const_reverse_iterator folly::BasicFixedString< Char, N >::crbegin ( ) const
inlinenoexcept
Note
Equivalent to rbegin() on a const-qualified reference to *this.

Definition at line 1033 of file FixedString.h.

1033  {
1034  return rbegin();
1035  }
FOLLY_CPP14_CONSTEXPR reverse_iterator rbegin() noexcept
Definition: FixedString.h:1019
template<class Char, std::size_t N>
constexpr const_reverse_iterator folly::BasicFixedString< Char, N >::crend ( ) const
inlinenoexcept
Note
Equivalent to rend() on a const-qualified reference to *this.

Definition at line 1055 of file FixedString.h.

1055  {
1056  return rend();
1057  }
FOLLY_CPP14_CONSTEXPR reverse_iterator rend() noexcept
Definition: FixedString.h:1041
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M> folly::BasicFixedString< Char, N >::creplace ( std::size_t  this_pos,
std::size_t  this_count,
const BasicFixedString< Char, M > &  that,
std::size_t  that_pos = 0u 
) const
inlinenoexcept

Construct a new string by replacing this_count characters starting from position this_pos within this string with the characters from string that starting at position that_pos.

Precondition
that_pos <= that.size()
Note
Equivalent to creplace(this_pos, this_count, that, that_pos, that.size() - that_pos)

Definition at line 1822 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), and folly::BasicFixedString< Char, N >::size_.

1826  {
1827  return creplace(
1828  this_pos,
1829  this_count,
1830  that,
1831  that_pos,
1832  that.size_ - detail::fixedstring::checkOverflow(that_pos, that.size_));
1833  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M> folly::BasicFixedString< Char, N >::creplace ( std::size_t  this_pos,
std::size_t  this_count,
const BasicFixedString< Char, M > &  that,
std::size_t  that_pos,
std::size_t  that_count 
) const
inlinenoexcept

Construct a new string by replacing this_count characters starting from position this_pos within this string with that_count characters from string that starting at position that_pos.

Parameters
this_posThe starting offset within *this of the first character to be replaced.
this_countThe number of characters to be replaced. If npos, it is treated as if this_count were size() - this_pos.
thatA string that contains the replacement string.
that_posThe offset to the first character in the replacement string.
that_countThe number of characters in the replacement string.
Precondition
this_pos <= size() && this_count <= size() - this_pos
that_pos <= that.size() && that_count <= that.size() - that_pos
Postcondition
The size of the returned string is size() - this_count + that_count
Note
Equivalent to BasicFixedString<Char, N + M>{substr(0, this_pos) + that.substr(that_pos, that_count) + substr(this_pos + this_count)}
Exceptions
std::out_of_rangeon any of the following conditions:

Definition at line 1859 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::checkOverflowOrNpos(), data_, folly::BasicFixedString< Char, N >::data_, and folly::BasicFixedString< Char, N >::size_.

1864  {
1865  return detail::fixedstring::Helper::replace_<Char>(
1866  data_,
1867  size_,
1868  detail::fixedstring::checkOverflow(this_pos, size_),
1869  detail::fixedstring::checkOverflowOrNpos(this_count, size_ - this_pos),
1870  that.data_,
1871  detail::fixedstring::checkOverflow(that_pos, that.size_),
1873  that_count, that.size_ - that_pos),
1875  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max)
Definition: FixedString.h:76
make_integer_sequence< std::size_t, Size > make_index_sequence
Definition: Utility.h:209
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M> folly::BasicFixedString< Char, N >::creplace ( const Char *  first,
const Char *  last,
const BasicFixedString< Char, M > &  that,
std::size_t  that_pos = 0u 
) const
inlinenoexcept

Construct a new string by replacing the characters denoted by the half-open range [first,last) within this string with the characters from string that starting at position that_pos.

Precondition
that_pos <= that.size()
Note
Equivalent to creplace(first - data(), last - first, that, that_pos, that.size() - that_pos)

Definition at line 1887 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), and folly::BasicFixedString< Char, N >::size_.

1891  {
1892  return creplace(
1893  first - data_,
1894  last - first,
1895  that,
1896  that_pos,
1897  that.size_ - detail::fixedstring::checkOverflow(that_pos, that.size_));
1898  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M> folly::BasicFixedString< Char, N >::creplace ( const Char *  first,
const Char *  last,
const BasicFixedString< Char, M > &  that,
std::size_t  that_pos,
std::size_t  that_count 
) const
inlinenoexcept

Construct a new string by replacing the characters denoted by the half-open range [first,last) within this string with the that_count characters from string that starting at position that_pos.

Note
Equivalent to creplace(first - data(), last - first, that, that_pos, that_count)

Definition at line 1909 of file FixedString.h.

References folly::gen::first.

1914  {
1915  return creplace(first - data_, last - first, that, that_pos, that_count);
1916  }
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M - 1u> folly::BasicFixedString< Char, N >::creplace ( std::size_t  this_pos,
std::size_t  this_count,
const Char(&)  that[M] 
) const
inlinenoexcept

Construct a new string by replacing this_count characters starting from position this_pos within this string with M-1 characters from character array that.

Precondition
strlen(that) == M-1
Note
Equivalent to creplace(this_pos, this_count, that, 0, M - 1)

Definition at line 1927 of file FixedString.h.

1930  {
1931  return creplace(this_pos, this_count, that, 0u, M - 1u);
1932  }
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M - 1u> folly::BasicFixedString< Char, N >::creplace ( std::size_t  this_pos,
std::size_t  this_count,
const Char(&)  that[M],
std::size_t  that_pos,
std::size_t  that_count 
) const
inlinenoexcept

Replace this_count characters starting from position this_pos with that_count characters from the character array that starting at position that_pos.

Parameters
this_posThe starting offset within *this of the first character to be replaced.
this_countThe number of characters to be replaced. If npos, it is treated as if this_count were size() - this_pos.
thatAn array of characters containing the replacement string.
that_posThe starting offset of the replacement string.
that_countThe number of characters in the replacement string. If npos, it is treated as if that_count were M - 1 - that_pos
Precondition
this_pos <= size() && this_count <= size() - this_pos
that_pos <= M - 1 && that_count <= M - 1 - that_pos
Postcondition
The size of the returned string is size() - this_count + that_count
Note
Equivalent to BasicFixedString<Char, N + M - 1>{ substr(0, this_pos) + makeFixedString(that).substr(that_pos, that_count) + substr(this_pos + this_count)}
Exceptions
std::out_of_rangeon any of the following conditions:
  • this_pos > size()
  • this_count > size() - this_pos
  • that_pos >= M
  • that_count >= M - that_pos

Definition at line 1960 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkNullTerminated(), folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::checkOverflowOrNpos(), and data_.

1965  {
1966  return detail::fixedstring::Helper::replace_<Char>(
1967  data_,
1968  size_,
1969  detail::fixedstring::checkOverflow(this_pos, size_),
1970  detail::fixedstring::checkOverflowOrNpos(this_count, size_ - this_pos),
1972  detail::fixedstring::checkOverflow(that_pos, M - 1u),
1973  detail::fixedstring::checkOverflowOrNpos(that_count, M - 1u - that_pos),
1974  folly::make_index_sequence<N + M - 1u>{});
1975  }
constexpr const Char(& checkNullTerminated(const Char(&a)[N]) noexcept)[N]
Definition: FixedString.h:92
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max)
Definition: FixedString.h:76
make_integer_sequence< std::size_t, Size > make_index_sequence
Definition: Utility.h:209
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M - 1u> folly::BasicFixedString< Char, N >::creplace ( const Char *  first,
const Char *  last,
const Char(&)  that[M] 
) const
inlinenoexcept

Construct a new string by replacing the characters denoted by the half-open range [first,last) within this string with the first M-1 characters from the character array that.

Precondition
strlen(that) == M-1
Note
Equivalent to creplace(first - data(), last - first, that, 0, M-1)

Definition at line 1987 of file FixedString.h.

1988  {
1989  return creplace(first - data_, last - first, that, 0u, M - 1u);
1990  }
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M - 1u> folly::BasicFixedString< Char, N >::creplace ( const Char *  first,
const Char *  last,
const Char(&)  that[M],
std::size_t  that_pos,
std::size_t  that_count 
) const
inlinenoexcept

Construct a new string by replacing the characters denoted by the half-open range [first,last) within this string with the that_count characters from the character array that starting at position that_pos.

Precondition
strlen(that) == M-1
Note
Equivalent to creplace(first - data(), last - first, that, that_pos, that_count)

Definition at line 2002 of file FixedString.h.

2007  {
2008  return creplace(first - data_, last - first, that, that_pos, that_count);
2009  }
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Char* folly::BasicFixedString< Char, N >::data ( )
inlinenoexcept

Return a pointer to a range of size()+1 characters, the last of which is Char(0).

Definition at line 955 of file FixedString.h.

References data_.

955  {
956  return data_;
957  }
template<class Char, std::size_t N>
constexpr const Char* folly::BasicFixedString< Char, N >::data ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 962 of file FixedString.h.

References data_.

962  {
963  return data_;
964  }
template<class Char, std::size_t N>
constexpr bool folly::BasicFixedString< Char, N >::empty ( ) const
inlinenoexcept
Returns
True if and only if size() == 0.

Definition at line 1076 of file FixedString.h.

1076  {
1077  return 0u == size_;
1078  }
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Char* folly::BasicFixedString< Char, N >::end ( )
inlinenoexcept

Returns
data() + size().

Definition at line 997 of file FixedString.h.

997  {
998  return data_ + size_;
999  }
template<class Char, std::size_t N>
constexpr const Char* folly::BasicFixedString< Char, N >::end ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1004 of file FixedString.h.

1004  {
1005  return data_ + size_;
1006  }
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::erase ( )
inlinenoexcept

Erase all characters from this string.

Note
Equivalent to clear()
Returns
*this;

Definition at line 1442 of file FixedString.h.

1442  {
1443  clear();
1444  return *this;
1445  }
FOLLY_CPP14_CONSTEXPR void clear() noexcept
Definition: FixedString.h:1188
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::erase ( std::size_t  pos,
std::size_t  count = npos 
)
inlinenoexcept

Erases count characters from position pos. If count is npos, erases from pos to the end of the string.

Precondition
pos <= size()
count <= size() - pos || count == npos
Postcondition
size() == old_size - min(count, old_size - pos)
at(size()) == Char(0)
Returns
*this;
Exceptions
std::out_of_rangewhen pos > size().

Definition at line 1457 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::checkOverflowOrNpos(), count, and replace().

1459  {
1460  using A = const Char[1];
1461  return replace(
1462  pos,
1465  A{Char(0)},
1466  0u);
1467  }
std::unique_ptr< int > A
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max)
Definition: FixedString.h:76
int * count
FOLLY_CPP14_CONSTEXPR BasicFixedString & replace(const Char *first, const Char *last, const BasicFixedString< Char, M > &that) noexcept(false)
Definition: FixedString.h:1663
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Char* folly::BasicFixedString< Char, N >::erase ( const Char *  first)
inlinenoexcept
Note
Equivalent to erase(first - data(), 1)
Returns
A pointer to the first character after the erased character.

Definition at line 1473 of file FixedString.h.

References data_, and folly::gen::first.

1473  {
1474  erase(first - data_, 1u);
1475  return data_ + (first - data_);
1476  }
FOLLY_CPP14_CONSTEXPR BasicFixedString & erase() noexcept
Definition: FixedString.h:1442
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Char* folly::BasicFixedString< Char, N >::erase ( const Char *  first,
const Char *  last 
)
inlinenoexcept
Note
Equivalent to erase(first - data(), last - first)
Returns
A pointer to the first character after the erased characters.

Definition at line 1482 of file FixedString.h.

References data_, and folly::gen::first.

1484  {
1485  erase(first - data_, last - first);
1486  return data_ + (first - data_);
1487  }
FOLLY_CPP14_CONSTEXPR BasicFixedString & erase() noexcept
Definition: FixedString.h:1442
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find ( const BasicFixedString< Char, M > &  that) const
inlinenoexcept

Finds the first occurrence of the character sequence that in this string.

Note
Equivalent to find(that.data(), 0, that.size())

Definition at line 2073 of file FixedString.h.

2074  {
2075  return find(that, 0u);
2076  }
constexpr std::size_t find(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2073
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the first occurrence of the character sequence that in this string, starting at offset pos.

Precondition
pos <= size()
Note
Equivalent to find(that.data(), pos, that.size())

Definition at line 2085 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::BasicFixedString< Char, N >::data_, folly::detail::fixedstring::find_(), folly::detail::fixedstring::FixedStringBase_< class >::npos, and folly::BasicFixedString< Char, N >::size_.

2087  {
2088  return that.size_ <= size_ - detail::fixedstring::checkOverflow(pos, size_)
2089  ? detail::fixedstring::find_(data_, size_, that.data_, pos, that.size_)
2090  : npos;
2091  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t find_(const Left &left, std::size_t left_size, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:193
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find ( const Char *  that) const
inlinenoexcept

Finds the first occurrence of the character sequence that in this string.

Note
Equivalent to find(that.data(), 0, strlen(that))

Definition at line 2097 of file FixedString.h.

References folly::constexpr_strlen().

2097  {
2098  return find(that, 0u, folly::constexpr_strlen(that));
2099  }
constexpr std::size_t find(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2073
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find ( const Char *  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the first occurrence of the character sequence that in this string, starting at offset pos.

Precondition
pos <= size()
Note
Equivalent to find(that.data(), pos, strlen(that))

Definition at line 2107 of file FixedString.h.

References folly::constexpr_strlen().

2108  {
2109  return find(that, pos, folly::constexpr_strlen(that));
2110  }
constexpr std::size_t find(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2073
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find ( const Char *  that,
std::size_t  pos,
std::size_t  count 
) const
inlinenoexcept

Finds the first occurrence of the first count characters in the buffer pointed to by that in this string, starting at offset pos.

Precondition
pos <= size()
that points to a buffer containing at least count contiguous characters.
Returns
The lowest offset i such that i >= pos and 0 == strncmp(data() + i, that, count); or npos if there is no such offset i.
Exceptions
std::out_of_rangewhen pos > size()

Definition at line 2123 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), count, folly::detail::fixedstring::find_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2126  {
2129  : npos;
2130  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t find_(const Left &left, std::size_t left_size, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:193
int * count
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find ( Char  ch) const
inlinenoexcept

Finds the first occurrence of the character ch in this string.

Note
Equivalent to find(&ch, 0, 1)

Definition at line 2136 of file FixedString.h.

References ch.

2136  {
2137  return find(ch, 0u);
2138  }
auto ch
constexpr std::size_t find(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2073
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find ( Char  ch,
std::size_t  pos 
) const
inlinenoexcept

Finds the first occurrence of the character character c in this string, starting at offset pos.

Precondition
pos <= size()
Note
Equivalent to find(&ch, pos, 1)

Definition at line 2146 of file FixedString.h.

References ch, folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::find_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2146  {
2147  using A = const Char[1u];
2148  return 0u == size_ - detail::fixedstring::checkOverflow(pos, size_)
2149  ? npos
2150  : detail::fixedstring::find_(data_, size_, A{ch}, pos, 1u);
2151  }
std::unique_ptr< int > A
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
auto ch
constexpr std::size_t find_(const Left &left, std::size_t left_size, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:193
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_not_of ( const BasicFixedString< Char, M > &  that) const
inlinenoexcept

Finds the first occurrence of any character not in that in this string.

Note
Equivalent to find_first_not_of(that.data(), 0, that.size())

Definition at line 2347 of file FixedString.h.

2348  {
2349  return find_first_not_of(that, 0u);
2350  }
constexpr std::size_t find_first_not_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2347
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_not_of ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the first occurrence of any character not in that in this string.

Note
Equivalent to find_first_not_of(that.data(), 0, that.size())

Definition at line 2357 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::BasicFixedString< Char, N >::data_, folly::detail::fixedstring::find_first_not_of_(), folly::detail::fixedstring::FixedStringBase_< class >::npos, and folly::BasicFixedString< Char, N >::size_.

2359  {
2361  ? npos
2363  data_, size_, that.data_, pos, that.size_);
2364  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
static constexpr std::size_t npos
Definition: FixedString.h:54
constexpr std::size_t find_first_not_of_(const Left &left, std::size_t left_size, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:231
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_not_of ( const Char *  that) const
inlinenoexcept

Finds the first occurrence of any character not in the null-terminated character sequence pointed to by that in this string.

Note
Equivalent to find_first_not_of(that, 0, strlen(that))

Definition at line 2371 of file FixedString.h.

References folly::constexpr_strlen().

2371  {
2372  return find_first_not_of(that, 0u, folly::constexpr_strlen(that));
2373  }
constexpr std::size_t find_first_not_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2347
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_not_of ( const Char *  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the first occurrence of any character not in the null-terminated character sequence pointed to by that in this string, starting at offset pos

Note
Equivalent to find_first_not_of(that, pos, strlen(that))

Definition at line 2381 of file FixedString.h.

References folly::constexpr_strlen().

2382  {
2383  return find_first_not_of(that, pos, folly::constexpr_strlen(that));
2384  }
constexpr std::size_t find_first_not_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2347
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_not_of ( const Char *  that,
std::size_t  pos,
std::size_t  count 
) const
inlinenoexcept

Finds the first occurrence of any character not in the first count characters in the buffer pointed to by that in this string, starting at offset pos.

Precondition
pos <= size()
that points to a buffer containing at least count contiguous characters.
Returns
The smallest offset i such that i >= pos and std::find(that, that+count, at(i)) == that+count; or npos if there is no such offset i.
Exceptions
std::out_of_rangewhen pos > size()

Definition at line 2398 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), count, folly::detail::fixedstring::find_first_not_of_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2401  {
2403  ? npos
2405  data_, size_, that, pos, count);
2406  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
int * count
static constexpr std::size_t npos
Definition: FixedString.h:54
constexpr std::size_t find_first_not_of_(const Left &left, std::size_t left_size, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:231
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_not_of ( Char  ch) const
inlinenoexcept

Finds the first occurrence of any character other than ch in this string.

Note
Equivalent to find_first_not_of(&ch, 0, 1)

Definition at line 2412 of file FixedString.h.

References ch.

2412  {
2413  return find_first_not_of(ch, 0u);
2414  }
auto ch
constexpr std::size_t find_first_not_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2347
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_not_of ( Char  ch,
std::size_t  pos 
) const
inlinenoexcept

Finds the first occurrence of any character other than ch in this string, starting at offset pos.

Note
Equivalent to find_first_not_of(&ch, pos, 1)

Definition at line 2421 of file FixedString.h.

References ch, folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::find_first_not_of_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2422  {
2423  using A = const Char[1u];
2424  return 1u <= size_ - detail::fixedstring::checkOverflow(pos, size_)
2426  : npos;
2427  }
std::unique_ptr< int > A
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
auto ch
static constexpr std::size_t npos
Definition: FixedString.h:54
constexpr std::size_t find_first_not_of_(const Left &left, std::size_t left_size, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:231
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_of ( const BasicFixedString< Char, M > &  that) const
inlinenoexcept

Finds the first occurrence of any character in that in this string.

Note
Equivalent to find_first_of(that.data(), 0, that.size())

Definition at line 2260 of file FixedString.h.

2261  {
2262  return find_first_of(that, 0u);
2263  }
constexpr std::size_t find_first_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2260
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_of ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the first occurrence of any character in that in this string, starting at offset pos

Note
Equivalent to find_first_of(that.data(), pos, that.size())

Definition at line 2271 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::BasicFixedString< Char, N >::data_, folly::detail::fixedstring::find_first_of_(), folly::detail::fixedstring::FixedStringBase_< class >::npos, and folly::BasicFixedString< Char, N >::size_.

2273  {
2275  ? npos
2277  data_, size_, that.data_, pos, that.size_);
2278  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t find_first_of_(const Left &left, std::size_t left_size, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:218
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_of ( const Char *  that) const
inlinenoexcept

Finds the first occurrence of any character in the null-terminated character sequence pointed to by that in this string.

Note
Equivalent to find_first_of(that, 0, strlen(that))

Definition at line 2285 of file FixedString.h.

References folly::constexpr_strlen().

2285  {
2286  return find_first_of(that, 0u, folly::constexpr_strlen(that));
2287  }
constexpr std::size_t find_first_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2260
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_of ( const Char *  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the first occurrence of any character in the null-terminated character sequence pointed to by that in this string, starting at offset pos

Note
Equivalent to find_first_of(that, pos, strlen(that))

Definition at line 2295 of file FixedString.h.

References folly::constexpr_strlen().

2296  {
2297  return find_first_of(that, pos, folly::constexpr_strlen(that));
2298  }
constexpr std::size_t find_first_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2260
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_of ( const Char *  that,
std::size_t  pos,
std::size_t  count 
) const
inlinenoexcept

Finds the first occurrence of any character in the first count characters in the buffer pointed to by that in this string, starting at offset pos.

Precondition
pos <= size()
that points to a buffer containing at least count contiguous characters.
Returns
The smallest offset i such that i >= pos and std::find(that, that+count, at(i)) != that+count; or npos if there is no such offset i.
Exceptions
std::out_of_rangewhen pos > size()

Definition at line 2312 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), count, folly::detail::fixedstring::find_first_of_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2315  {
2317  ? npos
2319  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr std::size_t find_first_of_(const Left &left, std::size_t left_size, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:218
int * count
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_of ( Char  ch) const
inlinenoexcept

Finds the first occurrence of ch in this string.

Note
Equivalent to find_first_of(&ch, 0, 1)

Definition at line 2325 of file FixedString.h.

References ch.

2325  {
2326  return find_first_of(ch, 0u);
2327  }
constexpr std::size_t find_first_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2260
auto ch
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_first_of ( Char  ch,
std::size_t  pos 
) const
inlinenoexcept

Finds the first occurrence of ch in this string, starting at offset pos.

Note
Equivalent to find_first_of(&ch, pos, 1)

Definition at line 2334 of file FixedString.h.

References ch, folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::find_first_of_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2335  {
2336  using A = const Char[1u];
2338  ? npos
2340  }
std::unique_ptr< int > A
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
auto ch
constexpr std::size_t find_first_of_(const Left &left, std::size_t left_size, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:218
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_not_of ( const BasicFixedString< Char, M > &  that) const
inlinenoexcept

Finds the last occurrence of any character not in that in this string.

Note
Equivalent to find_last_not_of(that.data(), size(), that.size())

Definition at line 2535 of file FixedString.h.

2536  {
2537  return find_last_not_of(that, size_);
2538  }
constexpr std::size_t find_last_not_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2535
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_not_of ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the last occurrence of any character not in that in this string, starting at offset pos

Note
Equivalent to find_last_not_of(that.data(), pos, that.size())

Definition at line 2546 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::constexpr_min(), folly::BasicFixedString< Char, N >::data_, folly::detail::fixedstring::find_last_not_of_(), folly::detail::fixedstring::FixedStringBase_< class >::npos, and folly::BasicFixedString< Char, N >::size_.

2548  {
2549  return 0u == size_
2550  ? npos
2552  data_,
2553  that.data_,
2556  that.size_);
2557  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
constexpr std::size_t find_last_not_of_(const Left &left, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:256
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_not_of ( const Char *  that) const
inlinenoexcept

Finds the last occurrence of any character not in the null-terminated character sequence pointed to by that in this string.

Note
Equivalent to find_last_not_of(that, size(), strlen(that))

Definition at line 2564 of file FixedString.h.

References folly::constexpr_strlen().

2564  {
2565  return find_last_not_of(that, size_, folly::constexpr_strlen(that));
2566  }
constexpr std::size_t find_last_not_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2535
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_not_of ( const Char *  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the last occurrence of any character not in the null-terminated character sequence pointed to by that in this string, starting at offset pos

Note
Equivalent to find_last_not_of(that, pos, strlen(that))

Definition at line 2574 of file FixedString.h.

References folly::constexpr_strlen().

2575  {
2576  return find_last_not_of(that, pos, folly::constexpr_strlen(that));
2577  }
constexpr std::size_t find_last_not_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2535
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_not_of ( const Char *  that,
std::size_t  pos,
std::size_t  count 
) const
inlinenoexcept

Finds the last occurrence of any character not in the first count characters in the buffer pointed to by that in this string, starting at offset pos.

Precondition
pos <= size()
that points to a buffer containing at least count contiguous characters.
Returns
The largest offset i such that i <= pos and i < size() and std::find(that, that+count, at(i)) == that+count; or npos if there is no such offset i.
Exceptions
std::out_of_rangewhen pos > size()

Definition at line 2591 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::constexpr_min(), count, folly::detail::fixedstring::find_last_not_of_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2594  {
2595  return 0u == size_
2596  ? npos
2598  data_,
2599  that,
2602  count);
2603  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
constexpr std::size_t find_last_not_of_(const Left &left, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:256
int * count
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_not_of ( Char  ch) const
inlinenoexcept

Finds the last occurrence of any character other than ch in this string.

Note
Equivalent to find_last_not_of(&ch, size(), 1)

Definition at line 2609 of file FixedString.h.

References ch.

2609  {
2610  return find_last_not_of(ch, size_);
2611  }
auto ch
constexpr std::size_t find_last_not_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2535
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_not_of ( Char  ch,
std::size_t  pos 
) const
inlinenoexcept

Finds the last occurrence of any character other than ch in this string, starting at offset pos.

Note
Equivalent to find_last_not_of(&ch, pos, 1)

Definition at line 2618 of file FixedString.h.

References ch, folly::detail::fixedstring::checkOverflow(), folly::constexpr_min(), folly::detail::fixedstring::find_last_not_of_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2619  {
2620  using A = const Char[1u];
2621  return 0u == size_
2622  ? npos
2624  data_,
2625  A{ch},
2628  1u);
2629  }
std::unique_ptr< int > A
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
auto ch
constexpr std::size_t find_last_not_of_(const Left &left, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:256
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_of ( const BasicFixedString< Char, M > &  that) const
inlinenoexcept

Finds the last occurrence of any character in that in this string.

Note
Equivalent to find_last_of(that.data(), size(), that.size())

Definition at line 2434 of file FixedString.h.

2435  {
2436  return find_last_of(that, size_);
2437  }
constexpr std::size_t find_last_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2434
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_of ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the last occurrence of any character in that in this string, starting at offset pos

Note
Equivalent to find_last_of(that.data(), pos, that.size())

Definition at line 2445 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::constexpr_min(), folly::BasicFixedString< Char, N >::data_, folly::detail::fixedstring::find_last_of_(), folly::detail::fixedstring::FixedStringBase_< class >::npos, and folly::BasicFixedString< Char, N >::size_.

2447  {
2448  return 0u == size_
2449  ? npos
2451  data_,
2452  that.data_,
2455  that.size_);
2456  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
constexpr std::size_t find_last_of_(const Left &left, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:244
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_of ( const Char *  that) const
inlinenoexcept

Finds the last occurrence of any character in the null-terminated character sequence pointed to by that in this string.

Note
Equivalent to find_last_of(that, size(), strlen(that))

Definition at line 2463 of file FixedString.h.

References folly::constexpr_strlen().

2463  {
2464  return find_last_of(that, size_, folly::constexpr_strlen(that));
2465  }
constexpr std::size_t find_last_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2434
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_of ( const Char *  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the last occurrence of any character in the null-terminated character sequence pointed to by that in this string, starting at offset pos

Note
Equivalent to find_last_of(that, pos, strlen(that))

Definition at line 2473 of file FixedString.h.

References folly::constexpr_strlen().

2474  {
2475  return find_last_of(that, pos, folly::constexpr_strlen(that));
2476  }
constexpr std::size_t find_last_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2434
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_of ( const Char *  that,
std::size_t  pos,
std::size_t  count 
) const
inlinenoexcept

Finds the last occurrence of any character in the first count characters in the buffer pointed to by that in this string, starting at offset pos.

Precondition
pos <= size()
that points to a buffer containing at least count contiguous characters.
Returns
The largest offset i such that i <= pos and i < size() and std::find(that, that+count, at(i)) != that+count; or npos if there is no such offset i.
Exceptions
std::out_of_rangewhen pos > size()

Definition at line 2490 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::constexpr_min(), count, folly::detail::fixedstring::find_last_of_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2493  {
2494  return 0u == size_
2495  ? npos
2497  data_,
2498  that,
2501  count);
2502  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
constexpr std::size_t find_last_of_(const Left &left, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:244
int * count
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_of ( Char  ch) const
inlinenoexcept

Finds the last occurrence of ch in this string.

Note
Equivalent to find_last_of(&ch, size(), 1)

Definition at line 2508 of file FixedString.h.

References ch.

2508  {
2509  return find_last_of(ch, size_);
2510  }
constexpr std::size_t find_last_of(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2434
auto ch
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::find_last_of ( Char  ch,
std::size_t  pos 
) const
inlinenoexcept

Finds the last occurrence of ch in this string, starting at offset pos.

Note
Equivalent to find_last_of(&ch, pos, 1)

Definition at line 2517 of file FixedString.h.

References ch, folly::detail::fixedstring::checkOverflow(), folly::constexpr_min(), folly::detail::fixedstring::find_last_of_(), and folly::detail::fixedstring::FixedStringBase_< class >::npos.

2518  {
2519  using A = const Char[1u];
2520  return 0u == size_
2521  ? npos
2523  data_,
2524  A{ch},
2527  1u);
2528  }
std::unique_ptr< int > A
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
auto ch
constexpr std::size_t find_last_of_(const Left &left, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:244
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Char& folly::BasicFixedString< Char, N >::front ( )
inlinenoexcept
Note
Equivalent to (*this)[0]

Definition at line 1149 of file FixedString.h.

1149  {
1150  return (*this)[0u];
1151  }
template<class Char, std::size_t N>
constexpr const Char& folly::BasicFixedString< Char, N >::front ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1156 of file FixedString.h.

1156  {
1157  return (*this)[0u];
1158  }
template<class Char, std::size_t N>
std::uint32_t folly::BasicFixedString< Char, N >::hash ( ) const
inlinenoexcept

Definition at line 1096 of file FixedString.h.

References folly::hsieh_hash32_buf().

1096  {
1098  }
std::uint32_t hsieh_hash32_buf(const void *buf, std::size_t len)
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::length ( ) const
inlinenoexcept
Returns
The number of Char elements in the string.

Definition at line 1069 of file FixedString.h.

1069  {
1070  return size_;
1071  }
template<class Char, std::size_t N>
static constexpr std::size_t folly::BasicFixedString< Char, N >::max_size ( )
inlinestaticnoexcept
Returns
N.

Definition at line 1090 of file FixedString.h.

1090  {
1091  return N;
1092  }
template<class Char, std::size_t N>
folly::BasicFixedString< Char, N >::operator std::basic_string< Char > ( ) const
inlinenoexcept

Conversion to std::basic_string<Char>

Returns
std::basic_string<Char>{begin(), end()}

Definition at line 811 of file FixedString.h.

References folly::test::begin(), and folly::test::end().

811  {
812  return std::basic_string<Char>{begin(), end()};
813  }
FOLLY_CPP14_CONSTEXPR Char * end() noexcept
Definition: FixedString.h:997
FOLLY_CPP14_CONSTEXPR Char * begin() noexcept
Definition: FixedString.h:976
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::operator+= ( const Char *  that)
inlinenoexcept

Appends characters from a null-terminated string literal to this string.

Note
Equivalent to append(that).

Definition at line 1404 of file FixedString.h.

References append().

1405  {
1406  return append(that);
1407  }
FOLLY_CPP14_CONSTEXPR BasicFixedString & append(std::size_t count, Char ch) noexcept(false)
Definition: FixedString.h:1240
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::operator+= ( const BasicFixedString< Char, M > &  that)
inlinenoexcept

Appends characters from another string to this one.

Note
Equivalent to append(that).

Definition at line 1414 of file FixedString.h.

References append(), and folly::BasicFixedString< Char, N >::size_.

1415  {
1416  return append(that, 0u, that.size_);
1417  }
FOLLY_CPP14_CONSTEXPR BasicFixedString & append(std::size_t count, Char ch) noexcept(false)
Definition: FixedString.h:1240
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::operator+= ( Char  ch)
inlinenoexcept

Appends a character to this string.

Note
Equivalent to push_back(ch).

Definition at line 1423 of file FixedString.h.

References ch, and push_back().

1423  {
1424  push_back(ch);
1425  return *this;
1426  }
auto ch
FOLLY_CPP14_CONSTEXPR void push_back(Char ch) noexcept(false)
Definition: FixedString.h:1196
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::operator+= ( std::initializer_list< Char >  il)
inlinenoexcept

Appends characters from an initializer_list to this string.

Note
Equivalent to append(il.begin(), il.size()).

Definition at line 1432 of file FixedString.h.

References append().

1433  {
1434  return append(il.begin(), il.size());
1435  }
FOLLY_CPP14_CONSTEXPR BasicFixedString & append(std::size_t count, Char ch) noexcept(false)
Definition: FixedString.h:1240
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::operator= ( const BasicFixedString< Char, N > &  )
defaultnoexcept
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::operator= ( const BasicFixedString< Char, M > &  that)
inlinenoexcept

Assign from a BasicFixedString<Char, M>.

Precondition
that.size() <= N
Postcondition
size() == that.size()
0 == strncmp(data(), that.begin(), size())
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen that.size() > N. When M <= N, this assignment operator will never throw.
Note
Assignments from larger-capacity BasicFixedString objects to smaller ones (M > N) are allowed as long as the size of the source string is small enough.
Returns
*this

Definition at line 748 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), folly::BasicFixedString< Char, N >::copy(), M, folly::BasicFixedString< Char, N >::size_, and type.

749  {
750  detail::fixedstring::checkOverflow(that.size_, N);
751  size_ = that.copy(data_, that.size_);
752  data_[size_] = Char(0);
753  return *this;
754  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::operator= ( const Char(&)  that[M])
inlinenoexcept

Assign from a null-terminated array of characters.

Precondition
M < N
that has no embedded null characters
that[M-1]==Char(0)
Postcondition
size() == M-1
0 == strncmp(data(), that, size())
at(size()) == Char(0)
Returns
*this

Definition at line 767 of file FixedString.h.

References folly::detail::fixedstring::checkNullTerminated().

768  {
770  }
constexpr const Char(& checkNullTerminated(const Char(&a)[N]) noexcept)[N]
Definition: FixedString.h:92
FOLLY_CPP14_CONSTEXPR BasicFixedString & assign(std::size_t count, Char ch) noexcept(false)
Definition: FixedString.h:844
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::operator= ( std::initializer_list< Char >  il)
inlinenoexcept

Assign from an initializer_list of characters.

Precondition
il.size() <= N
Postcondition
size() == il.size()
0 == strncmp(data(), il.begin(), size())
at(size()) == Char(0)
Exceptions
std::out_of_rangewhen il.size() > N
Returns
*this

Definition at line 781 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), and i.

782  {
784  for (std::size_t i = 0u; i < il.size(); ++i) {
785  data_[i] = il.begin()[i];
786  }
787  size_ = il.size();
788  data_[size_] = Char(0);
789  return *this;
790  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Char& folly::BasicFixedString< Char, N >::operator[] ( std::size_t  i)
inlinenoexcept
Precondition
i <= size()
Note
(*this)[size()] is allowed will return Char(0).
Returns
*(data() + i)

Definition at line 1127 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), and i.

1127  {
1128 #ifdef NDEBUG
1129  return data_[i];
1130 #else
1132 #endif
1133  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
template<class Char, std::size_t N>
constexpr const Char& folly::BasicFixedString< Char, N >::operator[] ( std::size_t  i) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1138 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), and i.

1138  {
1139 #ifdef NDEBUG
1140  return data_[i];
1141 #else
1143 #endif
1144  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR void folly::BasicFixedString< Char, N >::pop_back ( )
inlinenoexcept

Removes the last character from the string.

Precondition
!empty()
Postcondition
size() is one fewer than before calling pop_back().
at(size()) == Char(0)
The characters in the half-open range [0,size()-1) are unmodified.
Exceptions
std::out_of_rangeif empty().

Definition at line 1217 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), and folly::detail::fixedstring::checkOverflow().

1217  {
1219  --size_;
1220  data_[size_] = Char(0);
1221  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR void folly::BasicFixedString< Char, N >::push_back ( Char  ch)
inlinenoexcept
Note
Equivalent to append(1u, ch).

Definition at line 1196 of file FixedString.h.

References ch, testing::gmock_generated_actions_test::Char(), and folly::detail::fixedstring::checkOverflow().

1196  {
1198  data_[size_] = ch;
1199  data_[++size_] = Char(0);
1200  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
auto ch
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR reverse_iterator folly::BasicFixedString< Char, N >::rbegin ( )
inlinenoexcept

Returns a reverse iterator to the first character of the reversed string. It corresponds to the last + 1 character of the non-reversed string.

Definition at line 1019 of file FixedString.h.

Referenced by TEST().

1019  {
1020  return reverse_iterator{data_ + size_};
1021  }
detail::fixedstring::ReverseIterator< Char > reverse_iterator
Definition: FixedString.h:600
template<class Char, std::size_t N>
constexpr const_reverse_iterator folly::BasicFixedString< Char, N >::rbegin ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1026 of file FixedString.h.

1026  {
1028  }
detail::fixedstring::ReverseIterator< const Char > const_reverse_iterator
Definition: FixedString.h:602
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR reverse_iterator folly::BasicFixedString< Char, N >::rend ( )
inlinenoexcept

Returns a reverse iterator to the last + 1 character of the reversed string. It corresponds to the first character of the non-reversed string.

Definition at line 1041 of file FixedString.h.

Referenced by TEST().

1041  {
1042  return reverse_iterator{data_};
1043  }
detail::fixedstring::ReverseIterator< Char > reverse_iterator
Definition: FixedString.h:600
template<class Char, std::size_t N>
constexpr const_reverse_iterator folly::BasicFixedString< Char, N >::rend ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1048 of file FixedString.h.

1048  {
1049  return const_reverse_iterator{data_};
1050  }
detail::fixedstring::ReverseIterator< const Char > const_reverse_iterator
Definition: FixedString.h:602
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::replace ( const Char *  first,
const Char *  last,
const BasicFixedString< Char, M > &  that 
)
inlinenoexcept

Replace the characters in the range denoted by the half-open range [first, last) with the string that.

Precondition
first and last point to characters within this string (including the terminating null).
Note
Equivalent to replace(first - data(), last - first, that.data(), that.size())

Definition at line 1663 of file FixedString.h.

References folly::gen::first, replace(), and folly::BasicFixedString< Char, N >::size_.

Referenced by TEST().

1666  {
1667  return replace(first - data_, last - first, that, 0u, that.size_);
1668  }
FOLLY_CPP14_CONSTEXPR BasicFixedString & replace(const Char *first, const Char *last, const BasicFixedString< Char, M > &that) noexcept(false)
Definition: FixedString.h:1663
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::replace ( std::size_t  this_pos,
std::size_t  this_count,
const BasicFixedString< Char, M > &  that,
std::size_t  that_pos = 0u 
)
inlinenoexcept

Replace this_count characters starting from position this_pos with the characters from string that starting at position that_pos.

Precondition
that_pos <= that.size()
Note
Equivalent to replace(this_pos, this_count, that.data() + that_pos, that.size() - that_pos)

Definition at line 1679 of file FixedString.h.

References replace(), and folly::BasicFixedString< Char, N >::size_.

1683  {
1684  return replace(this_pos, this_count, that, that_pos, that.size_ - that_pos);
1685  }
FOLLY_CPP14_CONSTEXPR BasicFixedString & replace(const Char *first, const Char *last, const BasicFixedString< Char, M > &that) noexcept(false)
Definition: FixedString.h:1663
template<class Char, std::size_t N>
template<std::size_t M>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::replace ( std::size_t  this_pos,
std::size_t  this_count,
const BasicFixedString< Char, M > &  that,
std::size_t  that_pos,
std::size_t  that_count 
)
inlinenoexcept

Replace this_count characters starting from position this_pos with that_count characters from string that starting at position that_pos.

Precondition
that_pos <= that.size() && that_count <= that.size() - that_pos
Note
Equivalent to replace(this_pos, this_count, that.data() + that_pos, that_count)

Definition at line 1696 of file FixedString.h.

1701  {
1702  return *this = creplace(this_pos, this_count, that, that_pos, that_count);
1703  }
constexpr BasicFixedString< Char, N+M > creplace(std::size_t this_pos, std::size_t this_count, const BasicFixedString< Char, M > &that, std::size_t that_pos=0u) const noexcept(false)
Definition: FixedString.h:1822
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::replace ( std::size_t  this_pos,
std::size_t  this_count,
const Char *  that 
)
inlinenoexcept

Replace this_count characters starting from position this_pos with the characters from the string literal that.

Note
Equivalent to replace(this_pos, this_count, that, strlen(that))

Definition at line 1711 of file FixedString.h.

References folly::constexpr_strlen(), and replace().

1714  {
1715  return replace(this_pos, this_count, that, folly::constexpr_strlen(that));
1716  }
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
FOLLY_CPP14_CONSTEXPR BasicFixedString & replace(const Char *first, const Char *last, const BasicFixedString< Char, M > &that) noexcept(false)
Definition: FixedString.h:1663
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::replace ( const Char *  first,
const Char *  last,
const Char *  that 
)
inlinenoexcept

Replace the characters denoted by the half-open range [first,last) with the characters from the string literal that.

Precondition
first and last point to characters within this string (including the terminating null).
Note
Equivalent to replace(first - data(), last - first, that, strlen(that))

Definition at line 1726 of file FixedString.h.

References folly::constexpr_strlen(), folly::gen::first, and replace().

1729  {
1730  return replace(
1731  first - data_, last - first, that, folly::constexpr_strlen(that));
1732  }
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
FOLLY_CPP14_CONSTEXPR BasicFixedString & replace(const Char *first, const Char *last, const BasicFixedString< Char, M > &that) noexcept(false)
Definition: FixedString.h:1663
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::replace ( std::size_t  this_pos,
std::size_t  this_count,
const Char *  that,
std::size_t  that_count 
)
inlinenoexcept

Replace this_count characters starting from position this_pos with that_count characters from the character sequence pointed to by that.

Parameters
this_posThe starting offset within *this of the first character to be replaced.
this_countThe number of characters to be replaced. If npos, it is treated as if this_count were size() - this_pos.
thatA pointer to the replacement string.
that_countThe number of characters in the replacement string.
Precondition
this_pos <= size() && this_count <= size() - this_pos
that points to a contiguous sequence of at least that_count characters
Exceptions
std::out_of_rangeon any of the following conditions:

Definition at line 1751 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::detail::fixedstring::checkOverflowOrNpos(), and data_.

1755  {
1756  return *this = detail::fixedstring::Helper::replace_<Char>(
1757  data_,
1758  size_,
1759  detail::fixedstring::checkOverflow(this_pos, size_),
1761  this_count, size_ - this_pos),
1762  that,
1763  0u,
1764  that_count,
1765  Indices{});
1766  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
folly::make_index_sequence< N > Indices
Definition: FixedString.h:531
constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max)
Definition: FixedString.h:76
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::replace ( std::size_t  this_pos,
std::size_t  this_count,
std::size_t  that_count,
Char  ch 
)
inlinenoexcept

Replace this_count characters starting from position this_pos with that_count characters ch.

Note
Equivalent to replace(this_pos, this_count, BasicFixedString{that_count, ch})

Definition at line 1774 of file FixedString.h.

References ch, and replace().

1778  {
1779  return replace(this_pos, this_count, BasicFixedString{that_count, ch});
1780  }
auto ch
constexpr BasicFixedString()
Definition: FixedString.h:611
FOLLY_CPP14_CONSTEXPR BasicFixedString & replace(const Char *first, const Char *last, const BasicFixedString< Char, M > &that) noexcept(false)
Definition: FixedString.h:1663
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::replace ( const Char *  first,
const Char *  last,
std::size_t  that_count,
Char  ch 
)
inlinenoexcept

Replace the characters denoted by the half-open range [first,last) with that_count characters ch.

Note
Equivalent to replace(first - data(), last - first, BasicFixedString{that_count, ch})

Definition at line 1788 of file FixedString.h.

References ch, folly::gen::first, and replace().

1792  {
1793  return replace(
1794  first - data_, last - first, BasicFixedString{that_count, ch});
1795  }
auto ch
constexpr BasicFixedString()
Definition: FixedString.h:611
FOLLY_CPP14_CONSTEXPR BasicFixedString & replace(const Char *first, const Char *last, const BasicFixedString< Char, M > &that) noexcept(false)
Definition: FixedString.h:1663
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR BasicFixedString& folly::BasicFixedString< Char, N >::replace ( const Char *  first,
const Char *  last,
std::initializer_list< Char >  il 
)
inlinenoexcept

Replace the characters denoted by the half-open range [first,last) with the characters from the string literal that.

Precondition
first and last point to characters within this string (including the terminating null).
Note
Equivalent to replace(this_pos, this_count, il.begin(), il.size())

Definition at line 1805 of file FixedString.h.

References folly::gen::first, and replace().

1808  {
1809  return replace(first - data_, last - first, il.begin(), il.size());
1810  }
FOLLY_CPP14_CONSTEXPR BasicFixedString & replace(const Char *first, const Char *last, const BasicFixedString< Char, M > &that) noexcept(false)
Definition: FixedString.h:1663
constexpr detail::First first
Definition: Base-inl.h:2553
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR void folly::BasicFixedString< Char, N >::resize ( std::size_t  count)
inlinenoexcept

Resizes the current string.

Note
Equivalent to resize(count, Char(0))

Definition at line 2044 of file FixedString.h.

References testing::gmock_generated_actions_test::Char(), count, and resize().

2044  {
2045  resize(count, Char(0));
2046  }
FOLLY_CPP14_CONSTEXPR void resize(std::size_t count) noexcept(false)
Definition: FixedString.h:2044
int * count
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR void folly::BasicFixedString< Char, N >::resize ( std::size_t  count,
Char  ch 
)
inlinenoexcept

Resizes the current string by setting the size to count and setting data()[count] to Char(0). If count > old_size, the characters in the range [old_size,count) are set to ch.

Definition at line 2053 of file FixedString.h.

References ch, testing::gmock_generated_actions_test::Char(), folly::detail::fixedstring::checkOverflow(), and count.

2054  {
2056  if (count == size_) {
2057  } else if (count < size_) {
2058  size_ = count;
2059  data_[size_] = Char(0);
2060  } else {
2061  for (; size_ < count; ++size_) {
2062  data_[size_] = ch;
2063  }
2064  data_[size_] = Char(0);
2065  }
2066  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
auto ch
int * count
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::rfind ( const BasicFixedString< Char, M > &  that) const
inlinenoexcept

Finds the last occurrence of characters in the string that in this string.

Note
Equivalent to rfind(that.data(), size(), that.size())

Definition at line 2159 of file FixedString.h.

References folly::rfind().

2160  {
2161  return rfind(that, size_);
2162  }
constexpr std::size_t rfind(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2159
template<class Char, std::size_t N>
template<std::size_t M>
constexpr std::size_t folly::BasicFixedString< Char, N >::rfind ( const BasicFixedString< Char, M > &  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the last occurrence of characters in the string that in this string, starting at offset pos.

Note
Equivalent to rfind(that.data(), pos, that.size())

Definition at line 2170 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::constexpr_min(), folly::BasicFixedString< Char, N >::data_, folly::detail::fixedstring::FixedStringBase_< class >::npos, folly::detail::fixedstring::rfind_(), and folly::BasicFixedString< Char, N >::size_.

2172  {
2173  return that.size_ <= size_
2175  data_,
2176  that.data_,
2179  size_ - that.size_),
2180  that.size_)
2181  : npos;
2182  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
constexpr std::size_t rfind_(const Left &left, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:206
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::rfind ( const Char *  that) const
inlinenoexcept

Finds the last occurrence of characters in the buffer pointed to by that in this string.

Note
Equivalent to rfind(that, size(), strlen(that))

Definition at line 2189 of file FixedString.h.

References folly::constexpr_strlen(), and folly::rfind().

2189  {
2190  return rfind(that, size_, folly::constexpr_strlen(that));
2191  }
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
constexpr std::size_t rfind(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2159
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::rfind ( const Char *  that,
std::size_t  pos 
) const
inlinenoexcept

Finds the last occurrence of characters in the buffer pointed to by that in this string, starting at offset pos.

Note
Equivalent to rfind(that, pos, strlen(that))

Definition at line 2198 of file FixedString.h.

References folly::constexpr_strlen(), and folly::rfind().

2199  {
2200  return rfind(that, pos, folly::constexpr_strlen(that));
2201  }
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
constexpr std::size_t rfind(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2159
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::rfind ( const Char *  that,
std::size_t  pos,
std::size_t  count 
) const
inlinenoexcept

Finds the last occurrence of the first count characters in the buffer pointed to by that in this string, starting at offset pos.

Precondition
pos <= size()
that points to a buffer containing at least count contiguous characters.
Returns
The largest offset i such that i <= pos and i + count <= size() and 0 == strncmp(data() + i, that, count); or npos if there is no such offset i.
Exceptions
std::out_of_rangewhen pos > size()

Definition at line 2214 of file FixedString.h.

References folly::detail::fixedstring::checkOverflow(), folly::constexpr_min(), count, folly::detail::fixedstring::FixedStringBase_< class >::npos, and folly::detail::fixedstring::rfind_().

2217  {
2218  return count <= size_
2220  data_,
2221  that,
2224  size_ - count),
2225  count)
2226  : npos;
2227  }
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
constexpr std::size_t rfind_(const Left &left, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:206
int * count
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::rfind ( Char  ch) const
inlinenoexcept

Finds the last occurrence of the character character ch in this string.

Note
Equivalent to rfind(&ch, size(), 1)

Definition at line 2233 of file FixedString.h.

References ch, and folly::rfind().

2233  {
2234  return rfind(ch, size_);
2235  }
auto ch
constexpr std::size_t rfind(const BasicFixedString< Char, M > &that) const noexcept
Definition: FixedString.h:2159
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::rfind ( Char  ch,
std::size_t  pos 
) const
inlinenoexcept

Finds the last occurrence of the character character ch in this string, starting at offset pos.

Precondition
pos <= size()
Note
Equivalent to rfind(&ch, pos, 1)

Definition at line 2243 of file FixedString.h.

References ch, folly::detail::fixedstring::checkOverflow(), folly::constexpr_min(), folly::detail::fixedstring::FixedStringBase_< class >::npos, and folly::detail::fixedstring::rfind_().

2243  {
2244  using A = const Char[1u];
2245  return 0u == size_
2246  ? npos
2248  data_,
2249  A{ch},
2252  1u);
2253  }
std::unique_ptr< int > A
constexpr std::size_t checkOverflow(std::size_t i, std::size_t max)
Definition: FixedString.h:72
constexpr T constexpr_min(T a)
Definition: ConstexprMath.h:79
auto ch
constexpr std::size_t rfind_(const Left &left, const Right &right, std::size_t pos, std::size_t count) noexcept
Definition: FixedString.h:206
static constexpr std::size_t npos
Definition: FixedString.h:54
template<class Char, std::size_t N>
constexpr std::size_t folly::BasicFixedString< Char, N >::size ( ) const
inlinenoexcept
Returns
The number of Char elements in the string.

Definition at line 1062 of file FixedString.h.

Referenced by folly::BasicFixedString< Char, N >::compare().

1062  {
1063  return size_;
1064  }
template<class Char, std::size_t N>
constexpr BasicFixedString folly::BasicFixedString< Char, N >::substr ( std::size_t  pos) const
inlinenoexcept

Return a substring from pos to the end of the string.

Note
Equivalent to BasicFixedString{*this, pos}

Definition at line 1641 of file FixedString.h.

1641  {
1642  return {*this, pos};
1643  }
template<class Char, std::size_t N>
constexpr BasicFixedString folly::BasicFixedString< Char, N >::substr ( std::size_t  pos,
std::size_t  count 
) const
inlinenoexcept

Return a substring from pos to the end of the string.

Note
Equivalent to BasicFixedString{*this, pos, count}

Definition at line 1649 of file FixedString.h.

References count.

1650  {
1651  return {*this, pos, count};
1652  }
int * count
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR void folly::BasicFixedString< Char, N >::swap ( BasicFixedString< Char, N > &  that)
inlinenoexcept

Swap the contents of this string with that.

Definition at line 942 of file FixedString.h.

References folly::constexpr_max(), folly::detail::fixedstring::constexpr_swap(), folly::BasicFixedString< Char, N >::data_, i, and folly::BasicFixedString< Char, N >::size_.

Referenced by TEST().

942  {
943  // less-than-or-equal here to copy the null terminator:
944  for (std::size_t i = 0u; i <= folly::constexpr_max(size_, that.size_);
945  ++i) {
947  }
949  }
constexpr T constexpr_max(T a)
Definition: ConstexprMath.h:68
FOLLY_CPP14_CONSTEXPR void constexpr_swap(T &a, T &b) noexcept(noexcept(a=T(std::move(a))))
Definition: FixedString.h:310
template<class Char, std::size_t N>
FOLLY_CPP14_CONSTEXPR Range<Char*> folly::BasicFixedString< Char, N >::toRange ( )
inlinenoexcept

Conversion to folly::Range

Returns
Range<Char*>{begin(), end()}

Definition at line 796 of file FixedString.h.

References folly::test::begin(), and folly::test::end().

796  {
797  return {begin(), end()};
798  }
FOLLY_CPP14_CONSTEXPR Char * end() noexcept
Definition: FixedString.h:997
FOLLY_CPP14_CONSTEXPR Char * begin() noexcept
Definition: FixedString.h:976
template<class Char, std::size_t N>
constexpr Range<const Char*> folly::BasicFixedString< Char, N >::toRange ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 803 of file FixedString.h.

References folly::test::begin(), and folly::test::end().

803  {
804  return {begin(), end()};
805  }
FOLLY_CPP14_CONSTEXPR Char * end() noexcept
Definition: FixedString.h:997
FOLLY_CPP14_CONSTEXPR Char * begin() noexcept
Definition: FixedString.h:976
template<class Char, std::size_t N>
std::basic_string<Char> folly::BasicFixedString< Char, N >::toStdString ( ) const
inlinenoexcept

Definition at line 815 of file FixedString.h.

References folly::test::begin(), and folly::test::end().

815  {
816  return std::basic_string<Char>{begin(), end()};
817  }
FOLLY_CPP14_CONSTEXPR Char * end() noexcept
Definition: FixedString.h:997
FOLLY_CPP14_CONSTEXPR Char * begin() noexcept
Definition: FixedString.h:976

Friends And Related Function Documentation

template<class Char, std::size_t N>
template<class , std::size_t >
friend class BasicFixedString
friend

Definition at line 516 of file FixedString.h.

template<class Char, std::size_t N>
friend struct detail::fixedstring::Helper
friend

Definition at line 517 of file FixedString.h.

template<class Char, std::size_t N>
constexpr bool operator!= ( const Char *  a,
const BasicFixedString< Char, N > &  b 
)
friend

Definition at line 2668 of file FixedString.h.

2670  {
2671  return !(a == b);
2672  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator!= ( const BasicFixedString< Char, N > &  a,
const Char *  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2677 of file FixedString.h.

2679  {
2680  return !(b == a);
2681  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator!= ( Range< const Char * >  a,
const BasicFixedString< Char, N > &  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2686 of file FixedString.h.

2688  {
2689  return !(a == b);
2690  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator!= ( const BasicFixedString< Char, N > &  a,
Range< const Char * >  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2695 of file FixedString.h.

2697  {
2698  return !(a == b);
2699  }
char b
char a
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M - 1u> operator+ ( const Char(&)  a[M],
const BasicFixedString< Char, N > &  b 
)
friend

Asymmetric concatenation

Definition at line 2845 of file FixedString.h.

2847  {
2848  return detail::fixedstring::Helper::concat_<Char>(
2850  M - 1u,
2851  b.data_,
2852  b.size_,
2853  folly::make_index_sequence<N + M - 1u>{});
2854  }
constexpr const Char(& checkNullTerminated(const Char(&a)[N]) noexcept)[N]
Definition: FixedString.h:92
char b
make_integer_sequence< std::size_t, Size > make_index_sequence
Definition: Utility.h:209
char a
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<class Char, std::size_t N>
template<std::size_t M>
constexpr BasicFixedString<Char, N + M - 1u> operator+ ( const BasicFixedString< Char, N > &  a,
const Char(&)  b[M] 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2860 of file FixedString.h.

2862  {
2863  return detail::fixedstring::Helper::concat_<Char>(
2864  a.data_,
2865  a.size_,
2867  M - 1u,
2868  folly::make_index_sequence<N + M - 1u>{});
2869  }
constexpr const Char(& checkNullTerminated(const Char(&a)[N]) noexcept)[N]
Definition: FixedString.h:92
char b
make_integer_sequence< std::size_t, Size > make_index_sequence
Definition: Utility.h:209
char a
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<class Char, std::size_t N>
constexpr BasicFixedString<Char, N + 1u> operator+ ( Char  a,
const BasicFixedString< Char, N > &  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2874 of file FixedString.h.

2876  {
2877  using A = const Char[2u];
2878  return detail::fixedstring::Helper::concat_<Char>(
2879  A{a, Char(0)},
2880  1u,
2881  b.data_,
2882  b.size_,
2884  }
std::unique_ptr< int > A
char b
make_integer_sequence< std::size_t, Size > make_index_sequence
Definition: Utility.h:209
char a
template<class Char, std::size_t N>
constexpr BasicFixedString<Char, N + 1u> operator+ ( const BasicFixedString< Char, N > &  a,
Char  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2889 of file FixedString.h.

2891  {
2892  using A = const Char[2u];
2893  return detail::fixedstring::Helper::concat_<Char>(
2894  a.data_,
2895  a.size_,
2896  A{b, Char(0)},
2897  1u,
2899  }
std::unique_ptr< int > A
char b
make_integer_sequence< std::size_t, Size > make_index_sequence
Definition: Utility.h:209
char a
template<class Char, std::size_t N>
constexpr bool operator< ( const Char *  a,
const BasicFixedString< Char, N > &  b 
)
friend

Definition at line 2701 of file FixedString.h.

2703  {
2704  return ordering::lt ==
2706  a, 0u, folly::constexpr_strlen(a), b.data_, 0u, b.size_);
2707  }
char b
char a
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
constexpr ordering compare_(const Left &left, std::size_t left_pos, std::size_t left_size, const Right &right, std::size_t right_pos, std::size_t right_size) noexcept
Definition: FixedString.h:111
template<class Char, std::size_t N>
constexpr bool operator< ( const BasicFixedString< Char, N > &  a,
const Char *  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2712 of file FixedString.h.

2714  {
2715  return ordering::lt ==
2717  a.data_, 0u, a.size_, b, 0u, folly::constexpr_strlen(b));
2718  }
char b
char a
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
constexpr ordering compare_(const Left &left, std::size_t left_pos, std::size_t left_size, const Right &right, std::size_t right_pos, std::size_t right_size) noexcept
Definition: FixedString.h:111
template<class Char, std::size_t N>
constexpr bool operator< ( Range< const Char * >  a,
const BasicFixedString< Char, N > &  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2723 of file FixedString.h.

2725  {
2726  return ordering::lt ==
2728  a.begin(), 0u, a.size(), b.data_, 0u, b.size_);
2729  }
char b
char a
constexpr ordering compare_(const Left &left, std::size_t left_pos, std::size_t left_size, const Right &right, std::size_t right_pos, std::size_t right_size) noexcept
Definition: FixedString.h:111
template<class Char, std::size_t N>
constexpr bool operator< ( const BasicFixedString< Char, N > &  a,
Range< const Char * >  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2734 of file FixedString.h.

2736  {
2737  return ordering::lt ==
2739  a.data_, 0u, a.size_, b.begin(), 0u, b.size());
2740  }
char b
char a
constexpr ordering compare_(const Left &left, std::size_t left_pos, std::size_t left_size, const Right &right, std::size_t right_pos, std::size_t right_size) noexcept
Definition: FixedString.h:111
template<class Char, std::size_t N>
constexpr bool operator<= ( const Char *  a,
const BasicFixedString< Char, N > &  b 
)
friend

Definition at line 2775 of file FixedString.h.

2777  {
2778  return !(b < a);
2779  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator<= ( const BasicFixedString< Char, N > &  a,
const Char *  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2784 of file FixedString.h.

2786  {
2787  return !(b < a);
2788  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator<= ( Range< const Char * > const &  a,
const BasicFixedString< Char, N > &  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2793 of file FixedString.h.

2795  {
2796  return !(b < a);
2797  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator<= ( const BasicFixedString< Char, N > &  a,
Range< const Char * >  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2802 of file FixedString.h.

2804  {
2805  return !(b < a);
2806  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator== ( const Char *  a,
const BasicFixedString< Char, N > &  b 
)
friend

Asymmetric relational operators

Definition at line 2634 of file FixedString.h.

2636  {
2638  a, folly::constexpr_strlen(a), b.data_, b.size_);
2639  }
char b
constexpr bool equal_(const Left &left, std::size_t left_size, const Right &right, std::size_t right_size) noexcept
Definition: FixedString.h:135
char a
constexpr size_t constexpr_strlen(const Char *s)
Definition: Constexpr.h:57
template<class Char, std::size_t N>
constexpr bool operator== ( const BasicFixedString< Char, N > &  a,
const Char *  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2644 of file FixedString.h.

2646  {
2647  return b == a;
2648  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator== ( Range< const Char * >  a,
const BasicFixedString< Char, N > &  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2653 of file FixedString.h.

2655  {
2656  return detail::fixedstring::equal_(a.begin(), a.size(), b.data_, b.size_);
2657  }
char b
constexpr bool equal_(const Left &left, std::size_t left_size, const Right &right, std::size_t right_size) noexcept
Definition: FixedString.h:135
char a
template<class Char, std::size_t N>
constexpr bool operator== ( const BasicFixedString< Char, N > &  a,
Range< const Char * >  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2662 of file FixedString.h.

2664  {
2665  return b == a;
2666  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator> ( const Char *  a,
const BasicFixedString< Char, N > &  b 
)
friend

Definition at line 2742 of file FixedString.h.

2744  {
2745  return b < a;
2746  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator> ( const BasicFixedString< Char, N > &  a,
const Char *  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2751 of file FixedString.h.

2753  {
2754  return b < a;
2755  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator> ( Range< const Char * >  a,
const BasicFixedString< Char, N > &  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2760 of file FixedString.h.

2762  {
2763  return b < a;
2764  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator> ( const BasicFixedString< Char, N > &  a,
Range< const Char * >  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2769 of file FixedString.h.

2771  {
2772  return b < a;
2773  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator>= ( const Char *  a,
const BasicFixedString< Char, N > &  b 
)
friend

Definition at line 2808 of file FixedString.h.

2810  {
2811  return !(a < b);
2812  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator>= ( const BasicFixedString< Char, N > &  a,
const Char *  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2817 of file FixedString.h.

2819  {
2820  return !(a < b);
2821  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator>= ( Range< const Char * >  a,
const BasicFixedString< Char, N > &  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2826 of file FixedString.h.

2828  {
2829  return !(a < b);
2830  }
char b
char a
template<class Char, std::size_t N>
constexpr bool operator>= ( const BasicFixedString< Char, N > &  a,
Range< const Char * > const &  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2835 of file FixedString.h.

2837  {
2838  return !(a < b);
2839  }
char b
char a

Member Data Documentation


The documentation for this class was generated from the following file: