tmp.hh 615 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
#pragma once

#include <utility>

namespace polymesh
{
// small template metaprogramming
namespace tmp
{
template <class FuncT, class ArgT>
Philip Trettner's avatar
Philip Trettner committed
11
struct decayed_result_of
12
{
Philip Trettner's avatar
Philip Trettner committed
13
    using type = typename std::decay<decltype(std::declval<FuncT>()(std::declval<ArgT>()))>::type;
14
15
};

Philip Trettner's avatar
Philip Trettner committed
16
17
18
19
20
21
22
23
24
template <class FuncT, class ArgT>
using decayed_result_type_of = typename decayed_result_of<FuncT, ArgT>::type;

template <class FuncT, class ArgT>
struct result_of
{
    using type = decltype(std::declval<FuncT>()(std::declval<ArgT>()));
};

25
26
27
28
template <class FuncT, class ArgT>
using result_type_of = typename result_of<FuncT, ArgT>::type;
}
}