Skip to content

Instantly share code, notes, and snippets.

@ryanjdew
Created May 25, 2014 12:44
Show Gist options
  • Save ryanjdew/6d2d51006a3c58bff8c0 to your computer and use it in GitHub Desktop.
Save ryanjdew/6d2d51006a3c58bff8c0 to your computer and use it in GitHub Desktop.
C++ reduce MarkLogic UDF function
template<class T>
void Bucketeer<T>::
reduce(const AggregateUDF* _o, Reporter& reporter)
{
/* Merge matches found */
const Bucketeer<T> *o = (const Bucketeer<T>*)_o;
typename std::multimap<String, T> o_buckets = o->buckets;
for (typename std::multimap<String, T>::iterator it = o_buckets.begin(); it != o_buckets.end(); it++) {
buckets.insert(typename std::pair <String, T> (it->first, it->second));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment