better consistency for INVOKE, renaming some _at metafunctions

This commit is contained in:
badair
2016-05-15 16:02:45 -05:00
parent e37a19dc59
commit c07e8e609b
16 changed files with 232 additions and 164 deletions

View File

@@ -0,0 +1,83 @@
#include <tuple>
#include <utility>
#include <type_traits>
#include <callable_traits/callable_traits.hpp>
#ifndef CT_ASSERT
#define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
#endif //CT_ASSERT
namespace ct = callable_traits;
template<int I>
struct N {};
template<typename... Ts>
using sig = int(&)(Ts...);
int main() {
{
using f = sig<N<0>, N<1>, N<2>, N<3>, N<4>>;
using test = ct::remove_args<0, f>;
using expect = sig<N<1>, N<2>, N<3>, N<4>>;
CT_ASSERT(std::is_same<test, expect>::value);
}
{
using f = sig<N<0>, N<1>, N<2>, N<3>, N<4>>;
using test = ct::remove_args<1, f>;
using expect = sig<N<0>, N<2>, N<3>, N<4>>;
CT_ASSERT(std::is_same<test, expect>::value);
}
{
using f = sig<N<0>, N<1>, N<2>, N<3>, N<4>>;
using test = ct::remove_args<2, f>;
using expect = sig<N<0>, N<1>, N<3>, N<4>>;
CT_ASSERT(std::is_same<test, expect>::value);
}
{
using f = sig<N<0>, N<1>, N<2>, N<3>, N<4>>;
using test = ct::remove_args<3, f>;
using expect = sig<N<0>, N<1>, N<2>, N<4>>;
CT_ASSERT(std::is_same<test, expect>::value);
}
{
using f = sig<N<0>, N<1>, N<2>, N<3>, N<4>>;
using test = ct::remove_args<4, f>;
using expect = sig<N<0>, N<1>, N<2>, N<3>>;
CT_ASSERT(std::is_same<test, expect>::value);
}
{
using f = sig<N<0>, N<1>, N<2>, N<3>, N<4>>;
using test = ct::remove_args<0, f, 5>;
using expect = sig<>;
CT_ASSERT(std::is_same<test, expect>::value);
}
{
using f = sig<N<0>, N<1>, N<2>, N<3>, N<4>>;
using test = ct::remove_args<0, f, 3>;
using expect = sig<N<3>, N<4>>;
CT_ASSERT(std::is_same<test, expect>::value);
}
{
using f = sig<N<0>, N<1>, N<2>, N<3>, N<4>>;
using test = ct::remove_args<3, f, 2>;
using expect = sig<N<0>, N<1>, N<2>>;
CT_ASSERT(std::is_same<test, expect>::value);
}
{
using f = sig<N<0>, N<1>, N<2>, N<3>, N<4>>;
using test = ct::remove_args<4, f, 1>;
using expect = sig<N<0>, N<1>, N<2>, N<3>>;
CT_ASSERT(std::is_same<test, expect>::value);
}
}