How to make a conditional typedef in C++

后端 未结 3 917
野性不改
野性不改 2020-12-12 10:43

I am trying to do something like this:

#include 
#include 

typedef int Integer;

#if sizeof(Integer) <= 4
    typedef std::         


        
3条回答
  •  旧时难觅i
    2020-12-12 11:05

    Using std::conditional you can do it like so:

    using Engine = std::conditional::type;
    

    If you want to do a typedef, you can do that too.

    typedef std::conditional::type Engine
    

提交回复
热议问题