[Insight-developers] about class Vector

Xinwei Xue xwxue@cs.utah.edu
Tue, 1 Jan 2002 15:26:56 -0700 (MST)


Hi,

Thanks for the help. I found the reason that caused the error: I tried
to assigned value to the vector in a function(with 'const' at the
end) that was not supposed to change the value of class members. 

Thanks,

Xinwei

On Tue, 1 Jan 2002, Luis Ibanez wrote:

> 
> 
> Hi,
> 
> The declaration of th itk::Vector class should work fine.
> 
> You're right, you should be able to assign values to
> any component of the vector (this is inherited from
> itk::Array).
> 
> One possibility is that you're using this with a type
> (T) which is 'const', for example Vector<const char,3>
> will prevent you from assigning values to the components.
> 
> Could you please post a more complete piece of code ?
> or at least the complete error message that you get
> along with the platform in which this is being tested ?
> 
> It looks like the problem should be comming from the 
> surrounding code.
> 
> Thanks
> 
> Luis
> 
> ==============================
> 
> On Tue, 1 Jan 2002, Xinwei Xue wrote:
> 
> > 
> > Hi,
> > 
> > 
> > I declared a vector using Vector<T, VectorDimension>  and when I do the
> > following assignment, there was such error: "assignment of readonly
> > location". I though we should be  able to assign value to single vector
> > element, since it is a subclass of Array. Does anyone know the reason
> > why the error occurs?
> > 
> > Vector<T,VectorDimension> vectorF; //declared as a class member
> > 
> > vectorF[0] = somevalue;  //assigned in a member function;
> > 
> > 
> > Thanks,
> > 
> > Xinwei
> > 
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers@public.kitware.com
> > http://public.kitware.com/mailman/listinfo/insight-developers
> > 
> 
> -- 
> Luis Ibanez                                      CB#:   7060
> Research Assistan Professor                      phone: (919) 843 5436
> Division of Neurosurgery                         fax:   (919) 966 6627
> University of North Carolina at Chapel Hill      email: ibanez@cs.unc.edu
> Chapel Hill, NC 27599-7060                       http://www.cs.unc.edu/~ibanez
> 
>