Skip to content

Commit 5035050

Browse files
author
Daniel Kroening
committed
full constructor for goto_programt::instructiont
The constructor uses rvalue references. This eliminates the need to assign the fields of instructiont twice.
1 parent 4787717 commit 5035050

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/goto-programs/goto_program.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,23 @@ class goto_programt
432432
{
433433
}
434434

435+
/// Constructor that can set all members
436+
instructiont(
437+
codet &&_code,
438+
const irep_idt &_function,
439+
source_locationt &&_source_location,
440+
goto_program_instruction_typet _type,
441+
exprt &&_guard,
442+
targetst &&_targets)
443+
: code(std::move(_code)),
444+
function(_function),
445+
source_location(std::move(_source_location)),
446+
type(std::move(_type)),
447+
guard(std::move(_guard)),
448+
targets(std::move(_targets))
449+
{
450+
}
451+
435452
/// Swap two instructions
436453
void swap(instructiont &instruction)
437454
{

0 commit comments

Comments
 (0)