예제 #1
0
파일: Cnv.hpp 프로젝트: questor/git-ws
				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
파일: Reader.hpp 프로젝트: questor/git-ws
					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
파일: Cnv.hpp 프로젝트: sonyomega/SSVUtils
				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
파일: Cnv.hpp 프로젝트: sonyomega/SSVUtils
				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));
				}