C++17 Standard Published
iso.org
iso.org
C++17 https://github.com/AnthonyCalandra/modern-cpp-features/blob/...
17/14/11 https://github.com/AnthonyCalandra/modern-cpp-features
Or get the latest public draft from https://wg21.link/standard
Or an html version: http://eelis.net/c++draft/
I just built from the LaTeX source and it's 32 pages longer than the public draft in the second link from 6 weeks ago. Maybe just additional descriptive language, but...
If so, the result may depend on your installation (probably even if you use the same version of GraphViz but a different OS and/or set of fonts), and that can affect pagination.
Also, are you sure you built for the same paper size? A4 vs US letter could explain the difference.
https://github.com/cplusplus/draft/commit/83e302d3bb6a5f8855...
The only reason anyone cares about the officially published standard is if you're a compiler vendor who wants to know for sure that your product is standards compliant, which is why the cost for the no-draft versions is what it is.
And mind: It's not only for compiler vendors. An ISO standard is a legal document. Based on your country you might put in your software's contract that your code is compliant C++ code or might consult the standard in a legal debate with a commercial vendor. All quite limited ... but not only compiler vendors.
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.
std::set does have a contains() function, it's called count(): http://en.cppreference.com/w/cpp/container/set/count
std::string predates the STL and most of unicodes history. It was supposed to a be an alternative for using C functions for manipulating NTBS's, nothing more. Since then we've only really had 3 standard revisions, and most languages that see constant evolution still haven't got unicode right...
> 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
I can think of a bunch of languages that don't use "append" for pushing on to the back of a dynamic array. JavaScript for instance, which uses "push"
> 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 Ranges proposal/TS goes quite far in this direction. See Eric Nieblers range-v3 library as a testing ground.
String classes are fickle things. It's very hard to get them right. Still, std::string, for all of its age, does let you do a lot of what Python does with manipulation of bytes, particularly when combined with locales (admittedly painful to use) and iostreams (also a bit painful at times).
Python does have a LOT of other functionality tied into strings, but there's a legit design question as to whether that's really a good idea or not. What particular functionality do you think ought to be there?
Off the top of my head, what I use frequently (and which is unavailable in std::String) is:
- replace(search, new). std::string can do it, but first you have to find the index of the start, then you call replace() to replace a set of bytes. Too low level.
- endswith() and beginswith() are surprisingly helpful. endswith() in particular. s.index("prefix") == 0 is pretty clear, but s.index("suffix") == s.size() - "suffix".size() is not very clear.
- toupper()/tolower()/isspace()/isslanum()/isupper()/etc. are not something you use every day, but you really don't want to have to write proper handling of every language's idiosyncracies yourself, and it's not worth it to find a library, so probably only European languages will work initially.
- proper unicode handling. std::wstring (UTF16) is not it (to be fair, that wasn't clear at the time of design), plus I don't think it works well with either Microsoft's or Apple's UTF16
- making a string from a number. QString does this well, Python 2's str(num) is not really flexible enough. I don't want to have to create a stringstream just because I need a numeric string.
- create a string from a printf list. I know stringstream is supposed to do that, but I never seem to be able to do exactly what I want (e.g. %.3f), and regardless, I never can remember the correct syntax for the modifiers (e.g. hex(), precision()), despite it appearing like it ought to be obvious.
I pretty much expect all the above in a string. std::string is basically a veneer over an array of bytes. Maybe that was okay in 1998 when it was designed, but the first thing I have to do is add all that in now, every time I do anything UI-related with text.
I also would like split(), it makes simple parsing a lot easier.
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.
Just trying to help. This code is entirely implementation specific.
Wasn't that the incentive behind the D language?
or... you could just use any of the dozens of libraries that already has the API you want (append, contains... they are all in Qt for instance). Why wait for it to standardize ? it's already here and you can use it.
Long gone days where template meta-programming was the only way to do compile-time code generation and constant checks.... at least that's my impression of the latest language-level features.
I have not worked professionally with c++ for a few years now, but his piece from the article, just seems rather powerful incarnation of the compile-time programming.
constexpr auto add = [] (int x, int y) {
auto L = [=] { return x; };
auto R = [=] { return y; };
return [=] { return L() + R(); };
};One of the issues I have with C++ is that they seem to have used basically all the symbols you can find on a keyboard to create unspellable operators or modifiers, and since they didn't have enough to avoid colliding with C, they mixed them to create even more unreadable combinations. The other examples in the doc are good readings as well suggesting I never approach this "modern art".
I can see why a standardization body would want to avoid that, even though I agree wholeheartedly the result is not pretty.
C++ doesn't even use @ and $, yet ;)
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 returning a reference.
What fixes do you think std::move needs, out of curiosity?
This talk explains the pain quite well: https://www.youtube.com/watch?v=PNRju6_yn3o
put a debug breakpoint in the move constructor and run your tests :p
https://dlang.org/concepts.html
You should give D metaprogramming a try. It's a whole new world, a new fantastic point of view.
I think its good all around and balanced languages, but, there is always a better language for any use case, where D is an alternative
Ocaml, if you want performance close to C/C++ plus and high level abstractions
Rust, if you want manual memory managment
C# and Java, if you want large ecosystems and advanced features
Also C++ is now moving and improving fast Even Ada is sort of making a come back
But, I would suggest that investing in Rust might be more valuable for one's career I am learning a bit of ADA, only for educational purposes and to scratch an itch, it is very different from anything I used, and I like that
D development is lively and active. I enjoy the language, and I plan to keep using it as long as I keep enjoying it.
I really like it.
D is kind of the C++ I always wanted. It's familiar, I can see the C++ lineage, and it's so much nicer to write than C++.
I'm currently having fun writing Advent of Code in D:
So modules and concepts were nice to have, but C++17 is already a very good improvement to write such kind of libraries.
Programming: Principles and Practice Using C++, 2nd Ed., Bjarne Stroustrup https://www.amazon.com/Programming-Principles-Practice-Using...
C++ Primer, 5th Ed., Stanley Lippman https://www.amazon.com/Primer-5th-Stanley-B-Lippman/dp/03217...
For a very brief introduction:
A Tour of C++, Bjarne Stroustrup https://www.amazon.com/Tour-C-Depth/dp/0321958314/ref=sr_1_1...
> C++17 includes the following new language features:
> ...
> utf-8 character literals
> ...
> char x = u8'x';