Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
youngwolf
qme
提交
96397f05
Q
qme
项目概览
youngwolf
/
qme
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qme
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
96397f05
编写于
2月 02, 2024
作者:
Y
youngwolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make the return value of get_left_item/get_right_item to be const reference.
上级
ca07308d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
9 deletion
+12
-9
question_exp.h
question_exp.h
+12
-9
未找到文件。
question_exp.h
浏览文件 @
96397f05
...
...
@@ -109,8 +109,8 @@ public:
virtual
T
get_immediate_value
()
const
{
throw
(
"unsupported get immediate value operation!"
);}
virtual
const
std
::
string
&
get_variable_name
()
const
{
throw
(
"unsupported get variable name operation!"
);}
virtual
char
get_operator
()
const
{
throw
(
"unsupported get operator operation!"
);}
virtual
std
::
shared_ptr
<
data_exp
<
T
>>
get_left_item
()
const
{
throw
(
"unsupported get left item operation!"
);}
virtual
std
::
shared_ptr
<
data_exp
<
T
>>
get_right_item
()
const
{
throw
(
"unsupported get right item operation!"
);}
virtual
const
std
::
shared_ptr
<
data_exp
<
T
>>&
get_left_item
()
const
{
throw
(
"unsupported get left item operation!"
);}
virtual
const
std
::
shared_ptr
<
data_exp
<
T
>>&
get_right_item
()
const
{
throw
(
"unsupported get right item operation!"
);}
virtual
bool
merge_with
(
char
,
const
std
::
shared_ptr
<
data_exp
<
T
>>&
)
{
return
false
;}
virtual
bool
merge_with
(
const
std
::
shared_ptr
<
data_exp
<
T
>>&
,
char
)
{
return
false
;}
...
...
@@ -189,8 +189,8 @@ public:
}
virtual
int
get_depth
()
const
{
return
1
+
std
::
max
(
dexp_l
->
get_depth
(),
dexp_r
->
get_depth
());}
virtual
char
get_operator
()
const
{
return
op
;}
virtual
std
::
shared_ptr
<
data_exp
<
T
>>
get_left_item
()
const
{
return
dexp_l
;}
virtual
std
::
shared_ptr
<
data_exp
<
T
>>
get_right_item
()
const
{
return
dexp_r
;}
virtual
const
std
::
shared_ptr
<
data_exp
<
T
>>&
get_left_item
()
const
{
return
dexp_l
;}
virtual
const
std
::
shared_ptr
<
data_exp
<
T
>>&
get_right_item
()
const
{
return
dexp_r
;}
virtual
void
show_immediate_value
()
const
{
dexp_l
->
show_immediate_value
();
dexp_r
->
show_immediate_value
();}
virtual
bool
merge_with
(
char
other_op
,
const
std
::
shared_ptr
<
data_exp
<
T
>>&
other_exp
)
...
...
@@ -514,6 +514,7 @@ template <typename T> class variable_data_exp : public data_exp<T>
public:
variable_data_exp
(
const
std
::
string
&
_variable_name
)
:
variable_name
(
_variable_name
)
{}
virtual
const
std
::
string
&
get_variable_name
()
const
{
return
variable_name
;}
virtual
std
::
shared_ptr
<
data_exp
<
T
>>
to_negative
()
const
{
return
std
::
make_shared
<
negative_variable_data_exp
<
T
>>
(
variable_name
);}
virtual
T
operator
()(
const
std
::
function
<
T
(
const
std
::
string
&
)
>&
cb
)
const
...
...
@@ -551,6 +552,7 @@ template <typename T> class exponent_data_exp : public data_exp<T>
public:
exponent_data_exp
(
const
std
::
string
&
_variable_name
,
int
_exponent
)
:
variable_name
(
_variable_name
),
exponent
(
_exponent
)
{}
virtual
const
std
::
string
&
get_variable_name
()
const
{
return
variable_name
;}
virtual
void
show_immediate_value
()
const
{
std
::
cout
<<
' '
<<
exponent
;}
virtual
std
::
shared_ptr
<
data_exp
<
T
>>
to_negative
()
const
...
...
@@ -986,8 +988,8 @@ template <typename T> class judge_exp : public exp
public:
virtual
bool
is_judge
()
const
{
return
true
;}
virtual
const
std
::
string
&
get_operator
()
const
{
throw
(
"unsupported get operator operation!"
);}
virtual
std
::
shared_ptr
<
judge_exp
<
T
>>
get_left_item
()
const
{
throw
(
"unsupported get left item operation!"
);}
virtual
std
::
shared_ptr
<
judge_exp
<
T
>>
get_right_item
()
const
{
throw
(
"unsupported get right item operation!"
);}
virtual
const
std
::
shared_ptr
<
judge_exp
<
T
>>&
get_left_item
()
const
{
throw
(
"unsupported get left item operation!"
);}
virtual
const
std
::
shared_ptr
<
judge_exp
<
T
>>&
get_right_item
()
const
{
throw
(
"unsupported get right item operation!"
);}
virtual
std
::
shared_ptr
<
judge_exp
<
T
>>
final_optimize
()
=
0
;
...
...
@@ -1217,8 +1219,8 @@ protected:
public:
virtual
bool
is_composite
()
const
{
return
true
;}
virtual
const
std
::
string
&
get_operator
()
const
{
return
lop
;}
virtual
std
::
shared_ptr
<
judge_exp
<
T
>>
get_left_item
()
const
{
return
jexp_l
;}
virtual
std
::
shared_ptr
<
judge_exp
<
T
>>
get_right_item
()
const
{
return
jexp_r
;}
virtual
const
std
::
shared_ptr
<
judge_exp
<
T
>>&
get_left_item
()
const
{
return
jexp_l
;}
virtual
const
std
::
shared_ptr
<
judge_exp
<
T
>>&
get_right_item
()
const
{
return
jexp_r
;}
virtual
int
get_depth
()
const
{
return
1
+
std
::
max
(
jexp_l
->
get_depth
(),
jexp_l
->
get_depth
());}
virtual
void
show_immediate_value
()
const
{
jexp_l
->
show_immediate_value
();
jexp_r
->
show_immediate_value
();}
...
...
@@ -1302,7 +1304,8 @@ public:
virtual
T
safe_execute
(
const
std
::
function
<
T
(
const
std
::
string
&
)
>&
cb
)
const
{
return
qme
::
safe_execute
(
jexp
,
cb
)
?
qme
::
safe_execute
(
dexp_l
,
cb
)
:
qme
::
safe_execute
(
dexp_r
,
cb
);}
virtual
void
safe_delete
()
{
qme
::
safe_delete
(
jexp
);
qme
::
safe_delete
(
dexp_l
);
qme
::
safe_delete
(
dexp_r
);}
void
safe_delete
()
{
qme
::
safe_delete
(
jexp
);
qme
::
safe_delete
(
dexp_l
);
qme
::
safe_delete
(
dexp_r
);}
protected:
std
::
shared_ptr
<
data_exp
<
T
>>
clone
()
const
{
return
std
::
make_shared
<
question_exp
<
T
>>
(
jexp
,
dexp_l
,
dexp_r
);}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录