Skip to content

Commit

Permalink
Remove unused apply_tuple template
Browse files Browse the repository at this point in the history
  • Loading branch information
pmed committed Aug 15, 2017
1 parent 605093c commit 922c194
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
15 changes: 0 additions & 15 deletions test/test_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,6 @@ struct Z
void operator()();
};

void test_apply_tuple()
{
using v8pp::detail::apply_tuple;
using v8pp::detail::apply;

apply_tuple(f, std::make_tuple());
apply_tuple(g, std::make_tuple(1));
apply_tuple(h, std::make_tuple(1, true));

check_eq("apply(f)", apply(f), 1);
check_eq("apply(g)", apply(g, 2), 2);
check_eq("apply(h)", apply(h, 3, true), 3);
}

void test_is_callable()
{
using v8pp::detail::is_callable;
Expand All @@ -200,7 +186,6 @@ namespace test { class some_class {}; }

void test_utility()
{
test_apply_tuple();
test_is_callable();

using v8pp::detail::type_id;
Expand Down
25 changes: 0 additions & 25 deletions v8pp/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,31 +213,6 @@ template<size_t N>
using make_index_sequence = make_integer_sequence<size_t, N>;
#endif

/////////////////////////////////////////////////////////////////////////////
//
// apply_tuple
//
template<typename F, typename Tuple, size_t... Indices>
typename function_traits<F>::return_type apply_impl(
F&& f, Tuple&& t, index_sequence<Indices...>)
{
return std::forward<F>(f)(std::get<Indices>(std::forward<Tuple>(t))...);
}

template<typename F, typename Tuple>
typename function_traits<F>::return_type apply_tuple(F&& f, Tuple&& t)
{
using Indices = make_index_sequence<
std::tuple_size<typename std::decay<Tuple>::type>::value>;
return apply_impl(std::forward<F>(f), std::forward<Tuple>(t), Indices{});
}

template<typename F, typename ...Args>
typename function_traits<F>::return_type apply(F&& f, Args&&... args)
{
return std::forward<F>(f)(std::forward<Args>(args)...);
}

/// Type information for custom RTTI
class type_info
{
Expand Down

0 comments on commit 922c194

Please sign in to comment.