C ++ 0X concepts have disappeared. What other features should go too?

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 functions and seems to launch the standard again. If so, what other features do you think should be removed (or added) and why?

References:

Deleting concepts - Danny Kalev (on the decision to delete concepts)

Simplification of the use of concepts - Bjarne Stroustrup (about problems with the concepts that they are watching now)

The long pole gets longer - Martin Tasker (on the impact on the schedule for C ++ 0x, if you need to establish concepts)

C ++ 0x "Remove Concepts" Solution - Stroustrup on the problem of Dr. Dobbs

Trip Report: Release Concepts, Final ISO C ++ Draft in ~ 18 Months - Herb Sutter

Get Voted Off Concepts C ++ 0x Island - Jeremy Sieck Defending Current Concepts Concepts

What happened in Frankfurt? - Doug Gregor in C ++ Further (on the history and elimination of concepts).

+18
c ++ c ++ 11 c ++ - concepts
Jul 20 '09 at 19:17
source share
9 answers

Of course, this will affect other functions and seemingly standard wide open again.

Unlikely. They still want to close the standard soon, which is one of the main reasons for removing concepts. Making it “wide open” to unrelated changes will simply drop everything they have acquired using clear concepts.

Anyway .... From the remaining C ++ 0x add-ons, I can't think of anything that I would like to remove. However, I agree with their decision regarding the concepts. The Stroustrup article did highlight some serious issues. The current concept specification is admittedly simplifying error reporting in templates, but it would do so by drastically reducing the utility of general programming — the price I don't want to pay.

When I first read this article, it scared me because I assumed it was too late in the process of making major changes to the specification. It turns out that this is not so, and the committee was ready to take dramatic action.

But other than that, I think C ++ 0x is in good shape. Other new features look decent.

Of course, there are many existing functions that I would like to remove. First of all, the specialization of vector<bool> . There are other popular examples of functions that did not work (export keyword, exception specifications), but vector specialization is the only one that cannot be ignored. While we are not trying to export templates, it does not matter that the keyword exists (and is not implemented by compilers), and we can simply refrain from using exception specifications, but each time we need the bools vector, we are bitten by the dumb premature optimization that slipped into the current one standard.

Unfortunately, it looks like they refused to remove it. (The last thing I checked, it was not even out of date).

Of course, a lot of the old C-crack can also be discarded, but recently I discovered that one change that I really would like to see is the interception of the Iostreams library. Drop it and create a new STL-style I / O library based on common programming.

The current Oost library of Iostreams is ugly, slow, complex, and inflexible. There are too many voodoo involved in defining new flows, too few standard types of flows, too little flexibility (the problem that made me realize how limited the library was was that I needed to extract the float from the string., But if you needed to do this is often, you don’t want to copy the input string every time (as stringstream does) - where is the stream that works in the existing range of iterators? Or the raw array, even?)

Throw away IOstreams, develop a modern replacement, and C ++ will be greatly improved.

And maybe do something in the string class too. It works kind of ok'ish like it is now, but really, what with a huge amount of member functions? Most of them will work better and be more general, as free functions. Too much of the standard library relies specifically on the class of strings, when in principle it can work with any container or even with an iterator ( std::getline , I look at you)

+27
Jul 21 '09 at 13:29
source share

Personally, I want C ++ to finally break away from C. No more preprocessor, no more header files. I basically want D, but without all that D imposes using STL.

+10
Jul 20 '09 at 19:31
source share

No, I think the rest of the project was large - a large number of very small parts that can be correctly implemented independently, which allows suppliers to develop to full support and allows users to use the "shopping list" approach.

The situation with contracts is completely different, since they were similar to the new parallel type system and most likely would have led different compilers to complete their backward compatibility problems, very similar to CSS in web browsers.

+5
Jul 20 '09 at 19:25
source share

There are two things that, in my opinion, should be added in C ++ 0x, I thought about all of these two, and then discovered that others had suggested them before, but it looks like they won't.

1. By default, the constructors for moving and moving assignment operators

Writing a move constructor is manual and error-prone activity, if a member is added, it must be added to the move constructor, and the assignment operators and std::move must be used religiously. That is why I think that these functions should be invalid .

 movable(movable&&) = default; movable& operator=(movable&&) = default; 

Edit (2009-10-01): It looks like it will happen .

2. Override the type of deduction for expression patterns

Expression patterns often specify types that should not be used directly, an example is the return value of std::vector<bool> operator[](size_type n) , if auto or decltype are used for this type of object, unexpected behavior may occur. Therefore, the type should be able to say which type should be inferred as (or prevent the deduction using the syntax = delete ).

An example of adding a vector.

 // lazy evaluation of vector addition template<typename T, class V1, class V2> class vector_add { V1& lhs_; V2& rhs_; public: T operator[](size_t n) const { return lhs_[n] + rhs_[n]; } // If used by auto or decltype perform eager creation of vector std::vector<T> operator auto() const { if (lhs_.size() != rhs_.size()) throw std::exception("Vectors aren't same size"); std::vector<T> vec; vec.reserve(lhs_.size()); for (int i = 0; i < lhs_.size(); ++i) vec.push_back(lhs_[i] + rhs_[i]); return vec; } 
+5
Jul 21 '09 at 5:55
source share

For me, the problem is not that other functions have to be removed, but how complicated the other functions are after removing the concepts. This and how much more is required for the rest of the functions to be rephrased without concepts.

Many functions assumed that concepts would be adopted in the language, and the wording is expressed in terms of concepts. (I wonder if any proposed function depends on the concepts).

I am also interested in how other libraries will develop (I think boost :: type_traits) in order to occupy the niche left by the concepts. Some of the concepts provided can be implemented (even if it is more cumbersome) in terms of characteristics applied to type arguments.

For me, the most important thing is that the concepts added to the language were an expressive formulation of compilation errors, which is currently one of the places where C ++ is most criticized.

Rip concepts.

+3
Jul 20 '09 at 19:34
source share

Do whatever you want with concepts, but for the gods to keep streams and atoms, we absolutely need them. Perhaps add thread groups and support for aka fiber shared threads. IMO is much more important than concepts, because everyone will use / will use threads soon.

+2
Aug 17 '09 at 18:17
source share

I want to delete =delete .

There is already a common and accepted idiom in order to get the same effect (declare the function under consideration as confidential). I think this function will generate a lot of "I used =delete to remove the base class function from my derived class, but it can still be called using questions with the base class pointer.

Not to mention confusing people between (now) the two values ​​of the delete keyword.

+2
Feb 24 2018-10-24
source share

Delete the error message pages in the template code!

IIRC concepts should solve a big problem with a C ++ encoder: human readability messages for STLs. His bad news is that this issue is not being addressed.

+1
Jul 20 '09 at 19:48
source share

An unnamed function / function of a lambda function makes me nervous. Function objects are great and clear, making them easier to read and find.

On the other hand, I liked the concepts, although I certainly would not use them every day.

0
Jul 20 '09 at 19:29
source share



All Articles