C++ templates: Query regarding which is better of way of using and why -
i have got question. better of doing it.
typedef enum{ 1 = 1, 2 = 2 } number; template< typename t, number num > void foo( const t& param ) { } or template< typename t > void foo( const t& param, number num ) { }
what looking is, how these 2 methods different? if have use of these 1 should choose , why?
it depends on want do. if num
value template parameter must specified @ compile time. if function parameter can specified @ runtime.
what use case?
Comments
Post a Comment