Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZStd::basic_fixed_string< Element, MaxElementCount, Traits > Class Template Reference

#include <fixed_string.h>

Public Types

using pointer = Element *
 
using const_pointer = const Element *
 
using reference = Element &
 
using const_reference = const Element &
 
using difference_type = AZStd::ptrdiff_t
 
using size_type = AZStd::size_t
 
using iterator = pointer
 
using const_iterator = const_pointer
 
using reverse_iterator = AZStd::reverse_iterator< iterator >
 
using const_reverse_iterator = AZStd::reverse_iterator< const_iterator >
 
using value_type = Element
 
using traits_type = Traits
 
using allocator_type = void
 

Public Member Functions

constexpr basic_fixed_string (size_type count, Element ch)
 
constexpr basic_fixed_string (const basic_fixed_string &rhs, size_type rhsOffset)
 
constexpr basic_fixed_string (const basic_fixed_string &rhs, size_type rhsOffset, size_type count)
 
constexpr basic_fixed_string (const_pointer ptr, size_type count)
 
constexpr basic_fixed_string (const_pointer ptr)
 
template<class InputIt , typename = enable_if_t<input_iterator<InputIt> && !is_convertible_v<InputIt, size_t>>>
constexpr basic_fixed_string (InputIt first, InputIt last)
 
template<class R , class = enable_if_t<Internal::container_compatible_range<R, value_type>>>
constexpr basic_fixed_string (from_range_t, R &&rg)
 
constexpr basic_fixed_string (const basic_fixed_string &rhs)
 
constexpr basic_fixed_string (basic_fixed_string &&rhs)
 
constexpr basic_fixed_string (AZStd::initializer_list< Element > ilist)
 
template<typename T , typename = AZStd::enable_if_t<is_convertible_v<const T&, basic_string_view<Element, Traits>> && !is_convertible_v<const T&, const Element*>>>
constexpr basic_fixed_string (const T &convertibleToView)
 
template<typename T , typename = AZStd::enable_if_t<is_convertible_v<const T&, basic_string_view<Element, Traits>> && !is_convertible_v<const T&, const Element*>>>
constexpr basic_fixed_string (const T &convertibleToView, size_type rhsOffset, size_type count)
 
constexpr basic_fixed_string (AZStd::nullptr_t)=delete
 
constexpr operator AZStd::basic_string_view< Element, Traits > () const
 
constexpr auto begin () -> iterator
 
constexpr auto begin () const -> const_iterator
 
constexpr auto cbegin () const -> const_iterator
 
constexpr auto end () -> iterator
 
constexpr auto end () const -> const_iterator
 
constexpr auto cend () const -> const_iterator
 
constexpr auto rbegin () -> reverse_iterator
 
constexpr auto rbegin () const -> const_reverse_iterator
 
constexpr auto crbegin () const -> const_reverse_iterator
 
constexpr auto rend () -> reverse_iterator
 
constexpr auto rend () const -> const_reverse_iterator
 
constexpr auto crend () const -> const_reverse_iterator
 
constexpr auto operator= (const basic_fixed_string &rhs) -> basic_fixed_string &
 
constexpr auto operator= (basic_fixed_string &&rhs) -> basic_fixed_string &
 
constexpr auto operator= (const_pointer ptr) -> basic_fixed_string &
 
constexpr auto operator= (Element ch) -> basic_fixed_string &
 
constexpr auto operator= (AZStd::initializer_list< Element > ilist) -> basic_fixed_string &
 
template<typename T >
constexpr auto operator= (const T &convertible_to_view) -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, basic_fixed_string & >
 
constexpr auto operator= (AZStd::nullptr_t) -> basic_fixed_string &=delete
 
constexpr auto operator+= (const basic_fixed_string &rhs) -> basic_fixed_string &
 
constexpr auto operator+= (const_pointer ptr) -> basic_fixed_string &
 
constexpr auto operator+= (Element ch) -> basic_fixed_string &
 
constexpr auto operator+= (AZStd::initializer_list< Element > ilist) -> basic_fixed_string &
 
template<typename T >
constexpr auto operator+= (const T &convertible_to_view) -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, basic_fixed_string & >
 
constexpr auto append (const basic_fixed_string &rhs) -> basic_fixed_string &
 
constexpr auto append (const basic_fixed_string &rhs, size_type rhsOffset, size_type count) -> basic_fixed_string &
 
constexpr auto append (const_pointer ptr, size_type count) -> basic_fixed_string &
 
