34 noexcept(std::is_nothrow_constructible_v<T, U>)
35 : data_(
std::forward<U>(data)) {}
47 template<spell_for<T> Spell>
55 template<spell_for<T> Spell>
63 constexpr const T&
result() const & noexcept {
71 return std::move(data_);
89 return std::move(data_);
95 constexpr explicit operator bool() const noexcept {
96 if constexpr (std::is_pointer_v<T>) {
97 return data_ !=
nullptr;
98 }
else if constexpr (
requires { data_.empty(); }) {
99 return !data_.empty();
109 return typeid(T).name();
134template<
typename T, spell_concept Spell>
135 requires spell_for<Spell, std::decay_t<T>> ||
141 .cast(std::forward<Spell>(
spell))
145 .cast(std::forward<Spell>(
spell))
153template<
typename T, spell_for<T> Spell>
155 return std::move(caster_obj).
cast(std::forward<Spell>(
spell));
static RuneString from_utf8(std::string_view utf8_text)
Create a RuneString from UTF-8 text.
Unified spell object for text transformation.
A powerful chaining pipeline for applying spells to data.
constexpr const T & result() const &noexcept
Get the final result (const lvalue reference)
constexpr const T & operator*() const &noexcept
Access the underlying data directly.
constexpr T && operator*() &&noexcept
constexpr T && result() &&noexcept
Get the final result (rvalue reference - move semantics)
constexpr T result() const &&
Get the final result (const rvalue reference)
constexpr auto cast(Spell &&spell) const &-> caster< typename Spell::output_type >
Apply a spell and return a new caster with the result (C++20 concepts)
constexpr caster(U &&data) noexcept(std::is_nothrow_constructible_v< T, U >)
Construct caster with data (C++20 perfect forwarding)
static constexpr const char * type_name() noexcept
Get type information at compile time.
constexpr auto cast(Spell &&spell) &&-> caster< typename Spell::output_type >
Apply a spell and return a new caster (rvalue reference optimization)
Concept for spells that work with specific input types.
constexpr auto make_caster(T &&data) noexcept -> caster< std::decay_t< T > >
Factory function to create a caster (C++20 template argument deduction)
constexpr auto operator|(T &&data, Spell &&spell)
Pipe operator for functional programming style (C++20 concepts)