this maybe to easy for some of you but i want to do transform this string:

this_is_a_string
to this...

this is a string
i want the underscores to be replaced by spaces and vice versa... i want also to use transform stl (although lately stls hates me )
for this to work but i seem not to do it quite right... i know that transform needs unary operators so i created one but it give me trouble because it needs a argument... here is my code

my unary_operators
Code:
    //unary functions.. for transforming  space to _
    struct trans_under : std::unary_function<char , char>
    {
        char operator () (char & in) const
        {
            if (in == '_'){
                return ' ';
            }else{
                return in;
            }
        }
    }tunder;

    //unary functions.. for transforming _ to space
    struct trans_space : std::unary_function<char , char>
    {
        char operator () (char & in) const
        {
            if (in == ' '){
                return '_';
            }else{
                return in;
            }
        }
    }tspace;
and here is my transform...

Code:
                std::string str;
                file >> str;
                
                //doesn't work because tunder needs parameters??
                std::transform(str.begin(), str.end(), str.begin(), tunder());
i look on bunch of stuffs in google and i find nothing with having your own unary operators.. it's always about lower case and upper case.

please help and more power!