Boost logo

Boost :

From: Ivan J. Johnson (ivan66_at_[hidden])
Date: 1999-11-21 15:41:40

Your specialization for swap (shown below) should probably be inline.

// std::swap for empty_member
namespace std {

template <typename Base, typename Member>
void swap(empty_member<Base, Member> & a,
    empty_member<Base, Member> & b)
  // swap base classes in-place: for empty base classes, this will
  // away to nothing
  std::swap((Base &) a, (Base &) b);
  // swap member objects in-place
  std::swap(a.m, b.m);

} // namespace std

Also, as Darin pointed out, it might be better to avoid the C-style
cast. Rather than using static_cast, I think you could write
  std::swap<Base>(a, b);
which is effectively an implicit_cast.


Boost list run by bdawes at, gregod at, cpdaniel at, john at