What is ScatterHierarchyTag means?

A

alex

I read the Loki source code, I doubt why use ScatterHierarchyTag head?

----------------------------------------------------------------------------------------------------------------

namespace Private
{

template<class, class>
struct ScatterHierarchyTag;
}

template <class TList, template <class> class Unit>
class GenScatterHierarchy;

template <class T1, class T2, template <class> class Unit>
class GenScatterHierarchy<Typelist<T1, T2>, Unit>
: public GenScatterHierarchy<Private::ScatterHierarchyTag<T1,
T2>, Unit>
, public GenScatterHierarchy<T2, Unit>
{
public:
typedef Typelist<T1, T2> TList;
typedef GenScatterHierarchy<Private::ScatterHierarchyTag<T1,
T2>, Unit> LeftBase;
typedef GenScatterHierarchy<T2, Unit> RightBase;
template <typename T> struct Rebind
{
typedef Unit<T> Result;
};
};

template <class T1, class T2, template <class> class Unit>
class GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>,
Unit>
: public GenScatterHierarchy<T1, Unit>
{
};

template <class AtomicType, template <class> class Unit>
class GenScatterHierarchy : public Unit<AtomicType>
{
typedef Unit<AtomicType> LeftBase;
template <typename T> struct Rebind
{
typedef Unit<T> Result;
};
};

template <template <class> class Unit>
class GenScatterHierarchy<NullType, Unit>
{
template <typename T> struct Rebind
{
typedef Unit<T> Result;
};
};
 
B

Ben Pope

alex said:
I read the Loki source code

Then unfortunately, you are off topic here, the sourceforge project has
a forum for help relating to that library.

Ben Pope
 
D

David Harmon

I read the Loki source code

Then unfortunately, you are off topic here, the sourceforge project has
a forum for help relating to that library.[/QUOTE]

No, it is not off topic here. All of the Loki source code is
standard conforming C++ language code and completely subject to
discussion here. The sourceforge forum is still also a good
suggestion, and also comp.lang.c++.moderated since the author
sometimes answers questions there.

To Alex,
ScatterHierarchyTag was not used in the book version of Loki.
(I assume you are also reading _Modern C++ Design_ by Andre
Alexandrescu; if not there is no hope of understanding.)
The answer to your question is contained in the comment that appears
near the definition of ScatterHierarchyTag, or at least I hope it
answers your question because I probably cannot do any better.


// The following type helps to overcome subtle flaw in the original
// implementation of GenScatterHierarchy.
// The flaw is revealed when the input type list of GenScatterHierarchy
// contains more then one element of the same type (e.g. LOKI_TYPELIST_2(int,
int)).
// In this case GenScatterHierarchy will contain multiple bases of the same
// type and some of them will not be reachable (per 10.3).
// For example before the fix the first element of Tuple<LOKI_TYPELIST_2(int,
int)>
// is not reachable in any way!
 
B

Ben Pope

David said:
>>
Then unfortunately, you are off topic here, the sourceforge project has
a forum for help relating to that library.

No, it is not off topic here. All of the Loki source code is
standard conforming C++ language code and completely subject to
discussion here.[/QUOTE]

With all due respect, I don't think that all libraries that have
standards conforming code are up for discussion here.

That's a lot of code.

Ben Pope
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,785
Messages
2,569,624
Members
45,319
Latest member
LorenFlann

Latest Threads

Top