Brandon_6 0 Newbie Poster

You cannot determine whether a ctor is being called on an object that is to become const. Such as:

const Foo bar( another_foo ); // no way to determine in the ctor that bar will be const

I'd like some sort of function attribute for copy constructors to determine if *this is being constructed as const. Particularly for clases that share pointers to resources. A const ctor would make perfect sense if it were feasible to be implemented into the standard in this way.

we shouldn't have to create whole new classes for this kind of functionality, such as with iterator and const_iterator. C++ should be sophisticated enough to not have to prepending "const_" to a whole new class instead of making use of the real actual 'const' qualifier. That just feels incredibly hackish.

Is there no other way? Are there any propsed features for C++17 or anything? Are we forever doomed to write nearly unintelligible templatized code or flagrant D.R.Y. violations for such basic things like spcializing how constructors do their jobs for the sake of const-correctness?