Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitri Naumov
ogs
Commits
c6a64ea8
Commit
c6a64ea8
authored
4 years ago
by
Dmitri Naumov
Committed by
Lars Bilke
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[MaL] Avoid MSVC C4180 warnings.
Use perfect forwarding, store by value.
parent
3fda6879
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MathLib/Nonlinear/Root1D.h
+9
-6
9 additions, 6 deletions
MathLib/Nonlinear/Root1D.h
with
9 additions
and
6 deletions
MathLib/Nonlinear/Root1D.h
+
9
−
6
View file @
c6a64ea8
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
#include
<cmath>
#include
<cmath>
#include
<limits>
#include
<limits>
#include
<type_traits>
#include
<type_traits>
#include
<utility>
#include
"BaseLib/Error.h"
#include
"BaseLib/Error.h"
namespace
MathLib
namespace
MathLib
...
@@ -48,7 +50,7 @@ class RegulaFalsi
...
@@ -48,7 +50,7 @@ class RegulaFalsi
public:
public:
//! Initializes finding a root of the \c Function \c f in the interval
//! Initializes finding a root of the \c Function \c f in the interval
//! [\c a, \c b].
//! [\c a, \c b].
RegulaFalsi
(
Function
const
&
f
,
double
a
,
double
b
)
RegulaFalsi
(
Function
&
&
f
,
double
a
,
double
b
)
:
_f
(
f
),
_a
(
a
),
_b
(
b
),
_fa
(
f
(
a
)),
_fb
(
f
(
b
))
:
_f
(
f
),
_a
(
a
),
_b
(
b
),
_fa
(
f
(
a
)),
_fb
(
f
(
b
))
{
{
static_assert
(
std
::
is_same_v
<
double
,
decltype
(
f
(
0.0
))
>
,
static_assert
(
std
::
is_same_v
<
double
,
decltype
(
f
(
0.0
))
>
,
...
@@ -114,7 +116,7 @@ public:
...
@@ -114,7 +116,7 @@ public:
double
getRange
()
const
{
return
std
::
abs
(
_a
-
_b
);
}
double
getRange
()
const
{
return
std
::
abs
(
_a
-
_b
);
}
private
:
private
:
Function
const
&
_f
;
Function
_f
;
double
_a
,
_b
,
_fa
,
_fb
;
double
_a
,
_b
,
_fa
,
_fb
;
};
};
...
@@ -124,11 +126,12 @@ private:
...
@@ -124,11 +126,12 @@ private:
*
*
* \see https://en.wikipedia.org/wiki/False_position_method#Improvements_in_regula_falsi
* \see https://en.wikipedia.org/wiki/False_position_method#Improvements_in_regula_falsi
*/
*/
template
<
typename
SubType
,
typename
Function
>
template
<
typename
SubType
,
typename
Function
>
RegulaFalsi
<
SubType
,
Function
>
RegulaFalsi
<
SubType
,
Function
>
makeRegulaFalsi
(
Function
&&
f
,
makeRegulaFalsi
(
Function
const
&
f
,
double
const
a
,
double
const
b
)
double
const
a
,
double
const
b
)
{
{
return
RegulaFalsi
<
SubType
,
Function
>
(
f
,
a
,
b
);
return
RegulaFalsi
<
SubType
,
Function
>
(
std
::
forward
<
Function
>
(
f
)
,
a
,
b
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment