/usr/include/stxxl/bits/common/tmeta.h is in libstxxl-dev 1.4.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | /***************************************************************************
* include/stxxl/bits/common/tmeta.h
*
* Template Metaprogramming Tools
* (from the Generative Programming book Krysztof Czarnecki, Ulrich Eisenecker)
*
* Part of the STXXL. See http://stxxl.sourceforge.net
*
* Copyright (C) 2003 Roman Dementiev <dementiev@mpi-sb.mpg.de>
* Copyright (C) 2008 Andreas Beckmann <beckmann@cs.uni-frankfurt.de>
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
**************************************************************************/
#ifndef STXXL_COMMON_TMETA_HEADER
#define STXXL_COMMON_TMETA_HEADER
#include <stxxl/bits/namespace.h>
#include <stxxl/bits/common/types.h>
STXXL_BEGIN_NAMESPACE
//! IF template metaprogramming statement.
//!
//! If \c Flag is \c true then \c IF<>::result is of type Type1
//! otherwise of \c IF<>::result is of type Type2
template <bool Flag, class Type1, class Type2>
struct IF
{
typedef Type1 result;
};
template <class Type1, class Type2>
struct IF<false, Type1, Type2>
{
typedef Type2 result;
};
//! If \c Flag is \c true then \c IF<>::result is Num1
//! otherwise of \c IF<>::result is Num2
template <bool Flag, unsigned Num1, unsigned Num2>
struct IF_N
{
enum
{
result = Num1
};
};
template <unsigned Num1, unsigned Num2>
struct IF_N<false, Num1, Num2>
{
enum
{
result = Num2
};
};
const int DEFAULT = ~(~0u >> 1); // initialize with the smallest int
struct NilCase { };
template <int tag_, class Type_, class Next_ = NilCase>
struct CASE
{
enum { tag = tag_ };
typedef Type_ Type;
typedef Next_ Next;
};
template <int tag, class Case>
class SWITCH
{
typedef typename Case::Next NextCase;
enum
{
caseTag = Case::tag,
found = (caseTag == tag || caseTag == DEFAULT)
};
public:
typedef typename IF<found,
typename Case::Type,
typename SWITCH<tag, NextCase>::result
>::result result;
};
template <int tag>
class SWITCH<tag, NilCase>
{
public:
typedef NilCase result;
};
//! \internal, use LOG2 instead
template <unsigned_type Input>
class LOG2_floor
{
public:
enum
{
value = LOG2_floor<Input / 2>::value + 1
};
};
template <>
class LOG2_floor<1>
{
public:
enum
{
value = 0
};
};
template <>
class LOG2_floor<0>
{
public:
enum
{
value = 0
};
};
template <unsigned_type Input>
class LOG2
{
public:
enum
{
floor = LOG2_floor<Input>::value,
ceil = LOG2_floor<Input - 1>::value + 1
};
};
template <>
class LOG2<1>
{
public:
enum
{
floor = 0,
ceil = 0
};
};
template <>
class LOG2<0>
{
public:
enum
{
floor = 0,
ceil = 0
};
};
STXXL_END_NAMESPACE
#endif // !STXXL_COMMON_TMETA_HEADER
|