Is it possible to do this
std::string str(const char* s)
{  
     return std::string(s);
} 
int main() {  
    char* strz = (char*)str("asd").c_str();  
}  
Instead of:
int main(){  
    std::string temp = str("asd");  
    char* strz = (char*)temp.c_str();  
}
I know it should be const char* strz but I need it only within block of code(and without new/delete). After returning string from method it look for reference(if cant find it, deletes string) and then calls c_str(). I have a lot of char's(independent from me) and I could use second solution but it takes too much code.

``)!strfunction is unneccesary. Do you have it just to shorten the code?