This is the basic_string replacement. For conformity, basic_fbstring takes the same template parameters, plus the last one which is the core.

Synopsis

Declared in <folly/FBString.h>

template<
    typename E,
    class T = std::char_traits<E>,
    class A = std::allocator<E>,
    class Storage = fbstring_core<E>>
class basic_fbstring;

Type Aliases

Name

Description

IsRelocatable

Marks the string as trivially relocatable.

allocator_type

The allocator type.

const_iterator

A const random‐access iterator over the characters.

const_pointer

A const pointer to a character.

const_reference

A const reference to a character.

const_reverse_iterator

A const reverse iterator over the characters.

difference_type

The signed integer type used for differences between iterators.

iterator

A random‐access iterator over the characters.

pointer

A pointer to a character.

reference

A reference to a character.

reverse_iterator

A reverse iterator over the characters.

size_type

The unsigned integer type used for sizes and indices.

traits_type

The character traits type.

value_type

The character type stored in the string.

Member Functions

Name

Description

basic_fbstring [constructor]

Constructors

~basic_fbstring [destructor]

Destroys the string, releasing any allocated storage.

operator=

Assignment operators

append

append overloads

assign

assign overloads

at

Returns a reference to the character at a given position, bounds‐checked.

back

Returns a reference to the last character.

begin

begin overloads

c_str

Returns a pointer to a null‐terminated version of the string.

capacity

Returns the number of characters the string can hold without reallocation.

cbegin

Returns a const iterator to the first character.

cend

Returns a const iterator past the last character.

clear

Removes all characters, leaving an empty string.

compare

compare overloads

copy

Copies up to n characters into a destination buffer.

crbegin

Returns a const reverse iterator to the last character.

crend

Returns a const reverse iterator past the first character.

data

data overloads

empty

Returns whether the string contains no characters.

end

end overloads

erase

erase overloads

find

find overloads

find_first_not_of

find_first_not_of overloads

find_first_of

find_first_of overloads

find_last_not_of

find_last_not_of overloads

find_last_of

find_last_of overloads

front

Returns a reference to the first character.

get_allocator

Returns the allocator associated with the string.

insert

insert overloads

is_counted

Returns whether the string uses reference‐counted storage.

length

Returns the number of characters in the string.

max_size

Returns the maximum number of characters the string can hold.

operator+=

Addition assignment operators

operator[]

Returns a reference to the character at a given position.

pop_back

Removes the last character from the string.

push_back

Appends a single character.

rbegin

rbegin overloads

rend

rend overloads

replace

replace overloads

reserve

Ensures capacity for at least res_arg characters.

resize

Resizes the string to contain n characters.

rfind

rfind overloads

shrink_to_fit

Reduces capacity to fit the current size where worthwhile.

size

Returns the number of characters in the string.

substr

substr overloads

swap

Swaps the contents of this string with another.

toStdString

Converts the string to a std::basic_string.

use_count

Returns the reference count of this string's underlying data.

operator string_view_type

Converts the string to a string view.

Static Data Members

Name

Description

npos

Sentinel value indicating "not found" or "until the end".

Friends

Name

Description

folly::operator<=>

Three‐way compares a string with a std::basic_string.

folly::operator<=>

Three‐way compares a string with a null‐terminated array.

folly::operator<=>

Three‐way compares two strings.

folly::getline

Reads characters from a stream into a string until a newline.

folly::getline

Reads characters from a stream into a string until a delimiter.

Non-Member Functions

Name

Description

operator!=

Compares an fbstring and a std::basic_string for inequality.

operator!=

Inequality comparison against nullptr is deleted.

operator!=

Compares two strings for inequality.

operator!=

Compares a string and a null‐terminated array for inequality.

operator+

Concatenates a single character and a string.

operator+

Concatenates a single character and a string, reusing its storage.

operator+

Concatenates a null‐terminated array and a string, reusing its storage.

operator+

Concatenates a string and a single character.

operator+

Concatenates two strings, reusing the right operand's storage.

operator+

Concatenates two strings.

operator+

Concatenates a string and a null‐terminated array.

operator+

Concatenates two strings, reusing either operand's storage.

operator+

Concatenates a string and a single character, reusing its storage.

operator+

Concatenates two strings, reusing the left operand's storage.

operator+

Concatenates a string and a null‐terminated array, reusing its storage.

operator+

Concatenates a null‐terminated array and a string.

operator<

Orders an fbstring before a std::basic_string.

operator<=

Orders an fbstring at or before a std::basic_string.

operator<=>

Three‐way comparison against nullptr is deleted.

operator==

Compares a string and a null‐terminated array for equality.

operator==

Equality comparison against nullptr is deleted.

operator==

Compares two strings for equality.

operator==

Compares an fbstring and a std::basic_string for equality.

operator>

Orders an fbstring after a std::basic_string.

operator>=

Orders an fbstring at or after a std::basic_string.

swap

Swaps the contents of two strings.

Created with MrDocs