[C++-sig] [Py++] const-overloading: how to use it ?
Adrien Saladin
adrien-ml at wizzi.net
Tue Jul 17 16:14:49 CEST 2007
Hi,
I have a C++ class that returns reference to internal data. For this I'm using
two "get" functions, one returning const and one returning non-const (see
below for the explicit code)
I'm not sure how I should import them with boost python (and py++). Can both
functions (const and non-const) be imported ? This probably doesn't make
sense for python ?
Thanks,
Adrien
//-------- this is a code showing what I would like to import : ----
#include <string>
#include <vector>
using std::string ;
class A
{
public:
A(string s){mVstr.push_back(s);};
string& getC(uint i) {return mVstr[i]; };
const string& getC(uint i) const {return mVstr[i]; };
private:
std::vector<string> mVstr ;
};
More information about the Cplusplus-sig
mailing list