Skip to content

Type based state machines: implementing the builder pattern #50

@stephanroslen

Description

@stephanroslen

It turns out it's quite easy to enable compile time support when implementing the builder pattern using concepts and boost::hana. Every add method can only be called exactly once - and the build method can only be called after all adders were called. And with a trick we can even avoid unnecessary memory operations at runtime. Hana also allows us to generate compile time error messages.

Keywords: builder pattern, boost::hana, concepts, metaprogramming, type based state machines

Preparation: 2 week

Duration: 25-30 mins

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions