Thanks for the suggestions. I'm expecting that there will be relatively few unique name keys, so using ordered_non_unique with O(m*log(n)) complexity will definitely be more efficient,


On Fri, Aug 2, 2013 at 1:05 AM, Dominique Devienne <ddevienne@gmail.com> wrote:
On Fri, Aug 2, 2013 at 9:36 AM, Joaquín Mª López Muñoz <joaquin@tid.es> wrote:
  std::unique_copy(
    get<name>(taggedNodes).begin(),get<name>(taggedNodes).end(),
    boost::make_function_output_iterator(&dump_entry_name),
    equal_entry_name);
This is O(n), n being the number of total elements.

Ah yes, entries are clustered by keys during iteration whether ordered or hashed, I now realize. Thanks.

Here's my STL-challenged version using BOOST_FOREACH. Less generic of course, but hopefully not buggy. --DD

if (!get<name>(taggedNodes).empty()) {
  int curr_key = get<name>(taggedNodes).begin()->name;
  std::cout << curr_key << std::endl;
  BOOST_FOREACH (const TaggedNodeEntry& x, get<name>(taggedNodes)) {
    if (x.name != curr_key) {
      curr_key = x.name;
      std::cout << curr_key << std::endl;
    }
  }
}


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users