I have an class A:
class A {
  int value1;
  int value2;
  std::string text;
public:
  A(int value1, int value2, std::string text) 
   : value1(value1), value2(value2), text(text) { }
};
And some "container" class B:
class B {
  std::vector<A> objects;
  ...
public:
  ...
  void addObject(A a) {
    objects.push_back(a);
  }
};
And code:
B b;
A a(2, 5, "test");
b.addObject(a);
//I no longer need a from now on
My problem is, how to optimize B::addObject(A a) to avoid any copying. What I want to achive is to add new object of type A to B.objects via B's method.
 
     
    