473,246 Members | 1,447 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,246 software developers and data experts.

Template parse error

In a header, I have the following class template:

template<typename _ListItem>
class SimpleListItemConvert : public pqxxobject::RowConvert<_ListItem>
{
};

However, this won't compile:

$ g++ -c simplelist.cc -o simplelist.o
In file included from simplelist.h:11,
from simplelist.cc:1:
simplelist.h:127: error: `SimpleListItemConvert' is not a
template type
Why is it not a template type? Can a template class not inherit from
another template? At this point, I haven't even tried to instantiate
it.
Thanks,
Roger

--
Roger Leigh

Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
Jul 22 '05 #1
4 1605
"Roger Leigh" <${******@invalid.whinlatter.uklinux.net.invalid > wrote...
In a header, I have the following class template:

template<typename _ListItem>
class SimpleListItemConvert : public pqxxobject::RowConvert<_ListItem>
{
};

However, this won't compile:

$ g++ -c simplelist.cc -o simplelist.o
In file included from simplelist.h:11,
from simplelist.cc:1:
simplelist.h:127: error: `SimpleListItemConvert' is not a
template type
Why is it not a template type? Can a template class not inherit from
another template? At this point, I haven't even tried to instantiate
it.


(a) You're not inheriting from a template, you're inheriting from
an instantiation of a template. pqxxobject::RowConvert<_ListItem>
is a concrete class.

(b) Please read FAQ 5.8 and follow its recommendations. There is
not enough information in your post to advise anything beyond that
you probably have 'SimpleListItemConvert' forward-declared somewhere
as a class and not a template.

Victor
Jul 22 '05 #2
Roger Leigh wrote in news:87************@wrynose.whinlatter.uklinux.net :
In a header, I have the following class template:

template<typename _ListItem>
class SimpleListItemConvert : public
pqxxobject::RowConvert<_ListItem> {
};

It (Most probably) isn't your problem but identifiers like _Listitem,
i.e. that start with a _ followed by one of A-Z, are reserverd for
you implementation.
However, this won't compile:

$ g++ -c simplelist.cc -o simplelist.o
In file included from simplelist.h:11,
from simplelist.cc:1:
simplelist.h:127: error: `SimpleListItemConvert' is not a
template type

You need to tell us what pqxxobject and pqxxobject::RowConvert are.
preferably showing us declaration's.

Why is it not a template type? Can a template class not inherit from
another template? At this point, I haven't even tried to instantiate
it.


Yes thay can, example:

struct X
{
template < typename T > struct XX
{
};
};
template < typename T > struct Y : X::XX< T >
{
};

int main()
{
Y< int > yi;
}

Rob.
--
http://www.victim-prime.dsl.pipex.com/
Jul 22 '05 #3
"Victor Bazarov" <v.********@comAcast.net> writes:
"Roger Leigh" <${******@invalid.whinlatter.uklinux.net.invalid > wrote...
In a header, I have the following class template:

template<typename _ListItem>
class SimpleListItemConvert : public pqxxobject::RowConvert<_ListItem>
{
};

However, this won't compile:

$ g++ -c simplelist.cc -o simplelist.o
In file included from simplelist.h:11,
from simplelist.cc:1:
simplelist.h:127: error: `SimpleListItemConvert' is not a
template type
Why is it not a template type? Can a template class not inherit from
another template? At this point, I haven't even tried to instantiate
it.
(a) You're not inheriting from a template, you're inheriting from
an instantiation of a template. pqxxobject::RowConvert<_ListItem>
is a concrete class.


ACK.
(b) Please read FAQ 5.8 and follow its recommendations. There is
not enough information in your post to advise anything beyond that
you probably have 'SimpleListItemConvert' forward-declared somewhere
as a class and not a template.


That was 100% spot on. There was a friend class declaration in
another class--I didn't realise friend counted as forward declaration.

I'll include more detail next time.
Many thanks,
Roger

--
Roger Leigh

Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
Jul 22 '05 #4
Roger Leigh wrote:
In a header, I have the following class template:

template<typename _ListItem>
class SimpleListItemConvert : public pqxxobject::RowConvert<_ListItem>
{
};

However, this won't compile:


works for me:

class pqxxobject
{
public:

template <typename z>
struct RowConvert
{
};

};

template<typename _ListItem>
class SimpleListItemConvert : public pqxxobject::RowConvert<_ListItem>
{
};

Jul 22 '05 #5

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

Similar topics

2
by: Dave O'Hearn | last post by:
This is a stripped down example that duplicates the problem I am having. If I do it with concrete types, I can access the set's iterator type correctly. If I make a template with generic types, I...
1
by: David M Noriega | last post by:
Ok I'm no programmer but have done it in the past. I am trying to build a program from its source, its called Juk. It needs the kde bindings for GStreamer. I found them using CVS. So no I must...
0
by: Gil | last post by:
Hope this is the right group to post to. I compiled C++ code that ran fine on Windows with VisualStudio 6.0. I then moved the code to Solaris 9 and compiled with g++, but am getting the...
2
by: Nicolas GALAN | last post by:
Hello, I've a problem about templates which occurs on g++ and not with CC on Irix. g++ says : Test.cpp: In member function `void A::test()': Test.cpp:53: error: parse error before `>' token ...
7
by: Lionel B | last post by:
Greetings. The following code compiles ok and does what I'd expect it to do: ---------- START CODE ---------- // test.cpp
3
by: case2005 | last post by:
Can anyone help with the following, I don't know if it's possible, but I'm certain there must be a standard way of dealing with this. I have the following: template<typename FooBar, typename...
5
by: henkoo | last post by:
i want to explicit instantiate a member function of a class template, and got some error, can anyone give some advice to correct it? 3x complier: g++ 3.2 #include <iostream> #include...
1
by: gio | last post by:
I have a template class with a function that looks like this: template <class Key, int Value, class Tail> struct Parser<Typelist< MakePair<Key, Value>, Tail >, EmptyType> { static...
5
by: lobequadrat | last post by:
Hello, I am trying to get the following code work (unfortunately not mine ... :( ) template <class Tclass Test { public: class ELEM;
9
by: Adam Nielsen | last post by:
Hi all, I'm a bit confused about the syntax used to access a nested template class. Essentially I have a bunch of class types to represent different types of records in a database, and I want...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.