Hi all,
This is intended to be a discussion rather than a question; all opinions are welcome, and there is probably no best answer.
C++ is an efficient language. It's syntax is arguably simple, it's grammar especially rich and complex, and I would say that more than with other languages, writing beautiful code in C++ sadly requires a lot (a lot) of discipline, knowledge, and reflexion.
I have a very modest experience in programming, but I had the chance to play around with many different languages, each coming with it's advantages and drawbacks. C++0x comes with a lot of useful improvements (my top 3 is: smart pointers, random and regex). Still, some things keep annoying me from time to time when I have to write in C++; I am curious if I am the only one and if some of you would have solutions to share.
About dictionaries
This subject is very documented on the web.
The need is simple: How to efficiently index (linearly or not) objects of DIFFERENT types in C++?
How come there is no solution for such thing in the STL (without union or void*..)? Is the "mess-potential" too high?
About templates
Templates are very handy and save a lot of code duplication, sometimes.
However, one thing I would find natural would be a way of restricting the values that the template can take, so as to avoid mystical errors when used with a type that was not thought of at implementation time. There is a way (if you call explicit instantiation a way...) of doing something like that when exporting the compiled code in a DLL, but that's just an
ad hoc trick to me.
About decorators
Those of you who know Python know what I am talking about (
http://pythonconquerstheuniverse.wordpress.com/2012/04/29/python-decorators/). They are an easy and clean way of encapsulating a function in another one. I would really need this in C++, mostly for debugging purposes and event-based programming. Is there any way to decorate functions?
About event-based programming
Is there an easy, robust, lightweight, cross-platform way to program with events in C++ (create, trigger, listen, callback... or signal/slot like Qt)?
Thanks in advance, I'm really curious to read your answers!
John