Conditional type definitions

Posted by pythonic metaphor on Stack Overflow See other posts from Stack Overflow or by pythonic metaphor
Published on 2010-06-09T17:51:05Z Indexed on 2010/06/11 9:52 UTC
Read the original article Hit count: 231

Filed under:
|
|

I'm sure that boost has some functions for doing this, but I don't know the relevant libraries well enough. I have a template class, which is pretty basic, except for one twist where I need to define a conditional type. Here is the psuedo code for what I want

struct PlaceHolder {};
    template <typename T>
class C{
    typedef (T == PlaceHolder ? void : T) usefulType;
};

How do I write that type conditional?

© Stack Overflow or respective owner

Related posts about c++

Related posts about template