[fusion] Non-default initialisation of sequence components.
Hi Everyone,
I'm wondering if there is a (built-in) way in boost::fusion to instantiate a sequence of heterogeneous elements while passing an identical set of arguments to the constructor of each element? It seems like the only options are to default construct the elements or to supply references to previously constructed elements.
As a semi-concrete example, is there a way to achieve the equivalent of the following?
template <int Label>
struct TestType {
TestType(int i, double d, string s):I(i), D(d), S(s){}
int I;
double D;
string S;
};
int main(int argc, char* argv[]){
typedef vector
AMDG Hugh Dickinson wrote:
I'm wondering if there is a (built-in) way in boost::fusion to instantiate a sequence of heterogeneous elements while passing an identical set of arguments to the constructor of each element? It seems like the only options are to default construct the elements or to supply references to previously constructed elements.
I believe that there's a trac ticket for allowing the use of boost::in_place_factory with fusion. As far as I know, this isn't implemented yet, though. In Christ, Steven Watanabe
participants (2)
-
Hugh Dickinson
-
Steven Watanabe