Всем привет.
не знаю как правильно это называется, но хочется чтобы в test then<int> <int> можно было не указывать:
#include <type_traits>
#include <future>
template<typename F,
std::enable_if_t<std::is_same<typename std::result_of<F()>::type, void>::value, bool> = true>
void then(F objL_callback)
{
}
template<typename X, typename F,
std::enable_if_t<std::is_same<typename std::result_of<F()>::type, std::future<X>>::value, bool> = true>
void then(F objL_callback)
{
}
void test()
{
then<int>([]
{
return std::future<int>();
});
then([]
{
});
}
Есть идеи?