Author: Allen Lake
Date: 00:50:39 12/24/02
Go up one level in this thread
On December 23, 2002 at 16:20:48, Sune Fischer wrote: >Hi, I need some help. > >In order to simplify my code, I am making a small utility class (or library if >you will). > >I want to do Swap, Max, Sort and all that the smart way, no macros! >For this I think a template class would be a good idea, with static functions >cause I don't have any "util" objects, so it's just a namespace container. > >So far it's not quite compiling, I get this message in MSVC6.0 >"error C2955: 'CUtil' : use of class template requires template argument list" > >what does that mean? I did just as the book said! :) (except my function is >static) > >Different question, even more serious. >How tha' heck do I inline functions in C++? > >I want these Swap and Max to be inlined, I haven't figured out how to do that in >C++. The only way to inline is to write the whole function inside the header >file in the class, why is that? Isn't there a way to just have the prototype in >the class, and have the inlined function written in the cpp file? >What good is cpp files then, seems I only ever need headers??? > >So far I've lost 15% speed in writing from C to C++, the main problem is this >inlining issue, it's a real speed killer. > >Suggestions? > >-S. I think that this error indicates that, somewhere in either your code or possibly in the Visual C++ library code, an instance of CUtil is being declared with a statement such as: CUtil utils; rather than CUtil<int> util; A simple example is found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/C2955.asp If you can't find a declaration like this in your code, then it's probably buried in one of the Visual C++ libraries. You could then change the name of your utility class to something like FrenzeeUtil and solve the problem.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.