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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -