Boost logo

Boost :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-07-03 20:49:42


On Thu, Jul 3, 2008 at 7:36 PM, Jeremy Pack <rostovpack_at_[hidden]> wrote:
> Steven,
>
> Yeah, it isn't quite that simple. I read the original post too quickly and
> thought he was referring to a different function.
>
> I originally had a type for that std::map<int, factory<word> >, so it would
> be something like type_factory_map<int, word>, which isn't much terser.
> (thus, I removed it)
>
> I think the best solution here is to make your own typedefs for your
> specific case.
>
> There are a couple of other places in the library though where I intend to
> add the type of typedefs suggested.
>
> Jeremy
>
> On Thu, Jul 3, 2008 at 5:26 PM, Steven Watanabe <watanabesj_at_[hidden]>
> wrote:
>
>> AMDG
>>
>> Jeremy Pack wrote:
>>
>>> Yep! Good idea. I'll take care of it.
>>>
>>>
>>>> For example, right now I have to do this:
>>>>
>>>> factory_map fm;
>>>> std::map<int, factory<word> > & factory_list = fm.get<word, int>();
>>>>
>>>> It would be ideal to do this instead:
>>>>
>>>> factory_map fm;
>>>> factory_map::type& factory_list = fm.get<word, int>();
>>>>
>>>>
>>>
>> Is it really that easy? Doesn't the result of get
>> depend on the particular template arguments?
>> I don't quite see how you can get away with a
>> single typedef.
>>
>> In Christ,
>> Steven Watanabe
>>
>>
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

Why not turn factory_map::get() into a template utility class of some
sort instead of a function? That would give you the ability to typedef
the std::map. Perhaps another option is to do the following:

factory_map<word, int>::get()

I don't have time right now to give any reasonable ideas, but those
are just some thoughts off the top of my head. Later on I may try to
help find an alternative to this. All I know for sure is that exposing
std::map seems like an implementation detail, and specifying the same
template parameters more than once also bothers me slightly.


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