Summary:
C++0x is under construction. Get your licks in while there's still time.
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: January 1, 2009 6:55 AM by
|
C++0x is under construction. Get your licks in while there's still time. http://www.artima.com/cppsource/wishlist.html
|
|
|
I don't know if I read the wish list well but I didn't see anny mentioning of the following in the requests for enhancements to the STL:
-- Smart pointer objects (See Josuttis' book or look at the boost library cases)
-- HASH containers... come on this one is a must!
And also, can someone appoint some people that actually program in C++ to that commision. That would make a difference as most practical issues are usually ignored in order to get some theoretical perfection that is never reached.
|
|
|
Actually, the two items you mention are very high in the list. The Boost smart pointers are the basis for what is now being discussed for C++0x. Also, a hash table proposal is being reviewed, so, you're in good company!
|
|
|
>11. Extended type information (as much runtime type information as possible for a compiled language)
I guess this would cover introspection (by applying this extended type information to instances).
I would add to this: arbitrary user-created meta data for all constructs. I know this isn't an easy one, but getting something anywhere towards this ideal would be really great.
It's a feature that helps make introspection really useful. For example, when pushing introspection to do persistence, GUI editing, report making, etc. Arbitrary meta data lets you mark up the classes/fields with all sorts of things like a description, or a read-only marker, or marking things as primary state vs derived state, or setting policies for GUI editing (like to say that this Vector2 is a position in the space defined by _that_ transform).
I'm a die hard C++ programmer, but after working with C# for a bit, I found myself wishing C++ could do this. I know it's not fashionable for C++ to add features that "C++ replacement languages" have, but let's just say we are inspired by lisp or something...
|
|
|
I like templates and use them frequently and the most libraries are based on them too, but what I miss is the possibility to define templates with an unknown number of parameters. The BOOST tuple class or signal/slot classes or many others use copy & paste (or the preprocessor) and they are all limited to a fixed maximal count of parameters (e.g. 3 or 5 or 10).
It would be nice, if C++ could itself construct templates with any number of parameters (as '...' in printf()).
extensions to C++:
- '...' in templates - '##' is the number of '...' parameters (N) - '#' iterates over all the parameters (1 - N)
examples:
template<class A, ...> class X { typedef # arg#_type;
X(A a, ...) { } };
template<class T, ...> f(const T& t, ...) { g(t, ...); }
template<typename F, typename T, ...> class result_of<F(...)> { static F f; static # t#;
public: typedef typeof(f(...)) type; };
template <...> struct group { # a#; group(...) : a#(#...) {} };
template <class Ch, class Tr, ...> inline BOOST_IO_STD basic_ostream<Ch, Tr>& operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os, const group<...>& x) { os << x.a#; return os; }
I know this is hard work for compiler vendors but this would replace many copy & paste code and fewer use of the preprocessor.
I would also appreciate, if the header guards (with "#ifdef") could be replaced by another command (e.g. "#pragma once" like some (but not all) vendors do - I know that this is another pp-command, but easier to use).
|
|
|
I would hop for templated typedefs as a means to alias template names. THis greatly would faciliate metaprogramming and would also make C++ more consitent.
|
|
|
1. "Controlled virtuality" - like in C# or (even better) C++/CLI. Right now, if you declare a function virtual in a parent class, virtuality will automatically be inherited even if it is not really needed. For instance:
struct IMyInterface { virtual void fun() = 0; };
struct MyImplementation { void fun(); // this one is also virtual };
In order not to break existing code, maybe it would be a good idea to add a keyword that would "stop" a function from being virtual:
struct MyImplementation { nonvirtual void fun(); // this one is not virtual };
2. XML API. I agree we need a good XML API. However, I would strongly suggest to avoid DOM which is non-efficient and not "C++ friendly". Some cursor-based model would be much better, IMHO.
|
|
|
Of course, I meant:
struct MyImplementation : IMyInterface { void fun(); // this one is also virtual };
|
|
|
How about templated namespaces?
|
|
|
> How about templated namespaces?
Could you elaborate on that?
|
|
|
> > How about templated namespaces? > > Could you elaborate on that?
I'm not entirely sure I can. By that I mean that I can't foresee all of the side-effects it might have, or weird and possibly uncouth ways in which such a thing might be used.
I do seem to remember at leat a few projects which involved creating numerous templated classes where it seemed every template was using the same information. Rather than specifying that information for each object I used, and thus potentially screwing it up in numerous places, it would have saved a fair amount of time if I had been able to apply that template to the namespace I had wrapped all of those classes in.
|
|
|
> Rather than specifying that information for each object I > I used, and thus potentially screwing it up in numerous > places, it would have saved a fair amount of time if I had > been able to apply that template to the namespace I had > wrapped all of those classes in. Hmmm. Given that a namespace can be re-opened in several source files, this would place a bit of a burden on other people populating that NS. I don't see it would save you much. template< typename T >
namespace X
{
class Z
{
};
}
using X< int >::Z;
How do you get an object of type Z? Z< int > z;
//or
Z z;
You lose ease of understanding for ease of typing.
|
|
|
I would like some language/library support for an automatic way to use polymorphism without needing to expose pointers/memory management to the application program. I have developed ways to do this, based on the Coplien "envelope/letter" idiom, but more convenient and flexible. From my experience, I'm pretty sure that many other C++ developers could benefit greatly from support for such a feature, as it is far from obvious how to implement it unless you have seen it before.
|
|
|
No need to be bashful. Can you give us a taste of what you're referring to?
|
|
|
What about synchronized keyword to synchronize the whole method (like Java)? This will ensure that programmers do not forget to unlock a semaphore when they return from a middle of a function.
|
|