本文介绍了POD类成员订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 在我的POD课程中: class MyPodClass { public: MyPodClass (MyCtorArgs); ... 私人: 短数据1; 短数据2; 长数据3; }; 我可以依赖数据项的顺序 为他们出现了?章&诗歌? 感谢您的帮助。 迈克。 解决方案 您只能在两个不同的访问说明符之间。 9.2 / 12. V - 请在邮寄回复时从我的地址中删除资金 取决于是否你想知道POD课程的答案或你的 例子(绝对不是POD),答案是肯定的或不是。 取决于您是想知道POD类的答案还是你的例子(绝对不是POD),答案是肯定还是否定。 看起来对我来说是PODdy - 为什么它不是POD? Mike:是的,它是POD,而C ++定义了 访问说明符之间的数据成员的顺序(private:" )。您的实现必须在数据成员之间和之后定义包装 。 请编写有效的简单代码,不要memcpy()这些数据,或者 eqivalent。 - Phlip http://www.greencheese.org/ZeekLand < - 不是博客!!! In my POD class: class MyPodClass{public:MyPodClass(MyCtorArgs);...private:short data1;short data2;long data3;}; Can I rely on the order of the data itemsbeing as they appear? Chapter & verse? Thanks for your help.Mike. 解决方案 You can, only between two different access specifiers. 9.2/12. V--Please remove capital As from my address when replying by mail Depending on whether you want to know the answer for a POD class or for yourexample (which is definitely not a POD), the answer is either yes or no. Depending on whether you want to know the answer for a POD class or for your example (which is definitely not a POD), the answer is either yes or no. It look PODdy to me - why it not a POD? Mike: Yes, it''s a POD, and C++ defines the order of data members betweenaccess specifiers ("private:"). Your implementation must define the packingbetween and after data members. Please write simple code that works, and do not memcpy() this data, or theeqivalent.--Phlip http://www.greencheese.org/ZeekLand <-- NOT a blog!!! 这篇关于POD类成员订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-01 09:31