Wie Armadillos Vektor zu serialisieren

Wie kann ich serialisierenarma::Col? Unten sind ein MWE und die Fehlerausgabe.

MWE:

#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <iostream>
#include "armadillo"

namespace mpi = boost::mpi;

struct S
{   
    int i;
    arma::Col<double>::fixed<3> cvector;

    friend class boost::serialization::access;

    template<class Archive>
    void serialize(Archive& ar, const unsigned int version) 
    {
        ar& i;
        ar& cvector;
    }
};

int main()
{ 
    mpi::environment env;
    mpi::communicator world;

    S s;

    if (world.rank() == 0)
    {
        s.cvector[0] = 2;
        s.cvector[1] = 2;
        world.send(1, 0, s);
    }
    else
    {
        world.recv(0, 0, s);
        std::cout << s.cvector[0] << std::endl;
        std::cout << s.cvector[1] << std::endl;
    }

    return 0;
}

Fehlerausgabe (Überspringen von "erforderlichem" Material):

error: ‘class arma::Col<double>::fixed<3ull>’ has no member named ‘se,rialize’; did you mean ‘set_size’? t.serialize(ar, file_version);

Bearbeiten Diepost scheint mit meiner Frage zu tun zu haben und ist leider unbeantwortet.

Antworten auf die Frage(6)

Ihre Antwort auf die Frage