counting-fragmented.cc 390 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <embb/algorithms/algorithms.h>

/**
 * Example using embb::algorithms::Count and CountIf.
 *
 * Counting elements of a range that fulfill certain properties.
 */
void RunCounting() {
  #include "algorithms/counting/setup-snippet.h"

  #include "algorithms/counting/count-snippet.h"
  assert(count == 2);

  #include "algorithms/counting/count_if-snippet.h"
  assert(count == 6);
}