Useful features to learn in boost for immediate use [closed] - c++

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I know this could be seen as subjective off-the-cuff (thus a poor question), but bear with me.
Boost has recently become available on the project on which I'm working, and I don't have much experience with it. Boost has so many parts and features that it's hard to know where to get started in learning it - especially since I'll be trying to learn it while making production code.
So, I would greatly appreciate it if someone could list around 3 to 5 features which are very useful in general, every-day programming and state why they're useful. I'm not asking you which is best, or trying to get a debate - I just want to know some good features to start learning and using immediately. I don't need code samples either, I'll be more than happy to research how to use the features myself after I know which ones are sensible to start learning now.
I'll accept any answer with a concise list of features that are sensible :)

format and lexical_cast are great for string manipulation, I find them invaluable. I use them every day.
bind is great for ad hoc functors, you'll find it is reused throughout many of the boost libraries.
multi_index fills the gap of when you need the same data in two search structures at once, it is very handy at times. Keep it out of your headers though.
type_traits defines useful traits for template specializations.
signals is a signal/slot mechanism implementation, great for event driven designs.

shared_pointer is critical. It lets you automatically handle memory usage.
http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/shared_ptr.htm

Related

Why C++ can't be made as Python in terms of convenience [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
This question may seem to be naive.
But I think it'll be much worse if I don't ask it at all.
When a discussion begins about the features of Python that the developers love the most, they usually mention list comprehension, syntax relying on indentation (thus avoiding brackets, etc.) and some other.
At such moments I ask myself a question why there can't be made a language based on C++ but having a syntax like in Python and having all the features like list comprehensions, generators.
I understand that such a language won't have all the features that Python has, e.g. eval or exac statements (because they rely on Python being an interpreting language), may be some others that I don't know of.
But I also know that there is a project called Shedskin which makes a C code of a Python code (with some restrictions on what can be used in Python code).
So, are there some real reasons why it's impossible to create such a language that will combine all the best features of Python and a very fast code that produces C++? Or it's just the turn of events that Python for some reasons became very popular and it turned out to be interpreted, so a lot of people use it for its greatest features still discontent at the speed of the code, and some of them struggle to create something (like Shedskin or Psyco) to speed it up?
Google as created a language called Golang ( or Go). It is a compiled language with python like syntaxe. There are alot of video and documenttation that will answer your question there.

Should one use built in classes? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I've started programming C++ and I want to start programming useful stuff.
I know that for strings, one can use std::string or char-arrays. One can also use std::vectors as well, instead of arrays.
What should one do? Reinvent the wheel, or use the built in utilities?
The point of the question is to find out what people actually do. Do people use the STL a lot or do people use char[] instead of std::string?
Reinventing the wheel can be good as a training assignment, but If you want to write useful stuff - of course use the standard library ("the built in utilities").
The standard library (as well as boost, and other libraries) is validated and optimized, and it will let you write the useful stuff much easier, so you can focus on your logic instead of reinventing the wheel.
Always use standard libraries (STLs, Boost, etc) unless there is a reason for doing otherwise (e.g STL not available on platform). These libraries are time tested for both correctness and performance
If your goal is to program useful and stable software, use the standard libraries.
If your goal is to explore a specific topic, such as strings, then reinvent the string class and learn from your mistakes.
Usse the built in utilities. They are optimized and will ensure that your code is fully portable!
Note that you should use them skillfully: vectors can be rendered WAY faster if you reserve space before using them, etc.

Dependency Injection framework for C++ [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there a DI framework comparable to Google Guice? And what does Google use?
There is nothing as mature or standard as Guice in the C++ world. However, some people have put together simplistic implementations on their own. Here's a couple.
http://adam.younglogic.com/2008/07/dependency-injection-in-c/ (source for implementation is at the end of the post)
http://sourceforge.net/projects/qtioccontainer/ (requires Qt)
http://code.google.com/p/autumnframework/ (hasn't been touched since 2007)
http://programmaticallyspeaking.blogspot.com/2010/04/beautiful-dependency-injection-in-c.html (more of a description, really)
http://sourceforge.net/projects/cpp-resolver/ ("Alpha" quality)
You're unlikely to be satisfied by any of these.
If you really wanted to put in the effort to rally the world around a DI framework for C++, probably the way to go about it would be to make a proposal to the Boost guys.
I'm the author of wallaroo. It's actively developed and has the following features:
it's lightweight but powerful
its interface supports both C++11 and C++98 with boost
it's type safe
it doesn't need custom preprocessors / code generators
you can load classes defined in shared libraries
you can use a DSL syntax for object creation and wiring or
you can get object creation and wiring by parsing one or more xml / json file.
Any comment, suggestion or request are welcome.
There is a recent one that looks very interesting called Hypodermic, i haven't tested it but it looks pretty active
I am currently authoring one called sauce, whose design (and name) is directly inspired by guice. I still consider it alpha, but you may find it useful.

What to do with students after templates were explained? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm having a C++ seminar in 30 minutes :-)
Because I incorporated most of the examples I usually do on the seminar into the lecture I don't have anything to do with my students. I just gave them a broad overview of templates (from basics to advanced topics).
Any tips what to do?
It can be something that I will explain (step-by-step), or something they will have to code.
Replicate containers - like a list or a vector.
How about trying to implement templates that mirror or are similar to those currently in the STL?
It will give them practice in developing them.
You can challenge them with a "can-be-a-real-system"... and ask them what possible best-practices...
Once you've delivered the basics of templates, point them in the direction of the standard template library and have them get their head around using std::list, std::vector etc to store arrays of objects and iterate through them.
It's easier to implement your own template code, once you understand their advantages. So using the STL should be their next step.
After that, point them at boost ;)
If you haven't yet covered the STL, you could introduce them to that. It is a good example of why templates are extremely useful.
You could also introduce them to iterators using this approach. IMO, learning the STL is one of the most useful things you can learn in C++ :-)

which one to choose for future , c++ or python2.x/3.x [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
since last four years i had been coding in c/c++, but those lenthy programs made me sick of them.
then i got to know about python, and i have learned the basics.
python seams to be more flexible and powerful than c++...
But i want to know is python realy better than c++?
if yes/no in what ways , please explain.
since i am a student , practicing which language would fetch me better job?
Python is completely different than C/C++, so it's hard to compare. Python lets you write clear, concise programs and very quickly develop software at the price of performance. It lets you be very productive and in many cases program performance is less concern, than programmer performance.
There are many existing programs for python 2.*, so it's better to stick for now with it. It would be fairly easy to move to 3.* later on.
It all depends on your needs, Python isn't replacing C/C++ in the embedded space anytime soon, and not too many web frameworks are going to be based on C/C++.
Python is neither better nor worse, or neither more or less flexible or powerful than C++. it's just aimed at a different set of problems.
I would rather students start at something like C++ so they have a better understanding of things like pointers & memory management. It's not really objects all the way down.