mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-08 20:29:23 +00:00
Merge pull request #207 from dean0x7d/udl-api
Update Sphinx with C++11 literals fix and add fmt::literals API docs
This commit is contained in:
commit
9575e77e40
@ -26,6 +26,8 @@ arguments in the resulting string.
|
||||
|
||||
.. doxygenfunction:: format(CStringRef, ArgList)
|
||||
|
||||
.. doxygenfunction:: operator""_format(const char *, std::size_t)
|
||||
|
||||
.. _print:
|
||||
|
||||
.. doxygenfunction:: print(CStringRef, ArgList)
|
||||
@ -74,6 +76,8 @@ Utilities
|
||||
|
||||
.. doxygenfunction:: fmt::arg(StringRef, const T&)
|
||||
|
||||
.. doxygenfunction:: operator""_a(const char *, std::size_t)
|
||||
|
||||
.. doxygendefine:: FMT_CAPTURE
|
||||
|
||||
.. doxygendefine:: FMT_VARIADIC
|
||||
|
@ -30,7 +30,8 @@ def build_docs():
|
||||
activate_this_file = os.path.join(virtualenv_dir, 'bin', 'activate_this.py')
|
||||
execfile(activate_this_file, dict(__file__=activate_this_file))
|
||||
# Install Sphinx and Breathe.
|
||||
pip_install('sphinx==1.3.1')
|
||||
pip_install('sphinx-doc/sphinx',
|
||||
'4d2c17e043d9e8197fa5cd0db34212af3bb17069')
|
||||
pip_install('michaeljones/breathe',
|
||||
'511b0887293e7c6b12310bb61b3659068f48f0f4')
|
||||
# Build docs.
|
||||
@ -53,7 +54,8 @@ def build_docs():
|
||||
ALIASES += "endrst=\endverbatim"
|
||||
PREDEFINED = _WIN32=1 \
|
||||
FMT_USE_VARIADIC_TEMPLATES=1 \
|
||||
FMT_USE_RVALUE_REFERENCES=1
|
||||
FMT_USE_RVALUE_REFERENCES=1 \
|
||||
FMT_USE_USER_DEFINED_LITERALS=1
|
||||
EXCLUDE_SYMBOLS = fmt::internal::* StringValue write_str
|
||||
'''.format(os.path.dirname(doc_dir)))
|
||||
if p.returncode != 0:
|
||||
|
@ -165,7 +165,7 @@ Although the library uses C++11 features when available, it also works with olde
|
||||
compilers and standard library implementations. The only thing to keep in mind
|
||||
for C++98 portability:
|
||||
|
||||
* Variadic templates: minimum GCC 4.4, Clang 2.9 or VS2013. This feature allow
|
||||
* Variadic templates: minimum GCC 4.4, Clang 2.9 or VS2013. This feature allows
|
||||
the Format API to accept an unlimited number of arguments. With older compilers
|
||||
the maximum is 15.
|
||||
|
||||
|
20
format.h
20
format.h
@ -3044,11 +3044,31 @@ struct UdlArg {
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
/**
|
||||
\rst
|
||||
C++11 literal equivalent of :func:`fmt::format`.
|
||||
|
||||
**Example**::
|
||||
|
||||
using namespace fmt::literals;
|
||||
std::string message = "The answer is {}"_format(42);
|
||||
\endrst
|
||||
*/
|
||||
inline internal::UdlFormat<char>
|
||||
operator"" _format(const char *s, std::size_t) { return {s}; }
|
||||
inline internal::UdlFormat<wchar_t>
|
||||
operator"" _format(const wchar_t *s, std::size_t) { return {s}; }
|
||||
|
||||
/**
|
||||
\rst
|
||||
C++11 literal equivalent of :func:`fmt::arg`.
|
||||
|
||||
**Example**::
|
||||
|
||||
using namespace fmt::literals;
|
||||
print("Elapsed time: {s:.2f} seconds", "s"_a=1.23);
|
||||
\endrst
|
||||
*/
|
||||
inline internal::UdlArg<char>
|
||||
operator"" _a(const char *s, std::size_t) { return {s}; }
|
||||
inline internal::UdlArg<wchar_t>
|
||||
|
Loading…
Reference in New Issue
Block a user