title: boost mpl lower_bound at runtime
body: <p>In the code below I have a class <code>SizedFoo</code> which is constructed for a specific size. The class <code>GeneralFoo</code> holds an array of <code>SizedFoos</code> of different sizes and then the function <code>Bar</code> will find the <code>SizedFoo</code> which is initialized for the smallest size larger than the passed in parameter. I know boost mpl has the lower_bound function but that can only be used with a statically known value, is there any way to use an equivalent at runtime? </p>
  
  <pre><code>class SizedFoo {
    ...
  public:
    SizedFoo(size_t size);
    void Bar();
  }
  
  template&lt;size_t... sizes_in&gt;
  class GeneralFoo {
    typedef vector_c&lt;size_t, sizes_in...&gt;::type raw_sizes;
    typedef sort&lt;raw_sizes&gt;::type sorted_raw_sizes;
    typedef unique&lt;sorted_raw_vector, equal_to&lt;_1, _2&gt; &gt;::type sizes;
  
    std::array&lt;SizedFoos*, size&lt;sizes&gt;::type&gt; foos_;
  public:
    GeneralFoo() {
      ...
    }
    void Bar(size_t size) {
      //DOESN'T WORK: size is a runtime value
      //auto index = lower_bound&lt;sizes, size&gt;::type;
      auto index = ... //What goes here?
      foos_[index]-&gt;Bar();
    }
  }
  </code></pre>