Skip to content

Commit 3358614

Browse files
committed
Use std::make_unique to create unique ptrs
1 parent 0ab7276 commit 3358614

1 file changed

Lines changed: 34 additions & 34 deletions

File tree

src/codecfactory.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -59,110 +59,110 @@ std::shared_ptr<IntegerCODEC> const& CODECFactory::getFromName(std::string name)
5959
}
6060

6161
std::unique_ptr<IntegerCODEC> fastbinarypacking8_codec() {
62-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<FastBinaryPacking<8>, VariableByte>());
62+
return std::make_unique<CompositeCodec<FastBinaryPacking<8>, VariableByte>>();
6363
}
6464
std::unique_ptr<IntegerCODEC> fastbinarypacking16_codec() {
65-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<FastBinaryPacking<16>, VariableByte>());
65+
return std::make_unique<CompositeCodec<FastBinaryPacking<16>, VariableByte>>();
6666
}
6767
std::unique_ptr<IntegerCODEC> fastbinarypacking32_codec() {
68-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<FastBinaryPacking<32>, VariableByte>());
68+
return std::make_unique<CompositeCodec<FastBinaryPacking<32>, VariableByte>>();
6969
}
7070
std::unique_ptr<IntegerCODEC> BP32_codec() {
71-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<BP32, VariableByte>());
71+
return std::make_unique<CompositeCodec<BP32, VariableByte>>();
7272
}
7373
std::unique_ptr<IntegerCODEC> vsencoding_codec() {
74-
return std::unique_ptr<IntegerCODEC>(new vsencoding::VSEncodingBlocks(1U << 16));
74+
return std::make_unique<vsencoding::VSEncodingBlocks>(1U << 16);
7575
}
7676
std::unique_ptr<IntegerCODEC> fastpfor128_codec() {
77-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<FastPFor<4>, VariableByte>());
77+
return std::make_unique<CompositeCodec<FastPFor<4>, VariableByte>>();
7878
}
7979
std::unique_ptr<IntegerCODEC> fastpfor256_codec() {
80-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<FastPFor<8>, VariableByte>());
80+
return std::make_unique<CompositeCodec<FastPFor<8>, VariableByte>>();
8181
}
8282
std::unique_ptr<IntegerCODEC> simdfastpfor128_codec() {
83-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SIMDFastPFor<4>, VariableByte>());
83+
return std::make_unique<CompositeCodec<SIMDFastPFor<4>, VariableByte>>();
8484
}
8585
std::unique_ptr<IntegerCODEC> simdfastpfor256_codec() {
86-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SIMDFastPFor<8>, VariableByte>());
86+
return std::make_unique<CompositeCodec<SIMDFastPFor<8>, VariableByte>>();
8787
}
8888
std::unique_ptr<IntegerCODEC> simplepfor_codec() {
89-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SimplePFor<>, VariableByte>());
89+
return std::make_unique<CompositeCodec<SimplePFor<>, VariableByte>>();
9090
}
9191
std::unique_ptr<IntegerCODEC> simdsimplepfor_codec() {
92-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SIMDSimplePFor<>, VariableByte>());
92+
return std::make_unique<CompositeCodec<SIMDSimplePFor<>, VariableByte>>();
9393
}
9494
std::unique_ptr<IntegerCODEC> pfor_codec() {
95-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<PFor, VariableByte>());
95+
return std::make_unique<CompositeCodec<PFor, VariableByte>>();
9696
}
9797
std::unique_ptr<IntegerCODEC> simdpfor_codec() {
98-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SIMDPFor, VariableByte>());
98+
return std::make_unique<CompositeCodec<SIMDPFor, VariableByte>>();
9999
}
100100
std::unique_ptr<IntegerCODEC> pfor2008_codec() {
101-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<PFor2008, VariableByte>());
101+
return std::make_unique<CompositeCodec<PFor2008, VariableByte>>();
102102
}
103103
std::unique_ptr<IntegerCODEC> simdnewpfor_codec() {
104-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SIMDNewPFor<4, Simple16<false>>, VariableByte>());
104+
return std::make_unique<CompositeCodec<SIMDNewPFor<4, Simple16<false>>, VariableByte>>();
105105
}
106106
std::unique_ptr<IntegerCODEC> newpfor_codec() {
107-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<NewPFor<4, Simple16<false>>, VariableByte>());
107+
return std::make_unique<CompositeCodec<NewPFor<4, Simple16<false>>, VariableByte>>();
108108
}
109109
std::unique_ptr<IntegerCODEC> optpfor_codec() {
110-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<OPTPFor<4, Simple16<false>>, VariableByte>());
110+
return std::make_unique<CompositeCodec<OPTPFor<4, Simple16<false>>, VariableByte>>();
111111
}
112112
std::unique_ptr<IntegerCODEC> simdoptpfor_codec() {
113-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SIMDOPTPFor<4, Simple16<false>>, VariableByte>());
113+
return std::make_unique<CompositeCodec<SIMDOPTPFor<4, Simple16<false>>, VariableByte>>();
114114
}
115115
std::unique_ptr<IntegerCODEC> varint_codec() {
116-
return std::unique_ptr<IntegerCODEC>(new VariableByte());
116+
return std::make_unique<VariableByte>();
117117
}
118118
std::unique_ptr<IntegerCODEC> vbyte_codec() {
119-
return std::unique_ptr<IntegerCODEC>(new VByte());
119+
return std::make_unique<VByte>();
120120
}
121121
std::unique_ptr<IntegerCODEC> maskedvbyte_codec() {
122-
return std::unique_ptr<IntegerCODEC>(new MaskedVByte());
122+
return std::make_unique<MaskedVByte>();
123123
}
124124
std::unique_ptr<IntegerCODEC> streamvbyte_codec() {
125-
return std::unique_ptr<IntegerCODEC>(new StreamVByte());
125+
return std::make_unique<StreamVByte>();
126126
}
127127
std::unique_ptr<IntegerCODEC> varintgb_codec() {
128-
return std::unique_ptr<IntegerCODEC>(new VarIntGB<>());
128+
return std::make_unique<VarIntGB<>>();
129129
}
130130
std::unique_ptr<IntegerCODEC> simple16_codec() {
131-
return std::unique_ptr<IntegerCODEC>(new Simple16<true>());
131+
return std::make_unique<Simple16<true>>();
132132
}
133133
std::unique_ptr<IntegerCODEC> simple9_codec() {
134-
return std::unique_ptr<IntegerCODEC>(new Simple9<true>());
134+
return std::make_unique<Simple9<true>>();
135135
}
136136
std::unique_ptr<IntegerCODEC> simple9_rle_codec() {
137-
return std::unique_ptr<IntegerCODEC>(new Simple9_RLE<true>());
137+
return std::make_unique<Simple9_RLE<true>>();
138138
}
139139
std::unique_ptr<IntegerCODEC> simple8b_codec() {
140-
return std::unique_ptr<IntegerCODEC>(new Simple8b<true>());
140+
return std::make_unique<Simple8b<true>>();
141141
}
142142
std::unique_ptr<IntegerCODEC> simple8b_rle_codec() {
143-
return std::unique_ptr<IntegerCODEC>(new Simple8b_RLE<true>());
143+
return std::make_unique<Simple8b_RLE<true>>();
144144
}
145145
#ifdef VARINTG8IU_H__
146146
std::unique_ptr<IntegerCODEC> varintg8iu_codec() {
147-
return std::unique_ptr<IntegerCODEC>(new VarIntG8IU());
147+
return std::make_unique<VarIntG8IU>();
148148
}
149149
#endif
150150
#ifdef USESNAPPY
151151
std::unique_ptr<IntegerCODEC> snappy_codec() {
152-
return std::unique_ptr<IntegerCODEC>(new JustSnappy());
152+
return std::make_unique<JustSnappy>();
153153
}
154154
#endif
155155
std::unique_ptr<IntegerCODEC> simdbinarypacking_codec() {
156-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SIMDBinaryPacking, VariableByte>());
156+
return std::make_unique<CompositeCodec<SIMDBinaryPacking, VariableByte>>();
157157
}
158158
std::unique_ptr<IntegerCODEC> simdgroupsimple_codec() {
159-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SIMDGroupSimple<false, false>, VariableByte>());
159+
return std::make_unique<CompositeCodec<SIMDGroupSimple<false, false>, VariableByte>>();
160160
}
161161
std::unique_ptr<IntegerCODEC> simdgroupsimple_ringbuf_codec() {
162-
return std::unique_ptr<IntegerCODEC>(new CompositeCodec<SIMDGroupSimple<true, true>, VariableByte>());
162+
return std::make_unique<CompositeCodec<SIMDGroupSimple<true, true>, VariableByte>>();
163163
}
164164
std::unique_ptr<IntegerCODEC> copy_codec() {
165-
return std::unique_ptr<IntegerCODEC>(new JustCopy());
165+
return std::make_unique<JustCopy>();
166166
}
167167

168168
static CodecMap initializefactory() {

0 commit comments

Comments
 (0)