← Back to team overview

dolfin team mailing list archive

Re: Use of const and shared_ptr

 

2008/10/28 Garth N. Wells <gnw20@xxxxxxxxx>:
>
>
> Johan Jansson wrote:
>> Anders Logg wrote:
>>> We've been using const and shared_ptr differently in a few places. The
>>> correct usage as far as I understand is
>>>
>>>   std::tr1::shared_ptr<const Foo> foo
>>>
>>> and not
>>>
>>>   const std::tr1::shared_ptr<Foo> foo
>>>
>>> The first (correct) usage corresponds to
>>>
>>>   const Foo& foo
>>>
>>> or
>>>
>>>   const Foo* foo
>>>
>>> that is, one cannot change the object pointed to.
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> DOLFIN-dev mailing list
>>> DOLFIN-dev@xxxxxxxxxx
>>> http://www.fenics.org/mailman/listinfo/dolfin-dev
>>>
>>
>> Hi!
>>
>> Just a question about TR1, is it really a good idea to use? It's not
>> part of the standard, and I guess then you're quite dependent on a
>> specific compiler, or?
>>
>
> The tr1 shared pointers come from Boost, which we already have as a
> dependency, so if we run into compiler issues with std::tr1::shared_ptr
> we can just shift to boost::shared_ptr.
>
> Garth

I think TR1 is supported by most compilers, and it will be part of
the upcoming C++09 standard. Do you know of a particular compiler
that doesn't support it?

--
Martin


References