C++ template argument with expression

后端 未结 1 1459
遥遥无期
遥遥无期 2021-02-14 18:43

I am having trouble with C++. I want to be able to put an expression inside a template as an argument. Here is my code:

#include 
using names         


        
相关标签:
1条回答
  • 2021-02-14 19:42

    Use std::conditional:

    #include <type_traits> 
    std::vector<std::conditional<(1 > 0), float, int>::type> abc() {}
    
    0 讨论(0)
提交回复
热议问题