
"Thorsten Ottosen" wrote:
The following trait is supposed to make it easier to forward arguments in generic code and in particular string literals. For example, I will use it when I update boost.assign to use const T& arguments instead of T arguments. It could also be used to make a better version of std::make_pair():
template< class F, class S > inline std::pair< typename decayed<F>::type, typename decayed<S>::type > make_pair( const F& f, const S& s ) { return std::pair< typename decayed<F>::type, typename decayed<S>::type >( f, s ); }
Any thoughts from the type_traits authors? Do anybody mind if I add this to the cvs and make some docs for the type-traits library?
Attached is file which works on VC6 / Intel 7 / BCB6.4. Only tiny changes were needed. This boost::make_pair would be very useful. Questions: - maybe other name than decayed could be found - isn't parameter passing suboptimal for e.g. boost::make_pair(0, 0)? - following compiles: struct ABC { explicit ABC(int) {} }; std::pair<ABC, ABC> p5 = boost::make_pair(1, 2); std::pair<ABC, ABC> p5 = std::make_pair(1, 2); // also compiles Maybe the boost::make_pair could be coded somehow to disable this behavior (ABC constructor is explicit). /Pavel begin 666 decayed.cpp M(VEN8VQU9&4@/&)O;W-T+W)A;F=E+W9A;'5E7W1Y<&4N:'!P/@T*(VEN8VQU M9&4@/&)O;W-T+W1Y<&5?=')A:71S+VES7V%R<F%Y+FAP<#X-"B-I;F-L=61E M(#QB;V]S="]M<&PO979A;%]I9BYH<' ^#0HC:6YC;'5D92 \8F]O<W0O;7!L M+VED96YT:71Y+FAP<#X-"B-I;F-L=61E(#QU=&EL:71Y/@T*#0IN86UE<W!A M8V4@8F]O<W0-"GL-"B @("!N86UE<W!A8V4@9&5C87EE9%]D971A:6P-"B @ M("![#0H@(" @(" @('1E;7!L871E/"!C;&%S<R!4(#X-"B @(" @(" @<W1R M=6-T(')A;F=E7W!O:6YT97(-"B @(" @(" @>PT*(" @(" @(" @(" @='EP M961E9B!C;VYS="!T>7!E;F%M92!R86YG95]V86QU93Q4/CHZ='EP92H@='EP M93L-"B @(" @(" @?3L-"B @("!]#0H@(" @#0H@(" @=&5M<&QA=&4\(&-L M87-S(%0@/@T*(" @('-T<G5C="!D96-A>65D#0H@(" @>PT*(" @(" @("!T M>7!E9&5F('1Y<&5N86UE(&UP;#HZ979A;%]I9E]C/"!I<U]A<G)A>3Q4/CHZ M=F%L=64L#0H@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @ M(" @(&1E8V%Y961?9&5T86EL.CIR86YG95]P;VEN=&5R/%0^+ T*(" @(" @ M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @("!M<&PZ.FED96YT M:71Y/%0^(#XZ.G1Y<&4@='EP93L-"B @("!].PT*#0H@(" @=&5M<&QA=&4\ M(&-L87-S($8L(&-L87-S(%,@/@T*(" @(&EN;&EN92!S=&0Z.G!A:7(\('1Y M<&5N86UE(&1E8V%Y960\1CXZ.G1Y<&4L( T*(" @(" @(" @(" @(" @(" @ M(" @('1Y<&5N86UE(&1E8V%Y960\4SXZ.G1Y<&4@/@T*(" @(&UA:V5?<&%I M<B@@8V]N<W0@1B8@9BP@8V]N<W0@4R8@<R I#0H@(" @>PT*(" @(" @("!R M971U<FX@<W1D.CIP86ER/"!"3T]35%]$14150T5$7U194$5.04U%(&1E8V%Y M960\1CXZ.G1Y<&4L( T*(" @(" @(" @(" @(" @(" @(" @(" @("!"3T]3 M5%]$14150T5$7U194$5.04U%(&1E8V%Y960\4SXZ.G1Y<&4@/B@@9BP@<R I M.R -"B @("!]#0H-"GT-"@T*(VEN8VQU9&4@/'-T<FEN9SX-"@T*#0II;G0@ M;6%I;B@I#0I[#0HC:68@*&1E9FEN960@7U]"3U),04Y$0U]?*0T*(R @<')A M9VUA('=A<FX@+3@P,#0@+R\@;F5V97(@=7-E9"!V86QU97,-"B-E;F1I9@T* M(" @(&)O;W-T.CID96-A>65D/&EN=#XZ.G1Y<&4@:6YT96=E<B ](#$[#0H@ M(" @8F]O<W0Z.F1E8V%Y960\8VAA<ELR73XZ.G1Y<&4@8VAA<E]P='(@/2 B M9F]O(CL-"B @("!B;V]S=#HZ9&5C87EE9#QC;VYS="!C:&%R6S)=/CHZ='EP M92!C8VAA<E]P='(@/2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