TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: THOMAS MAEDER
from: ALBERTO MONTEIRO
date: 1997-12-22 20:59:00
subject: What`s wrong with this?

AM> What is the standard vector template? I know the MFC CArray class, a
TM>It's  a class template included in the Standard C++ Library (aka STL).
And what is its name?
TM>It has nothing to do with Microsoft (and I'm happy about that).
:-)))))
AM> it is tempting to create a derived Vector class [and also a Matrix
AM> class, btw] adding the overload of double * Vector, Vector + (or -)
AM> Vector, and Vector * Vector (scalar product). In fact, I have alread
AM> done those operations, for a class Vector with variable members int
AM> (dimension) and double * v (the array of elements).
TM>So you think of vectors in the mathematical sens of the term.
No; the mathematical sense of the term would require a very difficult
class; as a vector is anything, related to a field [the field of
scalars], that has sum of vectors and multiplication by scalar,
satisfying what you expect them to satisfy.
Is it possible to create a template class requiring in the TYPE
class some operators?
Something like:
template  class Finite_Dimensional_Field {
public:
  Field v[dimension];
// here force Field to have operator+(Field &, Field &) and ...
// operator*(Field &, Field &) and some other math stuff
};
TM>Then the val_array  class  template (also in the Standard C++
TM>Library) might be what you are looking for.
M$C++ doesn't include val_array :-(
Alberto Monteiro
---
 þ SLMR 2.1a þ Darkness/Imprisoning me/All that I see/Absolute horror
--- FMail/386 1.02
---------------
* Origin: CentroIn! +55-21-205-0281, 41 lines, 24h, RJ/Brazil (4:802/21)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.