Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #70300
| From | Christian Gollwitzer <auriocus@gmx.de> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: issues with std::variant |
| Date | 2019-12-06 09:39 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <qsd446$hs1$1@dont-email.me> (permalink) |
| References | (4 earlier) <f0062225-f506-4306-9d48-1e15215f72d1@googlegroups.com> <qs991n$80l$1@dont-email.me> <374e069c-2c44-4b3e-bdaa-86d0488d90e4@googlegroups.com> <qsa04p$pa9$1@dont-email.me> <5ecddbd0-d352-47e7-967d-1378da2635c4@googlegroups.com> |
Am 05.12.19 um 18:59 schrieb Taylor: > On Wednesday, December 4, 2019 at 8:13:24 PM UTC-8, Alf P. Steinbach wrote: >> On 05.12.2019 01:18, Taylor wrote: >> Re the problem you're asking about, it seems clear that there is some >> commonality of the classes that has not been factored out / abstracted, >> but that the rest of the code relies on. > > If I were to use inheritance to factor out commonality, I would need to use multiple inheritance and it could get messy. So for example, there's the base class Node, then there might be ExposedNode, and ColorfulNode, LabeledNode. > > Or I could use interfaces, such has HasExposedPosition, HasColor, HasLabel, etc. I did this before and it's much more code than the variant stuff. > I'm far from understanding the problem, but factoring out common members does not mean you nead "class A: public B" inheritance. You could also have a "struct Node" and then stuff the things that vary into the variant, which is a member of "Node". This is done in C with unions very often e.g. for byte code interpreters, where all the values have a type tag, a reference count, an alternative representation, and then a union which contains the real data. Christian
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
issues with std::variant wtholliday@gmail.com - 2019-12-04 08:37 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-04 10:26 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-04 11:07 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-04 12:31 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-04 13:09 -0800
Re: issues with std::variant "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-04 22:39 +0100
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-04 16:18 -0800
Re: issues with std::variant "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-05 05:13 +0100
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 09:59 -0800
Re: issues with std::variant Christian Gollwitzer <auriocus@gmx.de> - 2019-12-06 09:39 +0100
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-06 09:12 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-04 14:46 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-04 16:28 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 00:00 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 00:48 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 08:17 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 09:44 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 11:14 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 12:37 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 13:20 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 13:42 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-05 15:41 -0800
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-06 09:44 -0800
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-07 04:43 -0800
Re: issues with std::variant Manfred <noname@add.invalid> - 2019-12-07 18:17 +0100
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-07 11:45 -0800
Re: issues with std::variant Christian Gollwitzer <auriocus@gmx.de> - 2019-12-06 09:58 +0100
Re: issues with std::variant Öö Tiib <ootiib@hot.ee> - 2019-12-06 06:06 -0800
Re: issues with std::variant David Brown <david.brown@hesbynett.no> - 2019-12-04 22:34 +0100
Re: issues with std::variant Vir Campestris <vir.campestris@invalid.invalid> - 2019-12-05 15:07 +0000
Re: issues with std::variant Taylor <wtholliday@gmail.com> - 2019-12-05 10:01 -0800
Re: issues with std::variant David Brown <david.brown@hesbynett.no> - 2019-12-05 22:15 +0100
csiph-web