O
Olaf
Hi,
I'm writing a small wrapper for libcurl. For Options I use:
template<typename T, long CURLOPT_ID>
class CurlOption: boost::noncopyable
{
public:
typedef typename boost::call_traits<T>:
aram_type param_type;
typedef typename boost::call_traits<T>::reference reference;
typedef typename boost::call_traits<T>::const_reference
const_reference;
typedef T value_type;
typedef typename boost::call_traits<T>::value_type
result_type;
public:
CurlOption() {}
CurlOption(param_type v) : m_value(v) {}
long option() const { return CURLOPT_ID; }
result_type parameter() { return m_value; }
reference get() { return m_value; }
const_reference get() const { return m_value; }
private:
value_type m_value;
};
and than typedef
class CurlOpt {
typedef CurlOption<bool, CURLOPT_VERBOSE> Verbose;
...
};
and further more:
class EasyCurl : boost::noncopyable {
public:
template<typename T, long ID>
void setopt(const CurlOption<T, ID>& opt); //L351
};
and partially specialize the member function
template<long ID>
inline
void EasyCurl::setopt(const CurlOption<bool, ID>& opt) { //L389
curl_easy_setopt(m_curl, opt.option(), opt.value() ? 1 : 0);
}
The try to compile results in the error:
EasyCurl.hpp:389: Fehler: Prototyp für »void
pEDA::EasyCurl::setopt(const pEDA::CurlOption<bool, ID>&)« passt zu
nichts in Klasse »pEDA::EasyCurl«
EasyCurl.hpp:351: Fehler: Kandidat ist: template<class T, long int ID>
void pEDA::EasyCurl::setopt(const pEDA::CurlOption<T, ID>&)
EasyCurl.hpp:389: Fehler: Template-Definition eines Nicht-Templates
»void pEDA::EasyCurl::setopt(const pEDA::CurlOption<bool, ID>&)«
I'm wrong, obviously. How can I get it work?
Thanks,
Olaf
I'm writing a small wrapper for libcurl. For Options I use:
template<typename T, long CURLOPT_ID>
class CurlOption: boost::noncopyable
{
public:
typedef typename boost::call_traits<T>:
typedef typename boost::call_traits<T>::reference reference;
typedef typename boost::call_traits<T>::const_reference
const_reference;
typedef T value_type;
typedef typename boost::call_traits<T>::value_type
result_type;
public:
CurlOption() {}
CurlOption(param_type v) : m_value(v) {}
long option() const { return CURLOPT_ID; }
result_type parameter() { return m_value; }
reference get() { return m_value; }
const_reference get() const { return m_value; }
private:
value_type m_value;
};
and than typedef
class CurlOpt {
typedef CurlOption<bool, CURLOPT_VERBOSE> Verbose;
...
};
and further more:
class EasyCurl : boost::noncopyable {
public:
template<typename T, long ID>
void setopt(const CurlOption<T, ID>& opt); //L351
};
and partially specialize the member function
template<long ID>
inline
void EasyCurl::setopt(const CurlOption<bool, ID>& opt) { //L389
curl_easy_setopt(m_curl, opt.option(), opt.value() ? 1 : 0);
}
The try to compile results in the error:
EasyCurl.hpp:389: Fehler: Prototyp für »void
pEDA::EasyCurl::setopt(const pEDA::CurlOption<bool, ID>&)« passt zu
nichts in Klasse »pEDA::EasyCurl«
EasyCurl.hpp:351: Fehler: Kandidat ist: template<class T, long int ID>
void pEDA::EasyCurl::setopt(const pEDA::CurlOption<T, ID>&)
EasyCurl.hpp:389: Fehler: Template-Definition eines Nicht-Templates
»void pEDA::EasyCurl::setopt(const pEDA::CurlOption<bool, ID>&)«
I'm wrong, obviously. How can I get it work?
Thanks,
Olaf