#define EDGETYPETRAITS_H
// General
template
class edgeTypeTraits;
// =============================================
// Edge Specialization
template <>
class edgeTypeTraits
{
public:
typedef edge edgeType;
};
// =============================================
// Arcs Specialization
template <>
class edgeTypeTraits
{
public:
typedef arcs edgeType;
};
// =============================================
#endif
#ifndef VERTEXTYPETRAITS_H
#define VERTEXTYPETRAITS_H
class edge;
class arcs;
template
class vertex;
// Base class no definition
template
class vertexTypeTraits;
// Partial Specialization
template
class vertexTypeTraits
{
public:
typedef boost::shared_ptr
typedef std::vector
typedef edge edgeType;
};
// Partial Specialization
template
class vertexTypeTraits
{
public:
typedef boost::shared_ptr
typedef std::vector
typedef arcs edgeType;
};
#endif
/*
Traits
= A class template used to describle
another class template parameter
= If/else of type
= Used to Type Parameterize
The compiler looks up information
about the edgeType from graph class template
in the vertex's traits class
Example:
1. char_traits
2. float_traits(std::numeric_limits)
*/
Usage in Graph.h
template
class graph
{
public:
typedef edgeType edgeType;
typedef typename vertexTypeTraits
}
No comments:
Post a Comment