[libstdc++ PATCH] tr1::mem_fn and tr1::function, take 2

Paolo Carlini pcarlini@suse.de
Wed Feb 23 09:01:00 GMT 2005


well...

I have a comment. Any chance you can put some of this infrastructure

>int truncate_float(float x) { return (int)x; }
>long truncate_double(double x) { return (long)x; }
>
>struct do_truncate_float_t
>{
>  do_truncate_float_t()
>  {
>    ++live_objects;
>  }
>
>  do_truncate_float_t(const do_truncate_float_t&)
>  {
>    ++live_objects;
>  }
>
>  ~do_truncate_float_t()
>  {
>    --live_objects;
>  }
>
>  int operator()(float x) { return (int)x; }
>
>  static int live_objects;
>};
>
>int do_truncate_float_t::live_objects = 0;
>
>struct do_truncate_double_t
>{
>  do_truncate_double_t()
>  {
>    ++live_objects;
>  }
>
>  do_truncate_double_t(const do_truncate_double_t&)
>  {
>    ++live_objects;
>  }
>
>  ~do_truncate_double_t()
>  {
>    --live_objects;
>  }
>
>  long operator()(double x) { return (long)x; }
>
>  static int live_objects;
>};
>
>int do_truncate_double_t::live_objects = 0;
>
>struct X
>{
>  int bar;
>
>  int foo()                   { return 1; }
>  int foo_c() const           { return 2; }
>  int foo_v()  volatile       { return 3; }
>  int foo_cv() const volatile { return 4; }
>};
>
>  
>
inside testsuite_tr1.h and then avoid

>{
>  test01();
>  test02();
>  test03();
>  test04();
>  test05();
>  test06();
>  test07();
>  test08();
>  test09();
>  
>
so many tests in a single file?!? Usually, for various reasons, we don't
do that (i.e., in case of failures/regressions, you can see immediately
which specific feature is at issue).

Also, please add attribute unused to the bool test (see the beginning
of testsuite_hooks.h to understand why we are keeping this, for now
at least)

Paolo.



More information about the Gcc-patches mailing list