1. Yankes

    I think that “base class chaining” is very ugly and unnecessary syntax for C++11.
    It could be easy replaced by more friendly syntax:


    where `warp_base_class` is template alias that hide all ugly parts.
    Core implementation is simple:

    template<typename T,
    template F,
    template… Rest>
    using type = typename F<T typename warp_base_class_helper>::type;

    1. Arne Mertz

      Hi Yankes, thanks for dropping by!
      I am not sure I completely understand what the template would achieve. I tried to compile it and got several errors – I assume you meant `typename F` and `typename… Rest`, but after that I must confess I am lost: I have no idea how to fix this last error (link).

        1. Arne Mertz

          Ok, I get your point now. That technique would allow to write something like this: `class Rational : public boost::operators<Rational, addable, subtractable, multipliable>`, and if it gets a bit enhanced that template could even distinguish between the one- and two- parameter versions (see the part three of the series).


Leave a Reply

Your email address will not be published. Required fields are marked *