Skip to content
Selcuk Ilhan AYDI edited this page Aug 3, 2023 · 1 revision

Meta Expression Executor

Any meta expression can be called just like a regular function to execute the logic inside the function and return the result if necessary. Meta executor has the ability to execute any meta expression and grap the returned meta-type. The following meta expression has the required form to be called by the executor:

struct EmptyMetaFunctor
{
    template <typename... Ts>
    struct apply
    {
        using type = std::true_type;
    };
};

A meta expression must have an 'apply' inner struct with a return value in the 'type' alias member. This meta expression can be executed by the executor as follows:

// Call meta function with two parameters.
//
using Result = sia::meta::Exec<EmptyMetaFunctor(std::true_type, std::false_type)>::type;
static_assert(Result::value);

The 'EmptyMetaFunctor' can have a varying number of parameters but they are not important for this function cause the return value is always 'std::true_type'.

Clone this wiki locally