Ariles
boost_optional.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2017-2018 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 #pragma once
12 
13 #include <boost/optional.hpp>
14 
15 namespace ariles
16 {
17  template <class t_Value>
18  class PointerHandler<boost::optional<t_Value> >
19  {
20  public:
21  typedef boost::optional<t_Value> Pointer;
22  typedef t_Value Value;
23 
24 
25  public:
26  static void allocate(Pointer &ptr)
27  {
28  ptr = t_Value();
29  }
30 
31  static void reset(Pointer &ptr)
32  {
33  ptr = boost::none;
34  }
35 
36  static bool isNull(const Pointer &ptr)
37  {
38  return (boost::none == ptr);
39  }
40  };
41 } // namespace ariles
42 
43 #define ARILES_POINTER_TYPE boost::optional
class ARILES_VISIBILITY_ATTRIBUTE PointerHandler
Definition: helpers.h:114
Definition: basic.h:17