int best_fit_bin_packing(weight *b, weight *e) {
	set<float> bins;
	set<float>::iterator p;
	for (weight *i = b; i < e; ++i) {
		wt = *i;
		p = bins.lower_bound(wt);
	    if (p != bins.end()) { // wt fits here so replace with fuller bin
			cap = *p;
     	    bins.erase(p); 
        }
		else cap = 1
  	    bins.insert( cap - t );
    }
	return bins.size();
}

Given array W of n weights, 
b = W, e = W + n.
	for (weight *i = b; i < e; ++i) {
        ... access *i ...
    }
	for (int i = 0; i < n; ++i) {
        ... access W[i] ...
    }
