octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2.9.15 --> 3.0


From: David Bateman
Subject: Re: 2.9.15 --> 3.0
Date: Mon, 08 Oct 2007 22:26:27 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John W. Eaton wrote:
> On  8-Oct-2007, David Bateman wrote:
> 
> | You might want to add
> | 
> | #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL)
> | static octave_value
> | make_diag (const Matrix& v, octave_idx_type k);
> | #endif
> | 
> | etc to the patch for consistency. Though is there any C++ compiler that
> | Octave supports that needs declaration of template functions like that
> | before their use? In any case if you prefer a patch with the above
> | declarations, use the attached version instead..
> 
> OK, please check in this version.  I doubt that we use the
> CXX_NEW_FRIEND_TEMPLATE_DECL thing consistently, but I don't think the
> extra declaration can hurt, so let's leave it in for now.  We can look
> at removing this after 3.0.

Ok checked in..

> 
> Also, nice catch on the "const dim_vector" args for the constructors.

Their lack caused errors about ambiguous constructors after adding the
Array2 dim_vector constructors

> BTW, I don't see that the dim_vector args for Array2-based classes are
> checked to ensure that they are only 2D.  Should they be?  Hmm.
> Something else to look at later.

Humm, yes I suppose that should be checked.. They all go through either

Array2<T>::Array2 (const dim_vector&)

or

Array2<T>::Array2 (const dim_vectore&, const T&)

and so the test for a 2-D matrix could be isolated to just these
constructors. Something like

Array2<T>::Array2 (const dim_vector& dv)
  : Array<T> (dv)
{
  if (dv.length () != 0)
    (*current_liboctave_error_handler) ("too many dimensions");
}

Array2<T>::Array2 (const dim_vector& dv, const T& val)
  : Array<T> (dv)
{
  if (dv.length () != 0)
    (*current_liboctave_error_handler) ("too many dimensions");
  else
    Array<T>::fill (val);
}

should be all that is needed. Want to add that too?

D.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]