Skip to content

Commit

Permalink
[bugfix] fix setName compile error in some windows env.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Aug 30, 2024
1 parent fd0b0a2 commit 3345ff4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/CBasic/CDescInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ class CDescInfo {
* 设置名称信息
* @param name
* @return
* @notice 部分windows编译器不支持函数继承改变返回值类型,故做此区分
*/
virtual auto setName(const std::string& name)
-> decltype(this) {
#ifdef _WIN32
virtual CVoidPtr setName(const std::string& name) {
#else
virtual auto setName(const std::string& name) -> decltype(this) {
#endif
name_ = name;
return this;
}
Expand Down
4 changes: 4 additions & 0 deletions src/GraphCtrl/GraphElement/GElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ CVoid GElement::beforeRun() {
}


#ifdef _WIN32
CVoidPtr GElement::setName(const std::string& name) {
#else
GElementPtr GElement::setName(const std::string& name) {
#endif
CGRAPH_ASSERT_INIT_THROW_ERROR(false)
this->name_ = name.empty() ? this->session_ : name;
return this;
Expand Down
4 changes: 4 additions & 0 deletions src/GraphCtrl/GraphElement/GElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ class GElement : public GElementObject,
* @param name
* @return
*/
#ifdef _WIN32
CVoidPtr setName(const std::string& name) override;
#else
GElement* setName(const std::string& name) override;
#endif

/**
* 设置循环次数
Expand Down

0 comments on commit 3345ff4

Please sign in to comment.