#include <SFML/Graphics.hpp>
#include <string>
#include <vector>
using namespace std;using namespace sf;

class Obj
{
public:
	Obj(int x, int y, string path) : _x(x), _y(y), _path(path)
	{
		texture.loadFromFile(path);
		sprite.setTexture(texture);
	}
	void create()
	{
		texture.loadFromFile(path);
		sprite.setTexture(texture);
	}
	
	int _x;
	int _y;
	string path;
	Sprite sprite;
	Texture texture;
};

int main() 
{
	//Вот так рисуется:
	std::vector<Obj> obj;
	obj.emplace_back(16, 16, "res/sprite.png");
	
	//Но если 2строки выше заменить этим:
	std::vector<Obj> obj;
	Obj.reserve(1);
	Obj[0].x = 16;
	Obj[0].y = 16;
	Obj[0].path = "res/sprite.png";
	Obj[0].create();
	
	window()
	{
		while (window.isOpen())
		{
			window.draw(Obj[0].sprite);	//эта строка начнет крашить приложение
		}
	}
	return 0;
}