Help with shared_ptr and template
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
On Tue, Jan 27, 2009 at 7:24 PM, Mario Chacon
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
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; }
How can I create a shared_ptr for the template class "CVALUE"?? Please I do not know what else I can prove... :(
Your code seems to compile fine, what's the problem? Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode
AMDG Mario Chacon wrote:
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:
<snip working code>
How can I create a shared_ptr for the template class "CVALUE"?? Please I do not know what else I can prove... :(
I'm not sure what you're asking. Your code compiles for me and
the type of "a" is shared_ptr
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
Thank you for answer me, but the thing is I cannot get what I need. How can
I create an pValue object with different type??
because in my test It does not create a sharer_ptr of CVALUE specified in
bool value. Do you know what I mean??
Thank you ...
On Wed, Jan 28, 2009 at 2:20 AM, Steven Watanabe
AMDG
Max wrote:
replace
Type<bool>::pValue a;
with
typename Type<bool>::pValue a;
typename is illegal outside of templates.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Template template parameters?
template
Great !! These is it exactly what I need!!..
You rocks men!!...
Thank you for all!!...
Mario
Salu2...
On Wed, Jan 28, 2009 at 11:01 AM, Andrew Sutton
Template template parameters?
template
struct Type{ typedef boost::shared_ptr< Value<T> > pValue; }; int main(int argc, char *argv[]) { Type
::pValue a; return EXIT_SUCCESS; }
Andrew Sutton andrew.n.sutton@gmail.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
what if I want to make it as a composition class?
by example
/***************example**********/
#include "Type.h"
#include "CValue.h"
template<typename T>
class DIP //digital image processing
{
public:
DIP();
virtual ~DIP();
shared_ptr < Type );
Type cout<<"system pause"<
participants (6)
-
Andrew Sutton
-
Emil Dotchevski
-
Mario Chacon
-
Max
-
Samurai Deeper
-
Steven Watanabe