Skip to content

[Feature request] support std::filesystem::path #337

@gast128

Description

@gast128

Hello all,

is it possible to have support for std::filesystem::path serialization? There were old discussions about boost::filesystem::path:

Implementation inspired by John Rade's answer would be something like this:

namespace boost
{
    namespace serialization
    {
        template <class Archive>
        void serialize(Archive& ar, std::filesystem::path& rpth, const unsigned int)
        {
            std::string str;

           BOOST_IF_CONSTEXPR (Archive::is_saving::value)
            {
               str = rpth;
            }

            ar & boost::serialization::make_nvp("path", str);

            BOOST_IF_CONSTEXPR (Archive::is_loading::value)
            {
               rpth = std::move(str);
            }
        }
    }
}

Probably someone who knows the library would come up with a better implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions