Adobe Source Libraries 2.0.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
array.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_ARRAY_HPP
9#define ADOBE_ARRAY_HPP
10
11#include <adobe/config.hpp>
12
13#include <adobe/array_fwd.hpp>
14
15#include <adobe/any_regular.hpp>
16
17#ifdef ADOBE_STD_SERIALIZATION
18#include <adobe/iomanip.hpp>
19#endif
20
21/**************************************************************************************************/
22
23namespace adobe {
24
25/**************************************************************************************************/
26
27template <typename T> // T models Regular
28inline void push_back(array_t& v, T x) {
29 v.push_back(any_regular_t(std::move(x)));
30}
31
32inline void push_back(array_t& v, any_regular_t x) { v.push_back(std::move(x)); }
33
34/**************************************************************************************************/
35
36#ifdef ADOBE_STD_SERIALIZATION
37
38// To be findable by ADL, the operator must be in the same namespace as `any_regular_t.`
39inline namespace version_1 {
40
41inline std::ostream& operator<<(std::ostream& out, const array_t& x) {
42 out << begin_sequence;
43
44 for (const auto& e : x)
45 out << e; // format will be called by any_regular_t.
46
47 out << end_sequence;
48
49 return out;
50}
51
52} // namespace version_1
53
54#endif
55
56/**************************************************************************************************/
57
58} // namespace adobe
59
60/**************************************************************************************************/
61
62#endif
A runtime polymorphic type similar to boost::any which can hold any type which models Regular.
void push_back(array_t &v, T x)
Definition array.hpp:28
std::vector< any_regular_t > array_t
Definition array_fwd.hpp:23
std::ostream & operator<<(std::ostream &s, const extents_t &x)