46 explicit String(std::string_view str)
noexcept(
false);
55 explicit String(std::vector<Symbol> vec)
noexcept(
false) :
symbols_(std::move(vec)) {}
61 [[nodiscard]] std::size_t
length() const noexcept {
return this->
symbols_.size(); }
67 [[nodiscard]] std::string
get_str() const noexcept(false);
72 [[nodiscard]] auto
begin() const noexcept {
return this->
symbols_.begin(); }
77 [[nodiscard]]
auto end() const noexcept {
return this->
symbols_.end(); }
Alphabet class to manage the collection of valid symbols for the Turing Machine.
Represents the formal alphabet ( or ) of a Turing Machine.
Represents a formal string (w) consisting of a finite sequence of Symbols.
auto operator<=>(const String &other) const noexcept=default
Defaulted three-way comparison operator (C++20 spaceship operator).
std::vector< Symbol > symbols_
The finite sequence of symbols forming the string.
std::string get_str() const noexcept(false)
Reconstructs a standard std::string representation from the underlying symbols.
String(std::vector< Symbol > vec) noexcept(false)
Constructs a String by taking ownership of an existing vector of symbols.
std::size_t length() const noexcept
Returns the total number of symbols contained in the string.
bool is_valid_for(const Alphabet &alphabet) const noexcept
Validates if all symbols within this string belong to a specific formal Alphabet.
String() noexcept=default
Default constructor.
auto end() const noexcept
Returns an iterator to the end of the symbol sequence.
auto begin() const noexcept
Returns an iterator to the beginning of the symbol sequence.
Represents a single symbol on the Turing Machine's tape.
Symbol class to represent the symbols on the Turing Machine's tape.