We encourage to use the qr_invoice::builder for creating qr_invoice instances, as it guarantees proper object creation and implicitly performs validation. The builder can be used as follows:

#include <vector>

#include <qrinvoice/model/qr_invoice.hpp>
#include <qrinvoice/model/validation.hpp>

// ...
try {
    qrinvoice::model::qr_invoice::builder qr_invoice_builder;

        qr_invoice_builder.creditor_iban("CH4431999123000889012");

        qr_invoice_builder.payment_amount_info()
            .chf(1949.75);

        qr_invoice_builder.creditor()
                .structured_address()
                .name("Robert Schneider AG")
                .street_name("Rue du Lac")
                .house_number("1268")
                .postal_code("2501")
                .city("Biel")
                .country("CH");

        qr_invoice_builder.ultimate_debtor()
                .structured_address()
                .name("Pia-Maria Rutschmann-Schnyder")
                .street_name("Grosse Marktgasse")
                .house_number("28")
                .postal_code("9400")
                .city("Rorschach")
                .country("CH");

        qr_invoice_builder.payment_reference()
                .qr_reference("210000000003139471430009017");

        qr_invoice_builder.additional_information()
                .unstructured_message("Instruction of 03.04.2019")
                .bill_information("//S1/10/10201409/11/190512/20/1400.000-53/30/106017086/31/180508/32/7.7/40/2:10;0:30");

        qr_invoice_builder.alternative_scheme_params({
                "Name AV1: UV;UltraPay005;12345",
                "Name AV2: XY;XYService;54321"
        });

        const qrinvoice::model::qr_invoice qr_invoice = qr_invoice_builder.build();
} catch (const qrinvoice::model::validation::validation_exception& exception) {
        std::vector<qrinvoice::model::validation::validation_result::validation_error> errors = exception.get_result().get()->get_errors();
    // handle exception...
}

For more details on the validation_result see How to validate a QR Invoice object