template<typename T >
constexpr auto append (const T &convertible_to_view) -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, basic_fixed_string & >
 
constexpr auto append (const_pointer ptr) -> basic_fixed_string &
 
constexpr auto append (size_type count, Element ch) -> basic_fixed_string &
 
template<class InputIt >
constexpr auto append (InputIt first, InputIt last) -> enable_if_t< input_iterator< InputIt > &&!is_convertible_v< InputIt, size_type >, basic_fixed_string & >
 
template<class R >
constexpr auto append_range (R &&rg) -> enable_if_t< Internal::container_compatible_range< R, value_type >, basic_fixed_string & >
 
constexpr auto append (AZStd::initializer_list< Element > ilist) -> basic_fixed_string &
 
constexpr auto assign (const basic_fixed_string &rhs) -> basic_fixed_string &
 
constexpr auto assign (basic_fixed_string &&rhs) -> basic_fixed_string &
 
constexpr auto assign (const basic_fixed_string &rhs, size_type rhsOffset, size_type count) -> basic_fixed_string &
 
constexpr auto assign (const_pointer ptr, size_type count) -> basic_fixed_string &
 
template<typename T >
constexpr auto assign (const T &convertible_to_view) -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, basic_fixed_string & >
 
constexpr auto assign (const_pointer ptr) -> basic_fixed_string &
 
constexpr auto assign (size_type count, Element ch) -> basic_fixed_string &
 
template<class InputIt >
constexpr auto assign (InputIt first, InputIt last) -> enable_if_t< input_iterator< InputIt > &&!is_convertible_v< InputIt, size_type >, basic_fixed_string & >
 
template<class R >
constexpr auto assign_range (R &&rg) -> enable_if_t< Internal::container_compatible_range< R, value_type >, basic_fixed_string & >
 
constexpr auto assign (AZStd::initializer_list< Element > ilist) -> basic_fixed_string &
 
constexpr auto insert (size_type offset, const basic_fixed_string &rhs) -> basic_fixed_string &
 
constexpr auto insert (size_type offset, const basic_fixed_string &rhs, size_type rhsOffset, size_type count) -> basic_fixed_string &
 
constexpr auto insert (size_type offset, const_pointer ptr, size_type count) -> basic_fixed_string &
 
constexpr auto insert (size_type offset, const_pointer ptr) -> basic_fixed_string &
 
template<typename T >
constexpr auto insert (size_type offset, const T &convertible_to_view) -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, basic_fixed_string & >
 
constexpr auto insert (size_type offset, size_type count, Element ch) -> basic_fixed_string &
 
constexpr auto insert (const_iterator insertPos) -> iterator
 
constexpr auto insert (const_iterator insertPos, Element ch) -> iterator
 
constexpr auto insert (const_iterator insertPos, size_type count, Element ch) -> iterator
 
template<class InputIt >
constexpr auto insert (const_iterator insertPos, InputIt first, InputIt last) -> enable_if_t< input_iterator< InputIt > &&!is_convertible_v< InputIt, size_type >, iterator >
 
template<class R >
constexpr auto insert_range (const_iterator insertPos, R &&rg) -> enable_if_t< Internal::container_compatible_range< R, value_type >, iterator >
 
constexpr auto insert (const_iterator insertPos, AZStd::initializer_list< Element > ilist) -> iterator
 
constexpr auto erase (size_type offset=0, size_type count=npos) -> basic_fixed_string &
 
constexpr auto erase (const_iterator erasePos) -> iterator
 
constexpr auto erase (const_iterator first, const_iterator last) -> iterator
 
constexpr auto clear () -> void
 
constexpr auto replace (size_type offset, size_type count, const basic_fixed_string &rhs) -> basic_fixed_string &
 
constexpr auto replace (size_type offset, size_type count, const basic_fixed_string &rhs, size_type rhsOffset, size_type rhsCount) -> basic_fixed_string &
 
template<typename T >
constexpr auto replace (size_type offset, size_type count, const T &convertible_to_view, size_type rhsOffset, size_type rhsCount=npos) -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, basic_fixed_string & >
 
constexpr auto replace (size_type offset, size_type count, const_pointer ptr, size_type ptrCount) -> basic_fixed_string &
 
constexpr auto replace (size_type offset, size_type count, const_pointer ptr) -> basic_fixed_string &
 
template<typename T >
constexpr auto replace (size_type offset, size_type count, const T &convertible_to_view) -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, basic_fixed_string & >
 
constexpr auto replace (size_type offset, size_type count, size_type num, Element ch) -> basic_fixed_string &
 
