Array size
Is this a good approach to get a pointer and the size of the array?
Or there are better solutions?
1 2 3 4 5 6 7 8 9 10 11 12
|
struct MechanicalElement
{
virtual std::pair<size_t, Node*> getNodes() = 0;
};
struct Beam : public MechanicalElement
{
virtual std::pair<size_t, Node*> getNodes() { return std::pair<size_t, Node*>(2, node); }
protected:
Node node[2];
};
|
Use a vector.
It is better to declare the functions as const and change the order of elements of the pair
virtual std::pair<Node *, size_t> getNodes() const = 0;
Topic archived. No new replies allowed.