is it possible to do something like:
template<class T, T type>
constexpr auto f(/* type used in some way... */) // -> decltype (etc. in case of C++11)
{
return std::integral_constant<T,t>{};
}
constexpr auto z = f(3); // z is deduced as an integral_constant<int,3>;
It's for sure not possible using a runtime value, but 3 in this case is a compile time value. Maybe someone knows some trick I'm not aware of...
[edit] constexpr auto z2 = f<3>(); // This would be ok too
I just would like to avoid to repeat the type..