jeudi 29 octobre 2015

How to serialize TAO::unbouded_basic_string_sequence

This does not work:

    template <class Archive, typename T>
    inline void save(Archive& arch, const TAO::unbounded_basic_string_sequence<T>& varSequence, unsigned int version)
    {
        size_t length = varSequence.length();
        arch & length & make_array(varSequence.get_buffer(), length);
    }

    template <class Archive, typename T>
    void load(Archive& arch, TAO::unbounded_basic_string_sequence<T>& varSequence, unsigned int version)
    {
        size_t length;
        arch & length;

        varSequence.length(length);
        arch & make_array(varSequence.get_buffer(), length);
    }


    template <class Archive, typename T>
    inline void serialize(Archive& arch, TAO::unbounded_basic_string_sequence<T>& varSequence, const unsigned int version)
        {
            split_free(arch, varSequence, version);
        }

The compiller says:

(..)/include/boost/serialization/access.hpp:118:9: error: request for member 'serialize' in 't', which is of non-class type 'char'

I know that C-style strings are not supported by boost::serialization. Theoretically I could use std::string for save(), but I do not know how to go back from std::string to TAO::unbouded_basic_string_sequence - there's almost no documentation for this class.

Aucun commentaire:

Enregistrer un commentaire