Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
4a4151ec
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4a4151ec
编写于
3月 14, 2014
作者:
R
Roman Donchenko
提交者:
OpenCV Buildbot
3月 14, 2014
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2474 from akarsakov:fix_getpolicy
上级
0ce8f1d5
8910508b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
11 deletion
+25
-11
modules/flann/include/opencv2/flann/any.h
modules/flann/include/opencv2/flann/any.h
+25
-11
未找到文件。
modules/flann/include/opencv2/flann/any.h
浏览文件 @
4a4151ec
...
...
@@ -155,13 +155,27 @@ SMALL_POLICY(bool);
#undef SMALL_POLICY
/// This function will return a different policy for each type.
template
<
typename
T
>
base_any_policy
*
get_policy
()
template
<
typename
T
>
class
SinglePolicy
{
SinglePolicy
();
SinglePolicy
(
const
SinglePolicy
&
other
);
SinglePolicy
&
operator
=
(
const
SinglePolicy
&
other
);
public:
static
base_any_policy
*
get_policy
();
private:
static
typename
choose_policy
<
T
>::
type
policy
;
return
&
policy
;
}
};
template
<
typename
T
>
typename
choose_policy
<
T
>::
type
SinglePolicy
<
T
>::
policy
;
/// This function will return a different policy for each type.
template
<
typename
T
>
inline
base_any_policy
*
SinglePolicy
<
T
>::
get_policy
()
{
return
&
policy
;
}
}
// namespace anyimpl
struct
any
...
...
@@ -175,26 +189,26 @@ public:
/// Initializing constructor.
template
<
typename
T
>
any
(
const
T
&
x
)
:
policy
(
anyimpl
::
get_policy
<
anyimpl
::
empty_any
>
()),
object
(
NULL
)
:
policy
(
anyimpl
::
SinglePolicy
<
anyimpl
::
empty_any
>::
get_policy
()),
object
(
NULL
)
{
assign
(
x
);
}
/// Empty constructor.
any
()
:
policy
(
anyimpl
::
get_policy
<
anyimpl
::
empty_any
>
()),
object
(
NULL
)
:
policy
(
anyimpl
::
SinglePolicy
<
anyimpl
::
empty_any
>::
get_policy
()),
object
(
NULL
)
{
}
/// Special initializing constructor for string literals.
any
(
const
char
*
x
)
:
policy
(
anyimpl
::
get_policy
<
anyimpl
::
empty_any
>
()),
object
(
NULL
)
:
policy
(
anyimpl
::
SinglePolicy
<
anyimpl
::
empty_any
>::
get_policy
()),
object
(
NULL
)
{
assign
(
x
);
}
/// Copy constructor.
any
(
const
any
&
x
)
:
policy
(
anyimpl
::
get_policy
<
anyimpl
::
empty_any
>
()),
object
(
NULL
)
:
policy
(
anyimpl
::
SinglePolicy
<
anyimpl
::
empty_any
>::
get_policy
()),
object
(
NULL
)
{
assign
(
x
);
}
...
...
@@ -219,7 +233,7 @@ public:
any
&
assign
(
const
T
&
x
)
{
reset
();
policy
=
anyimpl
::
get_policy
<
T
>
();
policy
=
anyimpl
::
SinglePolicy
<
T
>::
get_policy
();
policy
->
copy_from_value
(
&
x
,
&
object
);
return
*
this
;
}
...
...
@@ -274,7 +288,7 @@ public:
void
reset
()
{
policy
->
static_delete
(
&
object
);
policy
=
anyimpl
::
get_policy
<
anyimpl
::
empty_any
>
();
policy
=
anyimpl
::
SinglePolicy
<
anyimpl
::
empty_any
>::
get_policy
();
}
/// Returns true if the two types are the same.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录