note about std::function
parent
e624f98be7
commit
d2d262afbd
|
@ -25,12 +25,20 @@ namespace cscript {
|
||||||
using CsInt = int;
|
using CsInt = int;
|
||||||
using CsFloat = float;
|
using CsFloat = float;
|
||||||
|
|
||||||
|
/* probably don't want to change these, but if you use a custom allocation
|
||||||
|
* function for your state, keep in mind potential heap allocations in
|
||||||
|
* these are not handled by it (as std::function has no allocator support)
|
||||||
|
*
|
||||||
|
* normally std::function is optimized not to do allocations for small
|
||||||
|
* objects, so as long as you don't pass a lambda that captures by copy
|
||||||
|
* or move or something similar, you should be fine - but if you really
|
||||||
|
* need to make sure, override this with your own type
|
||||||
|
*/
|
||||||
using CsVarCb = std::function<void(CsState &, CsIdent &)>;
|
using CsVarCb = std::function<void(CsState &, CsIdent &)>;
|
||||||
using CsCommandCb = std::function<void(CsState &, CsValueRange, CsValue &)>;
|
using CsCommandCb = std::function<void(CsState &, CsValueRange, CsValue &)>;
|
||||||
using CsHookCb = std::function<void(CsState &)>;
|
using CsHookCb = std::function<void(CsState &)>;
|
||||||
using CsAllocCb = void *(*)(void *, void *, size_t, size_t);
|
using CsAllocCb = void *(*)(void *, void *, size_t, size_t);
|
||||||
|
|
||||||
|
|
||||||
constexpr auto const IntFormat = "%d";
|
constexpr auto const IntFormat = "%d";
|
||||||
constexpr auto const FloatFormat = "%.7g";
|
constexpr auto const FloatFormat = "%.7g";
|
||||||
constexpr auto const RoundFloatFormat = "%.1f";
|
constexpr auto const RoundFloatFormat = "%.1f";
|
||||||
|
|
Loading…
Reference in New Issue