M
Mark
I have a pretty strange problem on my hands. I know of the syntax for
what I'm trying to do without templates, but not with, and I've come
to a point now where I don't really know where else to look for
answers, so I figured I'd post here!
As you can see below, I have OneNorm as an inline class of Set, and
OneNorm declared as a friend of Set. However, when I try to access
the private members of Set, I get a compiler error. Does anyone idea
what I've done wrong here?
Thanks,
Mark
PS – CylindricalCoor is an inheriting class of Element.
-----------------compiler error------------------------
set.hpp:13: type `Set<float,CylindricalCoor>' is not a base type for
type `Set<float,CylindricalCoor>::OneNorm'
set.hpp:13: confused by earlier errors, bailing out
make: *** [all] Error 1
-----------------set.h---------------------------------
template<typename T, template <typename> class Element>
class Set {
public:
Set(){}
~Set(){}
...
class OneNorm {
public:
friend class Set;
double operator()();
};
friend class OneNorm;
OneNorm CalcOneNorm;
....
private:
std::vector<Element<T> > SetMembers;
};
-----------------set.hpp---------------------------------
template<typename T, template <typename> class Element>
double Set<T, Element>::OneNorm:perator()()
{
double TotalMags = 0 ;
for(int i = 0; i < Set::SetMembers.size(); i++) //ERROR: line 13
TotalMags = TotalMags + Set::~SetMembers;
return TotalMags;
}
what I'm trying to do without templates, but not with, and I've come
to a point now where I don't really know where else to look for
answers, so I figured I'd post here!
As you can see below, I have OneNorm as an inline class of Set, and
OneNorm declared as a friend of Set. However, when I try to access
the private members of Set, I get a compiler error. Does anyone idea
what I've done wrong here?
Thanks,
Mark
PS – CylindricalCoor is an inheriting class of Element.
-----------------compiler error------------------------
set.hpp:13: type `Set<float,CylindricalCoor>' is not a base type for
type `Set<float,CylindricalCoor>::OneNorm'
set.hpp:13: confused by earlier errors, bailing out
make: *** [all] Error 1
-----------------set.h---------------------------------
template<typename T, template <typename> class Element>
class Set {
public:
Set(){}
~Set(){}
...
class OneNorm {
public:
friend class Set;
double operator()();
};
friend class OneNorm;
OneNorm CalcOneNorm;
....
private:
std::vector<Element<T> > SetMembers;
};
-----------------set.hpp---------------------------------
template<typename T, template <typename> class Element>
double Set<T, Element>::OneNorm:perator()()
{
double TotalMags = 0 ;
for(int i = 0; i < Set::SetMembers.size(); i++) //ERROR: line 13
TotalMags = TotalMags + Set::~SetMembers;
return TotalMags;
}