#include <iostream>
#include <vector>

class object
{
        private:

            int value;

        public:

        object(){}
        object(int value)
        {
            std::cout<<"object::constructor: "<< value << std::endl;
            this->value = value;
        }
        object( const object& o )
        {
           std::cout<<"object::copy-constructor: " << o.value << std::endl;
           this->value = o.value + 10;
        }
        ~object()
        {
            std::cout<<"object::destructor: "<< value << std::endl;
        }
        void call()
        {
            std::cout<<"object::call(): begin"<<std::endl;
            std::cout<<value<<std::endl;
            std::cout<<"object::call(): end"<<std::endl;
        }
};

int main()
{
    int max = 3;
    std::vector <object> OBJECTS;

    for(int index = 0; index < max; index++)
    {
            object OBJECT(index);
            
            std::cout<<"before push_back: capacity="<< OBJECTS.capacity() << std::endl;            
            OBJECTS.push_back(OBJECT);
            std::cout<<"after push_back: capacity="<< OBJECTS.capacity() << std::endl;
    }

    for(int index = 0; index < max; index++)
        OBJECTS[index].call();

    return 0;
}