Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ValueOperationAbstraction.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <ext/array>
9#include <ext/memory>
10
12
15
16namespace abstraction {
17
18template < class ReturnType >
20public:
21 template < typename ... ParamTypes, typename Callable >
22 static inline std::shared_ptr < abstraction::Value > run_helper ( Callable callback, const ext::array < std::shared_ptr < abstraction::Value >, sizeof ... ( ParamTypes ) > & inputs ) {
23 return std::make_shared < abstraction::ValueHolder < ReturnType > > ( abstraction::apply < ParamTypes ... > ( callback, inputs ), ! std::is_lvalue_reference_v < ReturnType > );
24 }
25
27 return abstraction::TypeQualifiers::typeQualifiers < ReturnType > ( );
28 }
29
31 return ext::type_index ( typeid ( ReturnType ) );
32 }
33
34};
35
36template < >
37class ValueOperationAbstraction < void > : virtual public OperationAbstraction {
38public:
39 template < typename ... ParamTypes, typename Callable >
40 static inline std::shared_ptr < abstraction::Value > run_helper ( Callable callback, const ext::array < std::shared_ptr < abstraction::Value >, sizeof ... ( ParamTypes ) > & inputs ) {
41 abstraction::apply < ParamTypes ... > ( callback, inputs );
42 return std::make_shared < abstraction::Void > ( );
43 }
44
45 ext::type_index getReturnTypeIndex ( ) const override;
46
48};
49
50} /* namespace abstraction */
51
Definition: OperationAbstraction.hpp:19
TypeQualifierSet
Definition: TypeQualifiers.hpp:15
static std::shared_ptr< abstraction::Value > run_helper(Callable callback, const ext::array< std::shared_ptr< abstraction::Value >, sizeof ...(ParamTypes) > &inputs)
Definition: ValueOperationAbstraction.hpp:40
Definition: ValueOperationAbstraction.hpp:19
static std::shared_ptr< abstraction::Value > run_helper(Callable callback, const ext::array< std::shared_ptr< abstraction::Value >, sizeof ...(ParamTypes) > &inputs)
Definition: ValueOperationAbstraction.hpp:22
abstraction::TypeQualifiers::TypeQualifierSet getReturnTypeQualifiers() const override
Definition: ValueOperationAbstraction.hpp:26
ext::type_index getReturnTypeIndex() const override
Definition: ValueOperationAbstraction.hpp:30
Class extending the array class from the standard library. Original reason is to allow printing of th...
Definition: array.hpp:68
Definition: typeindex.h:37
Definition: AlgorithmAbstraction.hpp:11
constexpr decltype(auto) apply(F &&f, Tuple &&t)
Definition: AbstractionHelpers.hpp:27
int callback(struct dl_phdr_info *info, size_t, void *data)
Definition: simpleStacktrace.cpp:25