Boost logo

Boost :

From: Noel Yap (Noel.Yap_at_[hidden])
Date: 2003-04-24 10:39:02


"Justin M. Lewis" wrote:
>
> I diagree with this. The code I've written using this looks more like
>
> void add_char( in_out<std::string> str, char ch)
> {
> std::string &s = str;
> s += ch;
> }

I think you're assuming everyone will code the way you want. If you're
going to force everyone to code this way, why not just have them code
like:

  void add_char( std::string& str_, char ch_ )
  {
    str += ch;
  }

  int len( std::string const& str )
  {
    return str.length();
  }

What is the added value of the proposed class? It's not that it forces
people to change the value if it's used:

  int len( in_out< std::string > str )
  {
    return static_cast< std::string& >( str ).length();
  }

Noel

-- 
NOTICE: If received in error, please destroy and notify sender.  Sender
does not waive confidentiality or privilege, and use is prohibited.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk