fixed test & impl
This commit is contained in:
parent
eaa3960373
commit
d317cc2ea7
3 changed files with 13 additions and 6 deletions
|
|
@ -6,12 +6,14 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef T int;
|
||||
typedef int T;
|
||||
|
||||
struct MyClass {
|
||||
MyClass(eoOptional<T> my_T = NULL)
|
||||
: actual_T(my_T.getOr(default_T))
|
||||
{ }
|
||||
: default_T(42), actual_T(my_T.getOr(default_T))
|
||||
{
|
||||
std::cout << "Value " << actual_T << " was used for construction" << std::endl;
|
||||
}
|
||||
private:
|
||||
T default_T;
|
||||
T& actual_T;
|
||||
|
|
@ -22,6 +24,6 @@ int main(int ac, char** av)
|
|||
// Three ways of using MyClass:
|
||||
MyClass mc1;
|
||||
MyClass mc2(NULL);
|
||||
T t;
|
||||
T t(666);
|
||||
MyClass mc3(t);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue