Article View: gnu.g++.help
Article #112Non function templates
From: Mark Stubley
Date: Tue, 11 Aug 1992 10:29
Date: Tue, 11 Aug 1992 10:29
79 lines
2339 bytes
2339 bytes
The following code produces this error message from g++2.2 :-
Operations.cc:5 Sorry,not implemented: non-function templates not yet supported.
Could anyone tell me if the code is syntactically correct and if it is,
is there any fix or work around for the problem. I don't really
want to have to define instances of the Operations class.
-- Header File Operations.hh
// -*- C++ -*-
#ifndef _Operations_hh
#define _Operations_hh
#include "MyString.hh"
#include "PobjId.hh"
#include <builtin.h>
template <class T>
class Operations
{
public :
static int EQ (T& key, T& tab);
static int LE (T& key, T& tab);
static int CMP (T& key, T& tab);
static unsigned int (*HASH) (T&);
};
template <class PobjId>
class Operations
{
public :
static int EQ (PobjId& key, PobjId& tab);
static int LE (PobjId& key, PobjId& tab);
static int CMP (PobjId& key, PobjId& tab);
static unsigned int (*HASH)(PobjId&);
};
template <class String>
class Operations
{
public :
static int EQ (String& key, String& tab);
static int LE (String& key, String& tab);
static int CMP (String& key, String& tab);
static unsigned int (*HASH) (const char *);
};
#endif
-- Source File Operations.cc
// -*- C++ -*-
#include "Operations.hh"
template <class T> unsigned int (Operations<T>::*HASH)(int&) = multiplicativehash; // line 5
template <class PobjId> unsigned int (Operations<T>::*HASH)(PobjId&) = PobjId::hash;
template <class String> unsigned int (Operations<T>::*HASH)(PobjId&) = hashpjw;
.
.
.
. Source continues .....
Thanks in advance for any help you can provide
Mark
--
===========================================================================
Mark A. Stubley (mas@fulcrum.bt.co.uk)
===========================================================================
Fulcrum communications L.T.D., Fordrough Lane, Birmingham, B9 5LD, ENGLAND.
Technical Details
Message-ID:
<MAS.92Aug11102912@vlad-vladikoff.fulcrum.bt.co.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!fulcrum!masShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!fulcrum!mas From: mas@fulcrum.bt.co.uk (Mark Stubley) Newsgroups: gnu.g++.help,comp.lang.c++ Subject: Non function templates Message-ID: <MAS.92Aug11102912@vlad-vladikoff.fulcrum.bt.co.uk> Date: 11 Aug 92 10:29:12 GMT Sender: news@fulcrum.bt.co.uk Organization: Fulcrum Communications Ltd., Birmingham, England Lines: 79