Re: [Boost-users] Retrieve multindex value type?
----- Mensaje original -----
De: Francesco Biscani
Hello,
is there a way to retrieve from a multiIndex container the type of its content?
I need to do something like this:
template <class T> class my_class { private: T set;
public: void insert(const T::value_type &); <------ ? };
Here T is a multiIndex container, and the insert function should add a term to the set. Hence "insert" must accept as input the kind of values that are stored in the multiIndex container. Is there a way to do so or should I just add another parameter to the template and use that as argument for insert? Thanks,
Hello Francesco, Indeed, multi_index_container provides a nested value_type typedef that you can use exactly in the way you describe. Have you encountered any problem in doing so? Thank you for using Boost.MultiIndex, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
Hello Francesco,
Indeed, multi_index_container provides a nested value_type typedef that you can use exactly in the way you describe. Have you encountered any problem in doing so?
Hi Joaquin, funny thing, I used that syntax in the example but did not try it really in the code. Talk about intuitive interface :) The only thing I had to do was to add a "typename" before "T::" and everything seems to be ok now. Sorry about the noise, I'm quite a newbie C++ programmer and I could not find the answer in the headers.
Thank you for using Boost.MultiIndex,
_I_ am the one who should thank you :) I'm writing this astronomical program to manipulate Poisson series (which are to be ordered in different ways at the same time), and multiIndex really lifted a lot of weight from my shoulders. My only possible concern about multiIndex is how much widespread is its use in the C++ programming community. Knowing that there are many people adopting it would really make me feel safer, since I'm going to use it _very_ heavily in my software. Anyway, thanks very much, for multiIndex and your answer :) Francesco
Francesco Biscani ha escrito:
My only possible concern about multiIndex is how much widespread is its use in the C++ programming community. Knowing that there are many people adopting it would really make me feel safer, since I'm going to use it _very_ heavily in my software.
I wish I knew that myself. I don't have usage figures for B.MI, and I don't think there's hard data for Boost as a whole either. From the posts received here at the lists, I think it's safe to assume users of B.MI range at least in the tens to low hundreds, but whether this is very conservative or not I don't really know.
Anyway, thanks very much, for multiIndex and your answer :)
Francesco
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (3)
-
Francesco Biscani
-
JOAQUIN LOPEZ MU?Z
-
Joaquín Mª López Muñoz