ClassView and templates 
Author Message
 ClassView and templates

Hi,

I am working on a windows app. in VC6.0. I cannot seem to add a template
because the add class menu optoin only gives me one type (general class).

Solution: Emmediately after creating the class I change the code so that it
is a template.

Problem:When I do this, I can not longer navigate to the code. VC complains
and cannot find the implementation.

Question:How can I create templates and navigate through them just as I
would a general user class?

Much obliged,

Yougo.



Sun, 14 Oct 2001 03:00:00 GMT  
 ClassView and templates

Hi

Unlike function templates, when instantiating a class template, you must
explicitly instantiate the class by giving the arguments for the class
templates. To create an instance of TempClass:

TempClass< float, 6 > test1;       // OK
TempClass< char, items++ > test2;  // Error, second parameter
                                   // must be constant.

No code is generated for a templated class (or function) until it is
instantiated. Moreover, member functions are instantiated only if they are
called. This can cause problems if you are building a library with templates
for other users. .

A class template is first specialized and then instantiated by the compiler.
The compiler does not instantiate the class template until a reference to a
member of this template class is made.

The Visual C++ compiler, in version 5.0 and later, now supports new syntax
for explicit specialization of class templates. For example:

template<class T> class X {...};

file://Explicit specialization of X with 'int'
//
template<> class X<int> { };

The following form of old syntax is also supported:

file://Explicit specialization of X with 'char'
//
class X<char> { };

--

Kindly get back to me for more help and let me know whether it helped.

regards
Vinod Shanbhag

www.e-supportpoint.com

Quote:
> Hi,

> I am working on a windows app. in VC6.0. I cannot seem to add a template
> because the add class menu optoin only gives me one type (general class).

> Solution: Emmediately after creating the class I change the code so that
it
> is a template.

> Problem:When I do this, I can not longer navigate to the code. VC
complains
> and cannot find the implementation.

> Question:How can I create templates and navigate through them just as I
> would a general user class?

> Much obliged,

> Yougo.



Tue, 11 Dec 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Class templates in ClassView

2. VC 7.1 final beta: bug with template template parameters

3. VC7 does NOT support template-template parameters involving non-type parameters

4. template template parameter with default value (VS.NET 2003)

5. C++ compiler bug: template and non template function overload resolution

6. Possible bug with template template parameters in VC++ 7.0

7. template-template params default values - std::deque

8. Bug in inheritance from template template parameters in VC7

9. Problem with template templates in VC++ 7

10. Creating from Templates not in Templates folder in Excel 2000

11. template class with a template member function

12. Template function within Template Class

 

 
Powered by phpBB® Forum Software