Jump to content

  • Log In with Google      Sign In   
  • Create Account


How much of Boost do you use?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
21 replies to this topic

#1 AaronWizardstar   Members   -  Reputation: 244

Like
1Likes
Like

Posted 28 April 2013 - 09:56 AM

I needed a certain kind of library and saw one of Boost's libraries recommended over and over, so I've began installing Boost.
 
Having Boost has led me to thinking about all the other libraries in Boost I could be using. Like replacing all my maps with unordered_maps and replacing all my iterator-based for lines with foreach. It's a bit overwhelming since Boost introduces so many attractive features, but I have to learn its libraries first and also figure out where they fit into my existing code.
 
"Boostifying" a project would probably be impractical if it has a deadline or is made by a team, so I'm asking more from the perspective of an individual hobbyist developer.
 
So to all of those whose projects depend on Boost, how much of its libraries do you actually use?


Sponsor:

#2 SimonForsman   Crossbones+   -  Reputation: 5805

Like
4Likes
Like

Posted 28 April 2013 - 12:01 PM

quite alot of the stuff found in boost is available in C++11 so i don't use boost at all.

Both foreach loops(or range based for loops rather) and unordered maps are part of the standard now.

look at std::unordered_map

foreach loops are written as:

std::vector<int> somevector;

for(int x: somevector) {
dostuffwithxhere;
}
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#3 Servant of the Lord   Crossbones+   -  Reputation: 17262

Like
0Likes
Like

Posted 28 April 2013 - 12:31 PM

I'm still using boost smart pointers, but it's on my todo to replace them with the C++11 ones.

Also, one part of my code uses boost::hash, but I plan to replace that with std::hash.

I've moved away from boost's assert as well, since I have my own assert code.

 

Other than that, I'm still using boost::filesystem, and recently needed to (unfortunately) add boost::any.


It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

[Fly with me on Twitter] [Google+] [My broken website]

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                       [Need free cloud storage? I personally like DropBox]

Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal


#4 swiftcoder   Senior Moderators   -  Reputation: 9645

Like
2Likes
Like

Posted 28 April 2013 - 12:33 PM

Since a number of the common parts of boost hade it into TR1 and C++11, I use it a lot less.

 

Still, I'm using boost::filesystem a fair bit, and boost::spirit for a number of complex parsing tasks.


Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#5 AllEightUp   Moderators   -  Reputation: 4123

Like
0Likes
Like

Posted 28 April 2013 - 12:36 PM

Boost has some nice items which I have used in the past but many of them have been moved to C++11 as Simon mentions above.  For a game I generally try to avoid external dependencies as much as possible but things like:  Boost serialization, ASIO and filesystem are pretty tempting when you need something to get a job done.  Of course there are other standalone libraries which can be used instead, some of them are preferable in some ways also.  It is really all a case of what you need, what your environment is like etc.  Some examples:

 

ASIO- far beyond networking, I've used it to write daemonized multicore event driven data processing systems that were freaky scary but thanks to the ASIO framework it was just a matter of plugging in some custom event sources and then the processing code.

 

Serialization- well, I prefer a stand alone library I found but when you are in a hurry and can't sit down to write a custom serialization system it is a good enough stand in.

 

Filesystem- easy enough to replace, but time consuming.  I wish this had made it to C++11 but it didn't, so do it yourself of use Boost.

 

Most of the other libraries are more special case and in many ways not really that useful.  Exceptions such as context and others exist but are specialized to certain needs, signals(2) is something nice looking but for UI I use QT and would be unlikely to use signals in a game engine as I generally refer immediate mode UI's instead of retained.

 

Anyway, it is dependent on your needs at any given time if Boost is justified.



#6 KaiserJohan   Members   -  Reputation: 1038

Like
0Likes
Like

Posted 28 April 2013 - 02:19 PM

Im not running C++11 so theres a few libraries Im using ontop of my head and loving:

 

Serialization: I use this for loading/saving my custom asset files. Extremely easy to serialize/deserialize nested structs of data, and amazingly supports all the stl containers. The only downside is that it is NOT a header-only lib sad.png

 

Foreach: simple and I love the syntax. Awesome.

 

Bind/function: I use this for registering user callbacks for my input module. 

 

Hash: I have scenes, nodes, meshes, etc reffered by name and I match them by the hashed names


Edited by KaiserJohan, 28 April 2013 - 02:20 PM.


#7 AaronWizardstar   Members   -  Reputation: 244

Like
0Likes
Like

Posted 28 April 2013 - 04:08 PM

I guess C++11 would have the greatest impact on how much of Boost I'd use.

 

I'm not running C++11 myself. At least, I don't think I'm running C++11 (using Mac OS X 10.6.8, Xcode 3.2.6, gcc 4.2.1). Given that I want to eventually support Windows, Mac, and maybe iOS, is C++11 supported in enough compilers to be used for production code?

 

I'm specifically getting Boost for signals(2) which I'll need for my UI code and for certain other things that need to generate events. For example, I want to be able to attach events to specific frames of animation objects. I'll probably also start using unordered_map since I have a lot of things I keep in maps and refer to by string IDs, and I don't need the sorting.



#8 swiftcoder   Senior Moderators   -  Reputation: 9645

Like
1Likes
Like

Posted 28 April 2013 - 04:13 PM

At least, I don't think I'm running C++11 (using Mac OS X 10.6.8, Xcode 3.2.6, gcc 4.2.1).

You have C++11 available. I don't believe it is enabled by default, though.

 

 

Given that I want to eventually support Windows, Mac, and maybe iOS, is C++11 supported in enough compilers to be used for production code?

Large parts of it, yes.

 

Mac, Linux and iOS have pretty solid support. Microsoft is a little more shaky, but gradually getting there (and you can use a recent version of GCC via MinGW instead).


Edited by swiftcoder, 28 April 2013 - 04:14 PM.

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#9 AllEightUp   Moderators   -  Reputation: 4123

Like
0Likes
Like

Posted 28 April 2013 - 05:45 PM

At least, I don't think I'm running C++11 (using Mac OS X 10.6.8, Xcode 3.2.6, gcc 4.2.1).

You have C++11 available. I don't believe it is enabled by default, though.

 

I spent a while in the CMake articles making sure it is enabled, by default it is not.  As a note though, I'd be curious why you have not updated to the newer Xcode?  The transition to Clang is quite worth it, faster compiles usually and usually considerably better code generation.



#10 Servant of the Lord   Crossbones+   -  Reputation: 17262

Like
0Likes
Like

Posted 28 April 2013 - 05:47 PM


At least, I don't think I'm running C++11 (using Mac OS X 10.6.8, Xcode 3.2.6, gcc 4.2.1).

You have C++11 available. I don't believe it is enabled by default, though.


GCC 4.2.1 is pretty old, isn't it? It seems most C++11 features began in gcc 4.3, and only really started getting the cool features around 4.5.
 
No, it's not enabled by default. You'd have to pass -std=c++0x to the compiler. Once you get to version 4.6 or so, you pass -std=c++11 instead.
 

Given that I want to eventually support Windows, Mac, and maybe iOS, is C++11 supported in enough compilers to be used for production code

Yep. GCC (and MinGW on Windows) implements the vast majority of the C++11 features, and most of the new standard library as well. I've only ran into one part of the C++11 standard library that wasn't available yet (the regex library) but even that might've been added in recent versions.

It's stable and supported well in Max, Linux, and Windows. I don't know about iOS.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

[Fly with me on Twitter] [Google+] [My broken website]

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                       [Need free cloud storage? I personally like DropBox]

Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal


#11 swiftcoder   Senior Moderators   -  Reputation: 9645

Like
0Likes
Like

Posted 28 April 2013 - 06:29 PM

GCC 4.2.1 is pretty old, isn't it? It seems most C++11 features began in gcc 4.3, and only really started getting the cool features around 4.5.

Right you are - I didn't look at the version. If you upgrade XCode (and/or OS X itself) you should have C++11.

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#12 AaronWizardstar   Members   -  Reputation: 244

Like
0Likes
Like

Posted 28 April 2013 - 06:43 PM

I was under the impression that the latest version of Xcode (4?) only worked on Lion. I'm still on Snow Leopard and I'm not in a position to upgrade right now. I'll see if I can upgrade Xcode itself (I just grab it off App Store, right?).

 

Update

Upgrading Xcode on my current machine is no go. I get "Xcode can't be installed on Macintosh HD because Mac OS X version 10.7.4 or later is required" when I click the "Free" button on Xcode's App Store page.


Edited by AaronWizardstar, 28 April 2013 - 06:45 PM.


#13 AllEightUp   Moderators   -  Reputation: 4123

Like
0Likes
Like

Posted 28 April 2013 - 07:45 PM

I was under the impression that the latest version of Xcode (4?) only worked on Lion. I'm still on Snow Leopard and I'm not in a position to upgrade right now. I'll see if I can upgrade Xcode itself (I just grab it off App Store, right?).

 

Update

Upgrading Xcode on my current machine is no go. I get "Xcode can't be installed on Macintosh HD because Mac OS X version 10.7.4 or later is required" when I click the "Free" button on Xcode's App Store page.

Yup, that rather stinks. The upgraded compiler is quite worth it but if you can't use it, nothing to do for that.  That old of a GCC, you probably don't have much C++11 available so Boost may be your best bet.



#14 swiftcoder   Senior Moderators   -  Reputation: 9645

Like
0Likes
Like

Posted 28 April 2013 - 09:48 PM

