nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
standard_engine.hpp
1// bundle/include/nk/bundle/standard_engine.hpp
2//
3// StandardEngine — an Engine with the standard library already installed, as a
4// stack-constructible convenience:
5//
6// nk::StandardEngine engine; // ready to eval("sin(1)") etc.
7//
8// It is a thin subclass over the public installStandardLibrary() composition
9// API — no new behaviour, just "construct + install" in one step. The three
10// composition flavours (this, installStandardLibrary, makeStandardEngine) all
11// live here in bundle/; core itself stays library-agnostic.
12//
13// Pulls in the full engine.hpp (needed to subclass Engine); embedders who only
14// want the free function include the lighter standard_library.hpp instead.
15
16#pragma once
17
19#include <nk/core/engine.hpp>
20
21#include <memory_resource>
22
23namespace nk {
24
25struct StandardEngine : Engine
26{
27 StandardEngine() { installStandardLibrary(*this); }
28 explicit StandardEngine(std::pmr::memory_resource *mr) : Engine(mr)
29 {
31 }
32};
33
34} // namespace nk
void installStandardLibrary(Engine &engine)
Forwarder for backward compatibility.