Goose  Artifact [2a6e282349]

Artifact 2a6e28234922527deeb1863480fad4a5fca0033bc01c817c75a318fdfae349ed:

  • File bs/builtins/types/func/bfunc.h — part of check-in [12c9e92618] at 2019-02-24 23:18:18 on branch trunk — Templates: implemented the template function invocation rule. Some pieces are still missing before it can work. (user: achavasse size: 771)

#ifndef EMPATHY_BUILTINS_TYPES_BFUNC_H
#define EMPATHY_BUILTINS_TYPES_BFUNC_H

namespace empathy::builtins
{
    using BuiltinFuncWrapper = function< optional< Value >( const Term& argVec ) >;

    template< typename F >
    void RegisterBuiltinFunc( Env& env, const StringId& name, F&& func );

    bool IsBuiltinFunc( const Value& func );
    const BuiltinFuncWrapper& GetBuiltinFuncWrapper( const Value& func );
}

namespace empathy::ir
{
    template< typename R, typename... T >
    struct Bridge< R ( T... )>
    {
        using functype = function< R ( T... ) >;

        static const Term& Type();

        template< typename F >
        static Value ToValue( F&& func );

        template< typename F >
        static auto WrapFunc( F&& func );
    };
}

#endif