Return an observable that emits grouped_observables, each of which corresponds to a unique key value and each of which emits those items from the source observable that share that key value.  
More...
Go to the source code of this file.
|  | 
| template<class... AN> | 
| auto | rxcpp::operators::group_by (AN &&...an) -> operator_factory< group_by_tag, AN... > | 
|  | Return an observable that emits grouped_observables, each of which corresponds to a unique key value and each of which emits those items from the source observable that share that key value.  More... 
 | 
|  | 
Return an observable that emits grouped_observables, each of which corresponds to a unique key value and each of which emits those items from the source observable that share that key value. 
- Template Parameters
- 
  
    | KeySelector | the type of the key extracting function |  | MarbleSelector | the type of the element extracting function |  | BinaryPredicate | the type of the key comparing function |  
 
- Parameters
- 
  
    | ks | a function that extracts the key for each item (optional) |  | ms | a function that extracts the return element for each item (optional) |  | p | a function that implements comparison of two keys (optional) |  
 
- Returns
- Observable that emits values of grouped_observable type, each of which corresponds to a unique key value and each of which emits those items from the source observable that share that key value.
- Sample Code
- bool less(int v1, int v2){ -     return v1 < v2; - } 
-             std::stringstream s; -             s << "Value " << v; -             return std::make_pair(v % 3, s.str()); -         }); -             [](std::pair<int, std::string> v){return v.first;}, -             [](std::pair<int, std::string> v){return v.second;}, -             less); -     values. -                 printf("OnNext: key = %d\n", key); -                     [key](const std::string& v){printf("[key %d] OnNext: %s\n", key, v.c_str());}, -                     [key](){printf("[key %d] OnCompleted\n", key);}); -             }, -             [](){printf("OnCompleted\n");}); 
- OnNext: key = 0 - [key 0] OnNext: Value 0 - OnNext: key = 1 - [key 1] OnNext: Value 1 - OnNext: key = 2 - [key 2] OnNext: Value 2 - [key 0] OnNext: Value 3 - [key 1] OnNext: Value 4 - [key 2] OnNext: Value 5 - [key 0] OnNext: Value 6 - [key 1] OnNext: Value 7 - [key 2] OnNext: Value 8 - [key 0] OnCompleted - [key 1] OnCompleted - [key 2] OnCompleted - OnCompleted 
- Sample Code
-             [](int v){return v % 3;}, -             [](int v){return 10 * v;}); -     values. -                 printf("OnNext: key = %d\n", key); -                     [key](int v){printf("[key %d] OnNext: %d\n", key, v);}, -                     [key](){printf("[key %d] OnCompleted\n", key);}); -             }, -             [](){printf("OnCompleted\n");}); 
- OnNext: key = 0 - [key 0] OnNext: 0 - OnNext: key = 1 - [key 1] OnNext: 10 - OnNext: key = 2 - [key 2] OnNext: 20 - [key 0] OnNext: 30 - [key 1] OnNext: 40 - [key 2] OnNext: 50 - [key 0] OnNext: 60 - [key 1] OnNext: 70 - [key 2] OnNext: 80 - [key 0] OnCompleted - [key 1] OnCompleted - [key 2] OnCompleted - OnCompleted 
      
        
          | #define RXCPP_OPERATORS_RX_GROUP_BY_HPP |