Playing With Template Meta-Programming Part 1

Published November 27, 2006
Advertisement
Seeing as how I've sortof decided to move my blog off site, at least until GDNet blogs actually are feature complete, I'll only post partial topics to this blog, and link to my external blog. Feel free to comment here or on the site.

I've recently started playing around with a mock implementation of the Technical Report on C++ Library Extensions (draft link). First off, I should note that its very difficult to implement these libraries properly. The standard makes many changes to the adopted boost libraries, both by enhancing functionality and by clarifying their properties and behaviors. One of the really interesting parts of implementing this standard is detecting the various conditions that need to be met by the reference_wrapper class. I will be discussing those conditions, and the methods that I have used to implement them. Mind you, implementing the TR1 standard is not an easy thing, and it requires a great deal of work on the part of compiler vendors to provide methods to determine object classifications at runtime, along with various other pieces of data that aren't typically available to template meta-programmers.

If you are interested, you can read more here.
Previous Entry Some thoughts...
0 likes 8 comments

Comments

mldaalder
Interesting, though I don't suppose I can persuade you to add an rss/atom feed?

I'd like to follow it more, but I already have 10 other sites to remember (that don't have rss feeds), but on the other hand, I have more than 30 rss/atom feeds that I follow more.
November 28, 2006 02:34 AM
Muhammad Haggag
Arr, an update at last! Glad to see you're still alive and kicking. Any plans to add RSS feeds to scapecode? If not, are you going to post links to your posts here anyway? (Cause I'm subscribed to this journal, so it'd be OK then)
November 28, 2006 08:16 AM
Muhammad Haggag
I tried to post this comment over there, but I got a runtime error (i.e. an ASP.NET exception, although of course no details were exposed):

Great post! I never knew that sizeof could be used like that.
Hopefully the next installment comes in the duration of this lifetime? You have a bad habit of suddenly disappearing :)

By the way, any specific reason you prefer the "typedef struct {...} name" syntax over the "struct name { ... }" one?
(in reference to:
typedef struct {
char t[2];
} two;
)
November 28, 2006 08:40 AM
Washu
I actually don't prefer it, however it does tend to make that piece of code more understandable for some people.
November 28, 2006 09:27 AM
Rebooted
I'm fairly sure template metaprogramming is turing complete.

edit: see here
November 28, 2006 10:06 AM
Daerax
Posting doesnt work.

Quote:Original post by Rebooted
I'm fairly sure template metaprogramming is turing complete.

edit: see here


Hey, you can't say "is", you can only say "there is good reason to believe" :p. They only sketched a physicist type proof and admit that it is unlikely that a full one is furnishable due to ambiguities of the language in the area of template instantiation/its too boring to check otherwiwse.
November 28, 2006 12:12 PM
Rebooted
It seems that way [smile]. However, I think it is the general consensus that the C++ type system is turing complete.
November 28, 2006 02:16 PM
Washu
In the absence of a rigorous proof, one cannot say that it is turing complete! All things considered though, the practical limitations of compilers makes writing anything turing based in a meta-programming way impossible.
November 28, 2006 04:47 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement