91 for (
unsigned i = 0; i < N1; ++i)
93 for (
unsigned i = N1; i < N + 1; ++i)
102 using value_type = char;
103 using reference =
char &;
104 using const_reference =
const char &;
105 using iterator = std::add_pointer_t<value_type>;
106 using const_iterator = std::add_pointer_t<value_type const>;
107 using difference_type =
typename data_type::difference_type;
108 using size_type =
typename data_type::size_type;
113 using allocator_type = void;
141 for (
unsigned i = 0; i < N + 1; ++i)
156 for (
unsigned i = 0; i < N; ++i)
207 constexpr const_reference
operator[](
size_t pos)
const noexcept
226 return std::string{ lit.cbegin(), lit.cend() - 1};
241 constexpr
const char *
c_str() const noexcept
250 constexpr size_type
size()
const noexcept
263 constexpr
bool empty() const noexcept
272 constexpr iterator
begin() noexcept
279 constexpr const_iterator
begin() const noexcept
285 constexpr const_iterator
cbegin() const noexcept
291 constexpr iterator
end() noexcept
297 constexpr const_iterator
end() const noexcept
303 constexpr const_iterator
cend() const noexcept
341 std::swap(*
this, other);
362 if constexpr (N != N2)
365 const_iterator it_rhs = rhs.cbegin();
366 for (const_iterator it =
cbegin(); it !=
cend(); ++it, ++it_rhs)
379 return !(*
this == rhs);
384 constexpr
bool operator<(constexpr_string<N2>
const & rhs)
const noexcept
386 for (
unsigned i = 0; i < ((N < N2) ? N : N2); ++i)
388 if (lit[i] < rhs.lit[i])
390 else if (lit[i] != rhs.lit[i])
398 constexpr
bool operator<=(constexpr_string<N2>
const & rhs)
const noexcept
400 for (
unsigned i = 0; i < ((N < N2) ? N : N2); ++i)
402 if (lit[i] > rhs.lit[i])
412 return !(*
this <= rhs);
419 return !(*
this < rhs);
442 constexpr
inline void constexpr reference operator[](size_t pos) noexcept
Access an element in the string.
Definition: constexpr_string.hpp:192
constexpr bool empty() const noexcept
Determines whether the string is empty.
Definition: constexpr_string.hpp:263
std::string string() const
Returns the content represented as std::string.
Definition: constexpr_string.hpp:224
constexpr bool operator>=(constexpr_string< N2 > const &rhs) const noexcept
Compares two strings lexicographically.
Definition: constexpr_string.hpp:417
constexpr const_iterator end() const noexcept
Returns iterator pass the end of the string.
Definition: constexpr_string.hpp:297
constexpr const_iterator cbegin() const noexcept
Returns the begin to the string.
Definition: constexpr_string.hpp:285
constexpr constexpr_string< N+N2 > operator+(constexpr_string< N2 > const &rhs) const noexcept
Concatenates two constexpr_strings.
Definition: constexpr_string.hpp:326
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:58
constexpr iterator begin() noexcept
Returns the begin to the string.
Definition: constexpr_string.hpp:273
constexpr bool operator>(constexpr_string< N2 > const &rhs) const noexcept
Compares two strings lexicographically.
Definition: constexpr_string.hpp:410
constexpr constexpr_string(const char c) noexcept
Construction from char.
Definition: constexpr_string.hpp:168
constexpr void swap(constexpr_string< N > &lhs, constexpr_string< N > &rhs)
Exchanges the given values.
Definition: constexpr_string.hpp:443
constexpr constexpr_string()=default
Default default constructor.
constexpr const_iterator begin() const noexcept
Returns the begin to the string.
Definition: constexpr_string.hpp:279
constexpr constexpr_string(const char(&_lit)[N+1]) noexcept
Construction from literal.
Definition: constexpr_string.hpp:137
constexpr constexpr_string(std::array< char, N > const &src) noexcept
Construction from char array.
Definition: constexpr_string.hpp:152
constexpr constexpr_string(constexpr_string< N1 > const &lhs, constexpr_string< N - N1 > const &rhs) noexcept
Constructs new constexpr_string by merging two other constexpr_strings.
Definition: constexpr_string.hpp:87
constexpr const_iterator cend() const noexcept
Returns iterator pass the end of the string.
Definition: constexpr_string.hpp:303
std::array< char, N+1 > data_type
Alias for the underlying data type.
Definition: constexpr_string.hpp:69
constexpr const_reference operator[](size_t pos) const noexcept
Access an element in the string.
Definition: constexpr_string.hpp:207
data_type lit
The internal string stored as array including \0-byte as last character.
Definition: constexpr_string.hpp:76
constexpr bool operator!=(constexpr_string< N2 > const &rhs) const noexcept
Compares two strings lexicographically.
Definition: constexpr_string.hpp:377
constexpr void swap(constexpr_string &other) noexcept
Swaps the contents.
Definition: constexpr_string.hpp:339
constexpr constexpr_string & operator=(constexpr_string const &)=default
Default copy-assignment operator.
Implements a constexpr string that can be used for compile time computations.
Definition: constexpr_string.hpp:65
~constexpr_string()=default
Default destructor.
Provides C++20 additions to the type_traits header.
constexpr iterator end() noexcept
Returns iterator pass the end of the string.
Definition: constexpr_string.hpp:291
constexpr bool operator==(constexpr_string< N2 > const &rhs) const noexcept
Compares two strings lexicographically.
Definition: constexpr_string.hpp:360
constexpr size_type max_size() const noexcept
Returns the maximal capacity (same as size()).
Definition: constexpr_string.hpp:257
constexpr const char * c_str() const noexcept
Returns the content represented as 0-terminated c-style string.
Definition: constexpr_string.hpp:241
constexpr size_type size() const noexcept
Returns the size.
Definition: constexpr_string.hpp:251