HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Data Fields | Friends
hi::v1::fixed_string< N > Struct Template Reference

#include <hikogui/utility/fixed_string.hpp>

Public Types

using value_type = char
 

Public Member Functions

constexpr fixed_string (fixed_string const &) noexcept=default
 
constexpr fixed_string (fixed_string &&) noexcept=default
 
constexpr fixed_stringoperator= (fixed_string const &) noexcept=default
 
constexpr fixed_stringoperator= (fixed_string &&) noexcept=default
 
template<std::size_t O>
requires ((O - 1) == N)
constexpr fixed_string (char const (&str)[O]) noexcept
 
template<std::invocable F>
constexpr fixed_string (F const &f) noexcept
 Create a fixed string from function returning a string-like.
 
constexpr operator std::string_view () const noexcept
 
constexpr operator std::string () const noexcept
 
constexpr std::size_t size () const noexcept
 
constexpr bool empty () const noexcept
 
constexpr char & operator[] (size_t index) noexcept
 
constexpr char const & operator[] (size_t index) const noexcept
 
constexpr auto begin () noexcept
 
constexpr auto end () noexcept
 
constexpr bool operator== (fixed_string const &rhs) const noexcept=default
 
constexpr auto operator<=> (fixed_string const &rhs) const noexcept=default
 
template<size_t O>
requires (O != N)
constexpr bool operator== (fixed_string< O > const &rhs) const noexcept
 
template<size_t O>
requires (O != N)
constexpr auto operator<=> (fixed_string< O > const &rhs) const noexcept
 
constexpr bool operator== (std::string_view rhs) const noexcept
 
constexpr auto operator<=> (std::string_view rhs) const noexcept
 
constexpr bool operator== (std::string const &rhs) const noexcept
 
constexpr auto operator<=> (std::string const &rhs) const noexcept
 
constexpr bool operator== (char const *rhs) const noexcept
 
constexpr auto operator<=> (char const *rhs) const noexcept
 
template<size_t O>
constexpr bool operator== (char const (&rhs)[O]) const noexcept
 
template<size_t O>
constexpr auto operator<=> (char const (&rhs)[O]) const noexcept
 
template<size_t R>
constexpr auto operator+ (fixed_string< R > const &rhs) const noexcept
 Append two strings.
 
template<size_t R>
constexpr auto operator+ (char const (&rhs)[R]) const noexcept
 
template<size_t R>
constexpr auto operator/ (fixed_string< R > const &rhs) const noexcept
 Join two strings with a slash '/'.
 
template<size_t R>
constexpr auto operator/ (char const (&rhs)[R]) const noexcept
 

Data Fields

std::array< char, N > _str = {}
 

Friends

template<size_t I>
constexpr friend char & get (fixed_string &a) noexcept
 
template<size_t I>
constexpr friend char const & get (fixed_string const &a) noexcept
 

Detailed Description

template<size_t N>
struct hi::v1::fixed_string< N >

A string which may be used as a none-type template parameter.

example: ``` template<hi::fixed_string Foo> class A { auto bar() { return std::string{Foo}; } };

std::string test() { auto a = A<"hello">{}; return a.bar(); } ```

Constructor & Destructor Documentation

◆ fixed_string()

template<size_t N>
template<std::invocable F>
constexpr hi::v1::fixed_string< N >::fixed_string ( F const & f)
inlineconstexprnoexcept

Create a fixed string from function returning a string-like.

Member Function Documentation

◆ operator+()

template<size_t N>
template<size_t R>
constexpr auto hi::v1::fixed_string< N >::operator+ ( fixed_string< R > const & rhs) const
inlineconstexprnoexcept

Append two strings.

◆ operator/()

template<size_t N>
template<size_t R>
constexpr auto hi::v1::fixed_string< N >::operator/ ( fixed_string< R > const & rhs) const
inlineconstexprnoexcept

Join two strings with a slash '/'.

If one or both of the operands is empty, no '/' is added.


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