Changeset 3061


Ignore:
Timestamp:
Dec 27, 2013 6:50:30 PM (6 years ago)
Author:
bradbell
Message:

Provide implicit constructor as a deprecated option for backward compability.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/run_cmake.sh

    r2897 r3061  
    8181#
    8282# simple options
     83cmake_args="$cmake_args -D cppad_implicit_ctor_from_any_type=NO"
    8384cmake_args="$cmake_args -D cppad_documentation=YES"
    8485cmake_args="$cmake_args -D cppad_sparse_list=YES"
  • trunk/cppad/CMakeLists.txt

    r2769 r3061  
    2525# command line arguments
    2626#
    27 #
    2827# cppad_testvector
    2928command_line_arg(cppad_testvector cppad STRING
     
    4948"type used to identify variables on one tape, size must be <= sizeof(size_t)"
    5049)
     50#
     51# cppad_implicit_ctor_from_any_type
     52command_line_arg(cppad_implicit_ctor_from_any_type NO BOOL
     53        "implicit (instead of explicit) conversion from any type to AD<Base>"
     54)
     55# -----------------------------------------------------------------------------
     56# cppad_explicit_ctor
     57IF( cppad_implicit_ctor_from_any_type )
     58        SET(cppad_implicit_ctor 1)
     59ELSE( cppad_implicit_ctor_from_any_type )
     60        SET(cppad_implicit_ctor 0)
     61ENDIF( cppad_implicit_ctor_from_any_type )
    5162# -----------------------------------------------------------------------------
    5263# cppad_internal_sparse_set
  • trunk/cppad/configure.hpp.in

    r2939 r3061  
    6060*/
    6161# define CPPAD_INTERNAL_SPARSE_SET @cppad_internal_sparse_set@
     62
     63/*!
     64\def CPPAD_IMPLICIT_CTOR
     65If this symbol is one, an implicit constor of AD<Base> is defined
     66where the argument has any type.
     67Otherwise this constructor is explicit.
     68*/
     69# define CPPAD_IMPLICIT_CTOR @cppad_implicit_ctor@
    6270
    6371/*!
  • trunk/cppad/local/ad.hpp

    r3060 r3061  
    162162        inline AD& operator=(const VecAD_reference<Base> &x);
    163163
    164         // explicit construction from some other type
     164# if CPPAD_IMPLICIT_CTOR
     165        // implicit construction from some other type (depricated)
     166        template <class T> inline AD(const T &t);
     167# else
     168        // explicit construction from some other type (depricated)
    165169        template <class T> inline explicit AD(const T &t);
     170# endif
    166171
    167172        // assignment from some other type
  • trunk/cppad/local/ad_ctor.hpp

    r3060 r3061  
    1919$begin ad_ctor$$
    2020$spell
     21        cppad
     22        ctor
    2123        initializes
    2224        Vec
     
    5456
    5557$subhead explicit$$
    56 There is an explicit constructor where $icode x$$ has the prototype
    57 prototypes:
     58There is an explicit constructor where $icode x$$ has prototype
    5859$codei%
    5960        const %Type%&        %x%
    6061%$$
    61 or any type that has an explicit constructor of the form
     62for any type that has an explicit constructor of the form
     63$icode%Base%(%x%)%$$.
     64
     65$subhead deprecated$$
     66$index deprecated, constructor$$
     67$index constructor, deprecated$$
     68If you set $cref/cppad_implicit_ctor/cmake/cppad_implicit_ctor/$$
     69to be $code YES$$ during the install procedure,
     70you will get an implicit constructor with prototype
     71$codei%
     72        const %Type%&        %x%
     73%$$
     74for any type that has an explicit constructor of the form
    6275$icode%Base%(%x%)%$$.
    6376
  • trunk/cppad/local/undef.hpp

    r2939 r3061  
    6767# undef CPPAD_HAS_GETTIMEOFDAY
    6868# undef CPPAD_HAS_NULLPTR
     69# undef CPPAD_IMPLICIT_CTOR
    6970# undef CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION
    7071# undef CPPAD_MAX_NUM_CAPACITY
  • trunk/omh/install/cmake.omh

    r2762 r3061  
    1414$escape $$
    1515$spell
     16        ctor
    1617        op
    1718        arg
     
    105106        -D cppad_tape_id_type=%cppad_tape_id_type%                   \
    106107        -D cppad_tape_addr_type=%cppad_tape_addr_type%               \
     108        -D cppad_implicit_ctor_from_any_type=%cppad_implicit_ctor%   \
    107109        \
    108110        ..
     
    338340$cref/size_par/seq_property/size_VecAD/$$.
    339341
     342$head cppad_implicit_ctor$$
     343$index ctor, implicit or explicit$$
     344$index implicit, ctor$$
     345$index explicit, ctor$$
     346The default value for $icode cppad_implicit_ctor$$ is $code NO$$.
     347If it is $code YES$$,
     348there is an implicit type constructor (type conversion)
     349from any type to $codei%AD<%Base%>%$$.
     350Otherwise this constructor is explicit.
     351
    340352
    341353$children%
  • trunk/omh/whats_new/whats_new_13.omh

    r3060 r3061  
    1414$dollar @$$
    1515$spell
     16        ctor
    1617        Num
    1718        autotools
     
    6768The caused problems when using CppAD with
    6869$cref/eigen/eigen_prefix/$$.
    69 This constructor has been changed to be
     70The default for this constructor has been changed to be
    7071$cref/explicit/ad_ctor/x/explicit/$$.
    71 In addition the
     72In addition, other
    7273$cref/implicit/ad_ctor/x/implicit/$$ constructors
    7374are now listed in the documentation.
     
    7980try an explicit conversion to
    8081$icode Base$$ or $codei%AD<%Base%>%$$ before the assignment.
     82A deprecated alternative is to make this constructor implicit using the
     83$cref/cppad_implicit_ctor/cmake/cppad_implicit_ctor/$$ option
     84during the install procedure.
    8185
    8286$head 12-26$$
Note: See TracChangeset for help on using the changeset viewer.