Concepts-Lite in gcc (with links to TS) - c++

As highlighted by a recent answer to this question, gcc now supports concepts-lite in builds from its svn trunk.
The same question links to the most recent TS, N4377. Edit - answer has a newer TS.
A helpful paper can be found labelled N3580 - this is from 2013, and the authors are Andrew Sutton, Bjarne Stroustrup and Gabriel Dos Reis.
A list of tweaks to N4377 can be found labelled N4434. This gives 3 suggested changes to the N4377 paper and lists as its reply point Walter E. Brown.
These papers/Technical Specifications are similar, but have various small changes in each case.
Is there some simple way to discover what gcc currently implements? Or indeed, plans to implement?
As a side question: Is ConceptClang or some similarly named project related to the c++1z concepts? A mailing list post from May 2015 collected some thoughts, in particular that:
Larisse may have some work done for the concepts ts, in addition to
her C++0x efforts.
No further reply was made to that thread.

It's my understanding that the GCC maintainers plan to implement Concepts as specified in the final TS that is soon to be published: N4549 C++ Extensions for Concepts. Most of that specification is implemented in GCC, with the notable exception of "generalized auto deduction" which is necessary to compile syntax like std::pair<auto, auto> foo = std::make_pair(x, y);. The implementation is still very rough - a quick search for open bugs with "[concepts]" in the title has 38 hits, so exactly what is implemented and what works well changes from week to week.
Is ConceptClang or some similarly named project related to the c++1z concepts?
ConceptClang is (was?) an implementation of C++0x concepts which I believe has been dead for some time now. There are a few people who have started looking at implementing the Concepts TS in clang in the last several months, they've only submitted a handful of patches to recognize the concept keyword and parse the syntax of concept function and variable declarations.

Related

How do I find the revision of C++ standard, where a specific requirement was removed or changed?

Let me give a concrete example to make it more clear what I exactly mean.
I have two drafts of C++ standard: N4296 that is quite old now and more recent revision N4750. There are some subsections that I am interested in, e.g. [unord.hash]. Version N4296 requires from std::hash to provide two nested types argument_type and result_type, but this requirement no longer present in N4750.
How can I find the revision, where this requirement was removed and the motivation for it?
Another source you can use is cppreference. They do a very good job in showing what is different in the different version of the standard. For instance, the std::hash page lists that argument_type and result_type are deprecated in C++17 and removed in C++20. With that information you at least know that the remove happened in a version of the standard between C++17 and C++20, which is lot less versions to look through.
Additionally, in at least some sections, if there was a defect report there will also be a link to that defect report on the page.
You'll still have to do some hunting, but hopefully this will narrow it down for you.
This can actually be kind of hard.
Individual revisions
First, there's the list of closed core language issues (and the equivalent page for library issues), which gives you a paper reference and some date information.
There's the working group's mailings.
There's the standard's source whose history can be examined using Git tools and their friends. The commit log in theory should be useful — though I recommend noting down the name (e.g. a word like "N3690") of the Final Draft for each standard so that you can recognise it in the tag list.
This is your best bet if you're literally looking for the specific revision where a change was introduced.
Between standards
When trying to determine in which standard the change was introduced, personally I tend to just open up individual standard documents and do my own visual bisection. This works well if you know where the feature's wording is located in the standard, and if the wording is mostly compartmentalised in one place, though it can still be time consuming.
For motivations you'll be looking for the original proposal paper. If you manage to find the draft revision where the change was made, hopefully someone will have cross-referenced the name/ID of the proposal.
I also find that Google gives some good results when searching for this if you already have a vague idea of its contents: e.g. "C++ if declaration definition while for consistent proposal".
And, if you don't mind non-authoritative sources (which should nonetheless be reliable), there are usually Stack Overflow answers that track changes between C++ standards, with links to the relevant papers. For example, this answer to "What are the new features in C++17?", which references the changes to std::hash that you mention.

Why aren't parts of the Concurrency TS going in C++17?

According to Michael Wong the Concurrency TS is not going in, despite complete, apparently
Although there is implementation experience, it was just approved and is too fresh to be voted to be added to C++17.
My favourite proposal was originally in N3327 but I first read of it in N3857/N3784 and had expected it for C++14. futures has had and implementation of .then() in Boost since 2013 and Microsoft has implemented a form of them in PPL so any issues will have been hit upon, discussed and corrected. An asynchronous version of .get() is a necessity and seemed to been decided upon since early-2014 when N3865 ('More Improvements to std::future') talked as if .then() was a given. Which means even with 5 years since N3327 first raised a .then() due to 'streamlining' any well thought out, discussed and implemented proposal is blocked by discussions going on that is tangential to it.
It is now going to be 2020 before it will ship.
Is the Concurrency TS a whole or nothing proposal? And if so why?
It is now going to be 2020 before it will ship.
It's shipping now. Just not in the C++ standard itself.
You shouldn't think of a TS as some kind of fictional document. It's a real thing, and many vendors implement TS's. Microsoft and libc++ have support for the FileSystem TS, for example.
With C++17 feature complete, compiler and standard library vendors have their hands full implementing those features. Not to mention the Concepts TS and so forth. So it's not surprising that the Concurrency TS isn't their highest priority.
As for why parts of Concurrency weren't added to C++17, the minutes of the Jacksonville meeting show that SG1 (the study group for concurrency issues) specifically proposed adding Parallelism TS to the standard, but did not do so for Concurrency TS. So they apparently felt that Concurrency TS was not ready to be added to the standard library, even partially.

