Ariles
Loading...
Searching...
No Matches
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#include "../internal/helpers.h"
15
16namespace ariles2
17{
18 template <class t_Value>
19 class PointerHandler<boost::optional<t_Value>>
20 {
21 public:
22 using Pointer = boost::optional<t_Value>;
23 using Value = t_Value;
24
25
26 public:
27 static void allocate(Pointer &ptr)
28 {
29 ptr = t_Value();
30 }
31
32 static void reset(Pointer &ptr)
33 {
34 ptr = boost::none;
35 }
36
37 static bool isNull(const Pointer &ptr)
38 {
39 return (boost::none == ptr);
40 }
41 };
42} // namespace ariles2
43
44#define ARILES2_POINTER_TYPE boost::optional