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
728e4f5a
Commit
728e4f5a
authored
May 16, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix docs
parent
8c255771
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
26 deletions
+21
-26
ChangeLog.rst
ChangeLog.rst
+10
-0
doc/api.rst
doc/api.rst
+1
-1
include/fmt/core.h
include/fmt/core.h
+3
-19
include/fmt/format.h
include/fmt/format.h
+7
-6
No files found.
ChangeLog.rst
View file @
728e4f5a
...
...
@@ -63,6 +63,16 @@
std::vector<char> out;
fmt::format_to(std::back_inserter(out), "{}", 42);
* Added the `formatted_size
<http://fmtlib.net/dev/api.html#output-iterator-support>`_ function for
computing output size:
.. code:: c++
#include <fmt/format.h>
auto size = fmt::formatted_size("{}", 12345); // size == 5
* Improved compile times by reducing dependencies on standard headers and
providing a lightweight `core API <http://fmtlib.net/dev/api.html#core-api>`_:
...
...
doc/api.rst
View file @
728e4f5a
...
...
@@ -151,7 +151,7 @@ The following user-defined literals are defined in ``fmt/format.h``.
Utilities
---------
.. do
s
ygenfunction:: fmt::formatted_size(string_view, const Args&...)
.. do
x
ygenfunction:: fmt::formatted_size(string_view, const Args&...)
.. doxygenfunction:: fmt::to_string(const T&)
...
...
include/fmt/core.h
View file @
728e4f5a
...
...
@@ -193,13 +193,11 @@ typename std::add_rvalue_reference<T>::type declval() FMT_NOEXCEPT;
}
/**
\rst
An implementation of ``std::basic_string_view`` for pre-C++17. It provides a
subset of the API. ``fmt::basic_string_view`` is used for format strings even
if ``std::string_view`` is available to prevent issues when a library is
compiled with a different ``-std`` option than the client code (which is not
recommended).
\endrst
*/
template
<
typename
Char
>
class
basic_string_view
{
...
...
@@ -238,11 +236,7 @@ class basic_string_view {
basic_string_view
(
const
Char
*
s
)
:
data_
(
s
),
size_
(
std
::
char_traits
<
Char
>::
length
(
s
))
{}
/**
\rst
Constructs a string reference from a ``std::basic_string`` object.
\endrst
*/
/** Constructs a string reference from a ``std::basic_string`` object. */
template
<
typename
Alloc
>
FMT_CONSTEXPR
basic_string_view
(
const
std
::
basic_string
<
Char
,
Alloc
>
&
s
)
FMT_NOEXCEPT
...
...
@@ -329,11 +323,7 @@ class basic_buffer {
capacity_
=
capacity
;
}
/**
\rst
Increases the buffer capacity to hold at least *capacity* elements.
\endrst
*/
/** Increases the buffer capacity to hold at least *capacity* elements. */
virtual
void
grow
(
std
::
size_t
capacity
)
=
0
;
public:
...
...
@@ -365,11 +355,7 @@ class basic_buffer {
size_
=
new_size
;
}
/**
\rst
Reserves space to store at least *capacity* elements.
\endrst
*/
/** Reserves space to store at least *capacity* elements. */
void
reserve
(
std
::
size_t
capacity
)
{
if
(
capacity
>
capacity_
)
grow
(
capacity
);
...
...
@@ -899,10 +885,8 @@ class basic_format_context :
using
typename
base
::
iterator
;
/**
\rst
Constructs a ``basic_format_context`` object. References to the arguments are
stored in the object so make sure they have appropriate lifetimes.
\endrst
*/
basic_format_context
(
OutputIt
out
,
basic_string_view
<
char_type
>
format_str
,
basic_format_args
<
basic_format_context
>
args
)
...
...
include/fmt/format.h
View file @
728e4f5a
...
...
@@ -3391,9 +3391,7 @@ std::string to_string(const T &value) {
}
/**
\rst
Converts *value* to ``std::wstring`` using the default format for type *T*.
\endrst
*/
template
<
typename
T
>
std
::
wstring
to_wstring
(
const
T
&
value
)
{
...
...
@@ -3455,10 +3453,10 @@ inline OutputIt vformat_to(OutputIt out, string_view format_str,
Formats arguments, writes the result to the output iterator ``out`` and returns
the iterator past the end of the output range.
**Example**::
**Example**::
std::vector<char> out;
fmt::format_to(std::back_inserter(out), "{}", 42);
std::vector<char> out;
fmt::format_to(std::back_inserter(out), "{}", 42);
\endrst
*/
template
<
typename
OutputIt
,
typename
...
Args
>
...
...
@@ -3535,7 +3533,10 @@ inline typename std::enable_if<internal::is_format_string<String>::value>::type
return
vprint
(
format_str
.
data
(),
make_format_args
(
args
...));
}
// Counts the number of characters in the output of format(format_str, args...).
/**
Returns the number of characters in the output of
``format(format_str, args...)``.
*/
template
<
typename
...
Args
>
inline
std
::
size_t
formatted_size
(
string_view
format_str
,
const
Args
&
...
args
)
{
...
...
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