Search Results

Search found 3 results on 1 pages for 'programwriter'.

Page 1/1 | 1 

  • Dynamically creating controls in MFC (Collection question)

    - by ProgramWriter
    Hello all, I have some custom control inside of which i should create radiobuttons or checkboxes. The count of child controls is available only at runtime (it loads some file from which it gets this count). So i need to create variable number of controls. Which collection i should use for this purpose? Solution 1: simply use std::vector (or CArray) - not suitable because i want use MFC (CButton). Of course i can Attach() and later Detach() handle to window each time i need this window, but it will give big overhead. Solution 2: use std::vector or CArray or CList or... In this case i take care about making 'new' and appropriate 'delete' when control is unneeded. I am forgetful :) MFC handle map contains pointer to CButton and i can't use simple CArray, because it will move my objects each time when his size will grow. ... and the question is: Which collection i should use for containing variable count of MFC control classes?

    Read the article

  • Null pointer to struct which has zero size (empty)... It is a good practice?

    - by ProgramWriter
    Hi2All.. I have some null struct, for example: struct null_type { NullType& someNonVirtualMethod() { return *this; } }; And in some function i need to pass reference to this type. Reason: template <typename T1 = null_type, typename T2 = null_type, ... > class LooksLikeATupleButItsNotATuple { public: LooksLikeATupleButItsNotATuple(T1& ref1 = defParamHere, T2& ref2 = andHere..) : _ref1(ref1), _ref2(ref2), ... { } void someCompositeFunctionHere() { _ref1.someNonVirtualMethod(); _ref2.someNonVirtualMethod(); ... } private: T1& _ref1; T2& _ref2; ...; }; It is a good practice to use null reference as a default parameter?: *static_cast<NullType*>(0) It works on MSVC, but i have some doubts...

    Read the article

  • <hash_set> equality operator doesn't work in VS2010

    - by ProgramWriter
    Sample code: std::hash_set<int> hs1; // also i try std::unorded_set<int> - same effect std::hash_set<int> hs2; hs1.insert(15); hs1.insert(20); hs2.insert(20); hs2.insert(15); assert(hs1 == hs2); hash_set doesn't stores elements in some order defined by hash function... why? Please note that this code works in VS2008 using stdext::hash_set.

    Read the article

1