Upgrading Xcode on my current machine is no go. I get "Xcode can't be installed on Macintosh HD because Mac OS X version 10.7.4 or later is required" when I click the "Free" button on Xcode's App Store page.

While that is correct, it isn't the entire story.

Apple did produce XCode 4.2 for Snow Leopard, and if you can find a late-edition 10.6.8 install disk, it contains a valid Snow Leopard installer for XCode 4.2. Unfortunately, in an effort to force Snow Leopard users to upgrade, they only offer the download for Lion and Mountain Lion.

(though, in all fairness, the OS upgrade is only $30)


Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#15 AllEightUp   Moderators   -  Reputation: 4123

Like
0Likes
Like

Posted 28 April 2013 - 10:07 PM

(though, in all fairness, the OS upgrade is only $30)

Unless of course your machine doesn't include a 64bit capable BIOS, or whatever OsX calls it.  This pissed me off a lot unfortunately, my older mac pro desktop and a laptop can not run ML due to being "too old".  Even though the CPU's are fully 64bit compatible, a small bit is 32bit only and as such ML is off limits. :(  The laptop wasn't a big issue as the space bar doesn't work so well and I love the air as my replacement, the desktop pissed me off a lot though as it was a big expensive dual box with reasonably new CPU's, just because of one piece though, no ML allowed.



#16 Chad Smith   Members   -  Reputation: 1041

Like
0Likes
Like

Posted 28 April 2013 - 11:28 PM

(though, in all fairness, the OS upgrade is only $30)

Unless of course your machine doesn't include a 64bit capable BIOS, or whatever OsX calls it.  This pissed me off a lot unfortunately, my older mac pro desktop and a laptop can not run ML due to being "too old".  Even though the CPU's are fully 64bit compatible, a small bit is 32bit only and as such ML is off limits. sad.png  The laptop wasn't a big issue as the space bar doesn't work so well and I love the air as my replacement, the desktop pissed me off a lot though as it was a big expensive dual box with reasonably new CPU's, just because of one piece though, no ML allowed.

I don't know what exactly you have or what this guide covers (I haven't read all of it), but maybe this guide/forum topic will help you: http://forums.macrumors.com/showthread.php?t=1325709



#17 David Perfors   Members   -  Reputation: 222

Like
0Likes
Like

Posted 29 April 2013 - 04:34 AM

At the moment I only use FileSystem, just because it is so easy to use on multiple platforms. Other parts of Boost I did not yet look at. (neither to the new c++11 features...)



#18 Katie   Members   -  Reputation: 1285

Like
0Likes
Like

Posted 29 April 2013 - 08:49 AM

shared_ptr, foreach, filesystem... when I arrived here at $WORKPLACE and discovered bind and function are banned because they make C++ 'too functional', I couldn't write compileable code for weeks... how do people do anything without bind??

 

 

Looked at spirit. Very quickly looked away...



#19 Bearhugger   Members   -  Reputation: 531

Like
0Likes
Like

Posted 29 April 2013 - 10:00 AM

I don't use boost at all actually. It's not that I'm avoiding it, I have the entire library downloaded and compiled, and I regularily look at what boost can do for me when I have a problem, but so far I simply haven't found a use for it. I also already have a large code base that does not use it; for a new project I'd probably use it more.

 

A few reason I'm not using it:

 

I was interested in boost's testing framework for a while, but there is one that's fully integrated into Visual Studio 2012 and Microsoft is at work to improve support for tests as much as possible, so I passed on boost::test.

 

I wanted to use boost::format because I thought it had better support for thousand separators (in the std library it's absurdly complicated, you have to swap locales for this to work) but later, the documentation says that %' support is not guaranteed. The design is kind of cool though, I might change my mind on that one.

 

I rarely use smart pointers, and when I do, the ones of the standard library are enough for me.

 

Boost uses a lot of templates. I love templates as much as they do, but right now I'm writing a DLL library, and templated types in exported class declarations can cause some issues when linked to code compiled with different compilers (exceptions have the same problem although). I want my library to support multiple compilers, so it's going to be a problem for me if I start using boost types as class attributes or in structs.



#20 Schrompf   Prime Members   -  Reputation: 950

Like
0Likes
Like

Posted 29 April 2013 - 11:00 AM

My Boost usage list is:

 

filesystem, bind, signals2, format, any, lexical_cast. 

 

Especially boost::signals2 is worth praising in my opinion. It's great to use signals to make decoupled systems talk to each other on occasion. You surely don't want to connect/disconnect thousands of times per frame, but calling through it is pretty fast.

 

Previously on boost, now deprecated due to C++11:

 

scoped_ptr, shared_ptr, unordered_map, random

 

I'm going to remove any at some point in the future, though, because I want an implementation of any that does not allocate for small types.


----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS