Select template argument at runtime in C++

前端 未结 3 1159
时光取名叫无心
时光取名叫无心 2020-12-15 10:54

Suppose I have a set of functions and classes which are templated to use single (float) or double precision. Of course I could write just two piece

3条回答
  •  忘掉有多难
    2020-12-15 11:26

    Templates are a compile-time mechanism. BTW, macros are as well (strictly speaking - a preprocessing mechanism - that comes even before compilation).

提交回复
热议问题