File tree Expand file tree Collapse file tree 3 files changed +26
-6
lines changed
Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 3030
3131/* stl header */
3232#include < iostream>
33- #include < vector>
33+ #if __cplusplus > 201703L
34+ #include < span>
35+ #endif
3436
3537/* gsl header */
36- #include < gsl/gsl>
37- #include < gsl/span>
38+ #if __cplusplus <= 201703L
39+ #include < gsl/gsl>
40+ #include < gsl/span>
41+ #endif
3842
3943int main ( int argc, char **argv ) {
4044
45+ #if __cplusplus > 201703L
46+ std::span<char *> args = { argv, static_cast <std::size_t >( argc ) };
47+ #else
4148 gsl::span<char *> args = { argv, static_cast <std::size_t >( argc ) };
49+ #endif
4250
4351 /* Usage: pipe RESULTCODE */
4452 if ( args.size () != 2 ) {
@@ -52,5 +60,9 @@ int main( int argc, char **argv ) {
5260 fprintf ( stderr, " This is fprintf( stderr ) text.\n " );
5361 printf ( " This is printf text.\n " );
5462
63+ #if __cplusplus > 201703L
64+ return std::stoi ( args[1 ] );
65+ #else
5566 return std::stoi ( gsl::at ( args, 1 ) );
67+ #endif
5668}
Original file line number Diff line number Diff line change 3636/* system header */
3737#include < fcntl.h> // open
3838#ifdef _WIN32
39- #include < io.h> // write, read, close
39+ #include < io.h> // write, read, close
4040#else
41- #include < termios.h>
42- #include < unistd.h> // write, read, close
41+ #include < termios.h>
42+ #include < unistd.h> // write, read, close
4343#endif
4444
4545/* stl header */
Original file line number Diff line number Diff line change @@ -51,8 +51,12 @@ namespace vx {
5151 * @param _function Call back function.
5252 * @param _delay Delay in milliseconds after the function is called.
5353 */
54+ #if __cplusplus > 201703L
55+ void setTimeout ( auto _function, int _delay ) {
56+ #else
5457 template <typename Function>
5558 void setTimeout ( Function _function, int _delay ) {
59+ #endif
5660
5761 this ->m_clear = false ;
5862 std::thread t ( [ = ]() {
@@ -76,8 +80,12 @@ namespace vx {
7680 * @param _function Call back function.
7781 * @param _interval Interval in milliseconds after the function is called.
7882 */
83+ #if __cplusplus > 201703L
84+ void setInterval ( auto _function, int _interval ) {
85+ #else
7986 template <typename Function>
8087 void setInterval ( Function _function, int _interval ) {
88+ #endif
8189
8290 this ->m_clear = false ;
8391 std::thread t ( [ = ]() {
You can’t perform that action at this time.
0 commit comments