[odb-users] custom containers or not: boost::multi_array

MM finjulhich at gmail.com
Tue Jul 17 05:29:30 EDT 2018


>
> MM <finjulhich at gmail.com> writes:
> > Is it possible to implement persistence and loading for a
> > boost::multi_array using the custom container method in the manual?
> You could try to store it as a map kind with a composite key with
> members for all the indexes. I think it should work though I haven't
> tried it myself.


I have specialized container_traits and added that file in an options file
like suggested in the manual.

In the below snippet from the odb compiler 2.5.0-a9, odb compilation fails
at :

key_type is found from my container_traits, however the error highlighted
below
(container key_type is not instantiated) is triggered.

I don't understand

------------ odb/processor.cxx

        // Get the key type for maps.
        //
        if (ck == ck_map || ck == ck_multimap)
        {
          tree decl (
            lookup_qualified_name (
              inst, get_identifier ("key_type"), true, false));

          if (decl == error_mark_node || TREE_CODE (decl) != TYPE_DECL)
          {
            os << f << ":" << l << ":" << c << ": error: "
               << "container_traits specialization does not define the "
               << "key_type type" << endl;
            throw operation_failed ();
          }

          tree type (TYPE_MAIN_VARIANT (TREE_TYPE (decl)));

          if (semantics::node* n = unit.find (type))
            kt = &dynamic_cast<semantics::type&> (*n);
          else
          {
            error (ml) << "container key type is not instantiated" << endl;
            info (ml) << "use typedef/using to instantiate" << endl;
            throw operation_failed ();
          }


More information about the odb-users mailing list