我在尝试编译代码时收到以下错误。
Error: no match for 'operator=' (operand types are 'std::vector<int>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}')|
----- >>>>> vertex[j] = trip.id[new_trip_id];
struct cardata{
std::vector<int> x;
std::vector<int> y;
std::vector<int> id;
std::vector<int> limit;
std::vector<bool> status;
};
struct tripdata{
std::vector<int> x;
std::vector<int> y;
std::vector<int> id;
std::vector<double> length;
std::vector<double> distance;
std::vector<double> travtime;
std::vector<double> trav;
std::vector<bool> status;
};
std::vector<std::vector<int> > Ridesharing::TAB(std::vector<std::vector<int> > input){
int new_trip_id;
int new_car_id;
for ( unsigned int i = 0; i < input.size(); i++ ) {
rideout.push_back(std::vector<int>());
if (input[i].size() > 1){
new_car_id = input[i][0];
vector<int> vertex[0] = 0; //// Test if car.id[2] = 2 = new_car_id
vector<double> x[0] = 0;
vector<double> y[0] = 0;
vector<double> demand[0] = 1;
vector<double> ready[0] = 0;
vector<double> dueDate[0] = 7284;
vector<double> unload[0] = 0;
for ( unsigned int j = 1; j < input[i].size(); j++ ){
new_trip_id = input[i][j] - car.id.size();
vertex[j] = trip.id[new_trip_id];
x[j] = trip.distance[new_trip_id].push_back(abs(car.x[new_car_id] - trip.x.[new_trip_id]) + abs(car.y[new_car_id] - trip.y.[new_trip_id]) + trip.length[new_trip_id]);
y[j] = trip.travtime[new_trip_id].push_back((abs(car.x[new_car_id] - trip.x.[new_trip_id]) + abs(car.y[new_car_id] - trip.y.[new_trip_id]) + (trip.length[new_trip_id]))/trip.trav[new_trip_id]);
demand[j] = 1; //// Note: x, y values will be rewritten for each cluster
ready[j] = 0;
dueDate[j] = 7284;
unload[j] = (rand() % 10 + 1);
}
}