]> https://gitweb.dealii.org/ - dealii.git/commitdiff
In some situations, the C++ standard requires a copy constructor to be accessible...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 3 Feb 2004 14:54:53 +0000 (14:54 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 3 Feb 2004 14:54:53 +0000 (14:54 +0000)
git-svn-id: https://svn.dealii.org/trunk@8384 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/fe.h
deal.II/deal.II/include/fe/fe_system.h
deal.II/deal.II/source/fe/fe.cc

index fcbe0e078b78f90ce319f9f567c6d1519bbbecb0..aaff9e3621e17517712da9a68a5b4d96dbcf4a56 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -55,13 +55,23 @@ template <int dim> class FESystem;
 template <int dim>
 class FiniteElement : public FiniteElementBase<dim>
 {
-  private:
-                                    /**
-                                     * Copy constructor prohibited.
-                                     */
-    FiniteElement(const FESystem<dim>&);
-
   public:
+                                     /**
+                                      * Copy constructor. This one is declared
+                                      * as a public constructor to avoid
+                                      * certain compiler errors when a copy
+                                      * constructor is required even if it is
+                                      * not executed (for example when binding
+                                      * a temporary object to a constant
+                                      * reference). However, if you try to
+                                      * actually call it, it will throw an
+                                      * exception, since copying finite
+                                      * element objects is not really
+                                      * supported. If you want to copy such an
+                                      * object, use the @p{clone} function.
+                                      */
+    FiniteElement (const FiniteElement &);
+    
                                     /**
                                      * Constructor
                                      */
index 29ffd66bf7bdc40b7ede05fa7842a0d14886d002..3cdc39eb96ccd497ac344876654f814c4f281d8d 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
 template <int dim>
 class FESystem : public FiniteElement<dim>
 {
-                                    /**
-                                     * Copy constructor prohibited.
-                                     */
-    FESystem(const FESystem<dim>&);
-
   public:
 
                                     /**
index eabd70b3bd78b62a5bfa44b3e64f6f79dfbff697..dd9c5f779ba03c9b6a7e943bc642e7b6fb81f62b 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -621,7 +621,8 @@ compute_n_nonzero_components (const std::vector<std::vector<bool> > &nonzero_com
 template <int dim>
 FiniteElement<dim>::FiniteElement (const FiniteElementData<dim> &fe_data,
                                   const std::vector<bool> &restriction_is_additive_flags,
-                                  const std::vector<std::vector<bool> > &nonzero_components) :
+                                  const std::vector<std::vector<bool> > &nonzero_components)
+                :
                FiniteElementBase<dim> (fe_data,
                                        restriction_is_additive_flags,
                                        nonzero_components)
@@ -629,6 +630,22 @@ FiniteElement<dim>::FiniteElement (const FiniteElementData<dim> &fe_data,
 
 
 
+template <int dim>
+FiniteElement<dim>::FiniteElement (const FiniteElement<dim> &)
+                :
+                FiniteElementBase<dim> (FiniteElementData<dim>(),
+                                        std::vector<bool> (),
+                                        std::vector<std::vector<bool> >())
+{
+  Assert (false,
+          ExcMessage ("Finite element objects don't support copying "
+                      "semantics through the copy constructor. If "
+                      "you want to copy a finite element, use the "
+                      "clone() function."));
+}
+
+
+
 template <int dim>
 FiniteElement<dim>::~FiniteElement ()
 {}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.