Visual Computing Library
Loading...
Searching...
No Matches
view.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_TYPES_VIEW_H
24#define VCL_TYPES_VIEW_H
25
26#define ZIP_VIEW_INJECT_STD_VIEWS_NAMESPACE
27#if __has_include(<zip_view.hpp>)
28#include <zip_view.hpp>
29#else
30// inclusion for usage of vclib without CMake - not ideal but necessary for
31// header only
32#include "../../../external/zip-views-1.0/zip_view.hpp"
33#endif
34#undef ZIP_VIEW_INJECT_STD_VIEWS_NAMESPACE
35
36#include <ranges>
37
38namespace vcl {
39
65template<typename It>
66class View : public std::ranges::view_interface<View<It>>
67{
68public:
69 using iterator = It;
70 using const_iterator = It;
71
72 View() = default;
73
74 View(It begin, It end) : mBegin(begin), mEnd(end) {}
75
76 auto begin() const { return mBegin; }
77
78 auto end() const { return mEnd; }
79
80protected:
81 It mBegin, mEnd;
82};
83
84} // namespace vcl
85
86#endif // VCL_TYPES_VIEW_H
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
The View class is a simple class that stores and exposes two iterators begin and end.
Definition view.h:67