This forum has been archived. All content is frozen. Please use KDE Discuss instead.

United template conversion functions

Tags: None
(comma "," separated)
Tal
Registered Member
Posts
30
Karma
0
First, I want to said that Eigen seems perfect, can't wait to work with it.

Now, because I don't want to do this manually and change the source, I ask this feature and want to here your opinion on it. Maybe someone posted this in past, but I don't know, I'm new ;)

The idea said that there is a united template conversions function, e.g.:
template <typename From, typename To>
void Eigen::ImplicitConvertion(const From& from, To& to);

template <typename From, typename To>
void Eigen::ExplicitConvertion(const From& from, To& to);

Both Eigen library and the user can specify for his own types, or her own template classes.

You might ask yourself, so why don't I declare it only for my own use?
The reason is that I wish Eigen declare template implicit constructor, explicit constructor, and conversion operator in its classes.

What are the benefit of having this?
1. Messy conversion options code doesn't have to appear on the class API. It can appear in a different, "private" header that specify those template functions.
2. Extensibility to user defined conversion between two types without access to one class API. A great feature of template.
3. A built in, optional, conversion to third party libraries. For example, Eigen might support conversion between Eigen Matrix and Boost Matrix. The user chose whether to invoke this dependency, either by macro definition before Eigen headers, or by including specific third party compatibility header.

I'm sure I didn't invented the wheel, but I hope to here what you think!


User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You can already add whatever fancy methods to main Eigen's classes: http://eigen.tuxfamily.org/dox/TopicCus ... tml#title0
Tal
Registered Member
Posts
30
Karma
0
ggael wrote:You can already add whatever fancy methods to main Eigen's classes: http://eigen.tuxfamily.org/dox/TopicCus ... tml#title0

Thanks




Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]