C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Allow virtual base classes in constexpr
From: Jack Adrian Zappa (adrianh.bsc_at_[hidden])
Date: 2019-05-31 22:58:56


Perhaps you might be able to implement this in a CRTP manner, just like you
could implement many constexpr functions like recursive ternary operation.
However, I've been seeing many of the wonderful cppcon videos and am seeing
that just because one can dig with spoons, doesn't mean that we should when
a shovel is a much better tool (https://youtu.be/4AfRAVcThyA). Though, as
CRTP is a static "inheritance", you'd have to use tuples instead of other
homogenous containers.

I don't pretend to understand the inner workings of the compiler, but as a
developer, I would think that anything is possible, it's just the level of
difficulty and if the feature is deemed worth the trouble.

A

On Fri, May 31, 2019, 22:33 Jake Arkinstall via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> Immediate thought: this doesn't make sense to me. Can you provide a more
> detailed description of your particular use case? If it is just the
> inheritance of the I/O child classes then CRTP is the canonical solution.
> At least that way the type of the child class is known by the compiler,
> whereas the entire point of virtual inheritance is to allow flexibility at
> runtime.
>
> As such, I don't think this is remotely possible apart from in the
> circumstances that only one type is possible (E.g. in a branch where the
> type is determined). If those circumstances are commonplace, virtual
> inheritance is likely avoidable.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>



STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups