Boost move














































Boost move



DESCRIPTION
 Boost.Move emulates C++ move semantics in C++03 compilers and allows writing portable code that works optimally in C++03 and C++ compilers.


HEADER

#include<iostream> #include<boost/move.hpp>


SYNTAX


class moveobject

void calc()



SOURCE CODE

#include<iostream>
#include<boost/move.hpp> using namespace boost; class moveobject { public : int x,y; //declaring two moves,one is forward and one is backward. int man; //declaring the object as a man void calc() { cin>>man; //getting the objects position cout<<"Initially the man is at the position :"<<man<<endl; //printing cin>>x; //getting the forward move(steps) { man=man+x; //calculating the forward position cout<<"forward position of the man is :"<<man<<endl; //printing } cin>>y; //getting backward move(steps)
{ man=man-y; //calculating the backward positon cout<<"backward position of the man is :"<<man<<endl; //printing } } }; int main() //main function { moveobject M; M.calc(); return 0; }

RUNTIME INPUT
10
5
2
OUTPUT
Initially the man is at the position :10
forward position of the man is :15
backward position of the man is :8

Comments