brigand icon indicating copy to clipboard operation
brigand copied to clipboard

Documentation in wiki

Open jfalcou opened this issue 9 years ago • 22 comments

jfalcou avatar Jun 09 '15 19:06 jfalcou

I guess this is a good place to ask for documentation ;)

if I have a metafunction lets say:

template<typename T, typename U>
struct MyData{};

template<typename T>
struct GetU;
template<typename T, typename U>
struct GetU<MyData<T,U>> {
    using type = U;
}

and I want to pass it to transform as a lambda what do I need to wrap it with in order to pass it as a lambda?

using l = list<MyData<int,int>,MyData<char,bool>>;
using restult = transform<l,WhatWrapperDoIUse<GetU>>;

Surely there is a wrapper class like:

template<template<typename...> class T>
struct Template{
    template<typename... Ts>
    using apply = T<Ts...>;
};

but I can't seem to find it.

odinthenerd avatar Dec 22 '15 18:12 odinthenerd

passing GetU<_1> should be enough as in MPL.

jfalcou avatar Dec 22 '15 20:12 jfalcou

Thanks for the answer, that works well, brigand::quote also does what I wanted.

odinthenerd avatar Dec 28 '15 17:12 odinthenerd

@ccharly, don't forget to make th python thingy for this issue ;)

jfalcou avatar Mar 19 '16 11:03 jfalcou

I started the layout and wrote the first tutorial. I think the best is to do a little every day rather than everything in one pass. We should discuss how to describe the functions because a lot can be scripted I think.

edouarda avatar Jul 23 '16 19:07 edouarda

I guess @ccharly script was used ?

As for the function, I think we should have a standardese like wording.

jfalcou avatar Jul 23 '16 19:07 jfalcou

I used his script but had to do a pass after there is a bug that writes \ instead of / in the path.

I'm not sure I understand your comment about the functions? My question was about, how much can we generate by a script and avoid the mistake of typing by hand? We could use doxygen but I submit it might suffer with the TMP heavy code.

edouarda avatar Jul 24 '16 07:07 edouarda

Do you guys have any ideas for tutorials?

edouarda avatar Jul 29 '16 16:07 edouarda

We could also use github pages.

edouarda avatar Aug 22 '16 19:08 edouarda

I'd like to start adding documentation as I use brigand, partly just to remind myself how to use things in the future and partly because that's probably not a bad way to go about doing it. Has there been any further thought on how to implement documentation? Newer doxygen handles template parameters, as well as template-template parameters and variadic templates. Some decision on how to document the corresponding lazy evaluations would need to be made too. Maybe these should be described in the non-lazy documentation as well? Louis Dionne is using Doxygen with Boost.hana and it seems to work out, we could ask to get some feedback from him. Thoughts?

nilsdeppe avatar Jan 10 '17 01:01 nilsdeppe

FWIW, I hate Doxygen with all my heart but I was not aware of a better solution at the time of writing Hana's documentation. It's full of quirks and I can't really recommend it for documenting template-heavy libraries. If you do end up using Doxygen, you should however consider taking inspiration from what I've done. I've spent (lost?) many many hours trying to get something decent out of Doxygen, so hopefully this can be useful to you too.

ldionne avatar Jan 10 '17 04:01 ldionne

I can only but but echo Louis.

I too decided to document my TMP library using Doxygen, because I didn't know better at the time.

It worked out better than I expected in the end, but not without many many days lost on heavy tweaking of undocumented features.

http://brunocodutra.github.io/metal/

If you really decide to go down this path, which is probably not a good idea, do contact me, it wouldn't be too hard to extract the hacks I've written in javascript/CSS to patch Doxygen as a drop in reusable module.

https://github.com/brunocodutra/metal/blob/master/doc/js/metal.js

That said, I'm not aware of an alternative for documenting TMP libraries. Maybe Boost.Doc, but I don't know.

brunocodutra avatar Jan 10 '17 07:01 brunocodutra

In quasardb we use Doxygen to describe ou C-API and that's a use case where it works nicely. For TMP honestly I think it may be easier and quicker to write a Python script. I'm open to suggestions.

edouarda avatar Jan 10 '17 08:01 edouarda

I may just suggest trying out standardese (https://github.com/foonathan/standardese). It's more or less Doxygen-like, but thought throughout for modern C++ (including TMP). I've tried it on toy projects only, nothing of real-world size, but it seems like a nice way to explore.

mkurdej avatar Jan 10 '17 08:01 mkurdej

I'm all for @foonathan 's standardese!

odinthenerd avatar Jan 10 '17 18:01 odinthenerd

I've put the output standardese currently generates on my website. You can browse it by file: http://foonathan.net/doc/brigand/standardese_files.html Or by entity: http://foonathan.net/doc/brigand/standardese_entities.html As there are no documentation comments it just generates a synopsis of the file. I

The option to generate the documentation were: standardese -I/tmp/brigand /tmp/brigand/brigand/ --input.blacklist_namespace=detail --compilation.comments_in_macro=false --output.format=html The compilation option was needed because of some Boost.MPL stuff, would be an error otherwise. When you play with it yourself, please build the develop branch as I had to fix a couple of issues there.

foonathan avatar Jan 10 '17 19:01 foonathan

Roger that, thanks!

edouarda avatar Jan 10 '17 20:01 edouarda

thanks @foonathan!

Just noticed in the case of std::integral_constant<std::size_t, sizeof...(T)> you are linking to a search for std::integral_constant<std::size_t, sizeof...(T)> which finds nothing, searching for std::integral_constant would probably yield better results (minor low priority feature request ;)

odinthenerd avatar Jan 10 '17 23:01 odinthenerd

I've fixed that on develop.

If there is anything else I can improve or if you need help with anything, let me know.

foonathan avatar Jan 11 '17 20:01 foonathan

@foonathan this is great! Thanks for helping out so quickly.

I'll start adding documentation as I work with brigand. Deciding on how to document everything might be best done once we see what things look like and have done some experimentation.

nilsdeppe avatar Jan 12 '17 15:01 nilsdeppe

I've updated the generated documentation with the latest develop build as well as enabled the option --output.require_comment_for_full_synopsis=false. It forces the full synopsis of class types in the file synopsis as welll; it was just to show how each synopsis will look before the documentation is written.

foonathan avatar Jan 13 '17 20:01 foonathan

That's pretty awesome, thanks!

edouarda avatar Jan 14 '17 11:01 edouarda