On 04/05/2016 12:25 PM, Victoria Ponce wrote:
>
> I'm working in a deal code that uses C++11's range-based for loops and
> it runs perfectly in linux. Now, I'm trying to run this code in a Mac
> and I'm getting the following error:
>
> */Users/victoria/workspace_mac/moving_boundary_model/moving_boundary_code/source/localequation_homogenized.cc:115:1:
> **error: **'auto' deduced as*
>
> *'dealii::TriaActiveIterator<dealii::DoFCellAccessor<dealii::hp::DoFHandler<2,
> 2>, false> >' in declaration of 'cell' and deduced as*
>
> *'dealii::TriaIterator<dealii::DoFCellAccessor<dealii::hp::DoFHandler<2,
> 2>, false> >' in declaration of 'endc'*
>
> auto cell = pi.dof_handler.begin_active(),
>
>
> I've tried to find out why I'm getting this error but I've had no
> luck... I wanted to know if this error has to do with the fact that my
> clang version doesn't support C++11's range-based for loops? or could be
> related to the way I installed deal ?
>
> At this moment, I'm using deal developer version and Apple LLVM version
> 7.0.0 (clang-700.1.76) which I think should support auto loops.
>
> Any comments or suggestions would be highly appreciated.
The problem is that you wrote something like
auto cell = dh.begin_active(),
endc = dh.end();
Here, the two right hand sides have different types (the first is an
*active* cell iterator, the latter just a regular cell iterator; but
they can be converted into each other). Your compiler then doesn't know
which type you want for the 'auto' (which should be the same type for
both variables).
You should be able to solve this by declaring the two variables separately:
auto cell = dh.begin_active();
auto endc = dh.end();
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@math.tamu.edu
www:
http://www.math.tamu.edu/~bangerth/