I'm going to send you an improved version.
Printable View
I'm going to send you an improved version.
I am participating. I emailed you my submission, sangdrax.Quote:
Please post in this thread if you're participating!
Question to the rest of you who have successfully completed the task: what compiler are you using? I cannot compile with Borland5.5, and the value works in a static array in MSVC++v6 only with a particular change to the struct.
I used VC++ 2003 .NET
I used the IDE for VC++.NET but I've updated the compiler with the free download for VC++.NET 2003.
The other compilers before that choke on most template stuff.
Other template stuff I have done in the past has been on Codewarrior or MingW
Take a peek over here - http://cboard.cprogramming.com/showthread.php?t=56548. That's a free VC++ compiler that can handle templates pretty well
Thanks for the link Fordy. Unfortunately I can't give it a go here at work because XP is the min OS. Sounds promising, though.
I'm on 2K and works for me
Submitted an entry.
Not to split hairs, but yeah, that's what I meant. XP is the min OS for the "toolkit" and at work I've a mere 98 box...Quote:
Originally Posted by Fordy
1# First I don't get this:If I do something trivial likeCode:char data[ SquareRoot<16>::v ];
I still get compiler errors, like:Code:template<int x> const int SquareRoot<x>::v = 2;
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2133: 'data' : unknown size
The template is decided at compile time... Why not the static variable?
Are you able to compile this?
If not, try the link Fordy provided and download a better compiler.Code:template <int n>
struct Test
{
static const int v = n;
};
char data[ Test<16>::v ];
I haven't received anything.Quote:
Originally Posted by pianorain
I had the same problem and had to resort to change v to an enumerated type (using MSVC6).
I used both the .NET compiler and my MSVC++6 compiler.. both gave me the same result...Quote:
Originally Posted by Sang-drax
[edit]
worked fine now.. probably distraction of mine :D :D :D
Solution sent and it works perfectly! :D
OK, I've lost every contest entry I've receieved so far.
The reason is this:
http://cboard.cprogramming.com/showthread.php?t=57298
Preliminary, this contest is closed for more submissions.
I'm unable to recive and judge more entries (I have no compiler). I know who is the winner though. If it's OK with you, I'll announce the winner and every contestant can post the submission they used.
I've seen your updated submission xErath, but not compiled it. I'm not going to use it when I judge the competition, sorry. :(
Wow that's nasty! You must be gutted...
I'm OK with this, but I'll have to post mine tomorrow as I'm in work now and I'm not home tonight