Talk:cpp/named req
Contents |
[edit] SeedSequence
I've removed SeedSequence which was on the list. I can't find it in standard papers -- Bazzy 16:08, 16 March 2012 (PDT)
- It's named as SSeq in the standard. -- P12 04:57, 17 March 2012 (PDT)
[edit] (C++11)
Why are some of the concepts marked as (C++11) ? None of the concepts were added before C++11, and they still aren't yet added to the standard. --- Undeterminant 17:28, 21 March 2012 (PDT)
- What this page is listing is properly called requirements. The 2003 revision of the C++ standard is defined in terms of requirements, such as CopyConstructible, Assignable, LessThanComparable, etc. The 2011 revision adds many more requirements (some of which are detailed under §17.6.3[utility.requirements]). I think this is a great idea, since it makes it much easier to be precise in the rest of this wiki. --Cubbi 18:47, 21 March 2012 (PDT)
- Ah, okay. That makes more sense, then. --- Undeterminant 19:02, 21 March 2012 (PDT)
- Is there a fundamental difference between "concepts" and "requirements"? As far as I remember, the committee used concepts to specify the constraints on templates throughout the draft paper in almost the same way as they now use requirements. To me it seems that direct language support is the only thing that these terms differ. Is there much ambiguity if we refer requirements by concepts, but also add an explanation in the page? -- P12 11:38, 22 March 2012 (PDT)
- After a further thought, I think that similarity doesn't mean anything if the terms are confusing. We could resolve this ambiguity easily by just replacing concepts with requirements or named requirements in {{cpp/named req/title}}, {{dcl list concept}} and several link names. -- P12 14:07, 22 March 2012 (PDT)
- I'm very slightly leaning towards renaming concepts => requirements. But only slightly. The current form, with the explanation as to what's going on, is tolerable and might save us some effort once concepts actually make it into the language. Nate 16:24, 22 March 2012 (PDT)
[edit] UnaryPredicate
I can't find the UnaryPredicate concept, as used by std::find_if, on the page. Is it missing, or is it there under a different name? Vtable 08:25, 22 March 2012 (PDT)
- I see Predicate and BinaryPredicate in the standard.
- They don't have many detailed requirements as the other concepts but maybe can be added here anyways.
- --Bazzy 09:07, 22 March 2012 (PDT)
- I've added those two to the list, but without any descriptive text yet.
- Would something like "A function or functor that takes a single argument and returns true or false." be ok as the brief description for Predicate? -- Vtable 11:55, 22 March 2012 (PDT)
- I've added a bit more precise description. Two things to note: the result doesn't need to be literally bool, only convertible to it. Also, the arguments are not modified. -- P12 13:46, 22 March 2012 (PDT)
[edit] Trivially copyable, POD etc.
Can these be considered concepts? --Bazzy 02:13, 24 March 2012 (PDT)
- I can't seem to find a specific place where they're mentioned on the wiki. It would make sense to include them here. --- Undeterminant 15:21, 24 March 2012 (PDT)
- Added as Class category --Bazzy 03:40, 25 March 2012 (PDT)
- Note, that neither C++11, nor C++0x draft before the removal of concepts define these type properties as named concepts or requirements. They are defined in §3 Basic concepts, so our usage is non-standard. There are a lot of other type properties, such as arithmetic, floating-point, reference, etc., so we probably want to very cautious with the wording (e.g. not "<...> must meet the requirements of Trivial", but "<...> must be trivial (see Trivial)"), and put notes everywhere that these requirements are not defined as such in the standard. -- P12 06:54, 25 March 2012 (PDT)
- I think it's worth listing all type categories (at least all categories standardized via type traits) here, if only to make it easy to explain things like the fourth overload of std::sqrt. We'd just link Integral to Integral, which would explain which types are part of that category, and give a seealso to std::is_itegral. Incidentally, here's a chart I like that arranges those type categories neatly: http://home.roadrunner.com/~hinnant/TypeHiearchy.pdf , although it's missing a few other important categories: aggregate and literal, for example (although we kinda defined literal type at cpp/language/constexpr, a link for aggregates would make explaining std::array and std::atomic easier. --Cubbi 07:13, 6 June 2012 (PDT)
- Agreed. A list with all our "custom" concepts and a note in corresponding pages should explain what we've done clearly enough. -- P12 13:28, 6 June 2012 (PDT)
- I think it's worth listing all type categories (at least all categories standardized via type traits) here, if only to make it easy to explain things like the fourth overload of std::sqrt. We'd just link Integral to Integral, which would explain which types are part of that category, and give a seealso to std::is_itegral. Incidentally, here's a chart I like that arranges those type categories neatly: http://home.roadrunner.com/~hinnant/TypeHiearchy.pdf , although it's missing a few other important categories: aggregate and literal, for example (although we kinda defined literal type at cpp/language/constexpr, a link for aggregates would make explaining std::array and std::atomic easier. --Cubbi 07:13, 6 June 2012 (PDT)
- Note, that neither C++11, nor C++0x draft before the removal of concepts define these type properties as named concepts or requirements. They are defined in §3 Basic concepts, so our usage is non-standard. There are a lot of other type properties, such as arithmetic, floating-point, reference, etc., so we probably want to very cautious with the wording (e.g. not "<...> must meet the requirements of Trivial", but "<...> must be trivial (see Trivial)"), and put notes everywhere that these requirements are not defined as such in the standard. -- P12 06:54, 25 March 2012 (PDT)
- Added as Class category --Bazzy 03:40, 25 March 2012 (PDT)
[edit] Duplicated page
I noticed that cpp/iterator/concepts was added to the wiki a while ago. Its information should probably be consolidated into this section. --- Undeterminant 14:28, 2 April 2012 (PDT)
- I replaced it with redirect. The subpages of cpp/named req already have better explanations than cpp/iterator/concepts. -- P12 13:34, 6 June 2012 (PDT)
[edit] N3701
Hello, Maybe update article with new draft N3701 ? http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3701.pdf Thanks Guillaume Belz 07:15, 9 August 2013 (PDT)
- Yes, that definitely should be mentioned. Updated.--Cubbi 08:40, 11 August 2013 (PDT)
[edit] Rename?
How about we rename these 'library concepts' to something like 'library type requirements', now that we have actual concepts in C++20 and Ranges TS? --Cubbi (talk) 14:03, 9 August 2017 (PDT)
- I'm OK with that, especially since the library specification doesn't really use the word "concept" for these. T. Canens (talk) 17:09, 9 August 2017 (PDT)
- The old STL called them "concepts", e.g. LessThanComparable - maybe P12 got the idea from there. Okay, whoever finds the time first can rename. --Cubbi (talk) 18:41, 9 August 2017 (PDT)