Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60518365
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
Tue, Apr 30, 19:42
Size
525 B
Mime Type
text/x-c++
Expires
Thu, May 2, 19:42 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17366096
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