Example #1
0
				template<typename T> inline static void toVal(Val& mV, T&& mX)
				{
					Arr result; result.reserve(sizeof...(TArgs));
					// TODO: fwd macro?
					tplFor([&result](auto&& mI){ result.emplace_back(fwd<decltype(mI)>(mI)); }, fwd<T>(mX));
					mV.setArr(std::move(result));
				}
Example #2
0
					inline Val parseArr()
					{
						Arr arr;

						// Skip '['
						++idx;

						// Empty array
						if(isC(']')) goto end;

						// Reserve some memory
						arr.reserve(10);

						while(true)
						{
							// Get value
							arr.emplace_back(parseVal());

							// Check for another value
							if(isC(',')) { ++idx; continue; }

							// Check for end of the array
							if(isC(']')) break;

							throwError("Invalid array", std::string{"Expected either `,` or `]`, got `"} + getC() + "`");
						}

						end:

						// Skip ']'
						++idx;

						return Val{arr};
					}
Example #3
0
				template<typename T> inline static void toVal(Val& mV, T&& mX)
				{
					Arr result; result.reserve(TS);
					for(auto i(0u); i < TS; ++i) result.emplace_back(moveIfRValue<decltype(mX)>(mX[i]));
					mV.setArr(std::move(result));
				}
Example #4
0
				template<typename T> inline static void toVal(Val& mV, T&& mX)
				{
					Arr result; result.reserve(mX.size());
					for(const auto& v : mX) result.emplace_back(moveIfRValue<decltype(mX)>(v));
					mV.setArr(std::move(result));
				}
Example #5
0
				template<typename T> inline static void toVal(Val& mV, T&& mX)
				{
					Arr result; result.reserve(sizeof...(TArgs));
					TplCnvHelper::fromTpl<0, TArgs...>(result, fwd<T>(mX));
					mV.setArr(std::move(result));
				}