#include <iostream>
#include <string>
int main(
int argc, 
const char * argv[]) {
 
  
  using weight_type = int;
  
  class my_weight_fct {
  public:
    
    weight_type operator()(
const value_type& str)
 const {
 
      return (str.size() % 2 == 0) ? 1 : 0;
    }
  };
  
  using my_cachedmeasure_type =
  using my_weighted_deque_type =
  
  my_weighted_deque_type d = { "Let's", "divide", "this", "sequence", "of",
                               "strings", "into", "two", "pieces" };  
  
  weight_type nb_even_length_strings = d.
get_cached();
 
  std::cout << "nb even-length strings: " << nb_even_length_strings << std::endl;
  
  my_weighted_deque_type f;
  
  d.split([=] (weight_type v) { return v >= nb_even_length_strings/2; }, f);
  
  std::cout << "d = " << std::endl;
  d.for_each([] (
value_type& s) { std::cout << s << 
" "; });
 
  std::cout << std::endl;
  std::cout << std::endl;
  
  std::cout << "f = " << std::endl;
  f.for_each([] (
value_type& s) { std::cout << s << 
" "; });
 
  std::cout << std::endl;
  
  return 0;
  
}