c++-concepts

C++0x will no longer have concepts. Opinions? How will this affect you?

左心房为你撑大大i 提交于 2019-12-01 03:40:11
At the July 2009 C++0x meeting in Frankfurt , it was decided to remove concepts from C++0x. Personally, I am disappointed but I'd rather have an implementable C++0x than no C++0x. They said they will be added at a later date. What are your opinions on this decision/issue? How will it affect you? dalle Personally I'm not too unhappy of the removal as the purpose of concepts were to mainly improve compile time error messages, as Jeremy Siek, one of the co-authors of the Concepts proposal, writes ( http://lambda-the-ultimate.org/node/3518#comment-50071 ): While the Concepts proposal was not

How do I build gcc with C++ concepts (“concepts lite”) support?

烂漫一生 提交于 2019-11-30 10:45:28
The C++ standards committee is working on a TS (Technical Specification) for Concepts extension: "Programming Languages - C++ Extensions for Concepts". N4377 is the latest version of this document. For inclusion into the C++ standard features are asked to be implemented, ideally for a publicly accessible system. I'm aware of concept-gcc but the concepts proposal above (colloquially referred to as Concepts Lite ) is different. I heard that there is a concepts branch and I have tried the origin/asutton/c++-concepts from gcc 's git mirror but that didn't compile. How do I build and use a version

C++0X Concepts are gone. Which other features should go too? [closed]

你说的曾经没有我的故事 提交于 2019-11-30 04:52:33
As you may have heard, the last meeting of the C++ standards committee voted to remove concepts from the next C++ standard. Of course, this will affect other features and would seem to throw the standard wide open again. If that is the case, which other features do you think should be stripped away (or added), and why? Links: Removal of Concepts -- Danny Kalev (on the decision to remove concepts) Simplifying the use of Concepts -- Bjarne Stroustrup (on the problems with concepts as they look now) The Long Pole Gets Longer -- Martin Tasker (on the impact to the schedule for C++0x if concepts

How do Concepts differ from Interfaces?

时间秒杀一切 提交于 2019-11-28 23:05:14
How do Concepts (ie those recently dropped from the C++0x standard) differ from Interfaces in languages such as Java? Concepts are for compile-time polymorphism, That means parametric generic code. Interfaces are for run-time polymorphism. You have to implement an interface as you implement a Concept. The difference is that you don't have to explicitly say that you are implementing a Concept. If the required interface is matched then no problems. In the case of interfaces, even if you implemented all the required functions, you have to excitability say that you are implementing it! I will try

What are the differences between concepts and template constraints?

折月煮酒 提交于 2019-11-28 15:02:56
I want to know what are the semantic differences between the C++ full concepts proposal and template constraints (for instance, constraints as appeared in Dlang or the new concepts-lite proposal for C++1y ). What are full-fledged concepts capable of doing than template constraints cannot do? sftrabbit The following information is out of date. It needs to be updated according to the latest Concepts Lite draft. Section 3 of the constraints proposal covers this in reasonable depth. The concepts proposal has been put on the back burners for a short while in the hope that constraints (i.e. concepts

Specifying a concept for a type that has a member function template using Concepts Lite

这一生的挚爱 提交于 2019-11-28 03:32:27
I'm trying to specify a concept to constrain a higher kinded type that has a member function template using Concepts Lite. However I am not able to find inside the technical specification or the tutorial a clause dealing with templated statements inside a concept. How is this done? Example: suppose I have the higher kinded type HKT with a member function template F : template<class T> struct HKT { template<class U> // this looks like e.g. rebind in std::allocators auto F(U) -> HKT<U>; }; and that now I want to specify a concept for constraining these higher kinded types: template <template

Why aren't ranges' algorithms compatible with std's iterators?

别等时光非礼了梦想. 提交于 2019-11-27 16:14:30
问题 #include <vector> #include <iostream> #include <range/v3/all.hpp> int main() { auto coll = std::vector{ 1, 2, 3 }; ranges::copy( coll, ranges::ostream_iterator<int>{ std::cout, ", " } ); // ok ranges::copy( coll, std::ostream_iterator<int>{ std::cout, ", " } ); // error } The issue is shown in the code above. I use ranges-v3-0.3.7. To me, the generic algorithm copy shouldn't care about the destination iterator type as long as it meets the requirements of output iterator. If so, why aren't

How do Concepts differ from Interfaces?

人盡茶涼 提交于 2019-11-27 14:43:32
问题 How do Concepts (ie those recently dropped from the C++0x standard) differ from Interfaces in languages such as Java? 回答1: Concepts are for compile-time polymorphism, That means parametric generic code. Interfaces are for run-time polymorphism. You have to implement an interface as you implement a Concept. The difference is that you don't have to explicitly say that you are implementing a Concept. If the required interface is matched then no problems. In the case of interfaces, even if you

void_t “can implement concepts”?

佐手、 提交于 2019-11-27 05:59:36
I was watching the second part of Walter Brown's CppCon2014 talk on template metaprogramming , during which he discussed the uses of his novel void_t<> construction. During his presentation Peter Sommerlad asked him a question that I didn't quite understand. (link goes directly to the question, the code under discussion took place directly before that) Sommerlad asked Walter, would that mean we actually can implement concepts lite right now? to which Walter responded Oh yeah! I've done it ... It doesn't have quite the same syntax. I understood this exchange to be about Concepts Lite. Is this

Specifying a concept for a type that has a member function template using Concepts Lite

筅森魡賤 提交于 2019-11-27 05:09:59
问题 I'm trying to specify a concept to constrain a higher kinded type that has a member function template using Concepts Lite. However I am not able to find inside the technical specification or the tutorial a clause dealing with templated statements inside a concept. How is this done? Example: suppose I have the higher kinded type HKT with a member function template F : template<class T> struct HKT { template<class U> // this looks like e.g. rebind in std::allocators auto F(U) -> HKT<U>; }; and