constexpr auto replace (const_iterator first, const_iterator last, const basic_fixed_string &rhs) -> basic_fixed_string &
 
constexpr auto replace (const_iterator first, const_iterator last, const_pointer ptr, size_type count) -> basic_fixed_string &
 
constexpr auto replace (const_iterator first, const_iterator last, const_pointer ptr) -> basic_fixed_string &
 
template<typename T >
constexpr auto replace (const_iterator first, const_iterator last, const T &convertible_to_view) -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, basic_fixed_string & >
 
constexpr auto replace (const_iterator first, const_iterator last, size_type count, Element ch) -> basic_fixed_string &
 
template<class InputIt >
constexpr auto replace (const_iterator first, const_iterator last, InputIt first2, InputIt last2) -> enable_if_t< input_iterator< InputIt > &&!is_convertible_v< InputIt, size_type >, basic_fixed_string & >
 
template<class R >
constexpr auto replace_with_range (const_iterator first, const_iterator last, R &&rg) -> enable_if_t< Internal::container_compatible_range< R, value_type >, basic_fixed_string & >
 
constexpr auto replace (const_iterator first, const_iterator last, AZStd::initializer_list< Element > ilist) -> basic_fixed_string &
 
constexpr auto at (size_type offset) -> reference
 
constexpr auto at (size_type offset) const -> const_reference
 
constexpr auto operator[] (size_type offset) -> reference
 
constexpr auto operator[] (size_type offset) const -> const_reference
 
constexpr auto front () -> reference
 
constexpr auto front () const -> const_reference
 
constexpr auto back () -> reference
 
constexpr auto back () const -> const_reference
 
constexpr auto push_back (Element ch) -> void
 
constexpr auto pop_back () -> void
 
constexpr auto c_str () const -> const_pointer
 
constexpr auto data () const -> const_pointer
 
constexpr auto data () -> pointer
 
constexpr auto length () const -> size_type
 
constexpr auto size () const -> size_type
 
constexpr auto capacity () const -> size_type
 
constexpr auto max_size () const -> size_type
 
constexpr auto resize (size_type newSize) -> void
 
constexpr auto resize (size_type newSize, Element ch) -> void
 
constexpr auto resize_no_construct (size_type newSize) -> void
 
template<class Operation >
constexpr auto resize_and_overwrite (size_type n, Operation op) -> void
 
constexpr auto reserve (size_type newCapacity=0) -> void
 
constexpr auto empty () const -> bool
 
constexpr auto copy (Element *dest, size_type count, size_type offset=0) const -> size_type
 
constexpr auto swap (basic_fixed_string &rhs) -> void
 
constexpr auto contains (const basic_fixed_string &other) const -> bool
 
constexpr auto contains (Element ch) const -> bool
 
constexpr auto contains (const_pointer s) const -> bool
 
constexpr auto find (const basic_fixed_string &rhs, size_type offset=0) const -> size_type
 
constexpr auto find (const_pointer ptr, size_type offset, size_type count) const -> size_type
 
constexpr auto find (const_pointer ptr, size_type offset=0) const -> size_type
 
constexpr auto find (Element ch, size_type offset=0) const -> size_type
 
template<typename T >
constexpr auto find (const T &convertibleToView, size_type offset=0) const -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, size_type >
 
constexpr auto rfind (const basic_fixed_string &rhs, size_type offset=npos) const -> size_type
 
constexpr auto rfind (const_pointer ptr, size_type offset, size_type count) const -> size_type
 
constexpr auto rfind (const_pointer ptr, size_type offset=npos) const -> size_type
 
constexpr auto rfind (Element ch, size_type offset=npos) const -> size_type
 
template<typename T >
constexpr auto rfind (const T &convertibleToView, size_type offset=npos) const -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, size_type >
 
constexpr auto find_first_of (const basic_fixed_string &rhs, size_type offset=0) const -> size_type
 
constexpr auto find_first_of (const_pointer ptr, size_type offset, size_type count) const -> size_type
 
constexpr auto find_first_of (const_pointer ptr, size_type offset=0) const -> size_type
 
constexpr auto find_first_of (Element ch, size_type offset=0) const -> size_type
 
template<typename T >
constexpr auto find_first_of (const T &convertibleToView, size_type offset=0) const -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, size_type >
 
constexpr auto find_first_not_of (const basic_fixed_string &rhs, size_type offset=0) const -> size_type
 
constexpr auto find_first_not_of (const_pointer ptr, size_type offset, size_type count) const -> size_type
 
