Live data from Hacker News

C++17 Standard Published

iso.org

31–40 of 85 posts

Re: C++17 Standard Published

#31
post #6

C++17 is a slight disappointment, I hope C++20 will be the real deal - concepts could really be a game changer and move semantics needs more fixes :/.

What are concepts? Is it like java/golang interfaces or rust traits?

It’s sorta like traits but also different.

Re: C++17 Standard Published

#32
post #6

C++17 is a slight disappointment, I hope C++20 will be the real deal - concepts could really be a game changer and move semantics needs more fixes :/.

D has had concepts for quite a while. They call them template constraints:

https://dlang.org/concepts.html

You should give D metaprogramming a try. It's a whole new world, a new fantastic point of view.

Re: C++17 Standard Published

#34
post #32
post #6

C++17 is a slight disappointment, I hope C++20 will be the real deal - concepts could really be a game changer and move semantics needs more fixes :/.

D has had concepts for quite a while. They call them template constraints: https://dlang.org/concepts.html You should give D metaprogramming a try. It's a whole new world, a new fantastic point of view.

That looks really interesting. Is this all done at compile time or runtime? After further reading the answer seems to be compile.

Re: C++17 Standard Published

#35
Do any of the standard's people read HN, or is there a way of submitting requests? The STL could seriously use some improvements. std::string doesn't do most of the stuff you want with a string; updating it to an interface like Python's string would be nice. Having a std::vector::append() would be really nice, so I don't have to remember that C++ uses something completely different from every other language. Convenience things like std::set::contains() would be nice because s.find() != s.end() is not very readable compared to contains().

I'm really impressed at what the standards committee has done, but I'm wondering if we ought to start thinking about a C++2.0 where we can write the C++ that we've learned we want. The poor young-uns learning C++ still have to learn all the old stuff, because otherwise it will bite them sooner or later.

Re: C++17 Standard Published

#36
post #34
post #32

Earlier quoted context omitted.

D has had concepts for quite a while. They call them template constraints: https://dlang.org/concepts.html You should give D metaprogramming a try. It's a whole new world, a new fantastic point of view.

That looks really interesting. Is this all done at compile time or runtime? After further reading the answer seems to be compile.

Definitely compile time. D has a somewhat similar feature called contracts (https://dlang.org/spec/contracts.html) which happen at runtime, but don't influence function/template resolution.

Re: C++17 Standard Published

#37
post #35

Do any of the standard's people read HN, or is there a way of submitting requests? The STL could seriously use some improvements. std::string doesn't do most of the stuff you want with a string; updating it to an interface like Python's string would be nice. Having a std::vector::append() would be really nice, so I don't have to remember that C++ uses something completely different from every other language. Convenie…

The process for proposals is at https://isocpp.org/std/submit-a-proposal

Re: C++17 Standard Published

#38
post #35

Do any of the standard's people read HN, or is there a way of submitting requests? The STL could seriously use some improvements. std::string doesn't do most of the stuff you want with a string; updating it to an interface like Python's string would be nice. Having a std::vector::append() would be really nice, so I don't have to remember that C++ uses something completely different from every other language. Convenie…

> std::set::contains()

I live in a "fast languages only when necessary, and with restraint" shop. Our C++ is not idiomatic, it is meant for programmers from other languages. Anything with iterators is a bit sketchy. It tends to look more like C than C++, and now that I'm an old person I am perfectly happy with that.

We use `s.count(i) == 1`. It's ok -- clear, readable etc. Doesn't give you an iterator if you want to delete the thing too, but most of the time you don't.

Re: C++17 Standard Published

#39
post #35

Do any of the standard's people read HN, or is there a way of submitting requests? The STL could seriously use some improvements. std::string doesn't do most of the stuff you want with a string; updating it to an interface like Python's string would be nice. Having a std::vector::append() would be really nice, so I don't have to remember that C++ uses something completely different from every other language. Convenie…

Some do. More are active on Reddit. But new proposals can come from anyone. Though, before writing and submitting any, check on the public std-proposals mailinglist if your idea would get any traction. See https://isocpp.org/std/submit-a-proposal

std::set does have a contains() function, it's called count(): http://en.cppreference.com/w/cpp/container/set/count

Re: C++17 Standard Published

#40

Earlier quoted context omitted.

It's not as major of an update as previous releases, but there are a lot of little convenience features. String views, same-line nested namespaces, [[fallthrough]], if with init (I'm sure Google single-handedly got this included; it's very Go-reminiscent and really nice when not using exceptions), structured bindings, maybes with std::optional (occasionally useful), and even just something as simple as emplace return…

Its not std::move, but the complexity coming with it. Its a hassle applying move semantics correctly and there is not the one goto solution for simple things. Im not aware of a proposal to change that issue, but at least there should be better defaults. This talk explains the pain quite well: https://www.youtube.com/watch?v=PNRju6_yn3o

The amount of prayer I have put into RVO and moves happening "right"... As someone who isn't a C++ programmer, is there anything better than looking at annotated asm? Templating everything and trying it with something that isn't copyable? (Actually, would that even work with RVO?)
Post reply on HN