After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 149483 - sigc::var() not documented
sigc::var() not documented
Status: RESOLVED FIXED
Product: libsigc++
Classification: Bindings
Component: documentation
2.0
Other All
: Normal normal
: ---
Assigned To: Martin Schulze
Martin Schulze
Depends on:
Blocks:
 
 
Reported: 2004-08-06 10:37 UTC by Roger Ferrer Ibáñez
Modified: 2005-02-01 19:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Roger Ferrer Ibáñez 2004-08-06 10:37:54 UTC
Documentation should explain that is possible to create a 0-ary functor
returning the value of a referenced variable. This can be done by constructing
the functor with sigc::var. Here follows a small example.

#include <sigc++/adaptors/lambda/lambda.h>

int main(int argc, char* argv[])
{
   int data;
   sigc::signal<int> readValue;
 
   readValue.connect(sigc::var(data));
 
   data = 3;
   cout << readValue() << endl;
 
   data = 5;
   cout << readValue() << endl;
}

The expected output is:

3
5
Comment 1 Roger Ferrer Ibáñez 2004-08-06 10:41:21 UTC
Nota also that lambda group doesn't appear to be documented in the doxygen
generated reference. 

Last time i checked it yield a 404 Not Found in the website.
http://libsigc.sourceforge.net/libsigc2/docs/reference/html/group__lamdba.html
Comment 2 Murray Cumming 2005-02-01 19:31:27 UTC
Thanks very much. I have added this as doxygen documenation to sigc::var:


/** Converts a reference into a lambda object.
 * sigc::var creates a 0-ary functor, returning the value of a referenced variable. 
 * For instance,
 *
 * @code
 * int main(int argc, char* argv[])
 * {
 *   int data;
 *   sigc::signal<int> readValue;
 *
 *   readValue.connect(sigc::var(data));
 *
 *   data = 3;
 *   std::cout << readValue() << std::endl; //Prints 3.
 *
 *  data = 5;
 *  std::cout << readValue() << std::endl; //Prints 5.
 * }
 * @endcode
 *
 */


Please try to create an actual patch in future.