fork(38) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <memory>
  4.  
  5. using namespace std;
  6.  
  7. struct S {
  8. int x;
  9. int y;
  10. };
  11.  
  12. int main() {
  13. std::vector<S> vec;
  14. vec.emplace_back(1, 2);
  15. // your code goes here
  16. return 0;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from /usr/include/i386-linux-gnu/c++/5/bits/c++allocator.h:33:0,
                 from /usr/include/c++/5/bits/allocator.h:46,
                 from /usr/include/c++/5/string:41,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/5/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = S; _Args = {int, int}; _Tp = S]':
/usr/include/c++/5/bits/alloc_traits.h:256:4:   required from 'static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = S; _Args = {int, int}; _Alloc = std::allocator<S>; std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> = void]'
/usr/include/c++/5/bits/alloc_traits.h:402:16:   required from 'static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = S; _Args = {int, int}; _Alloc = std::allocator<S>; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]'
/usr/include/c++/5/bits/vector.tcc:96:30:   required from 'void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int, int}; _Tp = S; _Alloc = std::allocator<S>]'
prog.cpp:14:23:   required from here
/usr/include/c++/5/ext/new_allocator.h:120:4: error: new initializer expression list treated as compound expression [-fpermissive]
  { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
    ^
/usr/include/c++/5/ext/new_allocator.h:120:4: error: no matching function for call to 'S::S(int)'
prog.cpp:7:8: note: candidate: S::S()
 struct S {
        ^
prog.cpp:7:8: note:   candidate expects 0 arguments, 1 provided
prog.cpp:7:8: note: candidate: constexpr S::S(const S&)
prog.cpp:7:8: note:   no known conversion for argument 1 from 'int' to 'const S&'
prog.cpp:7:8: note: candidate: constexpr S::S(S&&)
prog.cpp:7:8: note:   no known conversion for argument 1 from 'int' to 'S&&'
stdout
Standard output is empty