|
From: Ratko J. <rja...@gm...> - 2006-06-15 14:10:57
|
Use something like this:
%include "std_map.i"
%template() std::pair<std::string, std::string>;
%template(String_StringMap) std::map<std::string, std::string>;
// no typedef!
and then in your source use
class GraphProperty
{
public:
const map<string, string> GetProperties();
On 6/15/06, James Carroll <mr...@gm...> wrote:
>
> Hi I'm wrapping some C++ for python, and using stl::map.
>
> So far I have:
>
> %import stl.i
>
> //%template() std::pair<std::string, std::string>;
> //%template(String_StringMap) std::map<std::string, std::string>;
>
> typedef std::map<std::string, std::string> String_StringMap;
>
> class GraphProperty
> {
> public:
> const String_StringMap& GetProperties();
> ....
>
> ( I've tried it with and without the %template declarations. Using
> them gives me compile errors when my generated wrapper code is
> compiled.)
>
> What happens here is:
>
> d = bright.Graph()
> d.GetProperties()
> <Swig Object at
>
> _145fd601_p_std__mapTstd__string_std__string_std__lessTstd__string_t_std__allocatorTstd__pairTstd__string_const_std__string_t_t_t>
>
>
> How do I make this work?
> Thanks,
> -Jim
>
>
> _______________________________________________
> Swig-user mailing list
> Swi...@li...
> https://lists.sourceforge.net/lists/listinfo/swig-user
>
|