*
* This code has a problem: it creates four memory leaks because the first
* vector above is created with pointers to elements that are allocated with
- * <code>new</code> but never destroyed. Without C++11, you would have another
- * problem: brace-initializer don't exist in earlier C++ standards.
+ * <code>new</code> but never destroyed.
*
* The solution to the second of these problems is to create two static
* member functions that can create vectors. Here is an example:
MaterialIdEqualTo::MaterialIdEqualTo (const types::material_id material_id,
const bool only_locally_owned)
:
- // Note: matrial_ids is a const member and has to be populated with a
- // constructor. Unfortunately, C++98/03 does not allow the use of an
- // initializer list. Therefore, treat material_id as an array of one
- // element.
- // This is well defined according to [expr.add].4 (ISO 14882).
- material_ids (&material_id, &material_id+1),
- only_locally_owned (only_locally_owned)
+ material_ids {material_id},
+ only_locally_owned (only_locally_owned)
{}
ActiveFEIndexEqualTo::ActiveFEIndexEqualTo (const unsigned int active_fe_index,
const bool only_locally_owned)
:
- // Note: active_fe_indices is a const member and has to be populated
- // with a constructor. Unfortunately, C++98/03 does not allow the use
- // of an initializer list. Therefore, treat active_fe_index as an array
- // of one element.
- // This is well defined according to [expr.add].4 (ISO 14882).
- active_fe_indices (&active_fe_index, &active_fe_index+1),
- only_locally_owned (only_locally_owned)
+ active_fe_indices {active_fe_index},
+ only_locally_owned (only_locally_owned)
{}
/*------------------------- filtered_iterator.h ------------------------*/
#endif
/*------------------------- filtered_iterator.h ------------------------*/
-
-