[Proto] typeof in Hello World example
Dear all,
I have recently started reading about Proto and am only crawling through the user guide. So, sorry if the question is too newbie...
I see in the Hello World example at the Getting Started section
http://boost.org/doc/libs/1_44_0/doc/html/proto/users_guide.html#boost_proto...
in the Hello World example, the following header is also included:
On 11/15/2010 6:47 AM, Hossein Haeri wrote:
Dear all,
I have recently started reading about Proto and am only crawling through the user guide. So, sorry if the question is too newbie...
I see in the Hello World example at the Getting Started section
http://boost.org/doc/libs/1_44_0/doc/html/proto/users_guide.html#boost_proto...
in the Hello World example, the following header is also included:
Correct.
I was suspicious that this is not needed for this very example. So, I removed it and GCC 4.5.1 compiled it happily. I see also that this header is not included in the same example in the Example section of the user guide:
http://boost.org/doc/libs/1_44_0/doc/html/proto/users_guide.html#boost_proto...
I should fix that.
Am I right in guessing that this header is not needed then?
No, it belongs there for portability, but it is not needed on all compilers. Some older compilers don't have a decltype, typeof or __typeof__ operator. On those compilers, types need to be registered with the Boost.Typeof library, which provides emulation. With gcc-4.5, you are free to disregard this include. -- Eric Niebler BoostPro Computing http://www.boostpro.com
Dear Eric,
No, it belongs there for portability, but it is not needed on all compilers. Some older compilers don't have a decltype, typeof or __typeof__ operator. On those compilers, types need to be registered with the Boost.Typeof library, which provides emulation.
So, which part of the code will need this, could you explain? And, I would also suggest that you add the same explanation -- perhaps in the form of a footnote -- to the user guide. TIA, --Hossein
On 11/15/2010 11:33 AM, Hossein Haeri wrote:
Dear Eric,
No, it belongs there for portability, but it is not needed on all compilers. Some older compilers don't have a decltype, typeof or __typeof__ operator. On those compilers, types need to be registered with the Boost.Typeof library, which provides emulation.
So, which part of the code will need this, could you explain? And, I would also suggest that you add the same explanation -- perhaps in the form of a footnote -- to the user guide.
The proto::_default transform needs typeof (built-in or emulated) to know type type of an expression, so it knows what to return. Good idea about the users' guide. -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (2)
-
Eric Niebler
-
Hossein Haeri