C++ api: list all tensors in an archive file

Hi all,
I’m currently writing some files containing tensors via the C++ OutputArchive api. Reading the tensor back via InputArchive::read works fine when you know the tensor names. However I would also like to be able to list all the tensor names currently available in a given archive. Is there currently a way to achieve this ?

more details:
Tensor writing is done via

torch::serialize::OutputArchive archive;
archive.load_from(filename); 
archive.write(tensor_name, tensor);

I used to be able to list tensors in a hacky way with the following code but this seems to segfault.

    shared_ptr<torch::jit::script::Module> module = torch::jit::load(filename);           
    for (const auto &p : module->get_parameters()) {
      ...
    }

update: Updating to g++ from 4.8.5 to 5.2 made the segfault disappear which mostly solves my issue. Happy to know if there is a better way to do this though.