I have joined this site today. I hope I got right this time.

Code:
#include<iostream>
using namespace std;

class JStringToCharConstStar
{
public:
// constructor / destructor
JStringToCharConstStar (int a,
std::string j_string);
~JStringToCharConstStar (void);

// accessor
operator char const * (void) const
{
return(m_string);
}

private:
// intentionally unimplemented
JStringToCharConstStar (JStringToCharConstStar const &);
JStringToCharConstStar & operator = (JStringToCharConstStar const &);

// private data members
int abc;
std::string m_j_string;
char const * m_string;
}; // class JStringToCharConstStar


JStringToCharConstStar::
JStringToCharConstStar (int a,
std::string j_string)
:abc(a),
m_j_string(j_string),
m_string(NULL)
{
m_string = m_j_string.c_str();
if (NULL == m_string)
{
cout<<"GetStringUTFChars failed.\n";
}
}

JStringToCharConstStar::
~JStringToCharConstStar (void)
{
if (NULL != m_string)
{
cout<<"Destructor called";
}
}

int main()
{
std::string a;
char const *k = "vinit";
a = k;
cout<<"a="<<a<<"\n";
JStringToCharConstStar jstring(5,a);
std::string b;
b = jstring;
cout<<"b="<<b;
return 0;
}

My question is that auto conversion is compiler dependent? Is there any better way to implemet this?

because the above code compiled successfully in windows compiler, my local Linux compiler( Centos machine)

But it failed my build in Linux. I am sorry I dont know the compiler name as we have different build team out here.

Thanks for your reply.