assign raw pointer to the smart pointer

Hello forum,

I have declared two smart pointers inside the class declaration as follows:
1
2
3
4
5
6
7
8
  class A
  {
    ..............
    ..............
    private;
        std::shared_ptr<Line> l1;
        std::shared_ptr<Line> l2;
  };


Then in one of the member function has the following definition as follows:

1
2
3
4
5
6
void A::connect(Line *l)
{
    .............
    .............
    l1 = l; // GETTING ERROR HERE
}



I am getting the following error:

1
2
3
/home/sajjad/Documents/Wematter/CoversionModuleUpdated/WematterCoversion/Slice_Line.cpp:425: error: no match for 'operator=' (operand types are 'std::shared_ptr<conversionmodule::Slice::Line>' and 'conversionmodule::Slice::Line*')
    l1  = l;
        ^



Any hint to get around this issue ?


Thanks
Any hint to get around this issue ?
RTFM:
http://en.cppreference.com/w/cpp/memory/shared_ptr/reset
Topic archived. No new replies allowed.