Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: need help assigning variable to shared pointer  (Read 1160 times)

0 Members and 1 Guest are viewing this topic.

Programmy

  • Newbie
  • *
  • Posts: 19
    • View Profile
need help assigning variable to shared pointer
« on: December 14, 2018, 03:52:58 am »
I'm using a shared pointer but I'm having trouble using push_back assigning a value to a vector of shared pointers
how do you go about doing it?

void Window::Test1(std::vector<std::shared_ptr<Earth>>* proxy3)
{
   int *a ;
   int b = 10;

   int *a = &b;

   std::vector<std::shared_ptr<Earth>> proxy4;

   proxy3 = &proxy4;

}

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
Re: need help assigning variable to shared pointer
« Reply #1 on: December 14, 2018, 08:51:13 am »
This is the SFML forum, general C++ questions are better asked on platforms like StackOverflow.

Probably something alone the line of: vec.push_back(std::make_shared<Earth>());
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/