c++11 - function which inserts a unique_ptrs into a multimap does not compile ICPC in linux -


i trying build multimap unique_ptr , getting strange compilation errors in linux

example code:

#include <iostream> #include <memory> #include <map>  using namespace std;  class event { public:     event (double time) : _time(time) {}     double gettime () const { return _time; } private:     event (event const & e);     void operator= (event const &e);     double _time; };  class calendar { public:     void addevent (std::unique_ptr<event> e) {         double t = e->gettime(); // time before trying next line         _events.insert(move(make_pair (t, move(e)))); // insert multimap     } private:     multimap <double, unique_ptr<event>> _events; };  int main () {     unique_ptr<event> e (new event(1.0));      calendar c;     c.addevent (move(e)); } 

above code compiles in osx 10.10 icpc 15.0.2 20150121 not centos6.6 same compiler. there bunch of compiler errors boil down this:

std::multimap<_key, _tp, _compare, _alloc>::insert(const std::multimap<_key, _tp, _compare, _alloc>::value_type &) [with _key=double, _tp=std::unique_ptr>, _compare=std::less, _alloc=std::allocator>>>]" @ line 21 of "main.cpp"

clearly trying copy unique_ptr , triggering error. have tried kinds of different ways , still can't compile in linux. suggestions? think icpc support unique_ptr multimap right?

things i've tried:

  1. creating pair first (works) , inserting pair (fails)
  2. using/not using make_pair
  3. using/not using move

suggestions? i've searched extensively on here before posting , tried everything

i talked people @ intel , said "not supported". basically, compiling code using icpc still takes advantage of underlying compiler on system (in case gcc 4.4.7). things (nullptr example) icpc supports though underlying gcc doesn't. other items (in case, imbedding unique_ptrs in multimaps) icpc leverages underlying gcc headers , isn't going work.

the solution problem is: don't it

either upgrade compiler or avoid code in first place.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -