/usr/include/bobcat/repeat is in libbobcat-dev 3.23.01-1.
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 | #ifndef INCLUDED_BOBCAT_REPEAT_
#define INCLUDED_BOBCAT_REPEAT_
#include <utility>
#include <bobcat/typetrait>
namespace FBB
{
template <bool type>
struct Repeat__;
template <>
struct Repeat__<false>
{
template <typename Fun, typename ...Params>
static void call(Fun fun, Params &&...params); // 1.f
};
template <>
struct Repeat__<true>
{
template <typename Class, typename Member, typename ...Params>
static void call(Class &obj, Member member, Params &&...params); // 2.f
template <typename Class, typename Member, typename ...Params>
static void call(Class const &obj, Member member, // 3.f
Params &&...params);
};
template <typename Counter, typename First, typename ...Params>
inline void repeat(Counter counter, First &&first, Params &&...params); // .f
template <typename Fun, typename ...Params>
inline void Repeat__<false>::call(Fun fun, Params &&...params)
{
fun(std::forward<Params>(params)...);
}
template <typename Class, typename Member, typename ...Params>
inline void Repeat__<true>::call(Class &obj, Member member,
Params &&...params)
{
(obj.*member)(std::forward<Params>(params)...);
}
template <typename Class, typename Member, typename ...Params>
inline void Repeat__<true>::call(Class const &obj, Member member,
Params &&...params)
{
(obj.*member)(std::forward<Params>(params)...);
}
template <typename Counter, typename First, typename ...Params>
void repeat(Counter counter, First &&first, Params &&...params)
{
for (; counter; --counter)
Repeat__<TypeTrait<First>::isClass>::call(
std::forward<First>(first),
std::forward<Params>(params)...);
}
} // FBB
#endif
|