Skip to content

Commit

Permalink
Sphinx can't parse user-defined literals
Browse files Browse the repository at this point in the history
  • Loading branch information
dean0x7d committed Oct 11, 2015
1 parent dd60ec6 commit c12e3d6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion doc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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:
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 10 additions & 0 deletions format.h
Original file line number Diff line number Diff line change
Expand Up @@ -3044,6 +3044,16 @@ struct UdlArg {

inline namespace literals {

/**
\rst
C++11 literal form of ``fmt::format``.
Requires ``using namespace fmt::literals``.
**Example**::
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>
Expand Down

0 comments on commit c12e3d6

Please sign in to comment.