Are there any predefined concepts in Concepts TS?

心不动则不痛 提交于 2019-12-13 14:22:49

问题


'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.


回答1:


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.




回答2:


'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.



来源:https://stackoverflow.com/questions/32273796/are-there-any-predefined-concepts-in-concepts-ts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!