13 bool operator()(
const char *id1,
const char *id2)
const {
return std::strcmp(id1, id2) < 0; }
20 inline const char *
findOrInsert(
const char *
string)
throw();
23 typedef std::multiset<const char *, StringLess> IdSet;
26 std::allocator<char> stringAllocator;
32 for (std::multiset<const char *, StringLess>::iterator iter = idSet.begin(); iter != idSet.end(); iter++)
33 stringAllocator.deallocate(const_cast<char *>(*iter), std::strlen(*iter) + 1);
37 std::lock_guard<std::mutex> scoped_lock(
mutex);
39 IdSet::iterator pos = idSet.lower_bound(
string);
40 if (pos != idSet.end() && std::strcmp(*pos,
string) == 0)
43 std::size_t
size = std::strlen(
string) + 1;
44 char *
unique = stringAllocator.allocate(size);
45 std::memcpy(unique,
string, size);
47 idSet.insert(pos, unique);
52 namespace PhysicsTools {
Value & findOrInsert(std::map< Key, Value > &m, Key const &k)
tuple size
Write out results.