26template<
typename Input,
typename Output = Input>
45 virtual std::string
name()
const = 0;
59 return std::same_as<T, input_type> || std::convertible_to<T, input_type>;
67 return std::same_as<T, output_type> || std::convertible_to<output_type, T>;
100 typename T::input_type;
101 typename T::output_type;
102 {
spell.name() } -> std::convertible_to<std::string>;
103 {
spell.description() } -> std::convertible_to<std::string>;
104 requires std::invocable<T, typename T::input_type>;
105 requires std::same_as<
106 std::invoke_result_t<T, typename T::input_type>,
107 typename T::output_type
114template<
typename Spell,
typename Input>
116 std::same_as<typename Spell::input_type, Input>;
123 std::same_as<typename T::output_type, RuneSequence>;
128template<
typename Spell,
typename Input,
typename Output>
131 std::same_as<typename Spell::output_type, Output>;
136template<
typename Spell1,
typename Spell2>
139 (std::same_as<typename Spell1::output_type, typename Spell2::input_type> ||
140 std::convertible_to<typename Spell1::output_type, typename Spell2::input_type>);
146template<
typename Spell,
typename Input>
149template<
typename Spell1,
typename Spell2>
Base interface for all spell algorithms with C++20 enhancements.
virtual output_type operator()(const input_type &input) const =0
Apply the spell transformation.
virtual ~spell_base()=default
virtual std::string name() const =0
Get the spell's name.
static constexpr bool produces() noexcept
Check if this spell produces the expected output type (C++20 concepts)
virtual std::string description() const =0
Get the spell's description.
static constexpr const char * output_type_name() noexcept
Get output type name as compile-time string (C++20)
static constexpr const char * input_type_name() noexcept
Get input type name as compile-time string (C++20)
static constexpr bool can_process() noexcept
Check if this spell can be applied to the given input type (C++20 concepts)
Concept for spells that can be chained together.
Concept for sequence-based spells (most common case)
Concept defining what makes a valid spell.
Concept for spells that work with specific input types.
constexpr bool can_spell_process_v
constexpr bool chainable_v
constexpr bool is_spell_v
spell_base< RuneSequence > sequence_spell
Most common spell type: RuneSequence -> RuneSequence.
constexpr bool is_sequence_spell_v