[C++-sig] Enums with duplicated values.

Hugo Lima hugo.lima at openbossa.org
Tue Feb 3 18:55:49 CET 2009


On Fri, Dec 19, 2008 at 12:13 AM, David Abrahams <dave at boostpro.com> wrote:
>
> on Wed Dec 17 2008, "Hugo Lima" <hugo.lima-AT-openbossa.org> wrote:
>
>> Hi;
>>
>> I need wrap enums with duplicated values, but boost::python do not
>> support it. At the boost website you can find the quote:
>>
>> "Scott Snyder provided a patch; Dave was dissatisfied for some reason,
>
> I think I didn't really like the asymmetry of the "othervalues" field; I
> would probably prefer to store all values in a dict of lists.

I agree, so I'm sending a patch that does exactly this.
If the enum does not have duplicated values, all remains the same (the
"values" attribute is a dict of value=>enum_type).
If it has duplicated values, the duplicated values point to a tuple of
enum_types in the values attr dict.

Remarks:
 - Maybe I should use lists instead of tuples to avoid the list <=>
tuple conversion
 - I did not use tuples for all entries in the values attribute to
keep the source compatibility.

If this patch get accepted, is there any chance to include it in the
1.38.0 release?

>> but maybe it should just be applied if no further action occurs
>> http://aspn.activestate.com/ASPN/Mail/Message/1824616."
>>
>> Why this patch was not been accepted since 2003?
>
> Well, I suppose it's a lot better than no patch at all, so it should be
> applied.
>
>> What can we do to get this patch accepted, so we do not have to
>> maintain a boost-copy on our repositories?
>
> You can run the Boost.Python test suite with the patch in place against
> trunk, and assure me that all the tests pass.  If you do that, I'll be
> inclined to apply it and move it to the release branch.
>
> Thanks for the bump,
>
> --
> Dave Abrahams
> BoostPro Computing
> http://www.boostpro.com
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: enum_with_duplicated_values.patch
Type: application/octet-stream
Size: 1483 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20090203/89ca57ae/attachment.obj>


More information about the Cplusplus-sig mailing list