C++ checked scalar copying of special values
For Checked_Number<T, Policy> with an underlying native integer, mpz_class, mpq_class or configured supported native floating type, a source shall contain an infinity or quiet NaN admitted by its policy. Same-type copy construction and copy assignment shall preserve that special value's class and an infinity's sign. They shall require no rounding default, numerical conversion or policy result handler and shall not invoke a handler. Same-object copy assignment shall preserve the value. Both same-object and distinct-object assignment shall return a reference to the destination; a distinct source shall remain unchanged.
Each copied object shall own independently mutable storage. Replacing or destroying the source shall not change or invalidate a copy, and replacing one copy shall not change any other object. A live assignment destination may initially hold a finite or admitted special value. Construction and assignment shall retain normal C++ member/resource cleanup. Available resources shall suffice for underlying scalar copying. Finite copying shall retain 🔗 1. Finite checked scalar storage and copying.
The valid special representations and finite-reuse prerequisites shall follow 🔗 1. Typed special-marker assignment to native integer storage, 🔗 2. Typed special-marker assignment to GMP integer and rational storage or 🔗 4. Typed special-value assignment to native floating-point storage according to storage. Ordinary GMP numerical operations shall not be applied to copied PPL special representations. Native floating NaN payload/sign selection shall not be prescribed, and a signaling NaN shall not be admitted. Source/destination access overlapping mutation shall be synchronized. Calls shall require no library initialization, coefficient-constant stage or FPU setup and shall preserve hardware direction. Native floating exception/status conditions shall follow 🔗 4. Typed special-value assignment to native floating-point storage; unavailable formats shall not be instantiated.
Same-type copying preserves an owned numerical value without converting it or rerunning a policy handler, including for supported special states.
Public header: <ppl.hh>; members of the admitted Parma_Polyhedra_Library::Checked_Number<T, Policy>:
Checked_Number(const Checked_Number& source); Checked_Number& operator=(const Checked_Number& source);
For each storage family and special-admission policy, copy each admitted infinity/NaN, exercise self-assignment and every finite/special destination state, and require returned destination identity and unchanged sources. Replace and destroy sources, mutate independent copies and verify retained special values. Use large prior GMP allocations, handler traps and policies without rounding defaults. Check configured floating formats and every hardware direction without initialization.
src/Checked_Number_defs.hh; src/Checked_Number_inlines.hh; src/checked_inlines.hh; src/checked_mpz_inlines.hh; src/checked_mpq_inlines.hh; src/checked_int_inlines.hh; src/checked_float_inlines.hh; tests/checkedspecialcopyspec1.cc.