Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error use 'template' keyword to treat 'item' #15

Merged
merged 3 commits into from
Aug 26, 2021

Conversation

0x0000dead
Copy link
Contributor

@0x0000dead 0x0000dead commented Aug 23, 2021

Compile with CMAKE_CXX_STANDARD 17; Apple clang version 12.0.0 (clang-1200.0.32.29), getting an error:

../../Segmentor.h:187:21: error: use 'template' keyword to treat 'item' as a dependent template name loss_sum += loss.item<float>();

According to ISO C++03 14.2/4 fix it.

When the name of a member template specialization appears after . or -> in a postfix-expression, or after nested-name-specifier in a qualified-id, and the postfix-expression or qualified-id explicitly depends on a template-parameter (14.6.2), the member template name must be prefixed by the keyword template. Otherwise the name is assumed to name a non-template.

@AllentDan AllentDan self-requested a review August 24, 2021 01:36
Copy link
Owner

@AllentDan AllentDan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your PR. Is there anywhere else that should be fixed to compatipate with c++ 17? For instance, the training part or other model architectures.

@0x0000dead
Copy link
Contributor Author

Hi, yes, training and different models, everything works fine.
This fix was not part of C++17 or C++14 Standard, but clang - compatibility. I expect that you compile the project with g++, I use clang and fix it up. Also, I use C++17 - there is no error at all, so you can also update CMakeLists.txt

@AllentDan
Copy link
Owner

Alright, we may leave the CMakeLists.txt configuration to customers' preference.

Copy link
Owner

@AllentDan AllentDan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AllentDan AllentDan merged commit f872f93 into AllentDan:main Aug 26, 2021
@yuanhs1996 yuanhs1996 mentioned this pull request Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants