Hi!

Though Intel C++ compiles this without complaint 
gcc fails with ICE on this code snippet, which is 
preprocessor output of boost code:

struct void_ {};

template<
      bool C
    , typename T1
    , typename T2 
    >
struct if_c
{
    typedef T1 type;
};

template<
      typename T1 
    , typename T2
    >
struct if_c<false,T1,T2>
{
    typedef T2 type;
};


template<
      typename C = void_
    , typename T1 = void_
    , typename T2 = void_
    >
struct if_
{
 private:
    typedef if_c<
          static_cast<bool>(C::value)
        , T1
        , T2
        > almost_type_;

 public:
    typedef typename almost_type_::type type;

   
};


int main() {  
  typedef if_<true_, double, int>::type D;
  D d;
}
-----------------------------------------------------

A resolution with which g++ is happy again is:

struct if_
{
 private:
  enum { value = static_cast<bool>(C::value) };

    typedef if_c<
        value
        , T1
        , T2
        > almost_type_;
etc.

Does this solution have any impact on compilation time?


Markus





-- 

Build your own Expression Template Library with Daixtrose!
Visit http://daixtrose.sourceforge.net/ 

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to