Boost logo

Boost :

Subject: Re: [boost] Am I missing something or is Boost: String dictionary?
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2013-05-06 11:36:21


On May 6, 2013, at 8:26 AM, david.hagood_at_[hidden] wrote:

> One of the libraries I work with (libXML2) has a very useful concept
> called a string dictionary, and I am surprised this doesn't appear to be
> in either STL or Boost. Am I missing something, or is Boost missing
> something?
>
> The basic idea is:
> Given you have a string and an instance of a dictionary, you can:
> 1) check if the string is already in the dictionary.
> 2) Add the string to the dictionary and return the dictionary entry (if
> the string is already present, return existing entry).
>
> The dictionary entries contain a copy of the string. Entries may be
> compared for equality/inequality in O(1) time. The lifespan of the strings
> in the entry is managed by the entry.

Except for the O(1) part, this sounds to me like a:
        std::map<std::string, -dictionary entry;>

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk