B
Ben
Hi,
I was writing a expression template for string concatenation latetly.
When writing it, I started to feel curious that why there's not any
generic et lib that can save me from wring each different et lib from
scratch. Or, maybe I was just ignorant and there is some already?
matrix, string, array, vector, whatever, the idea of et is quite
similar. We need a leaf node and a binary non-leaf node for expressing
the expression syntax tree; We need to overload some operators; We
need to broadcast certain functor object recursively to all leaf
nodes, etc.
And there can be many generic tasks that are not specific to matrix or
string at all. (say, find out how many leaf nodes in the tree, or find
out the type of or reference to the #i leaf node, etc.)
And we shouldn't be writing such kind of code over and over again for
different things that we want to make lazy, should we?
So, I started writing my own generic et framework. And using this
framework, I have created my string concatenation for string, const
char*, const char[k], CString. They can even be mixed.
Each different type just needs to specialize a few classes to use this
framework.
Code using this framework can look like:
string str = "world";
CString cstr = "...";
string s = et + "hello" + " " + str + cstr + "!";
But before I start writing my next et, (I'm thinking about using it to
apply MCM algorithm for matrixes), I want to make sure that I'm not
doing anything that has been done well in another lib.
So, the question is: is there anything out there that has already does
so?
Can I simply customize an existing generic et lib to optimize my
string concatenation for string, CString, MyString etc?
Ben.
I was writing a expression template for string concatenation latetly.
When writing it, I started to feel curious that why there's not any
generic et lib that can save me from wring each different et lib from
scratch. Or, maybe I was just ignorant and there is some already?
matrix, string, array, vector, whatever, the idea of et is quite
similar. We need a leaf node and a binary non-leaf node for expressing
the expression syntax tree; We need to overload some operators; We
need to broadcast certain functor object recursively to all leaf
nodes, etc.
And there can be many generic tasks that are not specific to matrix or
string at all. (say, find out how many leaf nodes in the tree, or find
out the type of or reference to the #i leaf node, etc.)
And we shouldn't be writing such kind of code over and over again for
different things that we want to make lazy, should we?
So, I started writing my own generic et framework. And using this
framework, I have created my string concatenation for string, const
char*, const char[k], CString. They can even be mixed.
Each different type just needs to specialize a few classes to use this
framework.
Code using this framework can look like:
string str = "world";
CString cstr = "...";
string s = et + "hello" + " " + str + cstr + "!";
But before I start writing my next et, (I'm thinking about using it to
apply MCM algorithm for matrixes), I want to make sure that I'm not
doing anything that has been done well in another lib.
So, the question is: is there anything out there that has already does
so?
Can I simply customize an existing generic et lib to optimize my
string concatenation for string, CString, MyString etc?
Ben.