Function-Tools: get rid of the old-style FunctionSignature template

...it is now completely redundant, even superseded by the new _Fun
signature trait (which additionally also handles lambdas)
This commit is contained in:
Fischlurch 2017-03-19 02:48:32 +01:00
parent 9a0b72e8ca
commit 58898997d8
9 changed files with 21 additions and 194 deletions

View file

@ -282,7 +282,7 @@ namespace lib {
template<class IT, class FUN>
struct _TransformIterT
{
typedef typename _ProducedOutput<FUN>::Type ResVal;
typedef typename lib::meta::_Fun<FUN>::Ret ResVal;
typedef TransformIter<IT,ResVal> TransIter;
typedef typename IterSource<ResVal>::iterator Iter;
};

View file

@ -629,28 +629,6 @@ namespace lib {
namespace { // Helper to pick up the produced value type automatically
using lib::meta::FunctionSignature;
template<typename SIG>
struct _ProducedOutput
{
typedef typename FunctionSignature<function<SIG>>::Ret Type;
};
template<typename SIG>
struct _ProducedOutput<function<SIG>>
{
typedef typename FunctionSignature<function<SIG>>::Ret Type;
};
template<typename FUN>
struct _ProducedOutput<FUN*>
{
typedef typename FunctionSignature<function<FUN>>::Ret Type;
};
}
/** Build a TransformIter: convenience free function shortcut,
@ -659,10 +637,10 @@ namespace lib {
* @return Iterator processing the source feed
*/
template<class IT, typename FUN>
inline TransformIter<IT, typename _ProducedOutput<FUN>::Type>
inline auto
transformIterator (IT const& src, FUN processingFunc)
{
typedef typename _ProducedOutput<FUN>::Type OutVal;
using OutVal = typename lib::meta::_Fun<FUN>::Ret;
return TransformIter<IT,OutVal>(src,processingFunc);
}

View file

@ -476,8 +476,8 @@ namespace func{
template<typename SIG>
class TupleApplicator
{
using Args = typename FunctionSignature< function<SIG>>::Args;
using Ret = typename FunctionSignature< function<SIG>>::Ret;
using Args = typename _Fun<SIG>::Args;
using Ret = typename _Fun<SIG>::Ret;
using BoundFunc = function<Ret()>;

View file

@ -63,158 +63,6 @@ namespace meta{
using std::function;
/**
* Extract the type information contained in a
* function or functor type, so it can be manipulated
* by metaprogramming. Up to 9 function arguments are
* supported and can be extracted as a type sequence.
* The bare function signature serving as input can be
* obtained by capturing a function reference or pointer.
*/
template< typename SIG>
struct FunctionSignature;
template< typename RET>
struct FunctionSignature< function<RET(void)> >
{
typedef RET Ret;
typedef Types<> Args;
};
template< typename RET
, typename A1
>
struct FunctionSignature< function<RET(A1)> >
{
typedef RET Ret;
typedef Types<A1> Args;
};
template< typename RET
, typename A1
, typename A2
>
struct FunctionSignature< function<RET(A1,A2)> >
{
typedef RET Ret;
typedef Types<A1,A2> Args;
};
template< typename RET
, typename A1
, typename A2
, typename A3
>
struct FunctionSignature< function<RET(A1,A2,A3)> >
{
typedef RET Ret;
typedef Types<A1,A2,A3> Args;
};
template< typename RET
, typename A1
, typename A2
, typename A3
, typename A4
>
struct FunctionSignature< function<RET(A1,A2,A3,A4)> >
{
typedef RET Ret;
typedef Types<A1,A2,A3,A4> Args;
};
template< typename RET
, typename A1
, typename A2
, typename A3
, typename A4
, typename A5
>
struct FunctionSignature< function<RET(A1,A2,A3,A4,A5)> >
{
typedef RET Ret;
typedef Types<A1,A2,A3,A4,A5> Args;
};
template< typename RET
, typename A1
, typename A2
, typename A3
, typename A4
, typename A5
, typename A6
>
struct FunctionSignature< function<RET(A1,A2,A3,A4,A5,A6)> >
{
typedef RET Ret;
typedef Types<A1,A2,A3,A4,A5,A6> Args;
};
template< typename RET
, typename A1
, typename A2
, typename A3
, typename A4
, typename A5
, typename A6
, typename A7
>
struct FunctionSignature< function<RET(A1,A2,A3,A4,A5,A6,A7)> >
{
typedef RET Ret;
typedef Types<A1,A2,A3,A4,A5,A6,A7> Args;
};
template< typename RET
, typename A1
, typename A2
, typename A3
, typename A4
, typename A5
, typename A6
, typename A7
, typename A8
>
struct FunctionSignature< function<RET(A1,A2,A3,A4,A5,A6,A7,A8)> >
{
typedef RET Ret;
typedef Types<A1,A2,A3,A4,A5,A6,A7,A8> Args;
};
template< typename RET
, typename A1
, typename A2
, typename A3
, typename A4
, typename A5
, typename A6
, typename A7
, typename A8
, typename A9
>
struct FunctionSignature< function<RET(A1,A2,A3,A4,A5,A6,A7,A8,A9)> >
{
typedef RET Ret;
typedef Types<A1,A2,A3,A4,A5,A6,A7,A8,A9> Args;
};
/**
* Helper for uniform access to function signature types.
* Extract the type information contained in a function or functor type,

View file

@ -56,7 +56,7 @@ namespace wrapper {
using util::unConst;
using util::isSameObject;
using lib::meta::FunctionSignature;
using lib::meta::_Fun;
using lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE;
using std::function;
@ -346,7 +346,7 @@ namespace wrapper {
: public function<SIG>
, boost::noncopyable
{
using Res = typename FunctionSignature<function<SIG>>::Ret;
using Res = typename _Fun<SIG>::Ret;
using ResWrapper = ItemWrapper<Res>;
ResWrapper lastResult_;

View file

@ -591,13 +591,14 @@ namespace control {
using lib::meta::Tuple;
using lib::meta::_Fun;
template<typename SIG>
struct _Type
{
using Args = typename FunctionSignature< function<SIG>>::Args;
using Ret = typename FunctionSignature< function<SIG>>::Ret;
using Args = typename _Fun<SIG>::Args;
using Ret = typename _Fun<SIG>::Ret;
using Sig = SIG;
using ArgTuple = Tuple<Args>;
};

View file

@ -58,7 +58,7 @@
namespace proc {
namespace control {
using lib::meta::FunctionSignature;
using lib::meta::_Fun;
using lib::meta::Tuple;
using lib::meta::BuildTupleAccessor;
using lib::meta::func::TupleApplicator;
@ -153,10 +153,10 @@ namespace control {
template<typename SIG>
class OpClosure
{
using Args = typename FunctionSignature< function<SIG>>::Args;
using Args = typename _Fun<SIG>::Args;
using Builder = BuildTupleAccessor<ParamAccessor, Args>;
using ParamStorageTuple =typename Builder::Product;
using ParamStorageTuple = typename Builder::Product;
ParamStorageTuple params_;
bool activated_;

View file

@ -41,7 +41,7 @@ namespace test {
using lib::time::TimeVar;
using std::function;
using lib::meta::FunctionSignature;
using lib::meta::_Fun;
using lib::meta::Tuple;
@ -54,9 +54,9 @@ namespace test {
template<typename SIG>
struct _Tup
{
typedef typename FunctionSignature< function<SIG>>::Args Args;
typedef typename FunctionSignature< function<SIG>>::Ret Ret;
typedef Tuple<Args> Ty;
using Args = typename _Fun<SIG>::Args;
using Ret = typename _Fun<SIG>::Ret;
using Ty = Tuple<Args>;
};
@ -67,8 +67,8 @@ namespace test {
, typename _Tup<SIG>::Ty // base class to inherit from
>
{
typedef typename _Tup<SIG>::Ty ATuple;
typedef typename _Tup<SIG>::Ret RetType;
using ATuple = typename _Tup<SIG>::Ty;
using RetType = typename _Tup<SIG>::Ret;
public:

View file

@ -142,8 +142,8 @@ namespace test {
check_signatureTypeManip ()
{
typedef int someFunc(Num<5>,Num<9>);
typedef FunctionSignature<function<someFunc>>::Ret RetType; // should be int
typedef FunctionSignature<function<someFunc>>::Args Args;
typedef _Fun<someFunc>::Ret RetType; // should be int
typedef _Fun<someFunc>::Args Args;
DISPLAY (Args);
typedef Prepend<Num<1>, Args>::Seq NewArgs; // manipulate the argument type(s)