Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
3c654a7a
"docs/source/api/python/readout.rst" did not exist on "e17c41c0da801173ebbcde3c192d47504fc450d5"
Commit
3c654a7a
authored
Jan 24, 2022
by
Davis King
Browse files
cleanup formatting a little
parent
2ed6ae1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
15 deletions
+25
-15
dlib/invoke.h
dlib/invoke.h
+25
-15
No files found.
dlib/invoke.h
View file @
3c654a7a
// Copyright (C) 201
6
Davis E. King (davis@dlib.net)
// Copyright (C) 20
2
1 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_INVOKE_Hh_
#ifndef DLIB_INVOKE_Hh_
#define DLIB_INVOKE_Hh_
#define DLIB_INVOKE_Hh_
...
@@ -9,8 +9,9 @@
...
@@ -9,8 +9,9 @@
namespace
dlib
namespace
dlib
{
{
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
namespace
detail
{
namespace
detail
{
template
<
typename
T
>
template
<
typename
T
>
struct
is_reference_wrapper
:
std
::
false_type
{};
struct
is_reference_wrapper
:
std
::
false_type
{};
template
<
typename
U
>
template
<
typename
U
>
...
@@ -148,8 +149,10 @@ namespace dlib
...
@@ -148,8 +149,10 @@ namespace dlib
{
{
return
std
::
forward
<
F
>
(
f
)(
std
::
forward
<
Args
>
(
args
)...);
return
std
::
forward
<
F
>
(
f
)(
std
::
forward
<
Args
>
(
args
)...);
}
}
}
}
// end namespace detail
// ----------------------------------------------------------------------------------------
template
<
typename
F
,
typename
...
Args
>
template
<
typename
F
,
typename
...
Args
>
constexpr
auto
invoke
(
F
&&
f
,
Args
&&
...
args
)
constexpr
auto
invoke
(
F
&&
f
,
Args
&&
...
args
)
/*!
/*!
...
@@ -163,7 +166,7 @@ namespace dlib
...
@@ -163,7 +166,7 @@ namespace dlib
return
detail
::
INVOKE
(
std
::
forward
<
F
>
(
f
),
std
::
forward
<
Args
>
(
args
)...);
return
detail
::
INVOKE
(
std
::
forward
<
F
>
(
f
),
std
::
forward
<
Args
>
(
args
)...);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
namespace
detail
namespace
detail
{
{
...
@@ -179,7 +182,9 @@ namespace dlib
...
@@ -179,7 +182,9 @@ namespace dlib
static
constexpr
bool
value
=
true
;
static
constexpr
bool
value
=
true
;
using
type
=
decltype
(
dlib
::
invoke
(
std
::
declval
<
F
>
(),
std
::
declval
<
Args
>
()...)
);
using
type
=
decltype
(
dlib
::
invoke
(
std
::
declval
<
F
>
(),
std
::
declval
<
Args
>
()...)
);
};
};
}
}
// end namespace detail
// ----------------------------------------------------------------------------------------
template
<
typename
F
,
typename
...
Args
>
template
<
typename
F
,
typename
...
Args
>
struct
invoke_result
:
detail
::
invoke_traits
<
void
,
F
,
Args
...
>
{};
struct
invoke_result
:
detail
::
invoke_traits
<
void
,
F
,
Args
...
>
{};
...
@@ -197,7 +202,7 @@ namespace dlib
...
@@ -197,7 +202,7 @@ namespace dlib
- works with C++11 onwards
- works with C++11 onwards
!*/
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
F
,
typename
...
Args
>
template
<
typename
F
,
typename
...
Args
>
struct
is_invocable
:
std
::
integral_constant
<
bool
,
detail
::
invoke_traits
<
void
,
F
,
Args
...
>::
value
>
{};
struct
is_invocable
:
std
::
integral_constant
<
bool
,
detail
::
invoke_traits
<
void
,
F
,
Args
...
>::
value
>
{};
...
@@ -207,7 +212,7 @@ namespace dlib
...
@@ -207,7 +212,7 @@ namespace dlib
- works with C++11 onwards
- works with C++11 onwards
!*/
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
R
,
typename
F
,
typename
...
Args
>
template
<
typename
R
,
typename
F
,
typename
...
Args
>
struct
is_invocable_r
:
std
::
integral_constant
<
bool
,
dlib
::
is_invocable
<
F
,
Args
...
>::
value
&&
struct
is_invocable_r
:
std
::
integral_constant
<
bool
,
dlib
::
is_invocable
<
F
,
Args
...
>::
value
&&
...
@@ -218,7 +223,7 @@ namespace dlib
...
@@ -218,7 +223,7 @@ namespace dlib
- works with C++11 onwards
- works with C++11 onwards
!*/
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
R
,
typename
F
,
typename
...
Args
>
template
<
typename
R
,
typename
F
,
typename
...
Args
>
constexpr
typename
std
::
enable_if
<
dlib
::
is_invocable_r
<
R
,
F
,
Args
...
>::
value
,
R
>::
type
constexpr
typename
std
::
enable_if
<
dlib
::
is_invocable_r
<
R
,
F
,
Args
...
>::
value
,
R
>::
type
...
@@ -233,7 +238,7 @@ namespace dlib
...
@@ -233,7 +238,7 @@ namespace dlib
return
dlib
::
invoke
(
std
::
forward
<
F
>
(
f
),
std
::
forward
<
Args
>
(
args
)...);
return
dlib
::
invoke
(
std
::
forward
<
F
>
(
f
),
std
::
forward
<
Args
>
(
args
)...);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
namespace
detail
namespace
detail
{
{
...
@@ -247,7 +252,9 @@ namespace dlib
...
@@ -247,7 +252,9 @@ namespace dlib
return
dlib
::
invoke
(
std
::
forward
<
F
>
(
fn
),
return
dlib
::
invoke
(
std
::
forward
<
F
>
(
fn
),
std
::
get
<
I
>
(
std
::
forward
<
Tuple
>
(
tpl
))...);
std
::
get
<
I
>
(
std
::
forward
<
Tuple
>
(
tpl
))...);
}
}
}
}
// end namespace detail
// ----------------------------------------------------------------------------------------
template
<
typename
F
,
typename
Tuple
>
template
<
typename
F
,
typename
Tuple
>
constexpr
auto
apply
(
F
&&
fn
,
Tuple
&&
tpl
)
constexpr
auto
apply
(
F
&&
fn
,
Tuple
&&
tpl
)
...
@@ -268,7 +275,7 @@ namespace dlib
...
@@ -268,7 +275,7 @@ namespace dlib
make_index_sequence
<
std
::
tuple_size
<
typename
std
::
remove_reference
<
Tuple
>::
type
>::
value
>
{});
make_index_sequence
<
std
::
tuple_size
<
typename
std
::
remove_reference
<
Tuple
>::
type
>::
value
>
{});
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
namespace
detail
namespace
detail
{
{
...
@@ -277,7 +284,9 @@ namespace dlib
...
@@ -277,7 +284,9 @@ namespace dlib
{
{
return
T
(
std
::
get
<
I
>
(
std
::
forward
<
Tuple
>
(
t
))...);
return
T
(
std
::
get
<
I
>
(
std
::
forward
<
Tuple
>
(
t
))...);
}
}
}
}
// end namespace detail
// ----------------------------------------------------------------------------------------
template
<
class
T
,
class
Tuple
>
template
<
class
T
,
class
Tuple
>
constexpr
T
make_from_tuple
(
Tuple
&&
t
)
constexpr
T
make_from_tuple
(
Tuple
&&
t
)
...
@@ -291,7 +300,8 @@ namespace dlib
...
@@ -291,7 +300,8 @@ namespace dlib
make_index_sequence
<
std
::
tuple_size
<
typename
std
::
remove_reference
<
Tuple
>::
type
>::
value
>
{});
make_index_sequence
<
std
::
tuple_size
<
typename
std
::
remove_reference
<
Tuple
>::
type
>::
value
>
{});
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
#endif //DLIB_INVOKE_Hh_
#endif //DLIB_INVOKE_Hh_
\ No newline at end of file
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