Click here to Skip to main content
15,927,127 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralHelp about using Dll's Functions Pin
Jeab.21-Mar-04 22:15
sussJeab.21-Mar-04 22:15 
GeneralRe: Help about using Dll's Functions Pin
Alexander M.,22-Mar-04 3:16
Alexander M.,22-Mar-04 3:16 
GeneralRe: Help about using Dll's Functions Pin
JeabJB22-Mar-04 4:07
JeabJB22-Mar-04 4:07 
QuestionWhy not connect bitmap with button? Pin
vividtang21-Mar-04 21:23
vividtang21-Mar-04 21:23 
AnswerRe: Why not connect bitmap with button? Pin
Branislav22-Mar-04 2:33
Branislav22-Mar-04 2:33 
Generalhash table useful for hooking procedure Pin
name_or_alias21-Mar-04 21:20
name_or_alias21-Mar-04 21:20 
Generalusing vectors - begin method Pin
Ming Yan21-Mar-04 20:30
Ming Yan21-Mar-04 20:30 
GeneralRe: using vectors - begin method Pin
jhwurmbach21-Mar-04 22:09
jhwurmbach21-Mar-04 22:09 
Here is a class that shows how you can make a std::vector of std::vectors. It is heretic from the pure techings of the OOP-priests in that it inherits from a class (std::vector) that has no virtual destructor. Lint is crying in horror and I had to insert a switch.
But it works for me all the time. Also, a earlier version of a book by Alexandrescu also showed something like this.

/* matrix as vector of vectors*/
template<class T>
class Matrix : public std::vector<std::vector<T> > //lint -save -e1509
{
protected:
size_type rows,
columns;

public:
explicit Matrix(size_type r = 0, size_type c = 0)
: std::vector<std::vector<T> >(r, std::vector<T>(c)),
rows(r), columns(c)
{}

/* Thus, the Matrix class inherits from the std::vector class,
with the data type of the vector elements now being described
by a std::vector<T> template. With this, the matrix is a
nested container that exploits the combination of templates
with inheritance. The constructor initializes the implicit
subobject of the base class type (std::vector<std::vector<T> >)
with the correct size x. Exactly as with the standard vector
container, the second parameter of the constructor specifies
with which value each vector element is to be initialized.
Here, the value is nothing else but a vector of type
std::vector<T> and length y.*/

size_type Rows() const {return rows; }

size_type Columns() const {return columns; }

void init(const T& Value)
{
for (size_type i = 0; i < rows; ++i)
for (size_type j = 0; j < columns; ++j)
operator[](i)[j] = Value; // i.e. (*this)[i][j]
}


/* The index operator operator[]() is inherited from
std::vector. Applied to i, it supplies a reference to the ith
element of the (base class subobject) vector. This element is
itself a vector of type std::vector<T>. It is again applied
to the index operator, this time with the value j, which
returns a reference to an object of type T, which is then
assigned the value. */


// here, mathematical operators could follow ...
}; // class Matrix
//lint -restore

<hr size=1 /hr><small>"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."

-- Caius Petronius, Roman Consul, 66 A.D.</small>
GeneralRe: using vectors - begin method Pin
Maxwell Chen21-Mar-04 22:45
Maxwell Chen21-Mar-04 22:45 
GeneralRe: using vectors - begin method Pin
jhwurmbach21-Mar-04 23:01
jhwurmbach21-Mar-04 23:01 
GeneralRe: using vectors - begin method Pin
Maxwell Chen22-Mar-04 15:31
Maxwell Chen22-Mar-04 15:31 
GeneralRe: using vectors - begin method Pin
jhwurmbach22-Mar-04 21:08
jhwurmbach22-Mar-04 21:08 
GeneralRe: using vectors - begin method Pin
Roger Allen22-Mar-04 5:12
Roger Allen22-Mar-04 5:12 
Generalnewbie question about vc++ and dlls Pin
charlener21-Mar-04 19:38
charlener21-Mar-04 19:38 
GeneralRe: newbie question about vc++ and dlls Pin
axid3j1al21-Mar-04 20:05
axid3j1al21-Mar-04 20:05 
GeneralRe: newbie question about vc++ and dlls Pin
charlener21-Mar-04 20:18
charlener21-Mar-04 20:18 
GeneralRe: newbie question about vc++ and dlls Pin
bilal7822-Mar-04 0:53
bilal7822-Mar-04 0:53 
GeneralRe: newbie question about vc++ and dlls Pin
axid3j1al22-Mar-04 21:13
axid3j1al22-Mar-04 21:13 
GeneralStore the contents of a stucture in a file Pin
swarnamanoo21-Mar-04 19:34
swarnamanoo21-Mar-04 19:34 
GeneralRe: Store the contents of a stucture in a file Pin
RadioShark21-Mar-04 22:04
RadioShark21-Mar-04 22:04 
GeneralRe: Store the contents of a stucture in a file Pin
jhwurmbach21-Mar-04 22:16
jhwurmbach21-Mar-04 22:16 
GeneralRe: Store the contents of a stucture in a file Pin
jhwurmbach21-Mar-04 22:16
jhwurmbach21-Mar-04 22:16 
GeneralShowing a Tabbed Dialog box Pin
Tariq87821-Mar-04 19:30
Tariq87821-Mar-04 19:30 
GeneralRe: Showing a Tabbed Dialog box Pin
Michael P Butler21-Mar-04 21:56
Michael P Butler21-Mar-04 21:56 
GeneralPass Data to form using HTTP.. Pin
rasha200321-Mar-04 18:39
rasha200321-Mar-04 18:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.