C++ Coding Exercise - Maximum unit to load into a truck given it size
Names are better then indices. Consider
  struct box_type {
      int amount;
      int capacity;
  };

box.amount seems cleaner that box[0].

Along the same line, declaring such a structure would let you define
  friend bool box_type::operator &lt;(const box_type&amp; l, const box_type&amp; r) {
      return l.capacity &lt; r.capacity;
  }

and eliminate a lambda, as well as sort_boxtypes function.

I don't like max_units (it sounds like there are min_units somewhere). Similarly, truck_size is a truck size, a constant; consider a remaining_size or something like that.

It feels that a truck_size &gt;= 0 comparison shall be done beforehand. Consider
  std::sort(boxes.begin(), boxes.end());
  for (auto box = boxes.rbegin(); box != boxes.rend(); ++box) {
      auto the_load = std::min(box.amount, remaining_size());
      units += box.capacity * box.amount;
      remaining_size -= the_load;
      if (remaining_size == 0) {
          break;
      }
  }
  return units;