title: Function returning function pointer in C++11
body: <p>I have the following C code :</p>
  
  <pre><code>inline void ChooseNext ( std::vector&lt;RLS&gt; &amp; rls_vec_left_to_choose_,
             int &amp; num_files_left_to_choose_, const int algo_,
             std::vector&lt;RLS&gt; &amp; rls_vec_chosen_ )
  {
  if ( ( num_files_left_to_choose_ &gt; 0 )
   &amp;&amp; ( rls_vec_left_to_choose_.size ( ) &gt; 0 ) )
    {
      switch ( algo_ )
        {
        case kAlgo1 :
          std::sort ( rls_vec_left_to_choose_.begin ( ), rls_vec_left_to_choose_.end ( ), SortFunc1 );
          break;
        case kAlgo2 :
        default:
          std::sort ( rls_vec_left_to_choose_.begin ( ), rls_vec_left_to_choose_.end ( ), SortFunc2 );
          break;
        }
        // etc
     }
   }
  </code></pre>
  
  <p>Where the sort functions are all of the type :</p>
  
  <p><code>bool SortFunc1 ( const RLS &amp; d1, const RLS &amp; d2 ) ;</code></p>
  
  <p>How do I change it to a function that takes <code>const int algo_</code> and returns a <code>bool (*) ( const RLS &amp; d1, const RLS &amp; d2 )</code> and then remove the switch case in this function ?
  I am trying to do it in as readable a manner as possible, and hopefully using C++11 features.</p>