<div>I don't think that a GCC extension would be allowed. Could you do this with enable_if?</div><div><br></div>CC'ing Richard Smith since if this is possible in C++03, he'll almost surely know how to do it.<div>
<br></div><div>--Sean Silva<br><br><div class="gmail_quote">On Thu, Sep 13, 2012 at 6:58 PM, Nick Kledzik <span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank">kledzik@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have the traits based approach working for C++11.   I have a way to get it<br>
working for C++03, but it uses the typeof() (aka __typeof__()) language extension.<br>
It that extension legal in the LLVM code base?  It is used in one place<br>
in lib/Support/Unix/Program.inc.  But that might be ok because that file<br>
is  only compile by gcc or clang??<br>
<br>
I need a way to test if a class implements a particular method with particular parameters.<br>
<br>
template <class T><br>
struct has_scalar_trait<br>
{<br>
private:<br>
  struct two {char _[2];};<br>
  static two test(...);<br>
  template <class U, class X><br>
  static __typeof__(U::doScalar(declval<class IO&>(), declval<X&>()), char()) test(U& u, X& x);<br>
public:<br>
  static const bool value = (sizeof(test(declval<ScalarTrait<T>&>(), declval<T&>())) == 1);<br>
};<br>
<br>
<br>
-Nick<br>
<div class="HOEnZb"><div class="h5"><br>
On Aug 28, 2012, at 9:28 AM, Sean Silva wrote:<br>
>> This format is the most compact.  It is also the format that is easiest for<br>
>> YAML I/O to validate, since the legal keys at any point are well defined.<br>
>> What is lost though, is the original order of shapes.  For lld, that does<br>
>> not matter.  In fact the lld::File model does not have one list of all<br>
>> Atoms.  It already has four lists.  One for each Atom kind.<br>
><br>
> Ok, this seems satisfactory. I think it's important though that there<br>
> actually be an order here, for the sake of testing. E.g. it could be<br>
> that the keys are output in alphabetical order.<br>
><br>
> --Sean Silva<br>
<br>
</div></div></blockquote></div><br></div>