Topic: Is it legal for a POD-struct to have a member with pointer to member function type?


Author: Richard Corden <richard.corden@gmail.com>
Date: Tue, 11 Aug 2009 14:11:51 CST
Raw View
Consider this example:

   class B
   {
   public:
     void foo ();
   };

   struct A
   {
     int i;

     typedef void (B::*pf) ();
     pf m_pf;
   };

Is 'A' a POD-struct?

I cannot find anything in the standard that says that it shouldn't be.

Regards,

Richard


--
Richard Corden

[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: litb <Schaub-Johannes@web.de>
Date: Wed, 12 Aug 2009 11:57:33 CST
Raw View
On 11 Aug., 22:11, Richard Corden <richard.cor...@gmail.com> wrote:
> Consider this example:
>
>        class B
>        {
>        public:
>            void foo ();
>        };
>
>        struct A
>        {
>            int i;
>
>            typedef void (B::*pf) ();
>            pf m_pf;
>        };
>
> Is 'A' a POD-struct?
>
> I cannot find anything in the standard that says that it shouldn't be.
>

It was a non-POD in c++98, but has been made a POD in C++03. So in C+
+03, you won't find anything that says it's a non-POD :)

Have fun :)


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]