Skip to content
Snippets Groups Projects
Commit 4f9687a0 authored by Jan Trávníček's avatar Jan Trávníček Committed by Jan Trávníček
Browse files

clang-tidy: accept parameter by forwarding reference

parent 8338a8e0
No related branches found
No related tags found
1 merge request!211Merge jt
......@@ -84,8 +84,9 @@ public:
}
 
template < class T >
void setVariable ( std::string name, T value ) {
auto variable = std::make_shared < abstraction::ValueHolder < T > > ( std::move ( value ), false );
void setVariable ( std::string name, T && value ) {
static_assert ( ! std::is_reference_v < T >, "The argument is expected to be an rvalue reference." );
auto variable = std::make_shared < abstraction::ValueHolder < std::decay_t < T > > > ( std::forward < T > ( value ), false );
setVariableInt ( std::move ( name ), variable );
}
 
......
......@@ -297,7 +297,7 @@ TEST_CASE ( "Cli", "[unit][cli]" ) {
std::string in = "<Integer>1</Integer>";
 
cli::Environment environment;
environment.setVariable ( "in", in );
environment.setVariable ( "in", std::move ( in ) );
testLine ( "execute sax::SaxParseInterface $in | Move - | xml::Parse - | Add <(One) - | xml::Compose - | sax::SaxComposeInterface - > $out", environment );
std::string out = environment.getVariable < std::string > ( "out" );
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment