Perhaps in this case, it would be simpler to combine DistributeNode and AssimilateNode into a single function, which expects arg and a bool, and where this condition is encapsulated.

template<typename T>
void DistributeAndOptionallyAssimilateNode(T &&arg, bool assimilate)
{
       if  (assimilate)
       {
           DistributeNode(            arg  );
           AssimilateNode( forward<T>(arg) );
       }
       else
       {
           DistributeNode( forward<T>(arg) );
       }
}

 

Then ProcessNode is simplified and you can add a new line without too much danger.

 

template<typename T>
void ProcessNode(T &&arg)
{
       NormaliseNode(arg);
       DistributeAndOptionallyAssimilateNode(std::forward<T>(arg), NodeManager::mode == NodeManager::ModeAssimilate);
}


With something like relocation, the compiler can give an error, if a relocated variable is reused (after carelessly adding an additional line after relocation).
Would the currently proposed relocation work with function parameters?


 

-----Ursprüngliche Nachricht-----
Von: Frederick Virchanza Gotham via Std-Proposals <std-proposals@lists.isocpp.org>

   template<typename T>
   bool ProcessNode(T &&arg)
   {
       NormaliseNode(arg);

       if ( NodeManager::mode == NodeManager::ModeAssimilate )
       {
           DistributeNode(            arg  );
           AssimilateNode( forward<T>(arg) );
       }
       else
       {
           DistributeNode( forward<T>(arg) );
       }
   }