|
Boost : |
From: Johan Nilsson (johan.nilsson_at_[hidden])
Date: 2002-12-05 07:32:04
"Rozental, Gennadiy" <gennadiy.rozental_at_[hidden]> wrote in message
news:1373D6342FA1D4119A5100E029437F6401169E92_at_clifford.devo.ilx.com...
> > > If anyone interested I have more generic solution, that
> > includes both
[...snip...]
> namespace mapping {
> template<class Key, class Value, class ImplPolicy >
> class fixed_sized;
>
> // constructed by Key1,Value1,Key2,Value2 ... list plus "invalid value"
>
> template<class Key, class Value, class ImplPolicy >
> class dynamic;
>
> // constrcted by "invalid_value"
>
"invalid_value" ... is what / defined how?
> };
>
> mapping::fixed_sized<const_string,int,array_impl_policy> test_mapping1(
> "Key1", 1,
> "Key2", 2,
> "QWE", 3,
> 0
> );
>
> mapping::dyanamic<const_string,int,map_impl_policy> test_mapping2(
> "Key1", 1,
> "Key2", 2,
> "QWE", 3,
> 0
> );
What would the actual signature of the constructor be in this case?
>
> mapping::dynamic<const_string,int,map_impl_policy > test_mapping3( 0 );
> test_mapping3.add( "Key1", 1 );
> test_mapping3.add( "Key2", 2 );
> test_mapping3.add( "QWE" , 3 );
>
> Usage:
> test_mapping1["Key1"]
> test_mapping2["Key2"]
> test_mapping3["QWE"]
>
And reverse lookup? Does it require another template instantiation with the
first two parameters defined in reverse order, or is it included through
operator [] overloading, or ...?
// Johan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk