[C++-sig] Re: static methods

Nikolay Mladenov nickm at sitius.com
Mon Jan 13 15:21:53 CET 2003


David,

It seems to me (I have not tested) that with your fix the following code
will execute normaly:
int main()
{
    dict d;
    assert( d[0] == object() );
    return 0;
}

But in python:
>>> d=dict()
>>> d[0]
Traceback (most recent call last):
  File("?stdin>", line1, in?
KeyError: 0
>>>

Regards,

Nikolay

David Abrahams wrote:

> Nikolay Mladenov ?nickm at sitius.com? writes:
>
> ? David,
> ?
> ? In object dict_base::get(object_cref k) const
> ? isn't it better to have expect_non_null?
> ? Because otherwise wrong key leads to access violation.
> ?
> ? Best regards.
> ? Nikolay
>
> There's definitely a bug, good catch.  That's the wrong fix for it,
> but I've checked in the right one.
>
> Thanks,
> Dave
>
> --
>                        David Abrahams
>    dave at boost-consulting.com * http://www.boost-consulting.com
> Boost support, enhancements, training, and commercial distribution






More information about the Cplusplus-sig mailing list