In the below code snippet I had used variadic template findSum function and in that I ensured that argument types of that function is same using concepts but can someone suggest that how can I also ensure that return type of that function also matches with that of argument types.
#include <iostream>
#include <concepts>
template<typename F,typename... R>
struct FirstVariadicType
{
using Type = F;
};
template<typename... Ts>
requires requires(Ts... args){
std::conjunction_v<std::is_same<typename FirstVariadicType<Ts...>::Type, Ts>...>;
}
auto findSum(Ts... args)
{
return (... + args);
}
int main()
{
std::cout<<"sum of 2 and 3 is "<<findSum(2,3)<<std::endl;
return 0;
}