C++ (Qt)class MyClass { MyItem * FindItem( ...);const MyItem * FindItem( ...) const;..};
MyItem * FindItem() const;
C++ (Qt)int speex_encode_int (void *state, spx_int16_t *in, SpeexBits *bits)
C++ (Qt)opus_int32 opus_encode(OpusEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *data, opus_int32 max_data_bytes)
C++ (Qt)MyItem * MyClass::FindItem( ... ) { const MyItem * itm = FindItem(..); return const_cast <MyItem *> (itm);}
C++ (Qt)struct Data{ int a; int b;}; class Test{public: Data * findA(int A) { int index = findAImpl(A); return getA(index); } const Data * findA(int A) const { int index = findAImpl(A); return getA(index); } Data *getA(int index) { if(index > 0 && index < data.length()) return data[index]; else return 0; } const Data *getA(int index) const { if(index > 0 && index < data.length()) return data[index]; else return 0; } private: QList<Data *>data; int findAImpl(int A) const { for (int i = 0; i < data.size(); ++i) if(data[i]->a == A) return i; return -1; } volatile int index_;};
C++ (Qt)iterator begin ();const_iterator begin () const;
C++ (Qt)struct Data.. volatile int index_;};
C++ (Qt)class Test{public: Data * findA(int A) { return findAImpl(A); } const Data * findA(int A) const { return findAImpl(A); } private: QList<Data *>data; Data * findAImpl(int A) const { for (int i = 0; i < data.size(); ++i) if(data[i]->a == A) return data[i]; return 0; }};