Are there any predefined concepts in Concepts TS?

'Concepts lite' were already accepted as a TS and (example implementation) merged into GCC main branch, so the follow up question is will any concepts come predefined (like Sortable or Random_access_range)?
Where do I look for such predefined concepts?
Is the list at cppreference.com an acurate and exhaustive list?
Can I use them with the latest GCC trunk build?
Edit 1: Changed C++17 to TS due to concepts not being accepted into C++17.
There are no concepts defined in the Concepts TS (source: I wrote the Concepts TS).
It is neither an oversight nor mistake... The goal was to ship a pure language extension in the TS, allowing developers time to experiment with the new features before committing (an incredible amount of) time defining the concepts needed for the Standard Library.
The Ranges TS will define the concepts needed for the Standard Library.
GCC may ship with some concepts, but I have not heard of any concrete plans to do so. I have a library that defines many of the concepts (but not all) that appear in the Ranges TS here: https://github.com/asutton/origin, but I'm still working on a usable release and appropriate documentation. And it only compiles against GCC from trunk. I'm hoping for adequate documentation by next week.
'Concepts lite' were already accepted for C++17
No, it isn't. It's a separate TS.
will any concepts come predefined?
Not by the Concepts TS, which is limited to the language feature. The current Ranges TS working draft does define a number of concepts.

Do any STL implementations support C++ concepts?

I am working on a class project which uses C++ concepts. Where can I find an STL implementation that supports has constraints from the concepts draft TS, such as Equality_comparable or Sortable?
Thanks for your help!
Here's what I tried so far:
I've successfully compiled the c++-concepts branch from GCC's SVN, which appears to be maintained (last updated yesterday by Andrew Sutton). However, the libstdc++ that comes with this branch has not been updated for concepts.
I also tried Concepts-Lite (gcc-clite), which promises:
The standard library shipping with this compiler includes the constraints found in the paper "A Concept Design for the STL", which can be accessed by including the <type_traits> header file.
However, libstdc++ in the GCC code downloaded from that page also does not have concepts. In particular, the type_traits header appears to be unchanged from the GCC revision it was forked from.
Have a look at Andrew Sutton's Origin library on github. If you follow the origin/core directory you can find the basic concepts. He has some graph, math, and some container stuff stuff too from the look of it.
I have to admit that I'm in the middle of exploring this myself so I have no intelligent report yet.
Only downside: the most recent check-ins are a couple of months or more ago. I guess we'll see.

What do I need to know about C++0x? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Where can I learn more about C++0x?
I am fairly familiar with C++03 but I still need to come to terms with C++0x so I would like to read some fairly digestible information on C++0x.
I have looked at the Wikipedia but I am on the look out for something that is more readable. So is there a book or series of blog entries that provide a nice introduction to the matarial?
There is a ton of stuff on this very site - some of the posts include very informative discussion. I would point you to Google but it's going to be more efficient to search in C++0x tagged posts here imo.
Here's a good one to start with, which includes indirection to Stroustrup's own summary. Scott Meyers has presentation materials on the topic here.
Check up on your favourite compiler's support for the new version. Microsoft VC10 support is summarized here. GCC info can be found here.
Official state of the standard for the language is available here. Evolution of the language is in many places tied to ongoing work in Boost. See here for some info on that.
Honestly my preference these days is to look here for 99% of needed info rather than resort to a book.
It's too early for a book. The standard isn't fixed yet.
Now, if you think wikipedia is hard to read, you might try Stroustrup's page about it. However it might seem harder to read to some.
There's a good tutorial on codeproject here for VC++. Even if you aren't using Visual Studio though it's still useful.
Learn whatever feature you would have loved having in C++98 in the first place. For me, it was variadic templates, lambda functions, decltype and other cool stuff.
If you still don't know what to learn first, maybe you should try to understand what issues from the C++98 are adressed. I say this because all the xvalue, move semantics and al stuff is quite heavy to grasp if you don't know what the problems were (and still are btw). This may imply learning some more C++98 first.
Then, you can always browse the Wikipedia article and look at whatever you find cool. Implementors don't provide all the features yet, so you'll look like a 5 year old staring at the front window of a toy store. This is a good reason to behave like one.
I really liked this series of blog posts by the Visual C++ Team Blog:
The Future of the C++ Language
Lambdas, auto, and static_assert: C++0x Features in VC10, Part 1
Rvalue References: C++0x Features in VC10, Part 2
decltype: C++0x Features in VC10, Part 3
I found the Overview of the New C++ (C++0x) book by Scott Meyers to be a good, detailed summary of the main features. It's more of a presentation with very detailed footnotes that an actual book, but it's still an excellent, short read.
I suggest you using the book functionality of Wikipedia to make it more readable/printable. I did the same for the C++0x page.