how to write a cast-to-reference-to-array operator for a class?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pooria
    New Member
    • Jul 2010
    • 8

    #1

    how to write a cast-to-reference-to-array operator for a class?

    I have following class:

    Code:
        template <size_t size>
        class Araye{
         public:
          Araye(int input[]){
           for (int i=0;i<size;i++)
            araye[i]=input[i];
          }
          int araye[size];
        };
    How should I write a cast-to-reference-to-array operator for this class so that following works:

    Code:
        int adad[3]={1,2,3};
        Araye<3> araye(adad);
        int (&reference)[3]=araye;
Working...