|
Boost : |
Subject: Re: [boost] [phoenix] comma woes
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-03-26 20:12:16
AMDG
On 03/26/2011 04:49 PM, Michael Caisse wrote:
> On 03/26/2011 04:39 PM, Michael Caisse wrote:
>> On 03/26/2011 04:33 PM, Steven Watanabe wrote:
>>> On 03/26/2011 04:26 PM, Michael Caisse wrote:
>>>> Unfortunately this is a common problem (statement.h). I agree that the
>>>> silent built-in should be changed.
>>>>
>>>> I have had problems with std::endl and phoenix in the past... this
>>>> version compiles fine:
>>>
>>> It doesn't compile with VS 2010.
>>>
>>
>> Hmmmm...
>>
>> I only have clang and gcc available right now. I'll take a look later
>> when I have access to an MS compiler.
>>
>> michael
>>
>
> Hi Steven -
>
> Hartmut just gave it a try on VS 2010 and it compiled/worked fine for
> him. We are both using Phoenix V3 from the trunk. Are you on a different
> version? What type of error(s) are you seeing?
>
trunk_at_70605
>cl -EHsc -ID:/boost/trunk scratch.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
scratch.cpp
C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\INCLUDE\ostream(604) : error C2248:
'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private
member declared in class 'std::basic_ios<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\INCLUDE\ios(176): see declaration of
'std::basic_ios<_Elem,_Traits>::basic_ios'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
This diagnostic occurred in the compiler generated function
'std::basic_ostream<_Elem,_Traits>::basic_ostream(const
std::basic_ostream<_Elem,_Traits> &)
'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
>type scratch.cpp
#include <boost/phoenix/phoenix.hpp>
#include <boost/phoenix/statement.hpp>
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
double sum = 0.0;
int factor = 10;
using namespace boost::phoenix;
using namespace boost::phoenix::placeholders;
std::vector<double> v(3);
v[0] = 1.0; v[1] = 2.0; v[2] = 3.0;
std::for_each(v.begin(), v.end(), (
ref(sum) += factor * _1,
std::cout << "Summed: " << ref(sum) << "\n" )
);
return 0;
}
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk