Convert VisualC++ template to gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
trying to get some code converted from Visual C++ 6 to gcc. 
I've got pretty far, but as a C++ newbie I'm little bit lost with templates.

It would be very nice if somebody could help me to get this working (with 
explanation please so I can learn).
A possibility would also be to convert this template to a normal function 
(if it would help to get this working)

Here is the template (table.h):
#ifndef _TABLE_H
#define _TABLE_H

#include <string>
#include <vector>

using namespace std;

template <class T>
class table: public vector<T>
{
public:
	T operator[] (const string& key);
};


template <class T>
T table<T>::operator[] (const string& key)
{
	for (reverse_iterator i = rbegin(); i != rend(); i++)
		if (*i)
			if ((*i)->name ^ key)
				return (T)((**i)());
	throw out_of_range("no elements matching key");
}

  
#endif

Thanks in advance 
efgee
-- 
View this message in context: http://www.nabble.com/Convert-VisualC%2B%2B-template-to-gcc-tf4563603.html#a13025103
Sent from the gcc - Help mailing list archive at Nabble.com.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux