frameworks - On declarative programming in C++ -
I often face the problem of mapping the parameter space of one API on each other's parameter space I often get nested nested nested ... has been resolved by switch statements.
And I was wondering if there would be a library or a technique that allows you to declare 'mapping' instead of 'programming'. A trivial example involves the inclusion of the values of two conventions in one:
Nomspace source API {struct A {typefif e {A1, A2, A3}}; Structure b {typefif e {b1, b2}}; } Namespace target API {structure AB (typedffei {a1b1, a1b2, a2b1, a2b2, a3b1, a3b2}}}}}
Mappings are often done in this
switch (a) {case (a :: a1): switch (b) {case (b :: B1): Return A1B1; Case (B :: B2): Return A1B2; ....}
And this mapping is still a 'reverse' Switch needs to be done.
But I would like to have a dense type like
declare (source (A :: A1, B :: B1), target ( AB :: A1B1) ); Declare (Source: (A :: A1, B :: B2), Target (AB :: A1b2); ....
Is there any such Have seen techniques or structures or libraries?
You can use which one between two types Provides bidirectional mapping.
There is a bit of runtime overhead (usually, about the same amount you will get using a pair) code> std :: map s This object , Which is not a lot).
This allows you to define mapping as the density of your example; Normally you just add a pair at a time.
Comments
Post a Comment