Пример #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));
				}
Пример #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};
					}
Пример #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));
				}
Пример #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));
				}