constexpr auto find_first_not_of (const_pointer ptr, size_type offset=0) const -> size_type
 
constexpr auto find_first_not_of (Element ch, size_type offset=0) const -> size_type
 
template<typename T >
constexpr auto find_first_not_of (const T &convertibleToView, size_type offset=0) const -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, size_type >
 
constexpr auto find_last_of (const basic_fixed_string &rhs, size_type offset=npos) const -> size_type
 
constexpr auto find_last_of (const_pointer ptr, size_type offset, size_type count) const -> size_type
 
constexpr auto find_last_of (const_pointer ptr, size_type offset=npos) const -> size_type
 
constexpr auto find_last_of (Element ch, size_type offset=npos) const -> size_type
 
template<typename T >
constexpr auto find_last_of (const T &convertibleToView, size_type offset=npos) const -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, size_type >
 
constexpr auto find_last_not_of (const basic_fixed_string &rhs, size_type offset=npos) const -> size_type
 
constexpr auto find_last_not_of (const_pointer ptr, size_type offset, size_type count) const -> size_type
 
constexpr auto find_last_not_of (const_pointer ptr, size_type offset=npos) const -> size_type
 
constexpr auto find_last_not_of (Element ch, size_type offset=npos) const -> size_type
 
template<typename T >
constexpr auto find_last_not_of (const T &convertibleToView, size_type offset=npos) const -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, size_type >
 
constexpr auto substr (size_type offset=0, size_type count=npos) const -> basic_fixed_string
 
constexpr auto compare (const basic_fixed_string &rhs) const -> int
 
constexpr auto compare (size_type offset, size_type count, const basic_fixed_string &rhs) const -> int
 
constexpr auto compare (size_type offset, size_type count, const basic_fixed_string &rhs, size_type rhsOffset, size_type rhsCount) const -> int
 
constexpr auto compare (const_pointer ptr) const -> int
 
constexpr auto compare (size_type offset, size_type count, const_pointer ptr) const -> int
 
constexpr auto compare (size_type offset, size_type count, const_pointer ptr, size_type ptrCount) const -> int
 
template<typename T >
constexpr auto starts_with (const T &prefix) const -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, bool >
 
constexpr auto starts_with (value_type prefix) const -> bool
 
constexpr auto starts_with (const_pointer prefix) const -> bool
 
template<typename T >
constexpr auto ends_with (const T &suffix) const -> AZStd::enable_if_t< is_convertible_v< const T &, basic_string_view< Element, Traits > > &&!is_convertible_v< const T &, const Element * >, bool >
 
constexpr auto ends_with (value_type suffix) const -> bool
 
constexpr auto ends_with (const_pointer suffix) const -> bool
 
constexpr auto leak_and_reset () -> void
 

Static Public Member Functions

static decltype(auto) format_arg (const char *format, va_list argList)
 
static decltype(auto) format (const char *format,...) AZ_FORMAT_ATTRIBUTE(1
 
static decltype(auto) static decltype(auto) format_arg (const wchar_t *format, va_list argList)
 
static decltype(auto) format (const wchar_t *format,...)
 

Static Public Attributes

static constexpr size_type npos = size_type(-1)
 

Protected Member Functions

constexpr auto fits_in_capacity (size_type newSize) -> bool
 

Protected Attributes

Element m_buffer [Capacity+1] {}
 
internal_size_type m_size {}
 

Static Protected Attributes

static constexpr size_type Capacity = MaxElementCount
 

Detailed Description

template<class Element, size_t MaxElementCount, class Traits = char_traits<Element>>
class AZStd::basic_fixed_string< Element, MaxElementCount, Traits >

Implementation of string based class which stores an the characters in internal buffer that is determined at compile time The basic_fixed_string class performs no heap allocations. The API of the this class follows the same API as the C++20 std::string API with the exception that any API related to allocators have been removed This class performs no heap allocations and is constexpr with the exception of the basic_fixed_string::format functions which rely on the vs(w)nprintf function under the hood which are not constexpr. Due to being non-allocating this class is also safe to use in static memory unlike AZStd::string

Member Function Documentation

◆ leak_and_reset()

template<class Element , size_t MaxElementCount, class Traits >
constexpr auto AZStd::basic_fixed_string< Element, MaxElementCount, Traits >::leak_and_reset
inlineconstexpr

Resets the container without deallocating any memory or calling any destructor. This function should be used when we need very quick tear down. For fixed_string case this performs the same action as clear()


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