对于以下示例类,getter 方法的异常安全保证是什么?
这样的 getter 方法是否提供了最低限度的强有力保证?
按值返回基本类型是否总是提供不抛出保证?
class Foo
{
public:
// TODO: Constructor
// Getter methods
int getA() const { return a; }
std::string getB() const { return b; }
std::vector<int> getC() const { return c; }
Bar getD() const { return d; }
std::vector<Bar> getE() const { return e; }
protected:
int a;
std::string b;
std::vector<int> c;
Bar d;
std::vector<Bar> e;
}