Answer the question
In order to leave comments, you need to log in
How to get started with Boost, C++11?
I would like to start using the new standard to the fullest, but since it is now working under Windows, at 10 studios (and it is not known when I will switch to a new one) + the new standard borrowed a lot of things from Boost + Boost is a large and serious library + all the cool guys who contributed not a small share to the development of C ++, they advise you to get acquainted with Boost - in general, I think it’s not bad to start “seriously” using the same Boost.
All I had to deal with until today was Smart Pointers (to some extent) and Program_options .
So - what is the essence of the question:
how, without going to extremes (for example, replacing everyone new/delete
withboost::shared_ptr, unique_ptr
etc. - “wow, I use / know Boost”) to start a little bit into all this huge Boost and C ++ 11? Of course, I can look at the list of tasks that need to be done and the list of Boost features - choose the library I need, use it, and that's it. But! I would like to understand the foundations on which this is all built, how it works, why this, and not that, etc. What does "understand" mean to me? Well, for example, why, when “it is possible” - is it better to use boost/std::make_shared
instead of shared_ptr<T> ptr(new T(...))
? Because, in this case, optimization takes place - instead of 2 memory allocations (actually, for the object and for the counter), only one occurs ... This is all good - if you google, they write like that everywhere, explaining the reason, but I need to "before my own eyes" see this: debugger, it is really seen that in the case ofshared_ptr
one piece of memory is allocated for both the counter and the object T, and then, using the allocating new, the object is initialized. And it immediately becomes clear where the "lack" comes from make_shared
- i.e. the inability to use a user-defined functor to delete an object is because another functor is used, which simply calls the destructor directly, as follows from the use of allocating new.
In general, “roughly” the essence of the question: how to use (start using) Boost / new features of the new standard, having an idea about the implementation of the features used? How did you start learning C++11, for example?
Thank you.
Answer the question
In order to leave comments, you need to log in
Boost and C++11 are different topics. As for C ++ 11, I advise you to look at the Modern C ++ course on Pluralsight, in general, there are a lot of materials on the Internet. From what I highlighted: range-based for, the auto keyword, smart pointers are already by the way in std:: (so boost is not needed for this), initializer expressions are also cool, especially when combined with non-standard language extensions like __declspec(property) .
About Boost: look at this course , read the docks. This is a huge set of libraries, choose what you need. For example, I like serialization, boost::optional, I also use signals2 in some cases. Depends on tasks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question