Run Code  | API  | Code Wall  | Users  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

EmplaceStructNoCtorWithCommentedFix

Language: Layout:
+ ] Compiler args + ] Show input
Compilation time: 0.63 sec, absolute service time: 0,8 sec 
edit mode |  history
Error(s):
In file included from source_file.cpp:3:
In file included from /usr/include/c++/v1/iostream:38:
In file included from /usr/include/c++/v1/ios:216:
In file included from /usr/include/c++/v1/__locale:15:
In file included from /usr/include/c++/v1/string:439:
In file included from /usr/include/c++/v1/algorithm:628:
/usr/include/c++/v1/memory:1731:31: error: no matching constructor for initialization of 'subject'
            ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
                              ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/memory:1647:18: note: in instantiation of function template specialization 'std::__1::allocator<subject>::construct<subject, char const (&)[5], int, int>' requested here
            {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
                 ^
/usr/include/c++/v1/memory:1493:14: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<subject> >::__construct<subject, char const (&)[5], int, int>' requested here
            {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
             ^
/usr/include/c++/v1/vector:1639:25: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<subject> >::construct<subject, char const (&)[5], int, int>' requested here
        __alloc_traits::construct(this->__alloc(),
                        ^
source_file.cpp:21:9: note: in instantiation of function template specialization 'std::__1::vector<subject, std::__1::allocator<subject> >::emplace_back<char const (&)[5], int, int>' requested here
    sub.emplace_back( "Math", 70, 0 );
        ^
source_file.cpp:7:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 3 were provided
struct subject
       ^
source_file.cpp:7:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 3 were provided
source_file.cpp:7:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 3 were provided
1 error generated.