[Insight-developers] C++11 make_pair() isn't compatible with the uses of 'make_pair<const std::string, std::string>(tag, value)'
nmgzjf at gmail.com
nmgzjf at gmail.com
Mon Sep 30 05:02:59 EDT 2013
Hi,
You are right, "make_pair()' has changed in C++ 11 version. The following is the explanation of Stephan T. Lavavej of Visual C++ Libraries Developer.
C++03: template <class T1, class T2> pair<T1, T2> make_pair(T1 x, T2 y);
C++11: template <class T1, class T2> pair<V1, V2> make_pair(T1&& x, T2&& y);
There are several subtleties in both the C++03 and C++11 versions (C++03 taking values - changed from C++98 - and C++11 returning decayed types). As I recall, VC10 had four overloads, which may or may not have corresponded to a Working Paper at some point in time, but the final version of C++11 specifies the single function template above, and that's what we've implemented in VC11. It's Saturday, so I hope you won't mind if I skip directly to the high-level summary:
C++11 make_pair() is now a perfect forwarding function. This is a good thing (it's more efficient), but it's also incompatible with most uses of explicit template arguments. As it turns out, that's fine because make_pair()'s whole purpose in life is to be used WITHOUT explicit template arguments.
He also gives the suggestion of this situation, we can get the detail from the page: http://connect.microsoft.com/VisualStudio/feedback/details/691756/std-make-pair-error-in-vc11
Jianfeng Zhao
Inner Mongolia University of Science and Technology
nm_zjf at imust.edu.cn
发件人: Hauke Heibel
发送时间: 2013年9月30日, 星期一 16:56
收件人: nmgzjf at gmail.com
抄送: insight-developers at itk.org
Hi,
I think the use of std::make_pair in OptionList.cxx is causing the issue. Either directly instantiate a std::pair or apply a static_cast to the parameters of std::make_pair. The helper std::make_pair is intended to be used without explicitly specifying the template parameters; they should be automatically deduced.
Regards,
Hauke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130930/09c0cab7/attachment.htm>
More information about the Insight-developers
mailing list