Title
[dec.tr] Trivially simplifying decimal classes.
Status
trdec
Section
[trdec.types]
Submitter
Martin Sebor

Created on 2006-05-28.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change "3.2.2 Class decimal32" as follows:

      namespace std {
      namespace decimal {
        class decimal32 {
          public:
            // 3.2.2.1 construct/copy/destroy:
            decimal32();
            decimal32(const decimal32 & d32);
            decimal32 & operator=(const decimal32 & d32);
            ~decimal32();
            /* ... */

Change "3.2.2.1 construct/copy/destroy" as follows:

        decimal32();

    Effects: Constructs an object of type decimal32 with the value 0;

        decimal32(const decimal32 & d32);
        decimal32 & operator=(const decimal32 & d32);

    Effects: Copies an object of type decimal32.

        ~decimal32();

    Effects: Destroys an object of type decimal32.

Change "3.2.3 Class decimal64" as follows:

      namespace std {
      namespace decimal {
        class decimal64 {
          public:
            // 3.2.3.1 construct/copy/destroy:
            decimal64();
            decimal64(const decimal64 & d64);
            decimal64 & operator=(const decimal64 & d64);
            ~decimal64();
            /* ... */

Change "3.2.3.1 construct/copy/destroy" as follows:

        decimal64();

    Effects: Constructs an object of type decimal64 with the value 0;

        decimal64(const decimal64 & d64);
        decimal64 & operator=(const decimal64 & d64);

    Effects: Copies an object of type decimal64.

        ~decimal64();

    Effects: Destroys an object of type decimal64.

Change "3.2.4 Class decimal128" as follows:

      namespace std {
      namespace decimal {
        class decimal128 {
          public:
            // 3.2.4.1 construct/copy/destroy:
            decimal128();
            decimal128(const decimal128 & d128);
            decimal128 & operator=(const decimal128 & d128);
            ~decimal128();
            /* ... */

Change "3.2.4.1 construct/copy/destroy" as follows:

        decimal128();

    Effects: Constructs an object of type decimal128 with the value 0;

        decimal128(const decimal128 & d128);
        decimal128 & operator=(const decimal128 & d128);

    Effects: Copies an object of type decimal128.

        ~decimal128();

    Effects: Destroys an object of type decimal128.

Date: 2006-05-28.00:00:00

In c++std-lib-17198, Martin writes:

Each of the three classes proposed in the paper (decimal32, decimal64, and decimal128) explicitly declares and specifies the semantics of its copy constructor, copy assignment operator, and destructor. Since the semantics of all three functions are identical to the trivial versions implicitly generated by the compiler in the absence of any declarations it is safe to drop them from the spec. This change would make the proposed classes consistent with other similar classes already in the standard (e.g., std::complex).

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3191
2006-05-28 00:00:00admincreate