i simply made class with shared pointer to vector of end point as private,
class HTTPService_resolve
{
public:
HTTPService_resolve();
HTTPService_resolve(std::string);
boost::shared_ptr<std::vector<boost::asio::ip::tcp::endpoint>> resolve_func();
boost::shared_ptr<std::vector<boost::asio::ip::tcp::endpoint>> resolve_func(std::string);
boost::asio::io_service& get_service_reference();
boost::shared_ptr<std::vector<boost::asio::ip::tcp::endpoint>> get_vec_endpoints_ptr();
private:
boost::asio::io_service service_resolve_ios;
std::string service_resolve_protocol_host_URL;
std::string host_name;
std::string port_service;
boost::asio::ip::tcp::resolver protocol_host_URL_resolver{ service_resolve_ios };
boost::shared_ptr<std::vector<boost::asio::ip::tcp::endpoint>> vec_endpoints_ptr = boost::make_shared<std::vector<boost::asio::ip::tcp::endpoint>>();//(new HTTPResponse);
};
then i made method to get this shared pointer which return shared pointer ,
boost::shared_ptr<std::vector<boost::asio::ip::tcp::endpoint>> HTTPService_resolve::get_vec_endpoints_ptr()
{
return vec_endpoints_ptr;
}
in constructor of other class which is declared to take argument as shared pointer to vector i pass the previous method .
HTTPClient::HTTPClient(const symbols_enum symbol = symbols_enum::EURUSD, date day = date(2012, Jan, 10), boost::shared_ptr<std::vector<boost::asio::ip::tcp::endpoint>> client_vec_endpoints_ptr) :
symbol(symbol),
day(day),
client_vec_endpoints_ptr(client_vec_endpoints_ptr)
{
}
but intellisense tells me that the argument is different.
the argument is shared pointer to vector of endpoint and std allocator,
and because of std allocator part ,it gives error.
i do not know why the vector changed to one taking std allocator part,i even do not know what is std allocator and never used it before.
this is client class showing its methods and members:
class HTTPClient
{
friend class HTTPService_resolve;
public:
/*
// set up the worker threads in a thread group
22 boost::thread_group workers;
23 for (int i = 0; i < 3; ++i) {
24 workers.create_thread([&service, &mtx]() {
25 PRINT_ARGS("Starting worker thread ");
26 service.run();
27 PRINT_ARGS("Worker thread done");
28 });
29 }
*/
HTTPClient(const symbols_enum, date);
HTTPClient(const symbols_enum, date, boost::shared_ptr<std::vector<boost::asio::ip::tcp::endpoint>>);
boost::asio::io_service& HTTPClient::get_service_reference();
boost::shared_ptr<HTTPRequest> create_request(unsigned int);
boost::shared_ptr<HTTPRequest> create_request(unsigned int, std::string);
//void create_tasks(const symbols_enum&, date);
void create_tasks(const symbols_enum , date);
void fetch_day();
void close();
private:
//boost::asio::io_service m_ios;//HTTPService_resolve>>1
boost::asio::io_service m_ios;
std::unique_ptr<boost::asio::io_service::work> m_work;
std::unique_ptr<boost::thread> m_thread;
symbols_enum symbol = symbols_enum::EURUSD;
date day = date(2012, Jan, 10);
boost::shared_ptr<std::vector<boost::asio::ip::tcp::endpoint>> client_vec_endpoints_ptr;
};