fork download
  1. #include <map>
  2. #include <string>
  3. #include <vector>
  4.  
  5. int main() {
  6. std::map<std::string, double> myMap;
  7.  
  8. typedef std::remove_reference<decltype(myMap[1])>::type valueType; // double
  9. std::vector<valueType> myVector;
  10. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:8:48: error: invalid user-defined conversion from ‘int’ to ‘std::map<std::basic_string<char>, double>::key_type&& {aka std::basic_string<char>&&}’ [-fpermissive]
  typedef std::remove_reference<decltype(myMap[1])>::type valueType; // double
                                                ^
In file included from /usr/include/c++/4.8/string:52:0,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/bits/stl_map.h:63,
                 from /usr/include/c++/4.8/map:61,
                 from prog.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:490:7: note: candidate is: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>] <near match>
       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
       ^
/usr/include/c++/4.8/bits/basic_string.h:490:7: note:   no known conversion for argument 1 from ‘int’ to ‘const char*’
prog.cpp:8:48: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
  typedef std::remove_reference<decltype(myMap[1])>::type valueType; // double
                                                ^
In file included from /usr/include/c++/4.8/string:52:0,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/bits/stl_map.h:63,
                 from /usr/include/c++/4.8/map:61,
                 from prog.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:490:7: error:   initializing argument 1 of ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ [-fpermissive]
       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
       ^
prog.cpp:8:48: error: conversion to non-const reference type ‘std::map<std::basic_string<char>, double>::key_type&& {aka class std::basic_string<char>&&}’ from rvalue of type ‘std::basic_string<char>’ [-fpermissive]
  typedef std::remove_reference<decltype(myMap[1])>::type valueType; // double
                                                ^
prog.cpp:8:48: error: invalid user-defined conversion from ‘int’ to ‘std::map<std::basic_string<char>, double>::key_type&& {aka std::basic_string<char>&&}’ [-fpermissive]
In file included from /usr/include/c++/4.8/string:52:0,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/bits/stl_map.h:63,
                 from /usr/include/c++/4.8/map:61,
                 from prog.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:490:7: note: candidate is: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>] <near match>
       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
       ^
/usr/include/c++/4.8/bits/basic_string.h:490:7: note:   no known conversion for argument 1 from ‘int’ to ‘const char*’
prog.cpp:8:48: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
  typedef std::remove_reference<decltype(myMap[1])>::type valueType; // double
                                                ^
In file included from /usr/include/c++/4.8/string:52:0,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/bits/stl_map.h:63,
                 from /usr/include/c++/4.8/map:61,
                 from prog.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:490:7: error:   initializing argument 1 of ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ [-fpermissive]
       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
       ^
prog.cpp:8:48: error: conversion to non-const reference type ‘std::map<std::basic_string<char>, double>::key_type&& {aka class std::basic_string<char>&&}’ from rvalue of type ‘std::basic_string<char>’ [-fpermissive]
  typedef std::remove_reference<decltype(myMap[1])>::type valueType; // double
                                                ^
stdout
Standard output is empty