mercredi 26 octobre 2016

C++ can't pass vector by reference

Inside of my main() I have this vector declaration:

int main()
{
    vector<functions_interface *> devices{ &device_1, &device_3 };
}

Outside I have this function, which accepts the vector:

inline void process_request_buffer(string request_buffer, int quantity, vector<functions_interface *> &devices) {
}

If I compile this I get the following:

*error C2664: 'void process_request_buffer(std::string,int,std::vector> &)': cannot convert argument 3 from 'std::vector,std::allocator<_Ty>>' to 'std::vector> &'

Aucun commentaire:

Enregistrer un commentaire