subclassing standard containers? I have read so many times that one should not subclass standard containers.
Is there cases that one can subclass them ? 
for example, I have the following case:

struct Materials
{

  std::map&lt;std::string, std::unique_ptr&lt;Material&gt;&gt; materials;

  void setFrom(const Database&amp; db);
  void echo(std::ostream&amp;) const;

};


I want my materials class to act like a map, so I have to add methods like

Material&amp; getMaterial(std::string&amp; key);
void addMaterial(std::string&amp; key, Material&amp; material);


which could have been avoided if I just sublcassed the container.

 struct Materials:public std::map&lt;std::string, std::unique_ptr&lt;Material&gt;&gt; materials;
    {
      void setFrom(const Database&amp; db);
      void echo(std::ostream&amp;) const;
    };


is this a horrible thing to do ?
Yes it is horrible.

The only time where inheritance over composition makes any sense is when you want to take advantage of the empty baseclass optimization. A container is not a empty class.

In a struct all fields are public so you don't need to public inherit anyway. 

None of the methods of the std containers are virtual so you cannot override them. Which in turn means you cannot prevent user code from invalidating any invariants you want to impose. This last is an issue with public member field as well.

If you ever want to change containers to one with a different api you have to change all code dealing with the container part instead of only changing the type in the header and the implementation of the wrapper functions.