Nested class and linkdef.h

Hello,

I have a class (originally a struct, but it doesn’t make any difference apparently) as a data member of another class, which inherits from TObject. In a nutshell, the structure looks like the following:

    class Foo : public TObject {

    public:
    ...
    struct Bar {
     int baz;
    }

    void fillMap(int key, int val) {
      Bar bar;
      bar.baz = val;
      m_mymap[key] = bar;
    }

    private:

    std::map<int, Bar> m_mymap;

    ClassDef(Foo, 1);
    };

In the linkdef.h file, I have included the line #pragma link C++ nestedclasses; which - according to the docs - should ensure dictionaries are generated also for nested classes.
Alas, this seems not to be happening, as I get the following warning whenever I try to fill the map:

TStreamerInfo::Build:0: RuntimeWarning: pair<int,Foo::Bar>: Foo::Bar has no streamer or dictionary, data member "second" will not be saved

I have found a workaround, by explicitly linking the nested class:

#pragma link C++ class Foo::Bar+; //implicit

, but I wonder why the previous statement gets ignored.

Any insight would be much appreciated!

Cheers
Marco


_ROOT Version: 6.14/06
Platform: Not Provided
Compiler: Not Provided


Hi Marco,

for some reason the type of the data member is not selected, we’ll look into it.

Cheers,
Danilo