* gcc3.0: how to use template's?
@ 2001-08-03 6:43 Bruno.Voigt
2001-08-03 12:23 ` Alexandre Oliva
0 siblings, 1 reply; 2+ messages in thread
From: Bruno.Voigt @ 2001-08-03 6:43 UTC (permalink / raw)
To: gcc-help
Hi,
I get the following error, when I try to compile the following taglib.cpp
via g++ -c taglib.cpp
In file included from taglib.cpp:1:
taglib.h: In function `const std::string gucky::tag::const_singleTag(const
T&,
const std::string&)':
taglib.h:18: parse error before `it'
The same .cpp compiles and works just fine using MSVC6SP5
and SUN Forte C++ v6.1.
Thanky for advice,
Bruno
----
taglib.cpp:
#include "taglib.h"
----
taglib.h:
#ifndef TAGLIB_H
#define TAGLIB_H
#include <string>
#include <map>
namespace gucky {
namespace tag {
/** const_singleTag queries the given container for the given tagname
* and returns the value of the first found element.
* If several elements with the same tagname exists it is undefined which element is selected.
* @param t container to query
* @param tagname to query
* @returns the value of the element selected by given tagname or "" if tagname not present
*/
template<class T> inline const std::string const_singleTag(const T&t, const std::string& tagname)
{
const T::const_iterator it = t.find(tagname);
if (it != t.end())
return it->second;
return "";
}
}
}
#endif /* TAGLIB_H */
--
Bruno.Voigt@ic3s.de # IC3S AG # Tel. +49.4106.655.105 # Fax. +49.4109.555.550
http://www.ic3s.de # Mobile +49.700.686.00.686
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-08-03 12:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-03 6:43 gcc3.0: how to use template's? Bruno.Voigt
2001-08-03 12:23 ` Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).