Opened 12 years ago

Closed 12 years ago

#465 closed defect (invalid)

normalizer/Centralizer.h contains forbidden code?

Reported by: Jari Häkkinen Owned by: Peter
Priority: major Milestone: yat 0.5
Component: normalizer Version: trunk
Keywords: Cc:

Description

I admit, its been a while since I did yat contribution but was it not decided to disencourage code like:

/**
 \param uf unary function defining the center.
 */
Centralizer(const UnaryFunction& uf)
	: func_(uf) {}

Other classes in the normalizer namespace have similar code.

Change History (2)

comment:1 Changed 12 years ago by Peter

The thing is that Centralizer is a template so the implementation has to occur in the header file. I thought that fact made it OK to have that kind of code. If I'm wrong, I guess I have a few places to modify.

The change would be to implement the constructor outside the class in the same file. I would like to know why that is preferable.

comment:2 in reply to:  1 Changed 12 years ago by Jari Häkkinen

Resolution: invalid
Status: newclosed

Replying to peter:

The thing is that Centralizer is a template so the implementation has to occur in the header file. I thought that fact made it OK to have that kind of code. If I'm wrong, I guess I have a few places to modify.

The change would be to implement the constructor outside the class in the same file. I would like to know why that is preferable.

You are right the classes I am referring to are all template classes, there is no need to change anything. I mixed it up with non-template classes where we decided to have no inlining such as Averager. I told you, its been a while since I wrote any code (ignoring the fact that I've been working with R, Perl, Java and other strange languages).

Note: See TracTickets for help on using tickets.