cldoc icon indicating copy to clipboard operation
cldoc copied to clipboard

Support variadic template parameters

Open gnzlbg opened this issue 10 years ago • 2 comments
trafficstars

Example code (copy paste into a file and run cldoc on it, works as is):

#include <type_traits>

template <class... Ts> struct list;

// A list of types <Ts...>
//
// @Ts... types in the list
template <class... Ts> struct list
{
    // @return size of the list
    static constexpr std::size_t size() { return sizeof...(Ts); }
};

This generates the following documentation:

Structures

list<Ts, Ts> // A list of types <Ts...>

Then when clicking on list:

Struct list<Ts, Ts> A list of types <Ts...>

Template Parameters Ts Ts

Member Functions

static size_t size ( ) Size of the list return size of the list

The following is (in my opinion) wrong (each of these should be a separate issue):

  • It should be list<Ts...>,
  • the reference for <Ts...> in the comment should work
  • the documentation for the template parameter pack should work
  • constexpr is not documented, IMO the cleanest is to just present the function signature as is:

    static constexpr size_t size();

gnzlbg avatar Jan 29 '15 11:01 gnzlbg

Confirmed in latest master.

Template parameter packs are not displayed as parameter packs, but are duplicated, e.g.

template <typename ... Ts>
struct TypeList;

is documented as

Struct TypeList<Types, Types>

cbiffle avatar Jul 13 '15 17:07 cbiffle

...actually, the duplication seems to be more general than this. Will file or update a separate issue.

cbiffle avatar Jul 13 '15 17:07 cbiffle