Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
bc4b89c2
Commit
bc4b89c2
authored
Aug 30, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chrono: workaround for gcc 4.6 constexpr problems
parent
e10c287c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
Chrono.hxx
src/Chrono.hxx
+15
-4
No files found.
src/Chrono.hxx
View file @
bc4b89c2
...
...
@@ -20,10 +20,19 @@
#ifndef MPD_CHRONO_HXX
#define MPD_CHRONO_HXX
#include "Compiler.h"
#include <chrono>
#include <utility>
#include <cstdint>
#if defined(__GNUC__) && !GCC_CHECK_VERSION(4,7) && !defined(__clang__)
/* std::chrono::duration operators are "constexpr" since gcc 4.7 */
#define chrono_constexpr gcc_pure
#else
#define chrono_constexpr constexpr
#endif
/**
* A time stamp within a song. Granularity is 1 millisecond and the
* maximum value is about 49 days.
...
...
@@ -99,11 +108,11 @@ public:
return
count
()
>
0
;
}
constexpr
SongTime
operator
+
(
const
SongTime
&
other
)
const
{
c
hrono_c
onstexpr
SongTime
operator
+
(
const
SongTime
&
other
)
const
{
return
SongTime
(
*
(
const
Base
*
)
this
+
(
const
Base
&
)
other
);
}
constexpr
SongTime
operator
-
(
const
SongTime
&
other
)
const
{
c
hrono_c
onstexpr
SongTime
operator
-
(
const
SongTime
&
other
)
const
{
return
SongTime
(
*
(
const
Base
*
)
this
-
(
const
Base
&
)
other
);
}
};
...
...
@@ -203,13 +212,15 @@ public:
return
count
()
<
0
;
}
constexpr
SignedSongTime
operator
+
(
const
SignedSongTime
&
other
)
const
{
c
hrono_c
onstexpr
SignedSongTime
operator
+
(
const
SignedSongTime
&
other
)
const
{
return
SignedSongTime
(
*
(
const
Base
*
)
this
+
(
const
Base
&
)
other
);
}
constexpr
SignedSongTime
operator
-
(
const
SignedSongTime
&
other
)
const
{
c
hrono_c
onstexpr
SignedSongTime
operator
-
(
const
SignedSongTime
&
other
)
const
{
return
SignedSongTime
(
*
(
const
Base
*
)
this
-
(
const
Base
&
)
other
);
}
};
#undef chrono_constexpr
#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