Issue 4 in cdma: problems with = and copy constructor for std::shared_ptr

0 views
Skip to first unread message

cd...@googlecode.com

unread,
Nov 22, 2012, 6:34:03 AM11/22/12
to common-d...@googlegroups.com
Status: Accepted
Owner: eugen.win...@gmail.com
CC: stephane...@synchrotron-soleil.fr
Labels: Type-Defect Priority-Critical

New issue 4 by eugen.win...@gmail.com: problems with = and copy
constructor for std::shared_ptr
http://code.google.com/p/cdma/issues/detail?id=4

Hi folks
This is a critical issue when using standard C++ smart pointers. It is easy
to fix so I could do this. However, I do not want to interfere with the
existing yat smart pointers.
The problem concerns conversions from raw pointers to smart pointers. This
is not supported in C++11. As an example see line 110 of Array.cpp:

m_data_impl = new DefaultArrayStorage<short>((short*) pData, shape);

This may works for yat shared pointers but not for C++11 shared pointers.
The solution is

m_data_impl = IArrayStoragePtr(new DefaultArrayStorage<short>((short*)
pData, shape));

Would the last line also work with yat smart pointers? If not one has to
handle this situation using #ifdef CDMA_STD_SMART_PTR throughout the entire
code.




cd...@googlecode.com

unread,
Nov 22, 2012, 7:29:38 AM11/22/12
to common-d...@googlegroups.com

Comment #1 on issue 4 by eugen.win...@gmail.com: problems with = and
copy constructor for std::shared_ptr
http://code.google.com/p/cdma/issues/detail?id=4

I suggest to create an issue branch (issue_4) in the svn repo where we can
deal with this issue and afterwards merge this back to trunk.

cd...@googlecode.com

unread,
Nov 22, 2012, 8:21:45 AM11/22/12
to common-d...@googlegroups.com

Comment #3 on issue 4 by stephane...@synchrotron-soleil.fr: problems with =
and copy constructor for std::shared_ptr
http://code.google.com/p/cdma/issues/detail?id=4

Yes the solution you propose (explicit conversion) works with the
yat::SharedPtr class.


cd...@googlecode.com

unread,
Nov 22, 2012, 8:25:46 AM11/22/12
to common-d...@googlegroups.com

Comment #4 on issue 4 by eugen.win...@gmail.com: problems with = and
copy constructor for std::shared_ptr
http://code.google.com/p/cdma/issues/detail?id=4

ok - I have created the issue branch and start to fix the sources. This
makes quite good progress. I think this is the best solution since one can
easily modify and test the code without messing everything up with
#ifdefine statements.

cd...@googlecode.com

unread,
Nov 22, 2012, 9:34:14 AM11/22/12
to common-d...@googlegroups.com

Comment #15 on issue 4 by eugen.win...@gmail.com: problems with =
and copy constructor for std::shared_ptr
http://code.google.com/p/cdma/issues/detail?id=4

Ok - cdmacore seems to build now using a command line option named
--with-cpp11 and scons.

cd...@googlecode.com

unread,
Nov 29, 2012, 11:43:28 AM11/29/12
to common-d...@googlegroups.com
Updates:
Status: Fixed

Comment #16 on issue 4 by eugen.win...@gmail.com: problems with =
and copy constructor for std::shared_ptr
http://code.google.com/p/cdma/issues/detail?id=4

Merged issue_4 branch back to trunk. Build seems to work.

Reply all
Reply to author
Forward
0 new messages