[Solved] How to write one line and nested ‘if’ statement without ‘?:’ (is it possible?)

[ad_1] You already used the two important words that are key to undestand why what you intend is not possible, but you probably haven’t grasped their full meaning: Statement and expression. The if statement (like all statements) does not yield a value, while the ?: operator is an expression that does yield a value. Distinguishing … Read more

[Solved] How to specify type of a constexpr function returning a class (without resorting to auto keyword)

[ad_1] The actual type is hidden as it’s local inside the function, so you can’t explicitly use it. You should however be able to use decltype as in decltype(create<int>()) v = create<int>(); I fail to see a reason to do like this though, when auto works. 1 [ad_2] solved How to specify type of a … Read more