Jump to content
  • Advertisement
  • entries
  • comments
  • views

Playing With Template Meta-Programming Part 1

Sign in to follow this  


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.
Sign in to follow this  


Recommended Comments

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.

Share this comment

Link to comment
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)

Share this comment

Link to comment
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;

Share this comment

Link to comment
I actually don't prefer it, however it does tend to make that piece of code more understandable for some people.

Share this comment

Link to comment
Posting doesnt work.

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.

Share this comment

Link to comment
It seems that way [smile]. However, I think it is the general consensus that the C++ type system is turing complete.

Share this comment

Link to comment
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.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!