Testing C++11 lamdas

Hi all, i recently created a programme that checks if a string is a palindrome, using a lambda.
Unfortunately, it does not work. When I type "ama", it does not say it's a palindrome.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/********************************************************************
aim:
-
********************************************************************/
//headers
#include <iostream>
#include <algorithm>

//namespaces
using namespace std;
//other definitions and declarations


//main function
int main()
{
    string str;
    auto isPalindrome=[&]{string tmp(str);reverse(tmp.begin(),tmp.end());
        if(str==tmp) cout<<"\n\n"<<str<<" is a palindrome!";};

    cout<<"Please enter text: ";
    getline(cin,str);
    isPalindrome;
    return 0;
}


Aceix.
Thanks for reading. Anyway the problem has been solved.
How? isPalindrome(); i just added the brackets like a function call.

Aceix.
Topic archived. No new replies allowed.