ATLAS Offline Software
Loading...
Searching...
No Matches
IsSTLSequence.h
Go to the documentation of this file.
1// Yo emacs, this is -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7/***************************************************************************
8 determines whether CONTAINER is one of supported ATLAS sequences Requires
9 CONTAINER to define value_type
10 ----------------------------------------------------------------
11 ATLAS Collaboration
12 ***************************************************************************/
13
14// $Id: IsSTLSequence.h,v 1.5 2008-11-17 19:24:52 ssnyder Exp $
15
16#ifndef ATHLINKS_TOOLS_ISSTLSEQUENCE_H
17# define ATHLINKS_TOOLS_ISSTLSEQUENCE_H
18
19#include <vector>
20#include <list>
21#include <deque>
22#include <type_traits>
23
24
25
26// CLASS DECLARATIONS
27namespace SG {
28 // Some parts of Athena define FLAG as a macro.
29 template <class CONTAINER, class FLAG_>
31 {
32 typedef std::false_type type;
33 };
34
35 template <class CONTAINER>
36 struct TestSequenceTag<CONTAINER, typename CONTAINER::isSequence>
37 {
38 typedef typename CONTAINER::isSequence type;
39 };
40
41 template <class CONTAINER>
43 private:
44 // Causes trouble with fwd decls? cf xAODTruth?
45 //BOOST_CONCEPT_ASSERT((boost::ContainerConcept<CONTAINER>));
46 typedef typename CONTAINER::value_type value_type;
47
48 // vectors
49 typedef typename std::is_base_of< std::vector<value_type>, CONTAINER> isVector;
50
51 // lists
52 typedef typename std::is_base_of< std::list<value_type>, CONTAINER> isList;
53
54 // queues
55 typedef typename std::is_base_of< std::deque<value_type>, CONTAINER> isDeque;
56
57 // explicit tag, by adding
58 // typedef type_tools::true_tag isSequence;
59 // to a class.
61
62 public:
63 //putting it all together
64 static const bool value =
65 isDeque::value ||
66 isList::value ||
67 isVector::value ||
68 hasSequenceTag::value;
69 };
70}
71#endif // ATHLINKS_TOOLS_ISSTLSEQUENCE_H
Forward declaration.
static const bool value
TestSequenceTag< CONTAINER, std::true_type >::type hasSequenceTag
std::is_base_of< std::list< value_type >, CONTAINER > isList
std::is_base_of< std::deque< value_type >, CONTAINER > isDeque
CONTAINER::value_type value_type
std::is_base_of< std::vector< value_type >, CONTAINER > isVector
std::false_type type