Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78977191
my_vector_ostream.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Aug 24, 02:21
Size
525 B
Mime Type
text/x-c++
Expires
Mon, Aug 26, 02:21 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
20130577
Attached To
R9360 PCSC_git
my_vector_ostream.cpp
View Options
#include "myvector_template_dim.hh"
#include <iostream>
#include <ostream>
// function to print in an ostream
template
<
typename
T
,
int
dim
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
stream
,
const
MyVector
<
T
,
dim
>
&
vect
)
{
stream
<<
"["
;
for
(
int
d
=
0
;
d
<
dim
;
++
d
)
{
if
(
d
!=
0
)
stream
<<
", "
;
stream
<<
vect
[
d
];
}
stream
<<
"]"
;
return
stream
;
}
int
main
()
{
// using it
MyVector
<
double
>
vector_3d
;
// template parameters are guessed by the compiler
std
::
cout
<<
vector_3d
<<
std
::
endl
;
}
Event Timeline
Log In to Comment