5
#ifndef OPENCV_CORE_CVSTD_WRAPPER_HPP
6
#define OPENCV_CORE_CVSTD_WRAPPER_HPP
8
#include "opencv2/core/cvdef.h"
12
#include <type_traits>
23
template
<
typename
_Tp>
using
Ptr = std::shared_ptr<_Tp>;
25
template<
typename
_Tp,
typename
... A1>
static
inline
26Ptr<_Tp> makePtr(
const
A1&... a1) {
return
std::make_shared<_Tp>(a1...); }
35
void
operator()(Y* p)
const;
40
template<
typename
C,
typename
Ret,
typename... Args>
45
static
CV_CONSTEXPR std::true_type check(
typename
std::is_same<
typename
std::decay<
decltype(std::declval<T>().
operator()(std::declval<Args>()...))>::type, Ret>::type*);
47
template<
typename>
static
CV_CONSTEXPR std::false_type check(...);
49
typedef
decltype(check<C>(0)) type;
52
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900
)
53
static
CV_CONSTEXPR
bool
value = type::value;
56
static
const
int
value = type::value;
61
template
<
typename
T,
typename
=
void>
63
:
public
std::false_type {};
68
struct
has_custom_delete<T, typename std::enable_if< sfinae::has_parenthesis_operator<DefaultDeleter<T>, void, T*>::value >::type >
69
:
public
std::true_type {};
73
struct
Ptr
:
public
std::shared_ptr<T>
76
using
std::shared_ptr<T>::shared_ptr;
78
inline
Ptr() CV_NOEXCEPT : std::shared_ptr<T>() {}
79
inline
Ptr(nullptr_t) CV_NOEXCEPT : std::shared_ptr<T>(
nullptr) {}
80
template<
typename
Y,
typename
D>
inline
Ptr(Y* p, D d) : std::shared_ptr<T>(p, d) {}
81
template<
typename
D>
inline
Ptr(nullptr_t, D d) : std::shared_ptr<T>(
nullptr, d) {}
83
template<
typename
Y>
inline
Ptr(
const
Ptr<Y>& r, T* ptr) CV_NOEXCEPT : std::shared_ptr<T>(r, ptr) {}
85
inline
Ptr(
const
Ptr<T>& o) CV_NOEXCEPT : std::shared_ptr<T>(o) {}
86
inline
Ptr(
Ptr<T>&& o) CV_NOEXCEPT : std::shared_ptr<T>(std::move(o)) {}
88
template<
typename
Y>
inline
Ptr(
const
Ptr<Y>& o) CV_NOEXCEPT : std::shared_ptr<T>(o) {}
89
template<
typename
Y>
inline
Ptr(
Ptr<Y>&& o) CV_NOEXCEPT : std::shared_ptr<T>(std::move(o)) {}
91
inline
Ptr(
const
std::shared_ptr<T>& o) CV_NOEXCEPT : std::shared_ptr<T>(o) {}
92
inline
Ptr(std::shared_ptr<T>&& o) CV_NOEXCEPT : std::shared_ptr<T>(std::move(o)) {}
100
inline
Ptr(
const
std::false_type&, Y* ptr) : std::shared_ptr<T>(ptr) {}
102
template<
typename
Y = T>
107
inline
void
reset(
const
std::true_type&, Y* ptr) { std::shared_ptr<T>::reset(ptr,
DefaultDeleter<Y>()); }
111
inline
void
reset(
const
std::false_type&, Y* ptr) { std::shared_ptr<T>::reset(ptr); }
116
template<
class
Y,
class
Deleter>
117
void
reset(Y* ptr, Deleter d) { std::shared_ptr<T>::reset(ptr, d); }
119
void
reset() CV_NOEXCEPT { std::shared_ptr<T>::reset(); }
121
Ptr& operator=(
const
Ptr& o) { std::shared_ptr<T>::operator =(o);
return
*
this; }
122
template<
typename
Y>
inline
Ptr& operator=(
const
Ptr<Y>& o) { std::shared_ptr<T>::operator =(o);
return
*
this; }
124
T* operator->()
const
CV_NOEXCEPT {
return
std::shared_ptr<T>::get();}
125
typename
std::add_lvalue_reference<T>::type operator*()
const
CV_NOEXCEPT {
return
*std::shared_ptr<T>::get(); }
128
inline
void
release() { std::shared_ptr<T>::reset(); }
129
inline
operator
T* ()
const
{
return
std::shared_ptr<T>::get(); }
130
inline
bool
empty()
const
{
return
std::shared_ptr<T>::get() ==
nullptr; }
132
template<
typename
Y>
inline
133
Ptr<Y>
staticCast()
const
CV_NOEXCEPT {
return
std::static_pointer_cast<Y>(*
this); }
135
template<
typename
Y>
inline
136
Ptr<Y>
constCast()
const
CV_NOEXCEPT {
return
std::const_pointer_cast<Y>(*
this); }
138
template<
typename
Y>
inline
139
Ptr<Y>
dynamicCast()
const
CV_NOEXCEPT {
return
std::dynamic_pointer_cast<Y>(*
this); }
142
template<
typename
_Tp,
typename
... A1>
static
inline
146
return
(
Ptr<_Tp>)std::make_shared<_Tp>(a1...);
"black box" representation of the file storage associated with a file on disk.
Definition:
aruco.hpp:75
Definition:
cvstd_wrapper.hpp:32
Definition:
cvstd_wrapper.hpp:74
Definition:
cvstd_wrapper.hpp:63
Definition:
cvstd_wrapper.hpp:42