473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

C++ template metaprogramming in C#?

Joe
Hi,

I found a concept named template metaprogramming that can be used in C+
+ code at compile-time. I am a beginner at C++. But I am a programmer
on the .NET platform. Do you know if template metaprogramming is
supported in C# (.NET)? For reference I found it:
http://en.wikipedia.org/wiki/Template_metaprogramming.

Thanks to all.

Aug 27 '07 #1
9 2498
Joe wrote:
I found a concept named template metaprogramming that can be used in C+
+ code at compile-time. I am a beginner at C++. But I am a programmer
on the .NET platform. Do you know if template metaprogramming is
supported in C# (.NET)? For reference I found it:
http://en.wikipedia.org/wiki/Template_metaprogramming.
This newsgroup is only qualified to discuss C++. You'd get the best answer
for that _side_ of this question on a CSharp newsgroup.

And note that template metaprogramming is very hard, so you might also need
to consider programming time instead of execution time.

--
Phlip
http://www.oreilly.com/catalog/9780596510657/
Aug 27 '07 #2
Joe <jo************@globetrotter.netwrote in news:1188233527.113612.57460
@50g2000hsm.googlegroups.com:
Hi,

I found a concept named template metaprogramming that can be used in C+
+ code at compile-time. I am a beginner at C++. But I am a programmer
on the .NET platform. Do you know if template metaprogramming is
supported in C# (.NET)? For reference I found it:
http://en.wikipedia.org/wiki/Template_metaprogramming.

Thanks to all.
What are you asking us for? Ask in a C# newsgroup....
Aug 27 '07 #3
Joe <jo************@globetrotter.netwrote in news:1188233527.113612.57460
@50g2000hsm.googlegroups.com:
Hi,

I found a concept named template metaprogramming that can be used in C+
+ code at compile-time. I am a beginner at C++. But I am a programmer
on the .NET platform. Do you know if template metaprogramming is
supported in C# (.NET)? For reference I found it:
http://en.wikipedia.org/wiki/Template_metaprogramming.

Thanks to all.
My recollection is that the latest .NET and C# support generics and call
them templates, but it isn't quite as flexible as the C++ template
mechanism. Some consider it a good thing while others consider it a bad
thing. In any case, I doubt the experience in one will transfer all that
well to the other. Your favorite C# newsgroup will have more details of
the .NET stuff.

joe
Aug 27 '07 #4
On 2007-08-27 18:52, Joe wrote:
Hi,

I found a concept named template metaprogramming that can be used in C+
+ code at compile-time. I am a beginner at C++. But I am a programmer
on the .NET platform. Do you know if template metaprogramming is
supported in C# (.NET)? For reference I found it:
http://en.wikipedia.org/wiki/Template_metaprogramming.
C# has generics, which provide some of the functionality of templates
(however not the interesting ones IMO). There are a number of articles
comparing templates and generics, but it can be hard to understand the
difference if you don't know templates.

If you google for "generics templates compare" or something like that
you should find some articles to read.

--
Erik Wikström
Aug 27 '07 #5
Joe
Thanks to all! I will read articles about it.

Aug 27 '07 #6
Joe
For information to all of you C++ lovers:

http://blogs.msdn.com/csharpfaq/arch.../12/88913.aspx

Template metaprogramming

C++ templates are sometimes used for a technique known as template
metaprogramming. There is no way to do this in C#.

;-)

Aug 27 '07 #7
Joe wrote:
For information to all of you C++ lovers:

http://blogs.msdn.com/csharpfaq/arch.../12/88913.aspx

Template metaprogramming

C++ templates are sometimes used for a technique known as template
metaprogramming. There is no way to do this in C#.
Template metaprogramming is the standard answer to the FAQ "How do we use
C++ to crunch a lot of numbers?" That's why I answered with it. You would
use MT to write data engines, such as the innards of a Regexp system, or a
data mining engine, or a system to rotate 3D objects.

When you start a project, you cannot select your language based on asking a
newsgroup "which one is faster?" Each newsgroup will naturally declare
their own language is faster! You need to look at many other factors,
beginning with what languages you are familiar with. C++ without MT is
still faster than any C#. But the speed of C++ will not help you if you
take too long to learn the language. Depending on your project, the speed
of C# might do fine.

Next, you need to look at what libraries and tools are available, and how
close they come to your project. You need to audition these, and determine
if a solution for your problem is already available, off the shelf.

--
Phlip
http://www.oreilly.com/catalog/9780596510657/
Aug 27 '07 #8
iu2
On Aug 27, 6:52 pm, Joe <jonathanpou...@globetrotter.netwrote:
Hi,

I found a concept named template metaprogramming that can be used in C+
+ code at compile-time. I am a beginner at C++. But I am a programmer
on the .NET platform. Do you know if template metaprogramming is
supported in C# (.NET)? For reference I found it:http://en.wikipedia.org/wiki/Template_metaprogramming.

Thanks to all.
In case you would like to know, metaprogramming is an essential and a
very powerful capability of other programming languages, most notably
Lisp (although it is not called 'metaprogramming' but simply, macros).

Aug 27 '07 #9
Joe
Thanks Philip, I'll look for these factors.

Aug 27 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dave | last post by:
For those who might be so inclined, I was wondering if I might get honest critiques of my first real venture into template metaprogramming. This template metaprogram sorts a list of integers at...
12
by: Dave | last post by:
Would people agree with the statement that to a large degree, using template metaprogramming techniques turns a C++ compiler into a C++ interpreter (but just for the metaprogrammed portions of the...
5
by: Mohammad | last post by:
Hi, Is it possible to disable a method of a template class depending on the typename at compile time? thanks!
21
by: Protoman | last post by:
I've been looking at template metaprogramming. It seems really cool, make the compiler do most of the work. I have very simple program that uses TMP,it calculates the square of a number, but it...
5
by: Mark Stijnman | last post by:
I am trying to teach myself template metaprogramming and I have been trying to create lists of related types. I am however stuck when I want to make a template that gives me the last type in a...
7
by: Joe | last post by:
Hi, I found a concept named template metaprogramming that can be used in C+ + code at compile-time. I am a beginner at C++. But I am a programmer on the .NET platform. Do you know if template...
1
by: Ted | last post by:
I have cross posted this to comp.lang.c++ and to sci.math.num- analysis in the belief that the topic is of interest to some in both groups. I am building my toolkit, in support of my efforts in...
5
by: iapx86 | last post by:
My parser project calls for a computed goto (see code below). The C preprocessor delivers the desired result, but is ugly. Template metaprogramming delivers results I do not understand. Can...
3
by: stdlib99 | last post by:
Hi, I have a simple question regarding templates and meta programming. I am going to try and work my way through the C++ Template Metaprogramming, a book by David Abrahams and Aleksey...
12
by: nooneinparticular314159 | last post by:
Hello. If I declare the following: template<int a, int b, int SomeArray> class DoSomething{ public: .. .. ..
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.