1. bind1st and bind2nd (replaced by bind in C++11)
This function constructs an unary function object from the binary function object op by binding its second parameter to the fixed value x.
bind2nd(greater
X>Y
the second parameter Y is bound to "Baz", so it is like X>“Baz”.
If it is:
bind1st(greater
X>Y
X is the first parameter and is bound as "Baz", so it is like "Baz" > Y
-----------------------
class ABA{
public:
ABA(){}
ABA(ABA& a){}
ABA& operator=(const ABA& a){return *this;}
};
const ABA a1;
-----------------------
2.keyword "operator" in C++
1. operator overloading
typename operator ... (){}
2. implicit conversion - conversion operator
operator typename(){...}
If i want to convert A to B, the conversion operator is used as:
class A{
operator B(){}
};
-------------------
3.how to use throw
1. throw A;
2. throw;
The throw-expression without an operand may only be used inside a catch block (it calls std::terminate if used otherwise). It abandons the execution of the catch block and passes control to the next matching catch clause up the call stack (but not to another catch clause after the same try block), reusing the existing exception object: no new objects are made.
1 comment:
conversion operator is strange: the return value type is not the first part of the function!
Post a Comment