Jump to content
  • Advertisement
Sign in to follow this  
Storyyeller

boost -> c++11 porting

This topic is 2545 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a large project I wrote a while ago which uses boost a lot. Now that some parts of Boost are part of the standard library, I'm planning to port them. Specifically, array, function, and smart pointers; I'm not sure if there are any others. Anyway, are there any differences to watch out for? Is it safe to just do a search and replace? One difference I've discovered so far is that scoped_ptr was apparently renamed to unique_ptr.

P.S. I'm using Boost 1.43. I haven't updated in a while.

Share this post


Link to post
Share on other sites
Advertisement
scoped_ptr and unique_ptr aren't the same. scoped_ptr doesn't allow transfer of ownership while unique_ptr does.

Share this post


Link to post
Share on other sites
Are you sure it is not? (As I'm not really sure it is, can't say!)


The question is not about C++11 compatibility, but rather about which aspects of Boost have been subsumed into the language since the original C++03 standard.

Share this post


Link to post
Share on other sites

The question is not about C++11 compatibility, but rather about which aspects of Boost have been subsumed into the language since the original C++03 standard.

Oh, sorry about that! Misunderstood it!
If that's the case, search the net for C++0x TR1 and TR2!

Share this post


Link to post
Share on other sites
In case anyone else is trying to something similar, here are some other differences I have found.

std:function has no clear() or empty() members. (Can be replaced by the less readable alternatives func=0 and !func respectively)
std::bind placeholders (_1, _2, etc.) are not in an unamed namespace. They are in the std::placeholders namespace instead, so you have to put an explicit qualification or using directive.
std::bind appears unable to handle the adresses of overloaded functions. You can get around this by manually casting to a function pointer of the desired type.

Share this post


Link to post
Share on other sites
boost wasn't just copy-pasted into the standard, and the concepts that were adopted may also be implemented on top of new C++11 language features. The only solid documentation of C++11 is going to be the standard itself at this point, as most compilers still don't fully support the language features.

This might also be a good reference http://herbsutter.com/2011/11/01/scott-meyerss-c11-materials-the-best-available-overview-of-c11/

Share this post


Link to post
Share on other sites

[quote name='TheUnbeliever' timestamp='1324700765' post='4897001']
The question is not about C++11 compatibility, but rather about which aspects of Boost have been subsumed into the language since the original C++03 standard.

Oh, sorry about that! Misunderstood it!
If that's the case, search the net for C++0x TR1 and TR2!
[/quote]
Not sure how tr1 and tr2 are related to the question. Tr1 was a part of C++03, and not all of it is relevant to C++11 (for example, the tr1 random number library is completely different from the C++11 and boost random number library, there are significant differences to regexes, the numerous character types are not the same, semantics differ in many places, etc).

Tr2 is still under development.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!