Skip to content

Update to work with GCC 5

T.J. Corona requested to merge tjcorona/smtk:gcc-5-fix into master

GCC 5's implementation of std::map::emplace cannot handle the implicit conversion from a pointer to a unique_ptr. For example, the following will not compile on GCC 5.5:

#include <map>
#include <memory>
#include <utility>

struct Foo
{
  virtual ~Foo() {}
};

int main(int, char**)
{
  std::map<int, std::unique_ptr<Foo>> map;

  map.emplace(std::make_pair(3, new Foo));

  return 0;
}

This MR updates the emplace method to move the unique_ptr into the map.

Edited by T.J. Corona

Merge request reports

Loading