cds  2.3.2
cds::opt::tag< Tag > Struct Template Reference

[type-option] Option setter specifies a tag More...

#include <cds/opt/options.h>

Detailed Description

template<typename Tag>
struct cds::opt::tag< Tag >

[type-option] Option setter specifies a tag

Suppose, you have a struct

struct Feature
{ .... };

and you want that your class X would be derived from several Feature:

class X: public Feature, public Feature
{ .... };

How can you distinguish one Feature from another? You may use a tag option:

template <typename Tag>
struct Feature
{ .... };
class tag_a;
class tag_b;
class X: public Feature< tag_a >, public Feature< tag_b >
{ .... };

Now you can distinguish one Feature from another:

X x;
Feature<tag_a>& fa = static_cast< Feature<tag_a> >( x );
Feature<tag_b>& fb = static_cast< Feature<tag_b> >( x );

tag option setter allows you to do things like this for an option-centric approach:

template <typename ...Options>
struct Feature
{ .... };
class tag_a;
class tag_b;
class X: public Feature< tag<tag_a> >, public Feature< tag<tag_b> >
{ .... };

This option setter is widely used in cds::intrusive containers to distinguish between different intrusive part of container's node.

An incomplete type can serve as a Tag.


The documentation for this struct was generated from the following file:

cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:51 by Doxygen 1.8.13