|
What are the coolest examples of metaprogramming that you've seen in C++?
What are some practical uses of metaprogramming that you've seen in C++?
Started by Brian R. Bondy on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Coolest metaprogramming example: tricking the compiler into computing a list of prime numbers.
|
|
I have just started to learn Ruby and got a good take on the basics. I keep hearing that one of the cool things that Ruby does very well is metaprogramming, but none of the tutorials I've read cover this. Searching Google I can only seem to find paid ...
Answer Snippets (Read the full thread at stackoverflow):
Here is a nice overview: http://ola-bini.blogspot.com/2006/09/ruby-metaprogramming-techniques.html
Here is a good introduction for ruby metaprogramming: http://practicalruby.blogspot.com/2007/02/ruby-metaprogramming-introduction.....
|
|
Is Template Metaprogramming faster than the equivalent C code ? ( I'm talking about the runtime performance) :)
Started by n00ki3 on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
Template metaprogramming....
Template metaprogramming can be used to easily in the foot with.
The answer is it depends.
Template Metaprogramming (TMP) is 'run' at compile time, so it's not really comparing apples, then there's no runtime cost at all.
|
Ask your Facebook Friends
|
Static metaprogramming (aka "template metaprogramming") is a great C++ technique that allows the execution of programs at compile-time. A light bulb went off in my head as soon as I read this canonical metaprogramming example:
#include <iostream>...
Started by jwfearn on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
Andrei Alexandrescu's Modern C++ Design far are chapter 10, "Static Metaprogramming in C++" from Generative Programming, Methods, Tools mixes a bit of metaprogramming....
Also take a look at the companion library Loki.
metaprogramming.
|
|
Will I learn anything in Metaprogramming Ruby that is not covered in any of: Programming Ruby , The Ruby Cookbook , The Ruby Programming Language or The Ruby Way , all of which have at least a chapter's material covering metaprogramming in Ruby?
It also...
Started by Pinochle on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
A book about metaprogramming should be a book about when to not metaprogram; it's one of the most_method_and_rdoc.html )
Metaprogramming can make sense, but it can also mess up your code strongly biased when it comes to Metaprogramming....
|
|
I am a fan of static metaprogramming in C++ . I know Java now has generics. Does this mean that static metaprogramming (i.e., compile-time program execution) is possible in Java? If so, can anyone recommend any good resources where one can learn more ...
Started by jwfearn on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
That doesn't work if the language doesn't support metaprogramming well; other answers have observed that Java....
/2008/08/13/type-safe-builder-pattern-in-java/
Most people insist on trying to metaprogram from inside their favorite language.
|
|
I want to be able to create an array of calculated values (let's say for simplicity's sake that I want each value to be the square of it's index) at compile time using template metaprogramming. Is this possible? How does each location in the array get...
Answer Snippets (Read the full thread at stackoverflow):
Part of the algorithm used a large lookup table, which ended up looking like:
template < can use the results in the ....
The books "Modern C++ Design" (TMP basics) and "C++ Template Metaprogramming" (mainly MPL explained metaprogramming.
|
|
I was reading an article on TheServerSide on ployglot programming on the Java platform . Some comments in the article refer to metaprogramming as the ability to generate code (perhaps on the fly).
Is metaprogramming the ability to generate code on the...
Started by Parag on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
For example, many people use C++ templates to do metaprogramming ....
Metaprogramming is the writing of computer programs that write or manipulate other programs to do runtime modifications for something to qualify as metaprogramming.
|
|
Hi folks ...
i have a problem .. i don't understand Template Metaprogramming.
The Problem is : i read a lot . But it does not make much sense to me :/
Fact nr.1 : Template Metaprogramming is faster
template <int N> struct Factorial { enum { value...
Started by n00ki3 on
, 12 posts
by 12 people.
Answer Snippets (Read the full thread at stackoverflow):
It's just chooses what code to generate, conditionally.....
Books on real-world uses of C++ template metaprogramming; and describes many problems which C++-functional languages, neither is it a realistic example of template metaprogramming.
|
|
I discovered template metaprogramming more than 5 years ago and got a huge kick out of reading Modern C++ Design but I never found an opertunity to use it in real life.
Have you ever used this technique in real code?
Contributors to Boost need not apply...
Started by Motti on
, 11 posts
by 11 people.
Answer Snippets (Read the full thread at stackoverflow):
Most programmers who use template....
Template metaprogramming and expression templates are becoming Yang.
I once used template metaprogramming of data types and still be efficient.
Guess that's a fairly rare occasion, though...
At my company.
|