fork download
  1. #include <map>
  2. #include <string>
  3. #include <iostream>
  4.  
  5. struct MockMapItem {
  6. std::string property;
  7.  
  8. MockMapItem(const std::string& value) : property(value) {
  9. std::cout << "We constructed a new MockMapItem with a string!" << std::endl;
  10.  
  11. }
  12. };
  13.  
  14. typedef typename std::map<std::string, const MockMapItem&& > ItemMap;
  15.  
  16. int main()
  17. {
  18. MockMapItem map_item("some string value");
  19.  
  20. ItemMap themap;
  21. themap.emplace("something", std::move(map_item));
  22.  
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:14:60: error: template argument 2 is invalid
 typedef typename std::map<std::string, const MockMapItem&& > ItemMap;
                                                            ^
prog.cpp:14:60: error: template argument 4 is invalid
prog.cpp:14:62: error: 'ItemMap' in namespace 'std' does not name a type
 typedef typename std::map<std::string, const MockMapItem&& > ItemMap;
                                                              ^
prog.cpp:14:62: warning: 'typedef' was ignored in this declaration
prog.cpp: In function 'int main()':
prog.cpp:20:2: error: 'ItemMap' was not declared in this scope
  ItemMap themap;
  ^
prog.cpp:21:2: error: 'themap' was not declared in this scope
  themap.emplace("something", std::move(map_item));
  ^
prog.cpp:21:30: error: 'move' is not a member of 'std'
  themap.emplace("something", std::move(map_item));
                              ^
stdout
Standard output is empty