[multi_array] How to use non-default constructor?

Hi! I would like to know if in multi_array there is a possibility to initialize multi_array using non-default constructor? When I am using std::vector there is a possibility to do it like that: std::vector<MyObject> my_object_vec ( 2, MyObject( parameters ) ); This vector constructor uses non-default constructor of MyObject. In C++ arrays constructon like that should be done in two steps first is to initialize array (uses default constructor) and then we could assign values to the array using copy constructor, but this is not nice, and in my cases not good solution. Important is that in MyObject class there shouldn't be default constructor, and better not to use copy constructor. Of course there exists non-default constructor like MyObject ( const Parameters & parameters ). Regards. -- |\/\/| Seweryn Habdank-Wojewódzki `\/\/

Hi Seweryn, At this time, there is no means to initialize a multi_array using a non-default constructor in the way that you describe below. Cheers, ron On Apr 25, 2006, at 6:39 AM, Seweryn Habdank-Wojewódzki wrote:
Hi!
I would like to know if in multi_array there is a possibility to initialize multi_array using non-default constructor?
When I am using std::vector there is a possibility to do it like that:
std::vector<MyObject> my_object_vec ( 2, MyObject( parameters ) );
This vector constructor uses non-default constructor of MyObject. In C++ arrays constructon like that should be done in two steps first is to initialize array (uses default constructor) and then we could assign values to the array using copy constructor, but this is not nice, and in my cases not good solution.
Important is that in MyObject class there shouldn't be default constructor, and better not to use copy constructor. Of course there exists non-default constructor like MyObject ( const Parameters & parameters ).
Regards.
--
|\/\/| Seweryn Habdank-Wojewódzki `\/\/
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Hi! Ronald Garcia wrote:
At this time, there is no means to initialize a multi_array using a non-default constructor in the way that you describe below.
And in the future? Is it big problem to add such a functionality? Maybe it will be useful to be familiar with std::"containers". To be honest I am developing library based on array with non-POD objects and I am doing it using std::vector or std::deque (parametrized in template), but this is very dirty piece of my code. And in the future I would like to remove it and use better one. Of course I understand that my construction is not typical. The same problem with constructing matrix using my object I had in boost::ublas, there is no such a construction too. Regards. -- |\/\/| Seweryn Habdank-Wojewódzki `\/\/

On Apr 26, 2006, at 2:38 PM, Seweryn Habdank-Wojewódzki wrote:
Hi!
Ronald Garcia wrote:
At this time, there is no means to initialize a multi_array using a non-default constructor in the way that you describe below.
And in the future? Is it big problem to add such a functionality? Maybe it will be useful to be familiar with std::"containers".
I think that this is a reasonable addition to add in the future. I suspect that such an addition to the constructor interface is now possible, especially given some advances in the state of the art since this library was written (in particular, enable_if). I have added this to my list of issues regarding multi_array, but I cannot promise how soon I will be able to make the addition. Cheers, ron

Hi
I think that this is a reasonable addition to add in the future. I suspect that such an addition to the constructor interface is now possible, especially given some advances in the state of the art since this library was written (in particular, enable_if). I have added this to my list of issues regarding multi_array, but I cannot promise how soon I will be able to make the addition.
If it will be before "C++0x" it will be for me good, because, in fact, after "C++0x" I will have to recode my library :-). Regards. -- |\/\/| Seweryn Habdank-Wojewódzki `\/\/
participants (2)
-
Ronald Garcia
-
Seweryn Habdank-Wojewódzki