|
Boost Users : |
Subject: Re: [Boost-users] [assign][cref_list_of] Creating anonymous list of pairs
From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2014-09-22 04:45:43
On 21-09-2014 21:54, Aaron Levy wrote:
> Is there a way to generate a list of value pairs using ref_list_of or cref_list_of. Maybe such a list could be assigned to a map. Something like:
>
> ref_list_of<size, std::pair<std::string, std::string>>("foo", "bar")("foo1", "bar1")...;
>
> or
>
> std::map<string, string> names = ref_list_of<size, std::pair<std::string, std::string>>("foo", "bar")("foo1", "bar1")...;
I would have thought e.g. cref_list_of to work fine with std::pair<const
char*,const char*>. I assume you want to use this because of preformance
issues. The [c]ref_list_of functions needs to get a compile-time size so
it can create an array for the storage.
regards
-Thorsten
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net