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
11145541
Commit
11145541
authored
Nov 17, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work around visual studio's lack of C++11 support.
parent
9f6ad63b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
find_global_maximum.h
dlib/global_optimization/find_global_maximum.h
+17
-1
No files found.
dlib/global_optimization/find_global_maximum.h
View file @
11145541
...
...
@@ -38,7 +38,9 @@ namespace dlib
return
f
(
a
(
indices
-
1
)...);
}
// Visual studio, as of November 2017, doesn't support C++11 and can't compile this code.
// So we write the terrible garbage in the #else for visual studio. When Visual Studio supports C++11 I'll update this #ifdef to use the C++11 code.
#ifndef _MSC_VER
template
<
size_t
max_unpack
>
struct
call_with_vect
{
...
...
@@ -64,6 +66,20 @@ namespace dlib
return
f
(
disable_decay_to_scalar
(
a
));
}
};
#else
template
<
size_t
max_unpack
>
struct
call_with_vect
{
template
<
typename
T
>
static
auto
go
(
T
&&
f
,
const
matrix
<
double
,
0
,
1
>&
a
)
->
decltype
(
std
::
forward
<
T
>
(
f
),
disable_decay_to_scalar
(
a
))
{
return
f
(
disable_decay_to_scalar
(
a
));
}
template
<
typename
T
>
static
auto
go
(
T
&&
f
,
const
matrix
<
double
,
0
,
1
>&
a
)
->
decltype
(
std
::
forward
<
T
>
(
f
),
a
(
0
))
{
DLIB_CASSERT
(
a
.
size
()
==
1
);
return
f
(
a
(
0
));
}
template
<
typename
T
>
static
auto
go
(
T
&&
f
,
const
matrix
<
double
,
0
,
1
>&
a
)
->
decltype
(
std
::
forward
<
T
>
(
f
),
a
(
0
),
a
(
1
))
{
DLIB_CASSERT
(
a
.
size
()
==
2
);
return
f
(
a
(
0
),
a
(
1
));
}
template
<
typename
T
>
static
auto
go
(
T
&&
f
,
const
matrix
<
double
,
0
,
1
>&
a
)
->
decltype
(
std
::
forward
<
T
>
(
f
),
a
(
0
),
a
(
1
),
a
(
2
))
{
DLIB_CASSERT
(
a
.
size
()
==
3
);
return
f
(
a
(
0
),
a
(
1
),
a
(
2
));
}
template
<
typename
T
>
static
auto
go
(
T
&&
f
,
const
matrix
<
double
,
0
,
1
>&
a
)
->
decltype
(
std
::
forward
<
T
>
(
f
),
a
(
0
),
a
(
1
),
a
(
2
),
a
(
3
))
{
DLIB_CASSERT
(
a
.
size
()
==
4
);
return
f
(
a
(
0
),
a
(
1
),
a
(
2
),
a
(
3
));
}
template
<
typename
T
>
static
auto
go
(
T
&&
f
,
const
matrix
<
double
,
0
,
1
>&
a
)
->
decltype
(
std
::
forward
<
T
>
(
f
),
a
(
0
),
a
(
1
),
a
(
2
),
a
(
3
),
a
(
4
))
{
DLIB_CASSERT
(
a
.
size
()
==
5
);
return
f
(
a
(
0
),
a
(
1
),
a
(
2
),
a
(
3
),
a
(
4
));
}
template
<
typename
T
>
static
auto
go
(
T
&&
f
,
const
matrix
<
double
,
0
,
1
>&
a
)
->
decltype
(
std
::
forward
<
T
>
(
f
),
a
(
0
),
a
(
1
),
a
(
2
),
a
(
3
),
a
(
4
),
a
(
5
))
{
DLIB_CASSERT
(
a
.
size
()
==
6
);
return
f
(
a
(
0
),
a
(
1
),
a
(
2
),
a
(
3
),
a
(
4
),
a
(
5
));
}
template
<
typename
T
>
static
auto
go
(
T
&&
f
,
const
matrix
<
double
,
0
,
1
>&
a
)
->
decltype
(
std
::
forward
<
T
>
(
f
),
a
(
0
),
a
(
1
),
a
(
2
),
a
(
3
),
a
(
4
),
a
(
5
),
a
(
6
))
{
DLIB_CASSERT
(
a
.
size
()
==
7
);
return
f
(
a
(
0
),
a
(
1
),
a
(
2
),
a
(
3
),
a
(
4
),
a
(
5
),
a
(
6
));
}
};
#endif
}
// ----------------------------------------------------------------------------------------
...
...
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