Let's say I have the following code:
class A {
public:
void SetInteger(const int val) noexcept { integerMember = val; }
void SetString(const std::string& val) { stringMember = val; }
int GetInteger() const noexcept { return integerMember; }
std::string GetString() const { return stringMember; }
private:
int integerMember;
std::string stringMember;
}
Using noexcept for integral types and pointers seems for me pretty obvious.
But what are recommendations in case of not integral types like classes and structures that do not throw exceptions in constructor/copy-constructor and constructors of their parts explicitly (meaning using throw in constructor body)?