Changeset 523 for trunk/ADOL-C/include


Ignore:
Timestamp:
Jul 8, 2014 4:55:40 AM (5 years ago)
Author:
kulshres
Message:

make the usage of adub constructors extremely clear

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/include/adolc/adouble.h

    r515 r523  
    250250    friend ADOLC_DLL_EXPORT class adubref;
    251251    friend ADOLC_DLL_EXPORT adub* adubp_from_adub(const adub&);
    252     adub( adub const &) {}
    253 protected:
    254     adub( locint lo ):badouble(lo) {};
    255     adub( void ):badouble(0) {
     252    adub( adub const &) {
     253        isInit = false;
     254        fprintf(DIAG_OUT,"ADOL-C error: illegal copy construction of adub"
     255                " variable\n          ... adub objects must never be copied\n");
     256        throw logic_error("illegal constructor call, errorcode=-2");
     257    }
     258    adub( void ) {
     259        isInit = false;
    256260        fprintf(DIAG_OUT,"ADOL-C error: illegal default construction of adub"
    257261                " variable\n");
    258262        throw logic_error("illegal constructor call, errorcode=-2");
    259     };
    260     explicit adub( double ):badouble(0) {
     263    }
     264    explicit adub( double ) {
     265        isInit = false;
    261266        fprintf(DIAG_OUT,"ADOL-C error: illegal  construction of adub variable"
    262267                " from double\n");
    263268        throw logic_error("illegal constructor call, errorcode=-2");
    264     };
     269    }
     270protected:
     271   /* this is the only logically legal constructor, which can be called by
     272    * friend classes and functions
     273    */
     274   adub( locint lo ) : badouble(lo) {}
    265275
    266276public:
Note: See TracChangeset for help on using the changeset viewer.