[C++-sig] No to_python (by-value) converter found for C++ type

abhi.sri45 abhishek.srivastava at nechclst.in
Tue May 25 08:58:59 CEST 2010


Hi,

>mb = module_builder_t( ... )
>mb.class_(...).noncopyable = False

This does not works in my case.

Example code is:

enum CallStatus
{
        SUCCESS = 423,
        FAILURE = 764
};

template<class Result>
struct CallResult
{
public:
        CallResult(CallStatus const callStatus)
        : status(callStatus)
        {
        }

        CallResult(CallStatus const callStatus, Result const & result)
        : status(callStatus), result(result)
        {
        }
        /*
        CallResult(CallResult const& callResult)
        {
                status = callResult.status;
                result = callResult.result;
        }
        */
        CallStatus const status;
        Result const result;
     //   boost::optional<Result> const result;
};

class Simple
{
public:
        Simple()
        {
        }
/*
        Simple(Simple const&)
        {
        }
*/
};
//typedef CallResult<Simple> cRI;


CallResult<Simple> getCallResult()
{
        Simple si;
        return CallResult<Simple>(SUCCESS, si);
}

And the code generator that  I used 

import os
from pyplusplus import module_builder
from pyplusplus.module_builder import call_policies
from pyplusplus import code_creators


mb=module_builder.module_builder_t(["./include.h"]
)

mb.enum('CallStatus').include()
mb.class_('Simple').include()
mb.class_('VerifyResult').include()
mb.class_('CallResult<Simple>').include()
mb.class_('CallResult<Simple>').noncopyable = False
mb.free_function('getCallResult').include()
mb.build_code_creator( module_name = 'testModule')
mb.write_module('testModule.cpp')

I would like to mention here that, if I remove const from both status and
result, boost::noncopyable is removed.

versions are 
g++ (GCC) 4.1.2 20080704,
 gccxml-0.9 and 
os 2.6.18-128.el5 .


With Regards,
Abhishek Srivastava


Roman Yakovenko wrote:
> 
> On Tue, May 25, 2010 at 9:06 AM, vishal bayskar
> <vishal.bayskar at nechclst.in> wrote:
>>
>>
>>>Did you try to remove "noncopyable" from the generated code? If so
>>>what happened?
>>
>> Thanks, yes it works when "noncopyable" is removed.
>>
>>>If you think, that py++ wrong, you can always override its decision:
>>
>>>mb = module_builder_t( ... )
>>>mb.class_(...).noncopyable = False
>>
>> Thanks again it is helpful for us.
> 
> It seems, that py++ was wrong :-(. Can you specify gccxml version, OS
> and your compiler? Do you mind to submit a small test case that
> reproduce the problem?
> 
> Thanks
> 
> -- 
> Roman Yakovenko
> C++ Python language binding
> http://www.language-binding.net/
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
> 
> 

-- 
View this message in context: http://old.nabble.com/No-to_python-%28by-value%29-converter-found-for-C%2B%2B-type-tp28664090p28664895.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.



More information about the Cplusplus-sig mailing list