@@ -149,9 +149,10 @@ void replace_helper2(R replace, UP& new_value, T& t, Ts&... ts)
149149 }
150150}
151151
152- template <typename P, typename R, typename UP, typename T, typename ... Ts>
152+ template <int N, typename P, typename R, typename UP, typename T, typename ... Ts>
153153void replace_helper (P parent, R replace, UP& new_value, T& t, Ts&... ts)
154154{
155+ static_assert (N == (sizeof ...(Ts) + 1 ));
155156 replace_helper2 (replace, new_value, t, ts...);
156157 SetParentPtr_helper (parent, t, ts...);
157158}
@@ -1022,7 +1023,7 @@ std::unique_ptr<ContValue> ContValueAdd::clone() const
10221023
10231024void ContValueAdd::replace (ContToken const * which, std::unique_ptr<ContToken> v)
10241025{
1025- replace_helper (this , which, v, val1, val2);
1026+ replace_helper<NumParts> (this , which, v, val1, val2);
10261027}
10271028
10281029std::vector<uint8_t > ContValueAdd::Serialize () const
@@ -1095,7 +1096,7 @@ std::unique_ptr<ContValue> ContValueSub::clone() const
10951096
10961097void ContValueSub::replace (ContToken const * which, std::unique_ptr<ContToken> v)
10971098{
1098- replace_helper (this , which, v, val1, val2);
1099+ replace_helper<NumParts> (this , which, v, val1, val2);
10991100}
11001101
11011102std::vector<uint8_t > ContValueSub::Serialize () const
@@ -1168,7 +1169,7 @@ std::unique_ptr<ContValue> ContValueMult::clone() const
11681169
11691170void ContValueMult::replace (ContToken const * which, std::unique_ptr<ContToken> v)
11701171{
1171- replace_helper (this , which, v, val1, val2);
1172+ replace_helper<NumParts> (this , which, v, val1, val2);
11721173}
11731174
11741175std::vector<uint8_t > ContValueMult::Serialize () const
@@ -1247,7 +1248,7 @@ std::unique_ptr<ContValue> ContValueDiv::clone() const
12471248
12481249void ContValueDiv::replace (ContToken const * which, std::unique_ptr<ContToken> v)
12491250{
1250- replace_helper (this , which, v, val1, val2);
1251+ replace_helper<NumParts> (this , which, v, val1, val2);
12511252}
12521253
12531254std::vector<uint8_t > ContValueDiv::Serialize () const
@@ -1315,7 +1316,7 @@ std::unique_ptr<ContValue> ContValueNeg::clone() const
13151316
13161317void ContValueNeg::replace (ContToken const * which, std::unique_ptr<ContToken> v)
13171318{
1318- replace_helper (this , which, v, val);
1319+ replace_helper<NumParts> (this , which, v, val);
13191320}
13201321
13211322std::vector<uint8_t > ContValueNeg::Serialize () const
@@ -1546,7 +1547,7 @@ std::unique_ptr<ContValue> ContFuncDir::clone() const
15461547
15471548void ContFuncDir::replace (ContToken const * which, std::unique_ptr<ContToken> v)
15481549{
1549- replace_helper (this , which, v, pnt);
1550+ replace_helper<NumParts> (this , which, v, pnt);
15501551}
15511552
15521553std::vector<uint8_t > ContFuncDir::Serialize () const
@@ -1622,7 +1623,7 @@ std::unique_ptr<ContValue> ContFuncDirFrom::clone() const
16221623
16231624void ContFuncDirFrom::replace (ContToken const * which, std::unique_ptr<ContToken> v)
16241625{
1625- replace_helper (this , which, v, pnt_start, pnt_end);
1626+ replace_helper<NumParts> (this , which, v, pnt_start, pnt_end);
16261627}
16271628
16281629std::vector<uint8_t > ContFuncDirFrom::Serialize () const
@@ -1694,7 +1695,7 @@ std::unique_ptr<ContValue> ContFuncDist::clone() const
16941695
16951696void ContFuncDist::replace (ContToken const * which, std::unique_ptr<ContToken> v)
16961697{
1697- replace_helper (this , which, v, pnt);
1698+ replace_helper<NumParts> (this , which, v, pnt);
16981699}
16991700
17001701std::vector<uint8_t > ContFuncDist::Serialize () const
@@ -1766,7 +1767,7 @@ std::unique_ptr<ContValue> ContFuncDistFrom::clone() const
17661767
17671768void ContFuncDistFrom::replace (ContToken const * which, std::unique_ptr<ContToken> v)
17681769{
1769- replace_helper (this , which, v, pnt_start, pnt_end);
1770+ replace_helper<NumParts> (this , which, v, pnt_start, pnt_end);
17701771}
17711772
17721773std::vector<uint8_t > ContFuncDistFrom::Serialize () const
@@ -1858,7 +1859,7 @@ std::unique_ptr<ContValue> ContFuncEither::clone() const
18581859
18591860void ContFuncEither::replace (ContToken const * which, std::unique_ptr<ContToken> v)
18601861{
1861- replace_helper (this , which, v, dir1, dir2, pnt);
1862+ replace_helper<NumParts> (this , which, v, dir1, dir2, pnt);
18621863}
18631864
18641865std::vector<uint8_t > ContFuncEither::Serialize () const
@@ -1931,7 +1932,7 @@ std::unique_ptr<ContValue> ContFuncOpp::clone() const
19311932
19321933void ContFuncOpp::replace (ContToken const * which, std::unique_ptr<ContToken> v)
19331934{
1934- replace_helper (this , which, v, dir);
1935+ replace_helper<NumParts> (this , which, v, dir);
19351936}
19361937
19371938std::vector<uint8_t > ContFuncOpp::Serialize () const
@@ -2006,7 +2007,7 @@ std::unique_ptr<ContValue> ContFuncStep::clone() const
20062007
20072008void ContFuncStep::replace (ContToken const * which, std::unique_ptr<ContToken> v)
20082009{
2009- replace_helper (this , which, v, blksize, pnt);
2010+ replace_helper<NumParts> (this , which, v, numbeats , blksize, pnt);
20102011}
20112012
20122013std::vector<uint8_t > ContFuncStep::Serialize () const
@@ -2320,7 +2321,7 @@ std::unique_ptr<ContProcedure> ContProcCM::clone() const
23202321
23212322void ContProcCM::replace (ContToken const * which, std::unique_ptr<ContToken> v)
23222323{
2323- replace_helper (this , which, v, pnt1, pnt2, stps, dir1, dir2, numbeats);
2324+ replace_helper<NumParts> (this , which, v, pnt1, pnt2, stps, dir1, dir2, numbeats);
23242325}
23252326
23262327std::vector<uint8_t > ContProcCM::Serialize () const
@@ -2438,7 +2439,7 @@ std::unique_ptr<ContProcedure> ContProcDMCM::clone() const
24382439
24392440void ContProcDMCM::replace (ContToken const * which, std::unique_ptr<ContToken> v)
24402441{
2441- replace_helper (this , which, v, pnt1, pnt2, numbeats);
2442+ replace_helper<NumParts> (this , which, v, pnt1, pnt2, numbeats);
24422443}
24432444
24442445std::vector<uint8_t > ContProcDMCM::Serialize () const
@@ -2542,7 +2543,7 @@ std::unique_ptr<ContProcedure> ContProcDMHS::clone() const
25422543
25432544void ContProcDMHS::replace (ContToken const * which, std::unique_ptr<ContToken> v)
25442545{
2545- replace_helper (this , which, v, pnt);
2546+ replace_helper<NumParts> (this , which, v, pnt);
25462547}
25472548
25482549std::vector<uint8_t > ContProcDMHS::Serialize () const
@@ -2621,7 +2622,7 @@ std::unique_ptr<ContProcedure> ContProcEven::clone() const
26212622
26222623void ContProcEven::replace (ContToken const * which, std::unique_ptr<ContToken> v)
26232624{
2624- replace_helper (this , which, v, stps, pnt);
2625+ replace_helper<NumParts> (this , which, v, stps, pnt);
26252626}
26262627
26272628std::vector<uint8_t > ContProcEven::Serialize () const
@@ -2708,7 +2709,7 @@ std::unique_ptr<ContProcedure> ContProcEWNS::clone() const
27082709
27092710void ContProcEWNS::replace (ContToken const * which, std::unique_ptr<ContToken> v)
27102711{
2711- replace_helper (this , which, v, pnt);
2712+ replace_helper<NumParts> (this , which, v, pnt);
27122713}
27132714
27142715std::vector<uint8_t > ContProcEWNS::Serialize () const
@@ -2879,7 +2880,7 @@ std::unique_ptr<ContProcedure> ContProcFountain::clone() const
28792880
28802881void ContProcFountain::replace (ContToken const * which, std::unique_ptr<ContToken> v)
28812882{
2882- replace_helper (this , which, v, dir1, dir2, stepsize1, stepsize2, pnt);
2883+ replace_helper<NumParts> (this , which, v, dir1, dir2, stepsize1, stepsize2, pnt);
28832884}
28842885
28852886std::vector<uint8_t > ContProcFountain::Serialize () const
@@ -2982,7 +2983,7 @@ std::unique_ptr<ContProcedure> ContProcFM::clone() const
29822983
29832984void ContProcFM::replace (ContToken const * which, std::unique_ptr<ContToken> v)
29842985{
2985- replace_helper (this , which, v, stps, dir);
2986+ replace_helper<NumParts> (this , which, v, stps, dir);
29862987}
29872988
29882989std::vector<uint8_t > ContProcFM::Serialize () const
@@ -3058,7 +3059,7 @@ std::unique_ptr<ContProcedure> ContProcFMTO::clone() const
30583059
30593060void ContProcFMTO::replace (ContToken const * which, std::unique_ptr<ContToken> v)
30603061{
3061- replace_helper (this , which, v, pnt);
3062+ replace_helper<NumParts> (this , which, v, pnt);
30623063}
30633064
30643065static inline Coord::units roundcoord (Coord::units a, Coord::units mod)
@@ -3150,7 +3151,7 @@ std::unique_ptr<ContProcedure> ContProcGrid::clone() const
31503151
31513152void ContProcGrid::replace (ContToken const * which, std::unique_ptr<ContToken> v)
31523153{
3153- replace_helper (this , which, v, grid);
3154+ replace_helper<NumParts> (this , which, v, grid);
31543155}
31553156
31563157std::vector<uint8_t > ContProcGrid::Serialize () const
@@ -3243,7 +3244,7 @@ std::unique_ptr<ContProcedure> ContProcHSCM::clone() const
32433244
32443245void ContProcHSCM::replace (ContToken const * which, std::unique_ptr<ContToken> v)
32453246{
3246- replace_helper (this , which, v, pnt1, pnt2, numbeats);
3247+ replace_helper<NumParts> (this , which, v, pnt1, pnt2, numbeats);
32473248}
32483249
32493250std::vector<uint8_t > ContProcHSCM::Serialize () const
@@ -3346,7 +3347,7 @@ std::unique_ptr<ContProcedure> ContProcHSDM::clone() const
33463347
33473348void ContProcHSDM::replace (ContToken const * which, std::unique_ptr<ContToken> v)
33483349{
3349- replace_helper (this , which, v, pnt);
3350+ replace_helper<NumParts> (this , which, v, pnt);
33503351}
33513352
33523353std::vector<uint8_t > ContProcHSDM::Serialize () const
@@ -3416,7 +3417,7 @@ std::unique_ptr<ContProcedure> ContProcMagic::clone() const
34163417
34173418void ContProcMagic::replace (ContToken const * which, std::unique_ptr<ContToken> v)
34183419{
3419- replace_helper (this , which, v, pnt);
3420+ replace_helper<NumParts> (this , which, v, pnt);
34203421}
34213422
34223423std::vector<uint8_t > ContProcMagic::Serialize () const
@@ -3525,7 +3526,7 @@ std::unique_ptr<ContProcedure> ContProcMarch::clone() const
35253526
35263527void ContProcMarch::replace (ContToken const * which, std::unique_ptr<ContToken> v)
35273528{
3528- replace_helper (this , which, v, stpsize, stps, dir, facedir);
3529+ replace_helper<NumParts> (this , which, v, stpsize, stps, dir, facedir);
35293530}
35303531
35313532std::vector<uint8_t > ContProcMarch::Serialize () const
@@ -3613,7 +3614,7 @@ std::unique_ptr<ContProcedure> ContProcMT::clone() const
36133614
36143615void ContProcMT::replace (ContToken const * which, std::unique_ptr<ContToken> v)
36153616{
3616- replace_helper (this , which, v, numbeats, dir);
3617+ replace_helper<NumParts> (this , which, v, numbeats, dir);
36173618}
36183619
36193620std::vector<uint8_t > ContProcMT::Serialize () const
@@ -3686,7 +3687,7 @@ std::unique_ptr<ContProcedure> ContProcMTRM::clone() const
36863687
36873688void ContProcMTRM::replace (ContToken const * which, std::unique_ptr<ContToken> v)
36883689{
3689- replace_helper (this , which, v, dir);
3690+ replace_helper<NumParts> (this , which, v, dir);
36903691}
36913692
36923693std::vector<uint8_t > ContProcMTRM::Serialize () const
@@ -3771,7 +3772,7 @@ std::unique_ptr<ContProcedure> ContProcNSEW::clone() const
37713772
37723773void ContProcNSEW::replace (ContToken const * which, std::unique_ptr<ContToken> v)
37733774{
3774- replace_helper (this , which, v, pnt);
3775+ replace_helper<NumParts> (this , which, v, pnt);
37753776}
37763777
37773778std::vector<uint8_t > ContProcNSEW::Serialize () const
@@ -3865,7 +3866,7 @@ std::unique_ptr<ContProcedure> ContProcRotate::clone() const
38653866
38663867void ContProcRotate::replace (ContToken const * which, std::unique_ptr<ContToken> v)
38673868{
3868- replace_helper (this , which, v, ang, stps, pnt);
3869+ replace_helper<NumParts> (this , which, v, ang, stps, pnt);
38693870}
38703871
38713872std::vector<uint8_t > ContProcRotate::Serialize () const
0 commit comments