Boost logo

Boost Users :

From: Ronald Garcia (garcia_at_[hidden])
Date: 2005-06-14 16:28:25


Use static_cast, rather than const_cast.

Cheers,
ron

On Jun 13, 2005, at 11:14 AM, Yan Zhang wrote:

> Hi Ron,
>  
> How do you “cast "other" to the multi_array type” here? I used
>  
>       Array (const Array& other) : boost::multi_array<double,2>(
> const_cast<const boost::multi_array<double,2>& > other)
>       {
>       }
>  
> And it failed to compile.
>  
> Thank for your help,
>  
> Yan
>  
>
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Ronald
> Garcia
> Sent: Monday, June 13, 2005 7:54 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] How to inherit from boost::multi_array
>  
>
> Greetings Yan,
>  
>
> I do not recall the context of the problem you describe below, but It
> appears that the definition:
>  
>
> Array (const Array& other) :
>
> boost::multi_array<double, 2> (other)
>
> {}
>  
>
> is the problem. the above expression will call the templated
> constructor. I believe that the solution here is to cast "other" to
> the multi_array type. That should result in the proper constructor
> call.
>  
>
> HTH,
>
> ron
>
>  
>
> On Jun 6, 2005, at 12:09 PM, Yan Zhang wrote:
>  
>
> I’m read the posting by Thomas and replay by Ronald on how to inherit
> from boost::multi_array as following:  On Oct 2, 2004, at 10:26 AM,
> Thomas Mensch wrote: Dear List, I am using boost 1.31.0 on Linux (with
> gcc 3.3.2)I would like to create a 2D array class, which inherits 
> fromboost::multi_array<double, 2> class. However I have problemswith
> the copy constructor of my class Array.  Below is the code,which I am
> trying to run.  
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users



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