<div dir="ltr">Of course, I think there is no need to have different functions which differ only in the cast operation. We can use a template template parameter for the cast operation:<br><br><font face="monospace, monospace">    template <template<typename> class CastOp, typename DeclTy><br>    LLVM_NODISCARD bool import(DeclTy *&ToD, DeclTy *FromD) {<br>      if (auto Res = Importer.Import(FromD)) {<br>        ToD = CastOp<DeclTy>(*Res);<br>        return false;<br>      }<br>      return true;<br>    }<br></font><br>And then the usage:<br> <font face="monospace, monospace"> if (import<cast_or_null>(ToEPI.ExceptionSpec.SourceDecl,<br>                 FromEPI.ExceptionSpec.SourceDecl))<br>    return {};</font><div><br></div><div>Gabor</div><div><br></div><div>On Fri, May 18, 2018 at 8:52 PM Aleksei Sidorin <<a href="mailto:a.sidorin@samsung.com">a.sidorin@samsung.com</a>> wrote:<br>><br>> Sorry, I didn't got the idea. Could please you explain a bit more?<br>><br>> 18.05.2018 13:09, Gábor Márton via cfe-dev пишет:<br>> > An other idea, couldn't we just pass the cast operation as a template<br>> > template parameter?<br>> > _______________________________________________<br>> > cfe-dev mailing list<br>> > <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>><br>><br>> --<br>> Best regards,<br>> Aleksei Sidorin,<br>> SRR, Samsung Electronics<br>><br></div></div>