1#ifndef __JTOOLS__JARRAY__
2#define __JTOOLS__JARRAY__
38 template<
unsigned int N,
class T>
41 public JMath < JArray<N,T> >,
48 using typename array_type::value_type;
49 using typename array_type::size_type;
50 using typename array_type::difference_type;
51 using typename array_type::reference;
52 using typename array_type::const_reference;
53 using typename array_type::pointer;
54 using typename array_type::const_pointer;
55 using typename array_type::iterator;
56 using typename array_type::const_iterator;
57 using typename array_type::reverse_iterator;
58 using typename array_type::const_reverse_iterator;
62 typedef typename std::conditional<std::is_const<T>::value,
63 typename std::remove_const<T>::type,
64 typename std::add_const <T>::type>::type
U;
80 template<
unsigned int M>
91 template<
unsigned int M>
103 template<
class ...Args>
105 std::array<T, N>({value, args...})
116 std::copy_n(p, N, this->data());
139 template<
size_t M,
class ...Args>
141 JArray(array,
std::array<T, N-M>({value, args...}))
152 template<
size_t M,
class ...Args>
164 std::array<T, N>(key)
184 template<
unsigned int M>
196 template<
unsigned int M>
209 template<
unsigned int M,
class ...Args>
211 JArray(key,
std::array<T, N-M>({value, args...}))
222 template<
unsigned int M,
class ...Args>
224 JArray(key,
std::array<T, N-M>({value, args...}))
235 return pop_front(std::make_index_sequence<N>{});
246 return pop_back(std::make_index_sequence<N-1>{});
258 return push_back(value, std::make_index_sequence<N>{});
269 for (
int i = 0; i != N; ++i) {
270 (*this)[i] = -(*this)[i];
285 for (
int i = 0; i != N; ++i) {
286 (*this)[i] += array[i];
301 for (
int i = 0; i != N; ++i) {
302 (*this)[i] -= array[i];
317 for (
int i = 0; i != N; ++i) {
318 (*this)[i] *= factor;
333 for (
int i = 0; i != N; ++i) {
334 (*this)[i] /= factor;
349 for (
int i = 0; i != N; ++i) {
350 if ((*
this)[i] != array[i]) {
368 for (iterator i = array.begin(); i != array.end(); ++i) {
387 for (const_iterator i = array.begin(); i != array.end(); ++i) {
388 out <<
' ' << format << *i;
404 for (iterator i = buffer.begin(); i != buffer.end(); ++i) {
421 for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
436 template<
size_t M,
size_t ...i>
439 return {array[i]...};
452 return match(array, std::make_index_sequence<N>{});
463 template<
size_t ...i>
466 return {array[i]...};
479 return convert(array, std::make_index_sequence<M>{});
491 template<
size_t ...iv,
size_t ...iw>
493 const std::array<T,
sizeof...(iw)>& w,
const std::index_sequence<iw...>& lw)
495 return { v[iv]..., w[iw]... };
509 return combine(first, std::make_index_sequence< M >{},
510 second, std::make_index_sequence<N-M>{});
520 template<
size_t ...i>
523 return {(*this)[i]...};
534 template<
class ...Args>
547 template<
size_t ...i>
561 template<
size_t ...i>
564 return {value, (*this)[i]...};
JFormat_t & getFormat()
Get format for given type.
Base class for data structures with artithmetic capabilities.
Interface for binary input.
Interface for binary output.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JArgument< T >::argument_type argument_type
Template definition of auxiliary base class for comparison of data structures.
Auxiliary base class for aritmetic operations of derived class types.