On Tue, 10 Aug 2004 20:13:00 -0400, "David Hilsee"
<davidhilseenews@yahoo.com> wrote:
[color=blue]
>"Bob Hairgrove" <invalid@bigfoot.com> wrote in message
>news:7mjih05gvea010c69940jljk1dq8e8epfo@4ax.com.. .
>[snip][color=green]
>> Another (IMHO better) solution would be to provide const access to the
>> map itself, i.e. a member function such as:
>>
>> const map<string,string> & the_map() const { return my_map; }[/color]
>
>The begin()/end() approach buys you a little flexibility if you ever decide
>to drop std::map to use a different container. In theory, one could replace
>the container and provide an iterator that provided the same interface as
>std::map::const_iterator.[/color]
I'm not so sure ... map<> is a peculiar beast (behavior of its
operator[] compared to vector::operator[], for example). Clients will
probably want to know the exact type of container they are using,
especially if it's a map.
If you really want to replace the container, you could also provide a
typedef for it and merely change the typedef.
--
Bob Hairgrove
NoSpamPlease@Home.com