fork download
  1. #include <vector>
  2.  
  3. int main()
  4. {
  5.  
  6. std::vector<const int> v;
  7. v.push_back(2);
  8. v.push_back(8);
  9. v.insert(v.begin(),10);
  10. std::cout << "v[0] = " << v[0] << std::endl;
  11.  
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/ext/new_allocator.h: In instantiation of ‘__gnu_cxx::new_allocator<const int>’:
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/allocator.h:84:   instantiated from ‘std::allocator<const int>’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_vector.h:75:   instantiated from ‘std::_Vector_base<const int, std::allocator<const int> >’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_vector.h:176:   instantiated from ‘std::vector<const int, std::allocator<const int> >’
prog.cpp:6:   instantiated from here
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/ext/new_allocator.h:82: error: ‘const _Tp* __gnu_cxx::new_allocator<_Tp>::address(const _Tp&) const [with _Tp = const int]’ cannot be overloaded
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/ext/new_allocator.h:79: error: with ‘_Tp* __gnu_cxx::new_allocator<_Tp>::address(_Tp&) const [with _Tp = const int]’
prog.cpp: In function ‘int main()’:
prog.cpp:10: error: ‘cout’ is not a member of ‘std’
prog.cpp:10: error: ‘endl’ is not a member of ‘std’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = const int, _Alloc = std::allocator<const int>]’:
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_vector.h:694:   instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = const int, _Alloc = std::allocator<const int>]’
prog.cpp:7:   instantiated from here
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/vector.tcc:299: error: assignment of read-only location ‘__position.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator* [with _Iterator = const int*, _Container = std::vector<const int, std::allocator<const int> >]()’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/ext/new_allocator.h: In member function ‘void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*, size_t) [with _Tp = const int]’:
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_vector.h:150:   instantiated from ‘void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(_Tp*, size_t) [with _Tp = const int, _Alloc = std::allocator<const int>]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_vector.h:136:   instantiated from ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = const int, _Alloc = std::allocator<const int>]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_vector.h:214:   instantiated from ‘std::vector<_Tp, _Alloc>::vector() [with _Tp = const int, _Alloc = std::allocator<const int>]’
prog.cpp:6:   instantiated from here
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/ext/new_allocator.h:98: error: invalid conversion from ‘const void*’ to ‘void*’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/ext/new_allocator.h:98: error:   initializing argument 1 of ‘void operator delete(void*)’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algobase.h: In function ‘_BI2 std::__copy_move_backward_a(_BI1, _BI1, _BI2) [with bool _IsMove = false, _BI1 = const int*, _BI2 = const int*]’:
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algobase.h:602:   instantiated from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = false, _BI1 = const int*, _BI2 = const int*]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algobase.h:636:   instantiated from ‘_BI2 std::copy_backward(_BI1, _BI1, _BI2) [with _BI1 = const int*, _BI2 = const int*]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/vector.tcc:295:   instantiated from ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = const int, _Alloc = std::allocator<const int>]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_vector.h:694:   instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = const int, _Alloc = std::allocator<const int>]’
prog.cpp:7:   instantiated from here
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algobase.h:592: error: no matching function for call to ‘std::__copy_move_backward<false, true, std::random_access_iterator_tag>::__copy_move_b(const int*&, const int*&, const int*&)’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algobase.h: In function ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false, _II = const int*, _OI = const int*]’:
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algobase.h:435:   instantiated from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false, _II = const int*, _OI = const int*]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algobase.h:466:   instantiated from ‘_OI std::copy(_II, _II, _OI) [with _II = const int*, _OI = const int*]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_uninitialized.h:98:   instantiated from ‘static _ForwardIterator std::__uninitialized_copy<true>::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const int*, _ForwardIterator = const int*]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_uninitialized.h:122:   instantiated from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = const int*, _ForwardIterator = const int*]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_uninitialized.h:262:   instantiated from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = const int*, _ForwardIterator = const int*, _Tp = const int]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_uninitialized.h:272:   instantiated from ‘_ForwardIterator std::__uninitialized_move_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = const int*, _ForwardIterator = const int*, _Allocator = std::allocator<const int>]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/vector.tcc:316:   instantiated from ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = const int, _Alloc = std::allocator<const int>]’
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_vector.h:694:   instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = const int, _Alloc = std::allocator<const int>]’
prog.cpp:7:   instantiated from here
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4/bits/stl_algobase.h:396: error: no matching function for call to ‘std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m(const int*&, const int*&, const int*&)’
stdout
Standard output is empty