Boost logo

Boost :

Subject: [boost] [Variant] Documentation Questions/Notes
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-10-27 13:50:17

- What does this mean?

    Full value semantics, including adherence to standard overload
    resolution rules for conversion operations.

  Seems to me that it's impossible *not* to adhere to any standard
  rules. Is the part after the comma vacuous?

- The "temporary heap backup" technique seems to have a hole:

   1. Copy-construct the content of the left-hand side to the heap;
      call the pointer to this data backup.
   2. Destroy the content of the left-hand side.
   3. Copy-construct the content of the right-hand side in the
      (now-empty) storage of the left-hand side.
   4. In the event of failure, copy backup to the left-hand side
   5. In the event of success, deallocate the data pointed to by

  What happens in the event of a failure in step 4?

- I note the section on motivation doesn't mention the new capabilities
  of C++11 unions. Now some of the constructs are possible... *if* you
  do all the bookeeping yourself.

- I note that the implementation has at least some support for move
  semantics and yet the docs require all elements to be "bounded types",
  which in turn are required to be CopyConstructible. Is that accurate,
  or outdated?

- "completeness at the point of template instantiation" is a rather odd
  thing to put in a concept. I suggest that that should be just part of
  the requirements on the variant template rather than on BoundedType.

- Do the semantics for are_strict_equals at
  differ from those of the built-in equality operator?

- it might be worth making the point that recursive variants offer the
  ability to define complex linked data structures *as value types* in a
  type- and memory-safe manner. I.e. no explicit handling of pointers;
  copy construction and assignment "just work," etc.

Dave Abrahams
BoostPro Computing                  Software Development        Training             Clang/LLVM/EDG Compilers  C++  Boost

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