Page 1 of 1

Deprecate FixLength

PostPosted: Thu Jul 07, 2016 4:57 pm
by victorshoup
I would like to ask for some feedback from NTL users.
Going forward, I am thinking that I may want to deprecate the the FixLength
and FixAtCurrentLength methods in the Vec class.
These methods would be made private and would be available
only to the corresponding matrix class.
This is the only place that these are currently used in NTL
(to ensure that matrices are rectangular), and my guess is
that they are not used at all by NTL users.

The reason I want to do this is rather esoteric.
At some point in the future, I want to start incorporating C++11 "move semantics" in NTL.
Ideally, move constructor and assignment should be "noexcept" -- this allows for
certain optimizations that the STL exploits. Unfortunately, a number of NTL classes
will never have noexcept-moves (because of special memory management and the
"fixlength" feature). It's complicated...but suffice it to say many design decisions
in NTL were made long before noexcept-moves were ever even imagined.
However, I do envision that such noexcept-moves can be enabled in special cases by
some means... .this is still in the design phase, but to have any hope,
I have to restrict the usage of the "fixlength" feature.
For example, if one really wanted to have an STL vector of ZZ's, and one wanted
the ZZ's in the vector to be noexcept-moveable, then one might declare the
vector as vector< Moveable<ZZ> > ...where a Moveable<ZZ> is a (subclass of) ZZ
that supports noexcept-moves.

So assuming I don't hear any great objections, I will document these methods as
deprecated in the next release, and then actually make them private some time later.
I'm in no rush...nothing will really change for probably a year or so.