The next code snippet shows how to I simplify user code, making library slightly more complicated. In other words add some syntactic sugar.
Channel const& joinMulticast(NetAdres const &group) const;
/// Auto-construct NetAdres.
/// joinMulticast() can take any combination of args and passes them to NetAdres::NetAdres() constructor. No need to write many overloads
template<typename... Y>
auto joinMulticast(Y&&... y)
-> decltype(joinMulticast(std::declval<Y>()...))
{
return joinMulticast(NetAdres(std::forward<Y>(y)...));
}
VS2015
eats silently, but GCC cannot digest this code with fatal error:
template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum)
-> decltype(joinMulticast(std::declval<Y>()...))
~~~~~~~~~~~~~~~^~
Since in my case return type is always the same, simplify construction: