Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Leibner
dune-common
Commits
cc523b81
Commit
cc523b81
authored
7 years ago
by
Ansgar Burchardt
Browse files
Options
Downloads
Patches
Plain Diff
Detect support for C++17's class template argument deduction
parent
8e8875c0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmake/modules/CheckCXXFeatures.cmake
+34
-0
34 additions, 0 deletions
cmake/modules/CheckCXXFeatures.cmake
config.h.cmake
+3
-0
3 additions, 0 deletions
config.h.cmake
with
37 additions
and
0 deletions
cmake/modules/CheckCXXFeatures.cmake
+
34
−
0
View file @
cc523b81
...
...
@@ -19,6 +19,9 @@
# :code:`HAS_ATTRIBUTE_DEPRECATED_MSG`
# True if attribute deprecated("msg") is supported
#
# :code:`DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION`
# True if C++17's class template argument deduction is supported
#
# .. cmake_variable:: DISABLE_CXX_VERSION_CHECK
#
# You may set this variable to TRUE to disable checking for
...
...
@@ -313,6 +316,37 @@ check_cxx_source_compiles("
"
HAVE_IS_INDEXABLE_SUPPORT
)
# support for C++17's class template deduction guides
check_cxx_source_compiles
(
"
#include <type_traits>
template<typename T1>
struct A {
A(T1) {}
template<typename T2>
A(T2, T2) {}
};
struct B {
using type = bool;
};
template<typename T2>
A(T2, T2)
-> A<typename T2::type>;
int main()
{
A a1(1);
static_assert(std::is_same_v< decltype(a1), A<int> >);
B b;
A a2(b, b);
static_assert(std::is_same_v< decltype(a2), A<bool> >);
}
"
DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
)
# find the threading library
# Use a copy FindThreads from CMake 3.1 due to its support of pthread
...
...
This diff is collapsed.
Click to expand it.
config.h.cmake
+
3
−
0
View file @
cc523b81
...
...
@@ -26,6 +26,9 @@
/* does the compiler support
__attribute__
((
unused
))
? */
#cmakedefine HAS_ATTRIBUTE_UNUSED 1
/* does the compiler support C++17's class template argument deduction? */
#cmakedefine DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1
/* Define if you have a BLAS library. */
#cmakedefine HAVE_BLAS 1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment