Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
d41be23a
Commit
d41be23a
authored
Sep 22, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify string_view detection
parent
2def9e4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
17 deletions
+6
-17
include/fmt/core.h
include/fmt/core.h
+6
-17
No files found.
include/fmt/core.h
View file @
d41be23a
...
@@ -170,11 +170,10 @@
...
@@ -170,11 +170,10 @@
(__cplusplus > 201402L || defined(_LIBCPP_VERSION))) || \
(__cplusplus > 201402L || defined(_LIBCPP_VERSION))) || \
(defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910)
(defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910)
# include <string_view>
# include <string_view>
# define FMT_USE_STD_STRING_VIEW
# define FMT_STRING_VIEW std::basic_string_view
#elif (FMT_HAS_INCLUDE(<experimental/string_view>) && \
#elif FMT_HAS_INCLUDE(<experimental/string_view>) && __cplusplus >= 201402L
__cplusplus >= 201402L)
# include <experimental/string_view>
# include <experimental/string_view>
# define FMT_
USE_EXPERIMENTAL_STRING_VIEW
# define FMT_
STRING_VIEW std::experimental::basic_string_view
#endif
#endif
// std::result_of is defined in <functional> in gcc 4.4.
// std::result_of is defined in <functional> in gcc 4.4.
...
@@ -238,18 +237,6 @@ class basic_string_view {
...
@@ -238,18 +237,6 @@ class basic_string_view {
typedef
Char
char_type
;
typedef
Char
char_type
;
typedef
const
Char
*
iterator
;
typedef
const
Char
*
iterator
;
// Standard basic_string_view type.
#if defined(FMT_USE_STD_STRING_VIEW)
typedef
std
::
basic_string_view
<
Char
>
type
;
#elif defined(FMT_USE_EXPERIMENTAL_STRING_VIEW)
typedef
std
::
experimental
::
basic_string_view
<
Char
>
type
;
#else
struct
type
{
const
char
*
data
()
const
{
return
FMT_NULL
;
}
size_t
size
()
const
{
return
0
;
}
};
#endif
FMT_CONSTEXPR
basic_string_view
()
FMT_NOEXCEPT
:
data_
(
FMT_NULL
),
size_
(
0
)
{}
FMT_CONSTEXPR
basic_string_view
()
FMT_NOEXCEPT
:
data_
(
FMT_NULL
),
size_
(
0
)
{}
/** Constructs a string reference object from a C string and a size. */
/** Constructs a string reference object from a C string and a size. */
...
@@ -271,8 +258,10 @@ class basic_string_view {
...
@@ -271,8 +258,10 @@ class basic_string_view {
const
std
::
basic_string
<
Char
,
Alloc
>
&
s
)
FMT_NOEXCEPT
const
std
::
basic_string
<
Char
,
Alloc
>
&
s
)
FMT_NOEXCEPT
:
data_
(
s
.
data
()),
size_
(
s
.
size
())
{}
:
data_
(
s
.
data
()),
size_
(
s
.
size
())
{}
FMT_CONSTEXPR
basic_string_view
(
type
s
)
FMT_NOEXCEPT
#ifdef FMT_STRING_VIEW
FMT_CONSTEXPR
basic_string_view
(
FMT_STRING_VIEW
<
Char
>
s
)
FMT_NOEXCEPT
:
data_
(
s
.
data
()),
size_
(
s
.
size
())
{}
:
data_
(
s
.
data
()),
size_
(
s
.
size
())
{}
#endif
/** Returns a pointer to the string data. */
/** Returns a pointer to the string data. */
FMT_CONSTEXPR
const
Char
*
data
()
const
{
return
data_
;
}
FMT_CONSTEXPR
const
Char
*
data
()
const
{
return
data_
;
}
...
...
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