You want to sort my_array, declared below. Which choice is the correct call to std::sort, using a lambda expression as the comparison function?

Advertisement

std::array<uint32_t, 50> my_array;

  • A
    std::sort(my_array.begin(), my_array.end(),
    [](uint32_t a, uint32_t b) {
    return a < b;
    })
  • B
    lambda(uint32_t a, uint32_t b){
    return a < b;
    }
    std::sort(my_array.begin(), my_array.end(), lambda);
  • C
    std::sort(my_array.begin(), my_array.end(),
    lambda(uint32_t a, uint32_t b){
    return a < b;
    })
  • D
    lambda(uint32_t a, uint32_t b){
    return a < b;
    }
    std::sort(my_array.begin(), my_array.end(), &lambda);
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend