#41 Returning address of temporary variable.

closed-fixed
9
2003-12-16
2003-03-13
Petr Tovarys
No

In registry.cpp

const std::string
Registry::ConstSubnodeIterator::operator*()
{
return
it_sub->first;
}

const std::string *
Registry::ConstSubnodeIterator::operator->()
{
return
&operator*();
}

The second function returns address
of temporary object.
Should the first one return const
std::string & instead of const std::string?

Discussion

  • Petr Tovarys
    Petr Tovarys
    2003-05-04

    • status: open --> open-remind
     
  • Marek Vondrak
    Marek Vondrak
    2003-05-09

    Logged In: YES
    user_id=122416

    Ping!

     
  • Marek Svantner
    Marek Svantner
    2003-12-16

    • status: open-remind --> closed-fixed