Creating vector of clients
Hello, what is the easiest way to create one sslclient per thread in a boost::thread_pool?
I am trying to create a vector of httplib::SSLClient but I get errors like:
error:` no matching function for call to ‘httplib::SSLClient::SSLClient()’
with vector<httplib::SSLClient> clientDataVector(4)
or
error: static assertion failed: result type must be constructible from value type of input range 137 | static_assert(is_constructible<_ValueType2, decltype(*__first)>::value,
with vector<httplib::SSLClient> clientDataVector { httplib::SSLClient("host.com"), httplib::SSLClient("host.com"), httplib::SSLClient("host.com"), httplib::SSLClient("host.com") };
@jmbouffa, thanks for the feedback, but there is no easy clean way since the default and copy constructors are intentionally removed from SSLClient. If you want to put SSL Client instances into a vector with the initializer, you have to do it with std::shared_ptr unfortunately. But the vector will be std::vector<std::shared_ptr<httplib::SSLClient>>, and it doesn't look beautiful...
This is actually not a question for cpp-httplib, but a general C++ question to make a vector of a class which doesn't have the default and copy constructor. I think you can find answers in stackoverflow.
Hope it helps!
Ah, I see. I suspected as much, but I wasn't sure. Thanks for the clarification!