gnuradio / pmt

pmt
GNU Lesser General Public License v3.0
11 stars 11 forks source link

Implicit Conversions #30

Open jsallay opened 2 years ago

jsallay commented 2 years ago

A pmt and several of the other classes defined (like pmtf::scalar) are very permissive classes on purpose. They can be constructed from a very wide variety of objects. We use templates to allow for this.

We have a problem with implicit conversions. For example, in the code right now, if I write: std::cout << std::vector<int>(4) << std::endl; . There is no operator<< defined for a vector, but I can create a pmt (or a pmtf::vector) from one. The compiler will do an implicit conversion to a pmt and then print the values out. This is not expected or desired behavior.

In order to fix this, we need to add SFINAE to each of the generic function calls. This needs to be done for all of the functions where an argument is a pmt or a wrapper function and we define multiple versions depending on the type passed in.