|
Boost Users : |
Subject: Re: [Boost-users] Help with shared_ptr and template
From: Max (loadcom_at_[hidden])
Date: 2009-01-27 22:58:41
replace
Type<bool>::pValue a;
with
typename Type<bool>::pValue a;
?
B/Rgds
Max
Hello:
I have this problem and I do not how to fix it, I know I cannot write template typedefs, its a limitiation of the C++ syntax, right? or I'm wrong? I saw that the best way is to wrap your typedefs in a struct, which can be
templated, but I'm still stack with problems. The best way to explain it's with an example:
#include <cstdlib>
#include <iostream>
#include <boost/shared_ptr.hpp>
template< typename tvalue >
class CValue
{
public:
CValue( tvalue value ) : value_(value) {};
private:
tvalue value_;
};
template< typename tvalue >
struct Type{
typedef boost::shared_ptr< CValue< tvalue > > pValue;
};
int main(int argc, char *argv[])
{
Type<bool>::pValue a;
return EXIT_SUCCESS;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net