AMDG On 09/18/2018 12:55 PM, Hans Dembinski via Boost wrote:
<snip> I'm not 100% clear on the standards guarantees for the constructor initialiser list (in particular if a base initialiser is guaranteed to be fully constructed before the arguments to other initialisers are evaluated or not), so it's possible that this is UB if that guarantee is not met, but I would have thought it'd be more sensible to init as:
regular(...) : transform_type(std::move(trans) , min_(transform_type::forward(lower)) , ...
Such that the same instance is used in all cases.
AFAIK, the order in which these statements are executed is not guaranteed, that's why the ctor uses trans instead of transform_type. I am happy to be proven wrong by a language expert. If that's the case, I agree that your suggestion makes more sense.
Initializers are never interleaved. "In a non-delegating constructor, initialization proceeds in the following order: - ...virtual base classes ... - Then, direct base classes ... - Then, non-static data members ..." [class.base.init] "The initialization performed by each mem-initializer constitutes a full-expression" [class.base.init] "Every value computation and side effect associated with a full-expression is sequenced before every value computation and side effect associated with the next full-expression to be evaluated" [intro.execution] In Christ, Steven Watanabe