libabigail
Toggle main menu visibility
Loading...
Searching...
No Matches
include
abg-sptr-utils.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2
// -*- mode: C++ -*-
3
//
4
// Copyright (C) 2013-2026 Red Hat, Inc.
5
6
/// @file
7
///
8
/// Utilities to ease the wrapping of C types into std::shared_ptr
9
10
#ifndef __ABG_SPTR_UTILS_H__
11
#define __ABG_SPTR_UTILS_H__
12
13
#include <regex.h>
14
#include <memory>
15
16
17
namespace
abigail
18
{
19
20
/// Namespace for the utilities to wrap C types into std::shared_ptr.
21
namespace
sptr_utils
22
{
23
24
using
std::shared_ptr;
25
26
/// This is to be specialized for the diverse C types that needs
27
/// wrapping in shared_ptr.
28
///
29
/// @tparam T the type of the C type to wrap in a shared_ptr.
30
///
31
/// @param p a pointer to wrap in a shared_ptr.
32
///
33
/// @return then newly created shared_ptr<T>
34
template
<
class
T>
35
shared_ptr<T>
36
build_sptr
(T* p);
37
38
/// This is to be specialized for the diverse C types that needs
39
/// wrapping in shared_ptr.
40
///
41
/// This variant creates a pointer to T and wraps it into a
42
/// shared_ptr<T>.
43
///
44
/// @tparam T the type of the C type to wrap in a shared_ptr.
45
///
46
/// @return then newly created shared_ptr<T>
47
template
<
class
T>
48
shared_ptr<T>
49
build_sptr
();
50
51
/// A deleter for shared pointers that ... doesn't delete the object
52
/// managed by the shared pointer.
53
struct
noop_deleter
54
{
55
template
<
typename
T>
56
void
57
operator()(
const
T*)
58
{}
59
};
60
61
}
// end namespace sptr_utils
62
}
// end namespace abigail
63
64
#endif
//__ABG_SPTR_UTILS_H__
abigail::sptr_utils
Namespace for the utilities to wrap C types into std::shared_ptr.
Definition
abg-corpus-priv.h:28
abigail::sptr_utils::build_sptr
shared_ptr< T > build_sptr()
This is to be specialized for the diverse C types that needs wrapping in shared_ptr.
abigail
Toplevel namespace for libabigail.
Definition
abg-comp-filter.cc:27
abigail::sptr_utils::noop_deleter
A deleter for shared pointers that ... doesn't delete the object managed by the shared pointer.
Definition
abg-sptr-utils.h:54
Generated by
1.17.0