[Insight-developers] C++11 make_pair() isn't compatible with the uses of 'make_pair<const std::string, std::string>(tag, value)'

Matt McCormick matt.mccormick at kitware.com
Mon Sep 30 12:21:48 EDT 2013


Hi Jianfeng,

Thanks for notifying the list.

If you would like to submit a patch, your contributions are welcome
and appreciated!  The instructions for ITKApps [1] are the same as ITK
[2].

Our Chinese contribution expert, Xiaoxiao, can also help with any
translation needs! :-)

Thanks,
Matt

[1] http://itk.org/gitweb?p=ITKApps.git
[2] http://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySoftwareProcess/SubmitAPatchToGerrit/index.html

On Mon, Sep 30, 2013 at 9:02 AM,  <nmgzjf at gmail.com> wrote:
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list