Changeset 1624:61cc647dac99 in lemon-0.x for doc/named-param.dox
- Timestamp:
- 08/11/05 16:31:06 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2132
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/named-param.dox
r1619 r1624 1 *!1 /*! 2 2 3 3 \page named-param Named Parameters 4 4 5 \section named-func-param Named "Function"Parameters5 \section named-func-param Named Function Parameters 6 6 7 7 C++ makes it possible to use default parameter values when calling a … … 43 43 The usage is the following. 44 44 45 We have to define a class, let's call it named_fn. Let us assume that46 we would like to use a parameter, called X. In thenamed_fn class we47 have to define an _X attribute, and a functionX. The function48 expects a parameter with the type of _X, and sets the value of49 _X. After setting the value the function returns the class itself. The50 class also have to have a function, called for example run(), we have45 We have to define a class, let's call it \c named_fn. Let us assume that 46 we would like to use a parameter, called \c X. In the \c named_fn class we 47 have to define an \c _X attribute, and a function \c X. The function 48 expects a parameter with the type of \c _X, and sets the value of 49 \c _X. After setting the value the function returns the class itself. The 50 class also have to have a function, called for example <tt>run()</tt>, we have 51 51 to implement here the original function itself. The constructor of the 52 class have to give all the attributes like _X the default values of52 class have to give all the attributes like \c _X the default values of 53 53 them. 54 54 55 55 If we instantiate this class, the default values will be set for the 56 56 attributes (originally the parameters), initially. If we call function 57 X, we get a class with the modified parameter value of58 X. Therefore we can modify any parameter-value, independent from the59 order. To run the algorithm we have to call the run()function at the57 \c X, we get a class with the modified parameter value of 58 \c X. Therefore we can modify any parameter-value, independent from the 59 order. To run the algorithm we have to call the <tt>run()</tt> function at the 60 60 end of the row. 61 61 62 Example: named_fn().id(3).val(2).run(); 62 Example: 63 \code 64 named_fn().id(3).val(2).run(); 65 \endcode 63 66 64 67 \section traits-classes Traits Classes … … 93 96 DistMap and the PredMap is modified. 94 97 95 \section named-templ-func-param Named "Function"Template Parameters98 \section named-templ-func-param Named Function Template Parameters 96 99 97 100 If the class has so called wizard functions, the new class with the
Note: See TracChangeset
for help on using the changeset viewer.