Coverage Report

Created: 2025-12-31 06:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pistache/include/pistache/iterator_adapter.h
Line
Count
Source
1
/*
2
 * SPDX-FileCopyrightText: 2016 Mathieu Stefani
3
 *
4
 * SPDX-License-Identifier: Apache-2.0
5
 */
6
7
/*
8
   Mathieu Stefani, 28 février 2016
9
10
   A collection of sample iterator adapters
11
*/
12
13
#pragma once
14
15
namespace Pistache
16
{
17
18
    template <typename Map>
19
    struct FlatMapIteratorAdapter
20
    {
21
        typedef typename Map::key_type Key;
22
        typedef typename Map::mapped_type Value;
23
        typedef typename Map::const_iterator const_iterator;
24
25
        explicit FlatMapIteratorAdapter(const_iterator _it)
26
0
            : it(_it)
27
0
        { }
28
29
        FlatMapIteratorAdapter& operator++()
30
0
        {
31
0
            ++it;
32
0
            return *this;
33
0
        }
34
35
0
        const Value& operator*() { return it->second; }
36
37
0
        bool operator==(FlatMapIteratorAdapter other) { return other.it == it; }
38
39
0
        bool operator!=(FlatMapIteratorAdapter other) { return !(*this == other); }
40
41
    private:
42
        const_iterator it;
43
    };
44
45
    template <typename Map>
46
    FlatMapIteratorAdapter<Map>
47
    makeFlatMapIterator(const Map&, typename Map::const_iterator it)
48
0
    {
49
0
        return FlatMapIteratorAdapter<Map>(it);
50
0
    }
51
52
} // namespace Pistache