C++ (Qt)std::set <MyClass *, MyFunctor1> theSet1;..std::set <MyClass *, MyFunctor2> theSet2;..std::set <MyClass *, MyFunctor3> theSet3;
C++ (Qt)for (int i = 0; i < 3; ++i) { MyClass * data = theSet[i].find(val); if (data)...
set<int> s = *(set<int> *)array[i];
C++ (Qt) set<int> * s = (set<int> *)array[i];
C++ (Qt)set<int> * s = (set<int> *)array[i];
C++ (Qt)#include <iostream>#include <vector> using namespace std; class MyFunctor1{public: void operator() () { cout << "Call functor MyFunctor1" << endl; }}; class MyFunctor2{public: void operator() () { cout << "Call functor MyFunctor2" << endl; }}; class MyFunctor3{public: void operator() () { cout << "Call functor MyFunctor3" << endl; }}; class IMultiFunctor{public: virtual ~IMultiFunctor(){} void operator() () { callback(); }protected: virtual void callback() = 0;}; class MyMultiFunctor1: public IMultiFunctor{private: void callback() { cout << "Call functor MyMultiFunctor1" << endl; }}; class MyMultiFunctor2: public IMultiFunctor{private: void callback() { cout << "Call functor MyMultiFunctor2" << endl; }}; class MyMultiFunctor3: public IMultiFunctor{private: void callback() { cout << "Call functor MyMultiFunctor3" << endl; }}; class ITemplateFunctor{public: virtual ~ITemplateFunctor(){} void operator() () { callback(); }protected: virtual void callback() = 0;}; template <class T>class MyTemplateFunctor: public ITemplateFunctor{public: MyTemplateFunctor(T *functor): m_functor( functor ){} private: T *m_functor; void callback() { (*m_functor)(); }}; int main(){ std::vector<IMultiFunctor*> listOfInterfaceFunctor; std::vector<ITemplateFunctor*> listOfTemplateFunctor; IMultiFunctor* newMultiFunctor; newMultiFunctor = new MyMultiFunctor1; listOfInterfaceFunctor.push_back( newMultiFunctor ); newMultiFunctor = new MyMultiFunctor2; listOfInterfaceFunctor.push_back( newMultiFunctor ); newMultiFunctor = new MyMultiFunctor3; listOfInterfaceFunctor.push_back( newMultiFunctor ); ITemplateFunctor *newTemplateFunctor; newTemplateFunctor = new MyTemplateFunctor<MyFunctor1>( new MyFunctor1 ); listOfTemplateFunctor.push_back( newTemplateFunctor ); newTemplateFunctor = new MyTemplateFunctor<MyFunctor2>( new MyFunctor2 ); listOfTemplateFunctor.push_back( newTemplateFunctor ); newTemplateFunctor = new MyTemplateFunctor<MyFunctor3>( new MyFunctor3 ); listOfTemplateFunctor.push_back( newTemplateFunctor ); for( size_t i = 0; i < listOfInterfaceFunctor.size(); ++i ){ (*listOfInterfaceFunctor[i])(); } for( size_t i = 0; i < listOfTemplateFunctor.size(); ++i ){ (*listOfTemplateFunctor[i])(); } for( size_t i = 0; i < listOfInterfaceFunctor.size(); ++i ){ delete listOfInterfaceFunctor[i]; } listOfInterfaceFunctor.clear(); for( size_t i = 0; i < listOfTemplateFunctor.size(); ++i ){ delete listOfTemplateFunctor[i]; } listOfTemplateFunctor.clear(); cin.get(); return 0;}
C++ (Qt)std::set <MyClass *, MyFunctor> theSet;
[quote author=Igors link=topic=23034.msg162748#msg162748 date=1347647552]std::set <MyClass *, MyFunctor> theSet;
C++ (Qt)int x;
C++ (Qt)template<class T>class Greater : public BaseF<T>{ Greater( void ) { assert(sizeof(*this) == sizeof(BaseF<T>)); } ...};
struct _Rb_tree_impl : public _Node_allocator { _Key_compare _M_key_compare; _Rb_tree_node_base _M_header; size_type _M_node_count; // Keeps track of size of tree.