Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Example programs

Miscellaneous Tutorial Examples
Document-View
Postconstructors and Predestructors with deconstruct()

Miscellaneous Tutorial Examples

hello_world_slot

This example is a basic example of connecting a slot to a signal and then invoking the signal.

Download hello_world_slot.cpp.

hello_world_multi_slot

This example extends the hello_world_slot example slightly by connecting more than one slot to the signal before invoking it.

Download hello_world_multi_slot.cpp.

ordering_slots

This example extends the hello_world_multi_slot example slightly by using slot groups to specify the order slots should be invoked.

Download ordering_slots.cpp.

slot_arguments

The slot_arguments program shows how to pass arguments from a signal invocation to slots.

Download slot_arguments.cpp.

signal_return_value

This example shows how to return a value from slots to the signal invocation. It uses the default optional_last_value combiner.

Download signal_return_value.cpp.

custom_combiners

This example shows more returning of values from slots to the signal invocation. This time, custom combiners are defined and used.

Download custom_combiners.cpp.

disconnect_and_block

This example demonstrates various means of manually disconnecting slots, as well as temporarily blocking them via shared_connection_block.

Download disconnect_and_block.cpp.

passing_slots

This example demonstrates the passing of slot functions to a private signal through a non-template interface.

Download passing_slots.cpp.

extended_slot

This example demonstrates connecting an extended slot to a signal. An extended slot accepts a reference to its invoking signal-slot connection as an additional argument, permitting the slot to temporarily block or permanently disconnect itself.

Download extended_slot.cpp.

Document-View

doc_view

This is the document-view example program which is described in the tutorial. It shows usage of a signal and slots to implement two different views of a text document.

Download doc_view.cpp.

doc_view_acm

This program modifies the original doc_view.cpp example to employ automatic connection management.

Download doc_view_acm.cpp.

doc_view_acm_deconstruct

This program modifies the doc_view_acm.cpp example to use postconstructors and the deconstruct() factory function.

Download doc_view_acm_deconstruct.cpp.

Postconstructors and Predestructors with deconstruct()

postconstructor_ex1

This program is a basic example of how to define a class with a postconstructor which uses deconstruct() as its factory function.

Download postconstructor_ex1.

postconstructor_ex2

This program extends the postconstructor_ex1 example slightly, by additionally passing arguments from the deconstruct() call through to the class' constructor and postconstructor.

Download postconstructor_ex2.

predestructor_example

This program is a basic example of how to define a class with a predestructor which uses deconstruct() as its factory function.

Download predestructor_example.


PrevUpHomeNext