Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$ cling -std=c++17
****************** CLING ******************
* Type C++ code and press enter to run it *
* Type .q to exit *
*******************************************
[cling]$ #include <any>
[cling]$ #include <map>
[cling]$ #include <string>
[cling]$ using namespace std;
[cling]$ map<any, any> m;
[cling]$ m
(std::map<std::any, std::any> &) {}
[cling]$ string s = "foo";
[cling]$ int n = 42;
[cling]$ m[n] = s;
In file included from input_line_4:1:
In file included from /usr/include/c++/7/map:60:
In file included from /usr/include/c++/7/bits/stl_tree.h:65:
/usr/include/c++/7/bits/stl_function.h:386:20: error: invalid operands to binary expression ('const std::any' and 'const std::any')
{ return __x < __y; }
~~~ ^ ~~~
/usr/include/c++/7/bits/stl_map.h:511:22: note: in instantiation of member function 'std::less<std::any>::operator()' requested here
if (__i == end() || key_comp()(__k, (*__i).first))
^
input_line_12:2:3: note: in instantiation of member function 'std::map<std::any, std::any, std::less<std::any>,
std::allocator<std::pair<const std::any, std::any> > >::operator[]' requested here
m[n] = s;
^
/usr/include/c++/7/bits/stl_pair.h:454:5: note: candidate template ignored: could not match 'pair<type-parameter-0-0, type-parameter-0-1>' against
'const std::any'
operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^
/usr/include/c++/7/bits/stl_iterator.h:308:5: note: candidate template ignored: could not match 'reverse_iterator<type-parameter-0-0>' against
'const std::any'
operator<(const reverse_iterator<_Iterator>& __x,
^
/usr/include/c++/7/bits/stl_iterator.h:346:5: note: candidate template ignored: could not match 'reverse_iterator<type-parameter-0-0>' against
'const std::any'
operator<(const reverse_iterator<_IteratorL>& __x,
^
/usr/include/c++/7/bits/stl_iterator.h:1145:5: note: candidate template ignored: could not match 'move_iterator<type-parameter-0-0>' against
'const std::any'
operator<(const move_iterator<_IteratorL>& __x,
^
/usr/include/c++/7/bits/stl_iterator.h:1151:5: note: candidate template ignored: could not match 'move_iterator<type-parameter-0-0>' against
'const std::any'
operator<(const move_iterator<_Iterator>& __x,
^
/usr/include/c++/7/string_view:486:5: note: candidate template ignored: could not match 'basic_string_view<type-parameter-0-0,
type-parameter-0-1>' against 'std::any'
operator< (basic_string_view<_CharT, _Traits> __x,
^
/usr/include/c++/7/string_view:492:5: note: candidate template ignored: could not match 'basic_string_view<type-parameter-0-0,
type-parameter-0-1>' against 'std::any'
operator< (basic_string_view<_CharT, _Traits> __x,
^
/usr/include/c++/7/string_view:498:5: note: candidate template ignored: could not match 'basic_string_view<type-parameter-0-0,
type-parameter-0-1>' against 'std::any'
operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
^
/usr/include/c++/7/bits/basic_string.h:6094:5: note: candidate template ignored: could not match 'basic_string<type-parameter-0-0, type-parameter-0-1,
type-parameter-0-2>' against 'const std::any'
operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
^
/usr/include/c++/7/bits/basic_string.h:6107:5: note: candidate template ignored: could not match 'basic_string<type-parameter-0-0, type-parameter-0-1,
type-parameter-0-2>' against 'const std::any'
operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
^
/usr/include/c++/7/bits/basic_string.h:6119:5: note: candidate template ignored: could not match 'const _CharT *' against 'std::any'
operator<(const _CharT* __lhs,
^
/usr/include/c++/7/optional:810:5: note: candidate template ignored: could not match 'optional<type-parameter-0-0>' against 'const std::any'
operator<(const optional<_Tp>& __lhs, const optional<_Up>& __rhs)
^
/usr/include/c++/7/optional:863:5: note: candidate template ignored: could not match 'optional<type-parameter-0-0>' against 'const std::any'
operator<(const optional<_Tp>& /* __lhs */, nullopt_t) noexcept
^
/usr/include/c++/7/optional:868:5: note: candidate template ignored: could not match 'optional<type-parameter-0-0>' against 'const std::any'
operator<(nullopt_t, const optional<_Tp>& __rhs) noexcept
^
/usr/include/c++/7/optional:928:5: note: candidate template ignored: could not match 'optional<type-parameter-0-0>' against 'const std::any'
operator<(const optional<_Tp>& __lhs, const _Up& __rhs)
^
/usr/include/c++/7/optional:934:5: note: candidate template ignored: could not match 'optional<type-parameter-0-0>' against 'const std::any'
operator<(const _Up& __lhs, const optional<_Tp>& __rhs)
^
/usr/include/c++/7/bits/stl_tree.h:1543:5: note: candidate template ignored: could not match '_Rb_tree<type-parameter-0-0, type-parameter-0-1,
type-parameter-0-2, type-parameter-0-3, type-parameter-0-4>' against 'const std::any'
operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
^
/usr/include/c++/7/array:262:5: note: candidate template ignored: could not match 'array<type-parameter-0-0, _Nm>' against 'const std::any'
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
^
/usr/include/c++/7/tuple:1410:5: note: candidate template ignored: could not match 'tuple<type-parameter-0-0...>' against 'const std::any'
operator<(const tuple<_TElements...>& __t,
^
/usr/include/c++/7/bits/stl_map.h:1378:2: note: candidate template ignored: could not match 'map<type-parameter-0-0, type-parameter-0-1,
type-parameter-0-2, type-parameter-0-3>' against 'const std::any'
operator<(const map<_K1, _T1, _C1, _A1>&,
^
/usr/include/c++/7/bits/stl_multimap.h:1076:5: note: candidate template ignored: could not match 'multimap<type-parameter-0-0, type-parameter-0-1,
type-parameter-0-2, type-parameter-0-3>' against 'const std::any'
operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
^
/usr/include/c++/7/bits/unique_ptr.h:717:5: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>'
against 'const std::any'
operator<(const unique_ptr<_Tp, _Dp>& __x,
^
/usr/include/c++/7/bits/unique_ptr.h:728:5: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>'
against 'const std::any'
operator<(const unique_ptr<_Tp, _Dp>& __x, nullptr_t)
^
/usr/include/c++/7/bits/unique_ptr.h:734:5: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>'
against 'const std::any'
operator<(nullptr_t, const unique_ptr<_Tp, _Dp>& __x)
^
/usr/include/c++/7/bits/shared_ptr_base.h:1441:5: note: candidate template ignored: could not match '__shared_ptr<type-parameter-0-0, _Lp>' against
'const std::any'
operator<(const __shared_ptr<_Tp, _Lp>& __a,
^
/usr/include/c++/7/bits/shared_ptr_base.h:1452:5: note: candidate template ignored: could not match '__shared_ptr<type-parameter-0-0, _Lp>' against
'const std::any'
operator<(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept
^
/usr/include/c++/7/bits/shared_ptr_base.h:1460:5: note: candidate template ignored: could not match '__shared_ptr<type-parameter-0-0, _Lp>' against
'const std::any'
operator<(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept
^
/usr/include/c++/7/bits/shared_ptr.h:398:5: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against 'const std::any'
operator<(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept
^
/usr/include/c++/7/bits/shared_ptr.h:408:5: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against 'const std::any'
operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
^
/usr/include/c++/7/bits/shared_ptr.h:416:5: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against 'const std::any'
operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
^
[cling]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.