blob: 1055c26c45d8902fb611d01c67c7dd3f59bb228e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "symmetrictable.h"
namespace search {
namespace fef {
SymmetricTable::SymmetricTable() :
_backingTable(),
_size(),
_table(NULL),
_max(0)
{
}
SymmetricTable::SymmetricTable(const SymmetricTable & table) :
_backingTable(table._backingTable),
_size(_backingTable.size()/2),
_table(&_backingTable[_size]),
_max(table.max())
{
}
SymmetricTable & SymmetricTable::operator=(const SymmetricTable & rhs)
{
if (&rhs != this) {
SymmetricTable n(rhs);
swap(n);
}
return *this;
}
SymmetricTable::SymmetricTable(const Table & table) :
_backingTable(table.size()*2 - 1),
_size(_backingTable.size()/2),
_table(&_backingTable[_size]),
_max(table.max())
{
_table[0] = table[0];
for(int i(1); i <= _size; i++) {
_table[i] = table[i];
_table[-i] = -table[i];
}
}
SymmetricTable::~SymmetricTable()
{
}
} // namespace fef
} // namespace search
|