It is easier to delete unwanted defaults than implementing dummies.

  class C{
    // explicit C(){ unreachable(); } // note: may be ill formed.
    explicit C() = delete;
    [..]
  };

The use of “delete” will produce errors at compile time, much like correcly placed dummies. It's nice to have a real language feature here, to not need to resort to dummies.

NB: There is still a hole. If you don't either delete or make a dummy, you can still get caught.

gnucap/manual/tech/delete_dummies.txt · Last modified: 2022/11/25 01:49 by felixs
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki