Large portion of our commercial C++ library relies on templates. We plan to sell our product as header files and dynamically linked libraries (closed-source), but because most of our code base is concentrated in headers, we would de facto be releasing it as open-source with small, easily replaceable chunks missing.
Here is an example of what one of our classes from library interface look like:
template<class ItInput, class ItOutput>
struct serialize{
ItOutput operator() (ItInput first, ItInput last, ItOutput d_first) {
// operation on pointers (assuming that ++, -- and * operators work as expected for pointers)
}
Is there a way to provide level of obfuscation to our templated code equal to or better than compilation of regular code (i.e. technically reversible but not profitable nor optimal to do so)?
EDIT: To clarify, our goal is to prevent users from reading the implementation, not prevent unlawful copying of our work. For the sake of the question please assume we have a valid reasons for this requirement.