<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 05/07/2022 à 23:35,
      <a class="moz-txt-link-abbreviated" href="mailto:Bart.Duijndam@ziggo.nl">Bart.Duijndam@ziggo.nl</a> a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:004901d890b7$3240c4b0$96c24e10$@ziggo.nl">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        font-size:10.0pt;
        font-family:"Courier New";}span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US">Hi Even,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US">Thanks for your help; you’re working late…<o:p></o:p></span></p>
        <p><span style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US">Please be advised that I already started with
            using </span><span
            style="font-size:9.5pt;font-family:Consolas;color:black">nn_dynamic_pointer_cast<ProjectedCRS>(crs);</span><o:p></o:p></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US">But then I got the following obscure error
            message:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">D:\Source\VS19\PROJ\test\unit\test_crs.cpp(5516):
            error C2280:
'dropbox::oxygen::nn<osgeo::proj::crs::ProjectedCRSPtr>::nn(PtrType)':
            attempting to reference a deleted function<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">         
            with<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">         
            [<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">             
            PtrType=osgeo::proj::crs::ProjectedCRSPtr<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">         
            ]<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black"> 
            D:\Source\VS19\PROJ\include\proj\nn.hpp(126): note: see
            declaration of
            'dropbox::oxygen::nn<osgeo::proj::crs::ProjectedCRSPtr>::nn'<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black"> 
            D:\Source\VS19\PROJ\include\proj\nn.hpp(126): note:
'dropbox::oxygen::nn<osgeo::proj::crs::ProjectedCRSPtr>::nn(PtrType)':
            function was explicitly deleted<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">         
            with<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">         
            [<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">             
            PtrType=osgeo::proj::crs::ProjectedCRSPtr<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">         
            ]<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black"> 
            ninja: build stopped: subcommand failed.<o:p></o:p></span></p>
        <p class="MsoNormal"
          style="margin-left:36.0pt;text-autospace:none"><span
            style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="margin-left:36.0pt"><span
            style="font-size:9.5pt;font-family:Consolas;color:black">Build
            All failed.</span></p>
      </div>
    </blockquote>
    <p>Ah I see, the issue is that
      nn_dynamic_pointer_cast<ProjectedCRS> returns a
      ProjectedCRSPtr (which is a typedef for
      std::shared_ptr<ProjectedCRS>), which is potentially null
      (because nn_dynamic_pointer_cast<> might fail and return a
      null pointer). Whereas your function signature returns a
      ProjectedCRSNNPtr, which is an alias for nn<ProjectedCRSPtr>,
      that is a ProjectedCRSPtr that cannot be null. The conversion from
      ProjectedCRSPtr to nn<ProjectedCRSPtr> must be explicit, so
      you should typically modify the return statement to be return
      NN_CHECK_ASSERT(proj_crs);<br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
      cite="mid:004901d890b7$3240c4b0$96c24e10$@ziggo.nl">
      <div class="WordSection1">
        <p class="MsoNormal" style="margin-left:36.0pt"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US"><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US">So that’s why I tried </span><span
            style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">ProjectedCRSNNPtr</span><span
            style="color:#1F497D;mso-fareast-language:EN-US"> <span
              lang="EN-US">instead</span></span></p>
      </div>
    </blockquote>
    That would leak to a shared pointer of a null-nullable shared
    pointer. Definitely not something you want.<br>
    <blockquote type="cite"
      cite="mid:004901d890b7$3240c4b0$96c24e10$@ziggo.nl">
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"><span
              lang="EN-US"><o:p></o:p></span></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US">Cheers,<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US">Bart<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span
                lang="EN-US"> Even Rouault
                <a class="moz-txt-link-rfc2396E" href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a> <br>
                <b>Sent:</b> Tuesday, 5 July 2022 23:30<br>
                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:Bart.Duijndam@ziggo.nl">Bart.Duijndam@ziggo.nl</a>; <a class="moz-txt-link-abbreviated" href="mailto:proj@lists.osgeo.org">proj@lists.osgeo.org</a><br>
                <b>Subject:</b> Re: [PROJ] Affine transformation using
                DERIVEDPROJCRS<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt;text-autospace:none"><span
                style="font-size:9.5pt;font-family:Consolas;color:black">   
              </span><span
                style="font-size:9.5pt;font-family:Consolas;color:blue">auto</span><span
                style="font-size:9.5pt;font-family:Consolas;color:black">
                proj_crs = nn_dynamic_pointer_cast<</span><span
                style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">ProjectedCRSNNPtr</span><span
                style="font-size:9.5pt;font-family:Consolas;color:black">>(crs);</span><o:p></o:p></p>
          </div>
        </blockquote>
        <p>==> <span
            style="font-size:9.5pt;font-family:Consolas;color:blue">auto</span><span
            style="font-size:9.5pt;font-family:Consolas;color:black">
            proj_crs = nn_dynamic_pointer_cast<ProjectedCRS>(crs);</span><o:p></o:p></p>
        <pre>-- <o:p></o:p></pre>
        <pre><a href="http://www.spatialys.com" moz-do-not-send="true" class="moz-txt-link-freetext">http://www.spatialys.com</a><o:p></o:p></pre>
        <pre>My software is free, but my time generally not.<o:p></o:p></pre>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>