What is the Identity function in C++? How is it useful?

devquora
devquora

Posted On: Feb 22, 2018

 

In general, an ID is an abbreviation for identification. Identification is the act of being identified so a system can verify whom you say you really are. For example, if a service or system is protected with a username and password and the correct username and password is entered you are identified and can log in to the service or system. Implementing an identity function is usually with the goal of substituting every occurrence of an expression in the code by an identity function without changing the semantics of the program at all. However, the identity function is supposedly nothing more than a cast and it doesn’t affect the performance of the program. Lifetime extension applies to temporaries whose construction is visible. Interposing the call to the identity function disables lifetime extension.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    C++ Interview Questions

    Explain what is OOP?

    Object-oriented programming (OOP) is a type of computer programming, also more commonly known as software design, in wh..

    C++ Interview Questions

    What is the difference between #import and #include in C++?

    The statement #include is used in C++ to include the source file or import the header files containing definitions of f..

    C++ Interview Questions

    What is ‘this’ pointer?

    The ‘this’ pointer is passed as a hidden argument to all the non-static member method calls and is available as a l..