#include <iostream>
using namespace std;
class SomethingSpecial
{
public:
double value;
SomethingSpecial ():value (0)
{
}
SomethingSpecial (double value):value (value)
{
}
SomethingSpecial operator+= (SomethingSpecial & _Right)
{
SomethingSpecial result;
result.value = value + _Right.value;
return result;
}
};
template < typename T > class Pocket
{
T value;
public:
Pocket ()
{
}
Pocket (T value);
T getValue ()
{
return value;
}
void add (T _Right)
{
value += _Right;
}
};
template < class T > Pocket < T >::Pocket (T value):value (value)
{
}
int
main ()
{
Pocket < double >a (3); //LINE I
Pocket < SomethingSpecial > n;
n.add (SomethingSpecial ()); //LINE II
cout << a.getValue () << ", ";
a.add (3);
cout << a.getValue ();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY2xhc3MgU29tZXRoaW5nU3BlY2lhbAp7CgpwdWJsaWM6CgogIGRvdWJsZSB2YWx1ZTsKCiAgICBTb21ldGhpbmdTcGVjaWFsICgpOnZhbHVlICgwKQp7CiAgfQoKICBTb21ldGhpbmdTcGVjaWFsIChkb3VibGUgdmFsdWUpOnZhbHVlICh2YWx1ZSkKICB7CiAgfQoKICBTb21ldGhpbmdTcGVjaWFsIG9wZXJhdG9yKz0gKFNvbWV0aGluZ1NwZWNpYWwgJiBfUmlnaHQpCiAgewoKICAgIFNvbWV0aGluZ1NwZWNpYWwgcmVzdWx0OwoKICAgIHJlc3VsdC52YWx1ZSA9IHZhbHVlICsgX1JpZ2h0LnZhbHVlOwoKICAgIHJldHVybiByZXN1bHQ7CgogIH0KCiAgICB9OwoKdGVtcGxhdGUgPCB0eXBlbmFtZSBUID4gY2xhc3MgUG9ja2V0CnsKCiAgVCB2YWx1ZTsKCiAgcHVibGljOgoKICBQb2NrZXQgKCkKICB7CiAgfQoKICBQb2NrZXQgKFQgdmFsdWUpOwoKICBUIGdldFZhbHVlICgpCiAgewogICAgcmV0dXJuIHZhbHVlOwogIH0KCiAgdm9pZCBhZGQgKFQgX1JpZ2h0KQogI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