@@ -59,111 +59,117 @@ std::shared_ptr<IntegerCODEC> const& CODECFactory::getFromName(std::string name)
5959 return scodecmap.at (" copy" );
6060}
6161
62+ // std::make_unique equivalent
63+ template <typename T, typename ... Args>
64+ static std::unique_ptr<T> make_unique (Args&&... args) {
65+ return std::unique_ptr<T>(new T (std::forward<Args>(args)...));
66+ }
67+
6268std::unique_ptr<IntegerCODEC> fastbinarypacking8_codec () {
63- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<FastBinaryPacking<8 >, VariableByte>() );
69+ return make_unique< CompositeCodec<FastBinaryPacking<8 >, VariableByte>>( );
6470}
6571std::unique_ptr<IntegerCODEC> fastbinarypacking16_codec () {
66- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<FastBinaryPacking<16 >, VariableByte>() );
72+ return make_unique< CompositeCodec<FastBinaryPacking<16 >, VariableByte>>( );
6773}
6874std::unique_ptr<IntegerCODEC> fastbinarypacking32_codec () {
69- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<FastBinaryPacking<32 >, VariableByte>() );
75+ return make_unique< CompositeCodec<FastBinaryPacking<32 >, VariableByte>>( );
7076}
7177std::unique_ptr<IntegerCODEC> BP32_codec () {
72- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<BP32, VariableByte>() );
78+ return make_unique< CompositeCodec<BP32, VariableByte>>( );
7379}
7480std::unique_ptr<IntegerCODEC> vsencoding_codec () {
75- return std::unique_ptr<IntegerCODEC>( new vsencoding::VSEncodingBlocks (1U << 16 ) );
81+ return make_unique< vsencoding::VSEncodingBlocks> (1U << 16 );
7682}
7783std::unique_ptr<IntegerCODEC> fastpfor128_codec () {
78- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<FastPFor<4 >, VariableByte>() );
84+ return make_unique< CompositeCodec<FastPFor<4 >, VariableByte>>( );
7985}
8086std::unique_ptr<IntegerCODEC> fastpfor256_codec () {
81- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<FastPFor<8 >, VariableByte>() );
87+ return make_unique< CompositeCodec<FastPFor<8 >, VariableByte>>( );
8288}
8389std::unique_ptr<IntegerCODEC> simdfastpfor128_codec () {
84- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SIMDFastPFor<4 >, VariableByte>() );
90+ return make_unique< CompositeCodec<SIMDFastPFor<4 >, VariableByte>>( );
8591}
8692std::unique_ptr<IntegerCODEC> simdfastpfor256_codec () {
87- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SIMDFastPFor<8 >, VariableByte>() );
93+ return make_unique< CompositeCodec<SIMDFastPFor<8 >, VariableByte>>( );
8894}
8995std::unique_ptr<IntegerCODEC> simplepfor_codec () {
90- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SimplePFor<>, VariableByte>() );
96+ return make_unique< CompositeCodec<SimplePFor<>, VariableByte>>( );
9197}
9298std::unique_ptr<IntegerCODEC> simdsimplepfor_codec () {
93- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SIMDSimplePFor<>, VariableByte>() );
99+ return make_unique< CompositeCodec<SIMDSimplePFor<>, VariableByte>>( );
94100}
95101std::unique_ptr<IntegerCODEC> pfor_codec () {
96- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<PFor, VariableByte>() );
102+ return make_unique< CompositeCodec<PFor, VariableByte>>( );
97103}
98104std::unique_ptr<IntegerCODEC> simdpfor_codec () {
99- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SIMDPFor, VariableByte>() );
105+ return make_unique< CompositeCodec<SIMDPFor, VariableByte>>( );
100106}
101107std::unique_ptr<IntegerCODEC> pfor2008_codec () {
102- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<PFor2008, VariableByte>() );
108+ return make_unique< CompositeCodec<PFor2008, VariableByte>>( );
103109}
104110std::unique_ptr<IntegerCODEC> simdnewpfor_codec () {
105- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SIMDNewPFor<4 , Simple16<false >>, VariableByte>() );
111+ return make_unique< CompositeCodec<SIMDNewPFor<4 , Simple16<false >>, VariableByte>>( );
106112}
107113std::unique_ptr<IntegerCODEC> newpfor_codec () {
108- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<NewPFor<4 , Simple16<false >>, VariableByte>() );
114+ return make_unique< CompositeCodec<NewPFor<4 , Simple16<false >>, VariableByte>>( );
109115}
110116std::unique_ptr<IntegerCODEC> optpfor_codec () {
111- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<OPTPFor<4 , Simple16<false >>, VariableByte>() );
117+ return make_unique< CompositeCodec<OPTPFor<4 , Simple16<false >>, VariableByte>>( );
112118}
113119std::unique_ptr<IntegerCODEC> simdoptpfor_codec () {
114- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SIMDOPTPFor<4 , Simple16<false >>, VariableByte>() );
120+ return make_unique< CompositeCodec<SIMDOPTPFor<4 , Simple16<false >>, VariableByte>>( );
115121}
116122std::unique_ptr<IntegerCODEC> varint_codec () {
117- return std::unique_ptr<IntegerCODEC>( new VariableByte () );
123+ return make_unique<VariableByte>( );
118124}
119125std::unique_ptr<IntegerCODEC> vbyte_codec () {
120- return std::unique_ptr<IntegerCODEC>( new VByte () );
126+ return make_unique<VByte>( );
121127}
122128std::unique_ptr<IntegerCODEC> maskedvbyte_codec () {
123- return std::unique_ptr<IntegerCODEC>( new MaskedVByte () );
129+ return make_unique<MaskedVByte>( );
124130}
125131std::unique_ptr<IntegerCODEC> streamvbyte_codec () {
126- return std::unique_ptr<IntegerCODEC>( new StreamVByte () );
132+ return make_unique<StreamVByte>( );
127133}
128134std::unique_ptr<IntegerCODEC> varintgb_codec () {
129- return std::unique_ptr<IntegerCODEC>( new VarIntGB<>() );
135+ return make_unique< VarIntGB<>>( );
130136}
131137std::unique_ptr<IntegerCODEC> simple16_codec () {
132- return std::unique_ptr<IntegerCODEC>( new Simple16<true >() );
138+ return make_unique< Simple16<true >>( );
133139}
134140std::unique_ptr<IntegerCODEC> simple9_codec () {
135- return std::unique_ptr<IntegerCODEC>( new Simple9<true >() );
141+ return make_unique< Simple9<true >>( );
136142}
137143std::unique_ptr<IntegerCODEC> simple9_rle_codec () {
138- return std::unique_ptr<IntegerCODEC>( new Simple9_RLE<true >() );
144+ return make_unique< Simple9_RLE<true >>( );
139145}
140146std::unique_ptr<IntegerCODEC> simple8b_codec () {
141- return std::unique_ptr<IntegerCODEC>( new Simple8b<true >() );
147+ return make_unique< Simple8b<true >>( );
142148}
143149std::unique_ptr<IntegerCODEC> simple8b_rle_codec () {
144- return std::unique_ptr<IntegerCODEC>( new Simple8b_RLE<true >() );
150+ return make_unique< Simple8b_RLE<true >>( );
145151}
146152#ifdef VARINTG8IU_H__
147153std::unique_ptr<IntegerCODEC> varintg8iu_codec () {
148- return std::unique_ptr<IntegerCODEC>( new VarIntG8IU () );
154+ return make_unique<VarIntG8IU>( );
149155}
150156#endif
151157#ifdef USESNAPPY
152158std::unique_ptr<IntegerCODEC> snappy_codec () {
153- return std::unique_ptr<IntegerCODEC>( new JustSnappy () );
159+ return make_unique<JustSnappy>( );
154160}
155161#endif
156162std::unique_ptr<IntegerCODEC> simdbinarypacking_codec () {
157- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SIMDBinaryPacking, VariableByte>() );
163+ return make_unique< CompositeCodec<SIMDBinaryPacking, VariableByte>>( );
158164}
159165std::unique_ptr<IntegerCODEC> simdgroupsimple_codec () {
160- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SIMDGroupSimple<false , false >, VariableByte>() );
166+ return make_unique< CompositeCodec<SIMDGroupSimple<false , false >, VariableByte>>( );
161167}
162168std::unique_ptr<IntegerCODEC> simdgroupsimple_ringbuf_codec () {
163- return std::unique_ptr<IntegerCODEC>( new CompositeCodec<SIMDGroupSimple<true , true >, VariableByte>() );
169+ return make_unique< CompositeCodec<SIMDGroupSimple<true , true >, VariableByte>>( );
164170}
165171std::unique_ptr<IntegerCODEC> copy_codec () {
166- return std::unique_ptr<IntegerCODEC>( new JustCopy () );
172+ return make_unique<JustCopy>( );
167173}
168174
169175static CodecMap initializefactory () {
0 commit comments