Skip to content

Commit c345657

Browse files
committed
Fixed vector::zero and vector::identity for vectors with length > 2
1 parent 3b0675a commit c345657

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

dandy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,10 @@ namespace types
682682
*/
683683

684684
template<class S, size_t N>
685-
const vector<S, N> vector<S, N>::zero{ 0, 0 };
685+
const vector<S, N> vector<S, N>::zero(0);
686686

687687
template<class S, size_t N>
688-
const vector<S, N> vector<S, N>::identity{ 1, 1 };
688+
const vector<S, N> vector<S, N>::identity(1);
689689

690690

691691
_DD_NAMESPACE_CLOSE

test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ TEST(structure, components)
6868

6969
TEST(statics, statics)
7070
{
71-
EXPECT_EQ(double2d::zero, double2d(0, 0));
72-
EXPECT_EQ(double2d::identity, double2d(1, 1));
71+
EXPECT_EQ(double4d::zero, double4d(0, 0, 0, 0));
72+
EXPECT_EQ(double4d::identity, double4d(1, 1, 1, 1));
7373
}
7474

7575
TEST(constructors, default)
@@ -129,7 +129,7 @@ TEST(expressions, expressions)
129129
TEST(math, arithmetic)
130130
{
131131
// sum, product
132-
int2d a(1, 2);
132+
int2d a{1, 2};
133133
EXPECT_EQ(a.sum(), 3);
134134
EXPECT_EQ(a.product(), 2);
135135

0 commit comments

Comments
 (0)