Boost logo

Boost Users :

Subject: [Boost-users] enable_if: fusion seq, vs2010 vs gcc
From: Hicham Mouline (hicham_at_[hidden])
Date: 2011-01-04 05:14:33


#include <iostream>
#include <boost/utility/enable_if.hpp>
#include <boost/fusion/include/is_sequence.hpp>

struct S {
 double skid;
};

template<typename Archive>
void serialize(Archive& ar, S& sp, unsigned int)
{
  std::cout<<"1st one"<<std::endl;
}

template <typename Archive, typename Seq>
typename boost::enable_if_c<boost::fusion::traits::is_sequence<Seq>::value,
void>::type
serialize( Archive& ar, Seq& seq, unsigned int)
{
  std::cout<<"2nd one"<<std::endl;
}

template void serialize<double>(double&, S&, unsigned int);

int main()
{
  S s;
  double d1=5.;
  serialize(d1, s, 5);
  return 0;
}

The above code compiles ok on gcc4.5.1 and prints 1st one.
It crashes vs2008.
vs2010 was fixed not to crash but fails to compile according to those who
have vs2010.

Is this correct code (I guess I mean standard conforming)?

regards,


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net