Skip to content

boost serialization of pagmo::detail::prob_inner<UDP> manual export required #603

@codethinki

Description

@codethinki

Describe the bug
cpp The pagmo::detail::prob_inner<UDP> class is not automatically exported to boost by pagmo.
To Reproduce
If you instantiate a archipelago with:

pagmo::archipelago arch{
  ISLANDS,
  pagmo::algorithm{pagmo::sade{}},
  pagmo::problem{MyUDP{}},
  POPULATION_SIZE,
}

the serialization with:

std::ofstream file{"myfile.bin", std::ios::ate | std::ios::binary};
boost::archive::binary_oarchive archive{file};
archive << arch;

crashes with boost complaining about a base class thats not registered (no type information, hints whatsoever).

i also don't see any documentation for the serialization feature but thats something else.

fix

add

BOOST_CLASS_EXPORT(pagmo::detail::prob_inner<MyUDP>)

altho the library should probably take care of this

Expected behavior
Automatically register the class for boost serialization,

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: Windows
  • Installation method: vcpkg
  • Version: 2.19.1

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions