@@ -294,28 +294,22 @@ private static void generateGroupClassHeader(
294294 dimensionHeaderLength , blockLength , formatClassName (groupName )));
295295
296296 sb .append (
297+ indent + "#if __cplusplus < 201103L\n " +
297298 indent + " template<class Func> inline void forEach(Func& func)\n " +
298299 indent + " {\n " +
299300 indent + " while (hasNext())\n " +
300301 indent + " {\n " +
301302 indent + " next(); func(*this);\n " +
302303 indent + " }\n " +
303- indent + " }\n " +
304- indent + "#if __cplusplus >= 201103L \n " +
304+ indent + " }\n \n " +
305+ indent + "#else \n " +
305306 indent + " template<class Func> inline void forEach(Func&& func)\n " +
306307 indent + " {\n " +
307308 indent + " while (hasNext())\n " +
308309 indent + " {\n " +
309310 indent + " next(); func(*this);\n " +
310311 indent + " }\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 " +
312+ indent + " }\n \n " +
319313 indent + "#endif\n \n " );
320314 }
321315
@@ -1291,21 +1285,17 @@ private static CharSequence generateFixedFlyweightCode(final String className, f
12911285 " m_offset(codec.m_offset),\n " +
12921286 " m_actingVersion(codec.m_actingVersion){}\n \n " +
12931287 "#if __cplusplus >= 201103L\n " +
1294- " %1$s(%1$s&& codec) SBE_NOEXCEPT :\n " +
1288+ " %1$s(%1$s&& codec) :\n " +
12951289 " m_buffer(codec.m_buffer),\n " +
12961290 " m_bufferLength(codec.m_bufferLength),\n " +
12971291 " m_offset(codec.m_offset),\n " +
1298- " m_actingVersion(codec.m_actingVersion)\n " +
1299- " {\n " +
1300- " codec.reset(%1$s())\n " +
1301- " }\n \n " +
1292+ " m_actingVersion(codec.m_actingVersion){}\n \n " +
13021293 " %1$s& operator=(%1$s&& codec) SBE_NOEXCEPT\n " +
13031294 " {\n " +
1304- " if (this != &codec);\n " +
1305- " {\n " +
1306- " reset(codec);\n " +
1307- " codec.reset(%1$s());\n " +
1308- " }\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 " +
13091299 " return *this;\n " +
13101300 " }\n \n " +
13111301 "#endif\n \n " +
@@ -1360,27 +1350,22 @@ private static CharSequence generateConstructorsAndOperators(final String classN
13601350 " {\n " +
13611351 " reset(codec);\n " +
13621352 " }\n \n " +
1363- " %1$s& operator=(const %1$s& codec) SBE_NOEXCEPT\n " +
1353+ "#if __cplusplus >= 201103L\n " +
1354+ " %1$s(%1$s&& codec)\n " +
13641355 " {\n " +
13651356 " reset(codec);\n " +
1366- " return *this;\n " +
13671357 " }\n \n " +
1368- "#if __cplusplus >= 201103L\n " +
1369- " %1$s(%1$s&& codec) SBE_NOEXCEPT : \n " +
1358+ " %1$s& operator=(%1$s&& codec)\n " +
13701359 " {\n " +
13711360 " reset(codec);\n " +
1372- " codec.reset(%1$s()) ;\n " +
1361+ " return *this ;\n " +
13731362 " }\n \n " +
1374- " %1$s& operator =(%1$s&& codec) SBE_NOEXCEPT : \n " +
1363+ "#endif\n \n " +
1364+ " %1$s& operator=(const %1$s& codec)\n " +
13751365 " {\n " +
1376- " if (this != &codec)\n " +
1377- " {\n " +
1378- " reset(codec);\n " +
1379- " codec.reset(%1$s());\n " +
1380- " }\n " +
1366+ " reset(codec);\n " +
13811367 " return *this;\n " +
1382- " }\n " +
1383- "#endif\n \n " ,
1368+ " }\n \n " ,
13841369 className );
13851370 }
13861371
0 commit comments