0

オプションの値を持つストリームのラッパーを作成しています

次のように一時オブジェクトを定義しました(SourcePointはテンプレートパラメータです)

struct T
{

    POINT10 point;// always there
    typename enable_if<needsTime<SourcePoint>::val, GPSTime10>::type time;
    typename enable_if<needsRGB<SourcePoint>::val, RGB12>::type rgb;

} it;

今私の書き込み関数では、時間オブジェクトをスキップする必要がneedsTime<SourcePoint>あります

void write (const SourcePoint& rec)
{
  struct T it;
  it.point.X_ = rec.X * 100;
  it.point.Y_ = rec.Y * 100;
  it.point.Z_ = rec.Z * 100;
  //TODO convert to integral properly => find scale

  //FIXME conditional compilation

  if (needsTime<SourcePoint>)
    it.time.gpsTime = rec.T;//<-- right here

  //...

}

ただしit.time.gpsTime = rec.T;、needsTime が false の場合は意味的に有効ではないため、これは機能しません

このためにオーバーロードされたタグ付き関数の使用を避けたい

ここで使用できる static_if ハックはありますか

4

0 に答える 0