MCPcopy Create free account
hub / github.com/covscript/covscript / numeric

Function numeric

include/covscript/core/components.hpp:292–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290
291 template <typename T, typename = std::enable_if_t<!std::is_same<std::decay_t<T>, numeric>::value>>
292 numeric(T &&dat)
293 {
294 if (std::is_floating_point<std::decay_t<T>>::value) {
295 type = 0;
296 data._num = static_cast<numeric_float>(dat);
297 }
298 else if (std::is_integral<std::decay_t<T>>::value) {
299 type = 1;
300 data._int = static_cast<numeric_integer>(dat);
301 }
302 else
303 throw runtime_error("Construct numeric with incompatible type.");
304 }
305
306 numeric(const numeric &rhs) : data(rhs.data), type(rhs.type) {}
307

Callers 5

components.hppFile · 0.70
create_contextFunction · 0.50
create_subcontextFunction · 0.50
numeric>Method · 0.50
type_ext.hppFile · 0.50

Calls 1

runtime_errorClass · 0.85

Tested by

no test coverage detected