Answer the question
In order to leave comments, you need to log in
Why is there a "cannot be implicitly captured because no default capture mode has been specified" error when passed to a function?
Why is there an error when I write this code?
bool f(char* buf, char* key_input) {
boost::beast::string_view key = std::string(key_input);
//todo
ws.set_option(websocket::stream_base::decorator([](websocket::request_type& req) {
req.set("Api-Key", key);
})
);
//todo
C:\Project2.cpp(40,1): error C3493: 'key' cannot be implicitly captured because no default capture mode has been specified
C:\Project2.cpp(39,56): error C2440: '': cannot convert from 'int' to 'boost::beast::websocket::stream_base::decorator'
C:\Project2.cpp(41,14): message : No constructor could take the source type, or constructor overload resolution was ambiguous
Done building project "Project2.vcxproj" -- FAILED.
ws.set_option(websocket::stream_base::decorator([](websocket::request_type& req) {
req.set("Api-Key", "28369a57-7476-4d2c-9b9d-574d4282b428");
})
);
template<class Allocator>
void
basic_fields<Allocator>::
set(field name, string_view const& value)
template<class Allocator>
void
basic_fields<Allocator>::
set(string_view sname, string_view const& value)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question