Reputation: 103693
I'm trying to use std::transform
to merge two equal size vectors into a vector of pairs.
int main()
{
vector<string> names;
// fill it with names
vector<int> nums;
// fill it with numbers
typedef pair<int,string> Pair_t;
vector<Pair_t> pv;
transform(nums.begin(), nums.end(),
names.begin(), back_inserter(pv),
make_pair<int,string>);
}
VC10 gives me:
'_OutIt std::transform(_InIt1,_InIt1,_InIt2,_OutIt,_Fn2)' : could not deduce template argument for '_OutIt' from 'std::back_insert_iterator<_Container>'
with
[
_Container=std::vector<Pair_t>
]
So why can't the template argument be deduced? And how do I fix it?
Upvotes: 1
Views: 318