1

When i try to serialize a shared_pointer using boost i get the following error.

#include <boost/serialization/shared_ptr.hpp>
    int main()
{   
    float val = 5.0;
    std::shared_ptr<float> p1 = std::make_shared<float>(val);
    {
        std::ofstream ofs("D://test.dat");
        boost::archive::text_oarchive oa(ofs);
        // write class instance to archive
        oa  << p1;
    }
        while (!_kbhit())
        {

        }
        return 0;
}

This is the error.

Error C2338 boost::serialization::tracking_level< T >::value != boost::serialization::track_never PointerTest c:\boost_1_73_0\boost\serialization\shared_ptr.hpp 269

Summit
  • 2,112
  • 2
  • 12
  • 36

0 Answers0