@@ -294,22 +294,28 @@ private static void generateGroupClassHeader(
294294 dimensionHeaderLength , blockLength , formatClassName (groupName )));
295295
296296 sb .append (
297- indent + "#if __cplusplus < 201103L\n " +
298297 indent + " template<class Func> inline void forEach(Func& func)\n " +
299298 indent + " {\n " +
300299 indent + " while (hasNext())\n " +
301300 indent + " {\n " +
302301 indent + " next(); func(*this);\n " +
303302 indent + " }\n " +
304- indent + " }\n \n " +
305- indent + "#else \n " +
303+ indent + " }\n " +
304+ indent + "#if __cplusplus >= 201103L \n " +
306305 indent + " template<class Func> inline void forEach(Func&& func)\n " +
307306 indent + " {\n " +
308307 indent + " while (hasNext())\n " +
309308 indent + " {\n " +
310309 indent + " next(); func(*this);\n " +
311310 indent + " }\n " +
312- indent + " }\n \n " +
311+ indent + " }\n " +
312+ indent + " template<class Func> inline void forEach(Func const& func)\n " +
313+ indent + " {\n " +
314+ indent + " while (hasNext())\n " +
315+ indent + " {\n " +
316+ indent + " next(); func(*this);\n " +
317+ indent + " }\n " +
318+ indent + " }\n " +
313319 indent + "#endif\n \n " );
314320 }
315321
@@ -1285,17 +1291,21 @@ private static CharSequence generateFixedFlyweightCode(final String className, f
12851291 " m_offset(codec.m_offset),\n " +
12861292 " m_actingVersion(codec.m_actingVersion){}\n \n " +
12871293 "#if __cplusplus >= 201103L\n " +
1288- " %1$s(%1$s&& codec) :\n " +
1294+ " %1$s(%1$s&& codec) SBE_NOEXCEPT :\n " +
12891295 " m_buffer(codec.m_buffer),\n " +
12901296 " m_bufferLength(codec.m_bufferLength),\n " +
12911297 " m_offset(codec.m_offset),\n " +
1292- " m_actingVersion(codec.m_actingVersion){}\n \n " +
1298+ " m_actingVersion(codec.m_actingVersion)\n " +
1299+ " {\n " +
1300+ " codec.reset(%1$s())\n " +
1301+ " }\n \n " +
12931302 " %1$s& operator=(%1$s&& codec) SBE_NOEXCEPT\n " +
12941303 " {\n " +
1295- " m_buffer = codec.m_buffer;\n " +
1296- " m_bufferLength = codec.m_bufferLength;\n " +
1297- " m_offset = codec.m_offset;\n " +
1298- " m_actingVersion = codec.m_actingVersion;\n " +
1304+ " if (this != &codec);\n " +
1305+ " {\n " +
1306+ " reset(codec);\n " +
1307+ " codec.reset(%1$s());\n " +
1308+ " }\n " +
12991309 " return *this;\n " +
13001310 " }\n \n " +
13011311 "#endif\n \n " +
@@ -1350,22 +1360,27 @@ private static CharSequence generateConstructorsAndOperators(final String classN
13501360 " {\n " +
13511361 " reset(codec);\n " +
13521362 " }\n \n " +
1353- "#if __cplusplus >= 201103L\n " +
1354- " %1$s(%1$s&& codec)\n " +
1363+ " %1$s& operator=(const %1$s& codec) SBE_NOEXCEPT\n " +
13551364 " {\n " +
13561365 " reset(codec);\n " +
1366+ " return *this;\n " +
13571367 " }\n \n " +
1358- " %1$s& operator=(%1$s&& codec)\n " +
1368+ "#if __cplusplus >= 201103L\n " +
1369+ " %1$s(%1$s&& codec) SBE_NOEXCEPT : \n " +
13591370 " {\n " +
13601371 " reset(codec);\n " +
1361- " return *this ;\n " +
1372+ " codec.reset(%1$s()) ;\n " +
13621373 " }\n \n " +
1363- "#endif\n \n " +
1364- " %1$s& operator=(const %1$s& codec)\n " +
1374+ " %1$s& operator =(%1$s&& codec) SBE_NOEXCEPT : \n " +
13651375 " {\n " +
1366- " reset(codec);\n " +
1376+ " if (this != &codec)\n " +
1377+ " {\n " +
1378+ " reset(codec);\n " +
1379+ " codec.reset(%1$s());\n " +
1380+ " }\n " +
13671381 " return *this;\n " +
1368- " }\n \n " ,
1382+ " }\n " +
1383+ "#endif\n \n " ,
13691384 className );
13701385 }
13711386
0 commit comments