vendredi 6 décembre 2019

Am getting cannot bind non-const lvalue reference of type ‘Type&’ to an rvalue of type 'Type'

Here's my class

    class DriverPoint
{
public:

  DriverPoint(){};
  DriverPoint (DriverPoint& dp) = default;
  DriverPoint(double lat, double lon)
  {
    _lat = lat;
    _lon = lon;
  }
  double _lat;
  double _lon;
};

// main
    DriverPoint driverPoint(lat, _long); 
        vector.push_back(driverPoint);

When i try to compile it am getting

cannot bind non-const lvalue reference of type ‘DriverPoint&’ to an rvalue of type ‘DriverPoint’

Aucun commentaire:

Enregistrer un commentaire