-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtraits.hh
53 lines (42 loc) · 2.1 KB
/
traits.hh
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
// Copyright Stephan T. Lavavej, http://nuwen.net .
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://boost.org/LICENSE_1_0.txt .
#ifndef PHAM_TRAITS_HH
#define PHAM_TRAITS_HH
#include "compiler.hh"
#ifdef NUWEN_PLATFORM_MSVC
#pragma once
#endif
#include "typedef.hh"
#include "external_begin.hh"
#include <cstddef>
#include <deque>
#include <list>
#include <string>
#include <vector>
#include <boost/type_traits.hpp>
#include "external_end.hh"
namespace nuwen {
template <typename X> struct is_sequence { static const bool value = false; };
template <typename T> struct is_sequence<std::vector<T> > { static const bool value = true; };
template <typename T> struct is_sequence<std::deque<T> > { static const bool value = true; };
template <typename T> struct is_sequence<std::list<T> > { static const bool value = true; };
template <typename X, typename T> struct is_sequence_of { static const bool value = false; };
template <typename T> struct is_sequence_of<std::vector<T>, T> { static const bool value = true; };
template <typename T> struct is_sequence_of<std::deque<T>, T> { static const bool value = true; };
template <typename T> struct is_sequence_of<std::list<T>, T> { static const bool value = true; };
template <typename X> struct is_string {
static const bool value = boost::is_same<X, std::string>::value;
};
template <typename X> struct is_stringlike_sequence {
static const bool value =
is_sequence_of<X, char>::value
|| is_sequence_of<X, uc_t>::value
|| is_sequence_of<X, sc_t>::value;
};
template <typename X, typename T> struct is_bounded_array_of { static const bool value = false; };
template <typename T, std::size_t N> struct is_bounded_array_of< T[N], T> { static const bool value = true; };
template <typename T, std::size_t N> struct is_bounded_array_of<const T[N], T> { static const bool value = true; };
}
#endif // Idempotency