Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96069126
svector.h
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
Sun, Dec 22, 07:36
Size
1 KB
Mime Type
text/x-c++
Expires
Tue, Dec 24, 07:36 (2 d)
Engine
blob
Format
Raw Data
Handle
23113374
Attached To
rSTICAZZI yearII_reports
svector.h
View Options
#ifndef __STATIC_VECTOR_H__
#define __STATIC_VECTOR_H__
#include <array>
#include "vector.h"
template
<
class
T
,
std
::
size_t
N
>
class
SVector
:
public
Vector
<
T
>
{
public:
/* Constructors */
SVector
(
const
T
&
value
=
T
());
SVector
(
const
std
::
initializer_list
<
T
>
&
init
);
SVector
(
const
SVector
<
T
,
N
>&
);
SVector
&
operator
=
(
const
SVector
<
T
,
N
>&
);
virtual
const
size_t
size
()
const
override
;
virtual
T
&
operator
[](
size_t
i
)
override
;
virtual
const
T
&
operator
[](
size_t
i
)
const
override
;
/* Plus / minus */
SVector
<
T
,
N
>&
operator
+=
(
const
Vector
<
T
>&
);
SVector
<
T
,
N
>&
operator
-=
(
const
Vector
<
T
>&
);
/* Scalar multiplication / division */
SVector
<
T
,
N
>&
operator
*=
(
double
k
);
SVector
<
T
,
N
>&
operator
/=
(
double
k
);
/* Reverse operator */
SVector
<
T
,
N
>&
operator
~
();
/* Unit vector */
SVector
<
T
,
N
>&
unit
();
private:
std
::
array
<
T
,
N
>
components
;
};
template
<
class
T
,
std
::
size_t
N
>
const
SVector
<
T
,
N
>
operator
+
(
SVector
<
T
,
N
>
,
const
Vector
<
T
>&
);
template
<
class
T
,
std
::
size_t
N
>
const
SVector
<
T
,
N
>
operator
-
(
SVector
<
T
,
N
>
,
const
Vector
<
T
>&
);
template
<
class
T
,
std
::
size_t
N
>
const
SVector
<
T
,
N
>
operator
*
(
SVector
<
T
,
N
>
,
double
);
template
<
class
T
,
std
::
size_t
N
>
const
SVector
<
T
,
N
>
operator
/
(
SVector
<
T
,
N
>
,
double
);
template
<
class
T
,
std
::
size_t
N
>
const
SVector
<
T
,
N
>
operator
*
(
double
,
SVector
<
T
,
N
>
);
template
<
class
T
,
std
::
size_t
N
>
const
SVector
<
T
,
N
>
operator
/
(
double
,
SVector
<
T
,
N
>
);
template
<
class
T
,
std
::
size_t
N
>
const
SVector
<
T
,
N
>
operator
-
(
SVector
<
T
,
N
>
);
/*
* Prototipe for cross product
*/
inline
const
SVector
<
double
,
3
>
operator
^
(
const
SVector
<
double
,
3
>&
v
,
const
SVector
<
double
,
3
>&
w
);
inline
double
operator
^
(
const
SVector
<
double
,
2
>&
v
,
const
SVector
<
double
,
2
>&
w
);
inline
double
operator
^
(
const
SVector
<
double
,
1
>&
v
,
const
SVector
<
double
,
1
>&
w
);
/*
* Include definitions file
*/
#include "svector.tpp"
#endif
// __SVECTOR_H__
Event Timeline
Log In to Comment