[C++-SIG] setattr and CXX-4.2

Steve Harris sharris at primus.com
Wed May 17 01:30:38 CEST 2000

"Barry Scott" <barry at scottb.demon.co.uk> writes:


> Here is an example taken from CXX\Demo\r.cxx
> Py::Object r::getattr( const char *name )
> {
>     if(std::string(name) == "c")
> 		return Py::Float(300.0);
>     if(std::string(name) == "start")
> 		return Py::Int(start);
>     return getattr_methods( name );
> }

Would it be possible to get a length argument in addition to the const
char* argument, if we're not getting a const std::string& as a
parameter? That is, if the length of the string is known "upstream,"
it would be convenient to have it here to both speed comparisons or to
construct a std::string as you've shown here. If the string hasn't
even been examined yet, then this would not be an option here.

Steven E. Harris
Primus Knowledge Solutions, Inc.

More information about the Cplusplus-sig mailing list