A couple of corrections to my previous post:

>   And even if, how could one use a reference considering
>   that all its constructors are private?

All non-copy constructors, actually. Client code can easily create a
reference object by copy:

  dynamic_bitset<>::reference ref = b[0];

This brings the question: should we disable copy construction? Note
that vector<bool> has a member function to swap two references

  // see 23.2.5
  static void swap(reference x, reference y);

which, of course, requires a copy constructor. Should dynamic_bitset
have it too? In that case we could implement a private copy
constructor, which would be available to dynamic_bitset::swap (for
friendship) but not to the user; otherwise we could simply leave it
undefined:

  private:
    reference(reference&); // undefined

>In effect, declaring the copy-assignment operator has the pleasant
>effect to force an explicit definition, showing that the shallow-copy
>is intentional

Sorry, I was thinking to the copy constructor (implicitly declared),
that makes a shallow copy. The copy assignment operator does something
completely different.


Genny.

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

Reply via email to