is_convertible and array size question
Hello all,
Just perhaps a silly question but who knows ?
I have a small class that encapsulates a char[] type such as:
template <const unsigned int n>
struct C_Array
{
enum {
size = n
};
typedef char (&Array)[size];
typedef const char (&ConstArray)[size];
C_Array()
{
memset(&v[0], 0, 30); v[0] = '6'; v[1] = '7'; v[2] = '8'; v[3] = '9';
}
char v[n];
int toto;
char & operator[](const unsigned int i) { return v[i]; }
const char & operator[](const unsigned int i) const { return v[i]; }
operator Array () { return v; }
operator ConstArray () const { return v; }
};
Thanks to the operator Array, the objects of this class can be converted to
references to arrays and the following pseudo-code works fine as expected:
C_Array<30> obj;
cout << boost::is_convertible
participants (1)
-
globeordiļ¼ free.fr