C++ School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C++ Expert!

Join 308,424 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 3,261 people online right now. Registration is fast and FREE... Join Now!




What do you think of Boost and TMP?

 

What do you think of Boost and TMP?, Template Meta-Programming

NickDMax

6 Jun, 2009 - 06:44 AM
Post #1

Can grep dead trees!
Group Icon

Joined: 18 Feb, 2007
Posts: 5,306



Thanked: 296 times
Dream Kudos: 1175
Expert In: Java/C++

My Contributions
So I was working on my prime array initializer when I ran into a run away recursion. The logic seemed pretty good to me so I searched the net for meta programming debugging techniques. I didn't find any but I did find a bunch of complaints about the error messages that tend to be the result of TMP.

Boost was singled out as particularly awful. Adding Boost libraries can significantly increase compile times and significantly obfuscate error messages coming from the compiler. Boost uses a great deal of template meta programming which generates code at compile time -- which means that errors can occur anywhere within the generated code and can be particularly difficult to troubleshoot.

So what are your thoughts on Boost and its heavy reliance upon meta-programming?

User is online!Profile CardPM
+Quote Post


Pwn

RE: What Do You Think Of Boost And TMP?

7 Jun, 2009 - 07:01 AM
Post #2

D.I.C Regular
***

Joined: 25 Nov, 2007
Posts: 373



Thanked: 13 times
My Contributions
Since nobody else is replying, I'll pipe in. I have only just recently download the Boost library, and haven't had a chance to do anything with it, since I'm learning API GUI programming. I wanted to learn the API before diving into Boost. Boost seems like it's got some good features.

As far as meta-programming...huh? Speak english lol
User is offlineProfile CardPM
+Quote Post

NickDMax

RE: What Do You Think Of Boost And TMP?

7 Jun, 2009 - 02:47 PM
Post #3

Can grep dead trees!
Group Icon

Joined: 18 Feb, 2007
Posts: 5,306



Thanked: 296 times
Dream Kudos: 1175
Expert In: Java/C++

My Contributions
Well I am particularly intrigued by Boost -- at the moment Xpressive which is a Regex library that can build the regular expressions at compile time.

Although from what I am getting on the internet Xpressive is actually slower than other regular expression libraries (even though you would think that with so much work being done at compile time it would be faster -- in fact some people have written that very thought -- but the evidence seems to be to the contrary).

But when you make a simple syntax error in an Xpressive expression you get a terribly long complicated error that is not very helpful in helping you discover what you did wrong.
User is online!Profile CardPM
+Quote Post

JackOfAllTrades

RE: What Do You Think Of Boost And TMP?

23 Jun, 2009 - 05:43 AM
Post #4

I exist to Google your problems.
Group Icon

Joined: 23 Aug, 2008
Posts: 5,430



Thanked: 459 times
Dream Kudos: 50
Expert In: Being annoyed with lazy people.

My Contributions
Boost has some really nice libraries. In fact, I'd venture to guess they're all very good. However, the program options, regex, and filesystem libraries are the extent of my use, and they came in very handy.
User is online!Profile CardPM
+Quote Post

perfectly.insane

RE: What Do You Think Of Boost And TMP?

29 Jun, 2009 - 02:31 PM
Post #5

D.I.C Addict
Group Icon

Joined: 22 Mar, 2008
Posts: 635



Thanked: 63 times
Dream Kudos: 25
Expert In: C/C++

My Contributions
QUOTE(NickDMax @ 7 Jun, 2009 - 05:47 PM) *

Although from what I am getting on the internet Xpressive is actually slower than other regular expression libraries (even though you would think that with so much work being done at compile time it would be faster -- in fact some people have written that very thought -- but the evidence seems to be to the contrary).


In many situations where regex use is heavy, evaluation needs to happen far more times than compilation, so if the evaluation is slower in Boost.Xpressive (which could be due to compromised compilation quality due by not having a full programming language), the end result is likely to be similar.

I find that if one sticks to using the Boost libraries in a similar manner to the examples provided in the documentation, the libraries are usable with little difficulty. If one goes outside of this, then problems tend to occur, especially regarding using non 8-bit character types. While boost.regex does work with 16-bit types, it does not actually understand UTF-16. I was unable to get boost.iostreams to work with wide characters, and the source code for boost.iostreams is very unreadable.

It's amazing what some of the boost libraries do (boost.lambda is another interesting one), but I think that there are many practical issues that need to be addressed. Some of the libraries are more like research projects than production libraries, while others are very useful and down to earth (like boost.regex and the smart pointers). In the event that someone really needs compile-time regex compilation, it could probably be better solved with an additional tool than directly with the template language. But then again, boost.xpressive is relatively new, so it will be interesting to see where it goes.

User is offlineProfile CardPM
+Quote Post

NickDMax

RE: What Do You Think Of Boost And TMP?

29 Jun, 2009 - 07:53 PM
Post #6

Can grep dead trees!
Group Icon

Joined: 18 Feb, 2007
Posts: 5,306



Thanked: 296 times
Dream Kudos: 1175
Expert In: Java/C++

My Contributions
QUOTE
Some of the libraries are more like research projects than production libraries, while others are very useful and down to earth (like boost.regex and the smart pointers).
There is definitely some interesting things going on. I have been taking a close look at some of the libraries and while some are WAY over my head at this point I have managed to pull quite a bit down to my level and digest. For example the preprocessor libraries are incredibly interesting -- along with little things like the FOR_EACH macro which is quite a neat little bit of hacking.
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/24/09 01:35PM

Live C++ Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month