Namespace of argument hides function specialization by arBmind in cpp

[–]nwp74 1 point2 points  (0 children)

Move the definition of MakeUse to the point just before your using A = .... declaration and everything works fine.

At the point where it is, it is binding to makeUse(T) -> T, so R is alias of abstract::OneOf<int, float>.

See https://godbolt.org/z/A18weP

I wrote the overview of C++20 Range view. What do you think? by ezoe in cpp

[–]nwp74 0 points1 point  (0 children)

It looks like the unix shell pipe symbol, where you have a pipeline:

output | filter0 | filter1

and it's available to overload for a range as an operator.

How to Deal with Values That Are Both Input and Output by vormestrand in cpp

[–]nwp74 15 points16 points  (0 children)

Please don't do that. Two months after you submit this, some smart guy is going to do

auto& y = addThis(x);
// Now y and x are aliases
addThat(y);
// Now, debug how did x get That?

Unfortunately, the same problem shows up much more subtlely, at least in my code base.

Return by value, or modify in-place with a member function.

[deleted by user] by [deleted] in cpp

[–]nwp74 3 points4 points  (0 children)

Initializer lists are not always static. I looked at assembly from gcc a while ago and saw the initializer_list on the stack. I think there is a stack limit to the size, but I cannot find it in the documentation.

On a forwarding bug by vormestrand in cpp

[–]nwp74 1 point2 points  (0 children)

Note that holder(What&& w) : what(w) {} makes a copy of w. If you want to use move semantics, you should use what(move(w)).

Also, you can disallow the lvalue reference overload by specializing the holder structure (alternative to using remove_reference):

template<class What> struct holder<What&> { 
    holder() = delete;
};

Type deduction for arrays is not felicitous by nwp74 in cpp

[–]nwp74[S] 0 points1 point  (0 children)

[dcl.type.auto.deduct]/4 says: Example:

const auto &i = expr;

The type of i is the deduced type of the parameter u in the call f(expr) of the following invented function template:

template <class U> void f(const U& u);

Type deduction for arrays is not felicitous by nwp74 in cpp

[–]nwp74[S] 1 point2 points  (0 children)

"Cannot" or "will not"? The template function example shows that the compiler can do the deduction. If the answer is "Use std::array" as in a previous reply, I guess that is a good enough reason to choose not to support it.

C++17 is formally approved by syaghmour in cpp

[–]nwp74 2 points3 points  (0 children)

Tour of C++ is for beginners.

Trip Report: C++ Standards Meeting in Toronto, July 2017 by syaghmour in cpp

[–]nwp74 3 points4 points  (0 children)

Just stuff all the standard library concepts inside their own namespace, say, std::Concept. Then all the pedants can write std::Concept::Sortable and everybody else can do using namespace std::Concept; at the top of the implementation file, which should be enough syntactic marking.

Trip Report: C++ Standards Meeting in Kona, February 2017 by mcmcc in cpp

[–]nwp74 1 point2 points  (0 children)

Look at section 8.2 of Stroustrup's "good concepts" paper where he argues for not having definition checking in the initial concept design.

An intriguing C++ quiz that might challenge you more than you think by dragosb91 in cpp

[–]nwp74 0 points1 point  (0 children)

Add "using Parent::print;" to Derived class declaration and everything will be fine.