[Dune] [Dune-Commit] dune-common r7040 - in trunk/dune/common: . test
Martin Nolte
nolte at mathematik.uni-freiburg.de
Thu Oct 18 00:05:22 CEST 2012
Hi Christian,
as far as I know, explicit cast operators do not conform to C++03. Have you
tried an older gcc version (e.g. 4.1)?
Best,
Martin
On 10/17/2012 11:08 PM, christi at dune-project.org wrote:
> Author: christi
> Date: 2012-10-17 23:08:39 +0200 (Wed, 17 Oct 2012)
> New Revision: 7040
>
> Modified:
> trunk/dune/common/shared_ptr.hh
> trunk/dune/common/test/shared_ptrtest.cc
> Log:
> [shared_ptr]
> test initialization from nullptr
> fix bool cast of Dune implementation
>
> Modified: trunk/dune/common/shared_ptr.hh
> ===================================================================
> --- trunk/dune/common/shared_ptr.hh 2012-10-17 17:06:23 UTC (rev 7039)
> +++ trunk/dune/common/shared_ptr.hh 2012-10-17 21:08:39 UTC (rev 7040)
> @@ -110,6 +110,11 @@
> return rep_==0 ? 0 : rep_->rep_;
> }
>
> + /** \brief Checks if shared_ptr manages an object, i.e. whether get() != 0. */
> + explicit operator bool() const {
> + return rep_ != 0&& rep_->rep_ != 0;
> + }
> +
> /** \brief Swap content of this shared_ptr and another */
> inline void swap(shared_ptr& other);
>
>
> Modified: trunk/dune/common/test/shared_ptrtest.cc
> ===================================================================
> --- trunk/dune/common/test/shared_ptrtest.cc 2012-10-17 17:06:23 UTC (rev 7039)
> +++ trunk/dune/common/test/shared_ptrtest.cc 2012-10-17 21:08:39 UTC (rev 7040)
> @@ -128,6 +128,11 @@
> shared_ptr<double> bar(new double(43.0));
> assert(bar);
>
> + // test constructor from nullptr
> + shared_ptr<double> bar_null(nullptr);
> + assert(!bar_null);
> + assert(!bar_null.get());
> +
> // test reset()
> bar.reset();
> assert(!bar);
>
>
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit
--
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>
Universität Freiburg phone: +49-761-203-5630
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