UFO
ArrowProxy.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2019 Met Office UK
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
8 #ifndef UFO_UTILS_ARROWPROXY_H_
9 #define UFO_UTILS_ARROWPROXY_H_
10 
11 namespace ufo {
12 
13 /// \brief Utility class used in overloads of operator-> in forward iterators.
14 ///
15 /// See e.g. A. O'Dwyer's blog, https://quuxplusone.github.io/blog/2019/02/06/arrow-proxy.
16 template<class T>
17 class ArrowProxy {
18  public:
19  explicit ArrowProxy(const T &ref) :
20  ref_(ref)
21  {}
22 
23  T *operator->() {
24  return &ref_;
25  }
26 
27  private:
28  T ref_;
29 };
30 
31 } // namespace ufo
32 
33 #endif // UFO_UTILS_ARROWPROXY_H_
Utility class used in overloads of operator-> in forward iterators.
Definition: ArrowProxy.h:17
ArrowProxy(const T &ref)
Definition: ArrowProxy.h:19
T * operator->()
Definition: ArrowProxy.h:23
Definition: RunCRTM.h:27