From: Daniel Arndt Date: Wed, 20 Feb 2019 14:54:10 +0000 (+0100) Subject: Avoid ambiguous function declaration/variable initialization X-Git-Tag: v9.1.0-rc1~321^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd04520d13f6c563c4f3b573901933c1b0509f01;p=dealii.git Avoid ambiguous function declaration/variable initialization --- diff --git a/include/deal.II/lac/block_linear_operator.h b/include/deal.II/lac/block_linear_operator.h index 50868de147..12f9aba972 100644 --- a/include/deal.II/lac/block_linear_operator.h +++ b/include/deal.II/lac/block_linear_operator.h @@ -623,8 +623,8 @@ block_operator(const BlockMatrixType &block_matrix) using BlockType = typename BlockLinearOperator::BlockType; - BlockLinearOperator return_op( - BlockPayload(block_matrix, block_matrix)); + BlockLinearOperator 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::BlockType; - BlockLinearOperator 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 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::BlockType; - BlockLinearOperator return_op( - BlockPayload(block_matrix, block_matrix)); + BlockLinearOperator 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 &block_operator, const BlockLinearOperator &diagonal_inverse) { - LinearOperator return_op( - (typename BlockPayload::BlockType(diagonal_inverse))); + LinearOperator 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 &block_operator, const BlockLinearOperator &diagonal_inverse) { - LinearOperator return_op( - (typename BlockPayload::BlockType(diagonal_inverse))); + LinearOperator 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; diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index b8e118fe11..00b19126e0 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -389,9 +389,9 @@ operator+(const LinearOperator &first_op, } else { - LinearOperator return_op( + LinearOperator return_op{ static_cast(first_op) + - static_cast(second_op)); + static_cast(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 & first_op, } else { - LinearOperator return_op( + LinearOperator return_op{ static_cast(first_op) * - static_cast(second_op)); + static_cast(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 LinearOperator transpose_operator(const LinearOperator &op) { - LinearOperator return_op(op.transpose_payload()); + LinearOperator 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 &op, Solver & solver, const Preconditioner & preconditioner) { - LinearOperator return_op( - op.inverse_payload(solver, preconditioner)); + LinearOperator 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 &op, Solver & solver, const LinearOperator &preconditioner) { - LinearOperator return_op( - op.inverse_payload(solver, preconditioner)); + LinearOperator 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 identity_operator(const std::function &reinit_vector) { - LinearOperator return_op((Payload())); + LinearOperator return_op{Payload()}; return_op.reinit_range_vector = reinit_vector; return_op.reinit_domain_vector = reinit_vector; @@ -909,7 +909,7 @@ template LinearOperator null_operator(const LinearOperator &op) { - LinearOperator return_op(op.null_payload()); + LinearOperator return_op{op.null_payload()}; return_op.is_null_operator = true; @@ -946,7 +946,7 @@ template < LinearOperator mean_value_filter(const std::function &reinit_vector) { - LinearOperator return_op((Payload())); + LinearOperator 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 return_op( - Payload(operator_exemplar, matrix)); + LinearOperator 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