17-02-2025, 02:14 PM
Yes, in the example I took from AUTOSAR, B has only one member of type "std::int32_t* ptr;".
Let's assume it has 2 such members, ptr1 and ptr2, would this be compliant with A8-4-5?
Let's assume it has 2 such members, ptr1 and ptr2, would this be compliant with A8-4-5?
Code:
class B
{
public:
B(B&& oth) :
ptr1(std::move(oth.ptr1)),
ptr2(std::move(oth.ptr2))
{
oth.ptr1 = nullptr;
oth.ptr2 = nullptr;
}
private:
std::int32_t* ptr1;
std::int32_t* ptr2;
};