]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid ambiguous function declaration/variable initialization 7742/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 20 Feb 2019 14:54:10 +0000 (15:54 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 20 Feb 2019 15:11:09 +0000 (16:11 +0100)
include/deal.II/lac/block_linear_operator.h
include/deal.II/lac/linear_operator.h

index 50868de147f5e31921169fa589bfcb6def20af76..12f9aba972a9812e3a844f8757175cbe6ac1b6c7 100644 (file)
@@ -623,8 +623,8 @@ block_operator(const BlockMatrixType &block_matrix)
   using BlockType =
     typename BlockLinearOperator<Range, Domain, BlockPayload>::BlockType;
 
-  BlockLinearOperator<Range, Domain, BlockPayload> return_op(
-    BlockPayload(block_matrix, block_matrix));
+  BlockLinearOperator<Range, Domain, BlockPayload> return_op{
+    BlockPayload(block_matrix, block_matrix)};
 
   return_op.n_block_rows = [&block_matrix]() -> unsigned int {
     return block_matrix.n_block_rows();
@@ -698,9 +698,8 @@ block_operator(
   using BlockType =
     typename BlockLinearOperator<Range, Domain, BlockPayload>::BlockType;
 
-  BlockLinearOperator<Range, Domain, BlockPayload> return_op(
-    (BlockPayload())); // TODO: Create block payload so that this can be
-                       // initialized correctly
+  // TODO: Create block payload so that this can be initialized correctly
+  BlockLinearOperator<Range, Domain, BlockPayload> return_op{BlockPayload()};
 
   return_op.n_block_rows = []() -> unsigned int { return m; };
 
@@ -744,8 +743,8 @@ block_diagonal_operator(const BlockMatrixType &block_matrix)
   using BlockType =
     typename BlockLinearOperator<Range, Domain, BlockPayload>::BlockType;
 
-  BlockLinearOperator<Range, Domain, BlockPayload> return_op(
-    BlockPayload(block_matrix, block_matrix));
+  BlockLinearOperator<Range, Domain, BlockPayload> return_op{
+    BlockPayload(block_matrix, block_matrix)};
 
   return_op.n_block_rows = [&block_matrix]() -> unsigned int {
     return block_matrix.n_block_rows();
@@ -910,8 +909,8 @@ block_forward_substitution(
   const BlockLinearOperator<Range, Domain, BlockPayload> &block_operator,
   const BlockLinearOperator<Domain, Range, BlockPayload> &diagonal_inverse)
 {
-  LinearOperator<Range, Range, typename BlockPayload::BlockType> return_op(
-    (typename BlockPayload::BlockType(diagonal_inverse)));
+  LinearOperator<Range, Range, typename BlockPayload::BlockType> return_op{
+    typename BlockPayload::BlockType(diagonal_inverse)};
 
   return_op.reinit_range_vector  = diagonal_inverse.reinit_range_vector;
   return_op.reinit_domain_vector = diagonal_inverse.reinit_domain_vector;
@@ -1025,8 +1024,8 @@ block_back_substitution(
   const BlockLinearOperator<Range, Domain, BlockPayload> &block_operator,
   const BlockLinearOperator<Domain, Range, BlockPayload> &diagonal_inverse)
 {
-  LinearOperator<Range, Range, typename BlockPayload::BlockType> return_op(
-    (typename BlockPayload::BlockType(diagonal_inverse)));
+  LinearOperator<Range, Range, typename BlockPayload::BlockType> return_op{
+    typename BlockPayload::BlockType(diagonal_inverse)};
 
   return_op.reinit_range_vector  = diagonal_inverse.reinit_range_vector;
   return_op.reinit_domain_vector = diagonal_inverse.reinit_domain_vector;
index b8e118fe112cf4a69843e8e76c217308c63ef64a..00b19126e099db58bb6c061c33cd8463e8692162 100644 (file)
@@ -389,9 +389,9 @@ operator+(const LinearOperator<Range, Domain, Payload> &first_op,
     }
   else
     {
-      LinearOperator<Range, Domain, Payload> return_op(
+      LinearOperator<Range, Domain, Payload> return_op{
         static_cast<const Payload &>(first_op) +
-        static_cast<const Payload &>(second_op));
+        static_cast<const Payload &>(second_op)};
 
       return_op.reinit_range_vector  = first_op.reinit_range_vector;
       return_op.reinit_domain_vector = first_op.reinit_domain_vector;
@@ -585,9 +585,9 @@ operator*(const LinearOperator<Range, Intermediate, Payload> & first_op,
     }
   else
     {
-      LinearOperator<Range, Domain, Payload> return_op(
+      LinearOperator<Range, Domain, Payload> return_op{
         static_cast<const Payload &>(first_op) *
-        static_cast<const Payload &>(second_op));
+        static_cast<const Payload &>(second_op)};
 
       return_op.reinit_domain_vector = second_op.reinit_domain_vector;
       return_op.reinit_range_vector  = first_op.reinit_range_vector;
@@ -649,7 +649,7 @@ template <typename Range, typename Domain, typename Payload>
 LinearOperator<Domain, Range, Payload>
 transpose_operator(const LinearOperator<Range, Domain, Payload> &op)
 {
-  LinearOperator<Domain, Range, Payload> return_op(op.transpose_payload());
+  LinearOperator<Domain, Range, Payload> return_op{op.transpose_payload()};
 
   return_op.reinit_range_vector  = op.reinit_domain_vector;
   return_op.reinit_domain_vector = op.reinit_range_vector;
@@ -693,8 +693,8 @@ inverse_operator(const LinearOperator<Range, Domain, Payload> &op,
                  Solver &                                      solver,
                  const Preconditioner &                        preconditioner)
 {
-  LinearOperator<Domain, Range, Payload> return_op(
-    op.inverse_payload(solver, preconditioner));
+  LinearOperator<Domain, Range, Payload> return_op{
+    op.inverse_payload(solver, preconditioner)};
 
   return_op.reinit_range_vector  = op.reinit_domain_vector;
   return_op.reinit_domain_vector = op.reinit_range_vector;
@@ -750,8 +750,8 @@ inverse_operator(const LinearOperator<Range, Domain, Payload> &op,
                  Solver &                                      solver,
                  const LinearOperator<Range, Domain, Payload> &preconditioner)
 {
-  LinearOperator<Domain, Range, Payload> return_op(
-    op.inverse_payload(solver, preconditioner));
+  LinearOperator<Domain, Range, Payload> return_op{
+    op.inverse_payload(solver, preconditioner)};
 
   return_op.reinit_range_vector  = op.reinit_domain_vector;
   return_op.reinit_domain_vector = op.reinit_range_vector;
@@ -856,7 +856,7 @@ template <
 LinearOperator<Range, Range, Payload>
 identity_operator(const std::function<void(Range &, bool)> &reinit_vector)
 {
-  LinearOperator<Range, Range, Payload> return_op((Payload()));
+  LinearOperator<Range, Range, Payload> return_op{Payload()};
 
   return_op.reinit_range_vector  = reinit_vector;
   return_op.reinit_domain_vector = reinit_vector;
@@ -909,7 +909,7 @@ template <typename Range, typename Domain, typename Payload>
 LinearOperator<Range, Domain, Payload>
 null_operator(const LinearOperator<Range, Domain, Payload> &op)
 {
-  LinearOperator<Range, Domain, Payload> return_op(op.null_payload());
+  LinearOperator<Range, Domain, Payload> return_op{op.null_payload()};
 
   return_op.is_null_operator = true;
 
@@ -946,7 +946,7 @@ template <
 LinearOperator<Range, Range, Payload>
 mean_value_filter(const std::function<void(Range &, bool)> &reinit_vector)
 {
-  LinearOperator<Range, Range, Payload> return_op((Payload()));
+  LinearOperator<Range, Range, Payload> return_op{Payload()};
 
   return_op.reinit_range_vector  = reinit_vector;
   return_op.reinit_domain_vector = reinit_vector;
@@ -1402,8 +1402,8 @@ linear_operator(const OperatorExemplar &operator_exemplar, const Matrix &matrix)
 {
   using namespace internal::LinearOperatorImplementation;
   // Initialize the payload based on the input exemplar matrix
-  LinearOperator<Range, Domain, Payload> return_op(
-    Payload(operator_exemplar, matrix));
+  LinearOperator<Range, Domain, Payload> return_op{
+    Payload(operator_exemplar, matrix)};
 
   // Always store a reference to matrix and operator_exemplar in the lambda
   // functions. This ensures that a modification of the matrix after the

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.