Skip to content

Commit e709764

Browse files
committed
Use std::make_unique_for_overwrite for keys
1 parent e6c16f6 commit e709764

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

include/cloudkey.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,19 @@ struct EvalKey {
102102
void emplacebkfft(const SecretKey& sk)
103103
{
104104
if constexpr (std::is_same_v<P, lvl01param>) {
105-
bkfftlvl01 = std::make_unique<BootstrappingKeyFFT<lvl01param>>();
105+
bkfftlvl01 = std::make_unique_for_overwrite<BootstrappingKeyFFT<lvl01param>>();
106106
bkfftgen<lvl01param>(*bkfftlvl01, sk);
107107
}
108108
else if constexpr (std::is_same_v<P, lvlh1param>) {
109-
bkfftlvlh1 = std::make_unique<BootstrappingKeyFFT<lvlh1param>>();
109+
bkfftlvlh1 = std::make_unique_for_overwrite<BootstrappingKeyFFT<lvlh1param>>();
110110
bkfftgen<lvlh1param>(*bkfftlvlh1, sk);
111111
}
112112
else if constexpr (std::is_same_v<P, lvl02param>) {
113-
bkfftlvl02 = std::make_unique<BootstrappingKeyFFT<lvl02param>>();
113+
bkfftlvl02 = std::make_unique_for_overwrite<BootstrappingKeyFFT<lvl02param>>();
114114
bkfftgen<lvl02param>(*bkfftlvl02, sk);
115115
}
116116
else if constexpr (std::is_same_v<P, lvlh2param>) {
117-
bkfftlvlh2 = std::make_unique<BootstrappingKeyFFT<lvlh2param>>();
117+
bkfftlvlh2 = std::make_unique_for_overwrite<BootstrappingKeyFFT<lvlh2param>>();
118118
bkfftgen<lvlh2param>(*bkfftlvlh2, sk);
119119
}
120120
else
@@ -214,15 +214,15 @@ struct EvalKey {
214214
void emplaceiksk(const SecretKey& sk)
215215
{
216216
if constexpr (std::is_same_v<P, lvl10param>) {
217-
iksklvl10 = std::make_unique<KeySwitchingKey<lvl10param>>();
217+
iksklvl10 = std::make_unique_for_overwrite<KeySwitchingKey<lvl10param>>();
218218
ikskgen<lvl10param>(*iksklvl10, sk);
219219
}
220220
else if constexpr (std::is_same_v<P, lvl1hparam>) {
221-
iksklvl1h = std::make_unique<KeySwitchingKey<lvl1hparam>>();
221+
iksklvl1h = std::make_unique_for_overwrite<KeySwitchingKey<lvl1hparam>>();
222222
ikskgen<lvl1hparam>(*iksklvl1h, sk);
223223
}
224224
else if constexpr (std::is_same_v<P, lvl20param>) {
225-
iksklvl20 = std::make_unique<KeySwitchingKey<lvl20param>>();
225+
iksklvl20 = std::make_unique_for_overwrite<KeySwitchingKey<lvl20param>>();
226226
ikskgen<lvl20param>(*iksklvl20, sk);
227227
}
228228
else if constexpr (std::is_same_v<P, lvl2hparam>) {
@@ -231,15 +231,15 @@ struct EvalKey {
231231
ikskgen<lvl2hparam>(*iksklvl2h, sk);
232232
}
233233
else if constexpr (std::is_same_v<P, lvl21param>) {
234-
iksklvl21 = std::make_unique<KeySwitchingKey<lvl21param>>();
234+
iksklvl21 = std::make_unique_for_overwrite<KeySwitchingKey<lvl21param>>();
235235
ikskgen<lvl21param>(*iksklvl21, sk);
236236
}
237237
else if constexpr (std::is_same_v<P, lvl22param>) {
238-
iksklvl22 = std::make_unique<KeySwitchingKey<lvl22param>>();
238+
iksklvl22 = std::make_unique_for_overwrite<KeySwitchingKey<lvl22param>>();
239239
ikskgen<lvl22param>(*iksklvl22, sk);
240240
}
241241
else if constexpr (std::is_same_v<P, lvl31param>) {
242-
iksklvl31 = std::make_unique<KeySwitchingKey<lvl31param>>();
242+
iksklvl31 = std::make_unique_for_overwrite<KeySwitchingKey<lvl31param>>();
243243
ikskgen<lvl31param>(*iksklvl31, sk);
244244
}
245245
else
@@ -290,7 +290,7 @@ struct EvalKey {
290290
{
291291
if constexpr (std::is_same_v<P, lvl21param>) {
292292
subprivksklvl21[key] =
293-
std::make_unique<SubsetPrivateKeySwitchingKey<lvl21param>>();
293+
std::make_unique_for_overwrite<SubsetPrivateKeySwitchingKey<lvl21param>>();
294294
subprivkskgen<lvl21param>(*subprivksklvl21[key], func, sk);
295295
}
296296
else

0 commit comments

Comments
 (0)