Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
b47ab37b
Commit
b47ab37b
authored
Apr 09, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved C++11 detection.
parent
6e9ee89e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
cpp11_test.cpp
dlib/dnn/test_for_cpp11/cpp11_test.cpp
+15
-2
use_cpp_11.cmake
dlib/use_cpp_11.cmake
+2
-1
No files found.
dlib/dnn/test_for_cpp11/cpp11_test.cpp
View file @
b47ab37b
...
...
@@ -13,15 +13,26 @@ public:
testme
(
testme
&&
)
=
default
;
testme
(
const
testme
&
)
=
delete
;
template
<
typename
T
>
auto
auto_return
(
T
f
)
->
decltype
(
f
(
4
))
{
return
f
(
4
);
}
template
<
typename
T
>
auto
auto_return
(
T
f
)
->
decltype
(
f
())
{
return
f
();
}
int
returnint
()
{
return
0
;
}
void
dostuff
()
{
thread_local
stuff1
=
999
;
thread_local
int
stuff1
=
999
;
auto
x
=
4
;
decltype
(
x
)
asdf
=
9
;
auto
f
=
[](){
cout
<<
"in a lambda!"
<<
endl
;
};
auto
f
=
[]()
{
cout
<<
"in a lambda!"
<<
endl
;
};
f
();
auto_return
(
returnint
);
}
template
<
typename
...
T
>
...
...
@@ -31,6 +42,8 @@ public:
{
}
std
::
shared_ptr
<
int
>
asdf
;
};
...
...
dlib/use_cpp_11.cmake
View file @
b47ab37b
...
...
@@ -24,7 +24,7 @@ include(${dlib_path}/add_global_compiler_switch.cmake)
# Now turn on the appropriate compiler switch to enable C++11 if you have a
# C++11 compiler. In CMake 3.1 there is a simple flag you can set, but earlier
# verions of CMake are not so convenient.
if
(
CMAKE_VERSION VERSION_LESS
"3.1"
)
if
(
CMAKE_VERSION VERSION_LESS
"3.1
.2
"
)
if
(
CMAKE_COMPILER_IS_GNUCXX
)
execute_process
(
COMMAND
${
CMAKE_CXX_COMPILER
}
-dumpversion OUTPUT_VARIABLE GCC_VERSION
)
if
(
GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8
)
...
...
@@ -61,6 +61,7 @@ else()
";
${
CMAKE_CXX_COMPILE_FEATURES
}
;"
MATCHES
";cxx_delegating_constructors;"
AND
";
${
CMAKE_CXX_COMPILE_FEATURES
}
;"
MATCHES
";cxx_thread_local;"
AND
";
${
CMAKE_CXX_COMPILE_FEATURES
}
;"
MATCHES
";cxx_constexpr;"
AND
";
${
CMAKE_CXX_COMPILE_FEATURES
}
;"
MATCHES
";cxx_decltype_incomplete_return_types;"
AND
";
${
CMAKE_CXX_COMPILE_FEATURES
}
;"
MATCHES
";cxx_auto_type;"
)
set
(
COMPILER_CAN_DO_CPP_11 1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment