Tech Off Post

Single Post Permalink

View Thread: What's the reasoning behind the behavior of c++ "std::equal"?
  • User profile image

    The "equal" function is in every language for doing a "deep"-check on two objects.

    It ensures, that, as the name implies, both objects are actually equal. Consider the following the string construction in class c++:

    char *String1 = "Hello World";char *String2= "Hello World";

    In more simple languages like VB, you could just compare the strings by "String1 = String2", in more complex languages this wouldn't work because the content will beplaced at two different memory locations, thus an error will be returned.

    The "equal" function now does check the real content of the string pointers.



    Founder / | Lelala