[Dune] [Dune-Commit] dune-grid r7005 - trunk/dune/grid/sgrid

Martin Nolte nolte at mathematik.uni-freiburg.de
Thu Oct 14 15:40:46 CEST 2010


Hi Christian,

while I never really saw the need for using C++0x or TR1 arrays, I don't see 
the point of your change. In the TR1 case, you can simply write

template< class T
struct array : public std::array
{
   void fill ( const T &t ) { this->assign( t ); }
};

Ok, this would mean to repeat the constructors, too. But in my opinion it 
would solve the problem more eleganly.

But, as I don't care for TR1 stuff, go ahead if you like...

Martin

On 10/14/2010 03:33 PM, Christian Engwer wrote:
> Hi,
>
> I would consider this a non-c++0x-array. I have a modified m4 test
> which checks for the fill method. Only when fill is available
> std::array is used, otherwise the Dune replacement is used.
>
> Any strong arguments against commiting this patch? It would help us
> avoid the std::fill(...).
>
> Christian
>
> On Thu, Oct 14, 2010 at 11:42:25AM +0200, Andreas Dedner wrote:
>>
>> Hi.
>>
>> My std::array implementation (from
>> g++ (Gentoo 4.3.4 p1.0, pie-10.1.5) 4.3.4
>> ) has no fill method and on the web I found that one shoud use
>> the global std::fill(...) method.
>>
>> Best
>> Andreas
>>
>>
>> On 10/13/2010 11:22 PM, Christian Engwer wrote:
>>> Hi Martin,
>>>
>>> I am somewhat surprised. Reading the code in array.hh I
>>> assumed that only std::array is used, not the one in tr1.
>>>
>>> The standard says that c++0x has array::fill, while tr1 uses
>>> array::assign.
>>>
>>> Christian
>>>
>>> On Wed, Oct 13, 2010 at 09:34:24PM +0200, mnolte at dune-project.org wrote:
>>>> Author: mnolte
>>>> Date: 2010-10-13 21:34:23 +0200 (Wed, 13 Oct 2010)
>>>> New Revision: 7005
>>>>
>>>> Modified:
>>>>     trunk/dune/grid/sgrid/numbering.cc
>>>> Log:
>>>> array::fill does not always exist (is it called assign in TR1?)
>>>>
>>>>
>>>> Modified: trunk/dune/grid/sgrid/numbering.cc
>>>> ===================================================================
>>>> --- trunk/dune/grid/sgrid/numbering.cc	2010-10-13 13:41:28 UTC (rev 7004)
>>>> +++ trunk/dune/grid/sgrid/numbering.cc	2010-10-13 19:34:23 UTC (rev 7005)
>>>> @@ -103,7 +103,7 @@
>>>>   CubeMapper<dim>::CubeMapper ()
>>>>   {
>>>>       array<int,dim>   M;
>>>> -    M.fill(1);
>>>> +    std::fill( M.begin(), M.end(), 1 );
>>>>       make(M);
>>>>   }
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Dune-Commit mailing list
>>>> Dune-Commit at dune-project.org
>>>> http://lists.dune-project.org/mailman/listinfo/dune-commit
>>>>
>>> _______________________________________________
>>> Dune mailing list
>>> Dune at dune-project.org
>>> http://lists.dune-project.org/mailman/listinfo/dune
>>
>>
>> _______________________________________________
>> Dune mailing list
>> Dune at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune
>>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune

-- 
Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5642
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany




More information about the Dune mailing list