mercredi 31 mai 2017

what's the use of brace in constructor position in C++? [duplicate]

This question already has an answer here:

I have read part of boost, it shows:

struct activation_record {
    typedef boost::intrusive_ptr< activation_record >    ptr_t;

    thread_local static ptr_t   current_rec;

    std::atomic< std::size_t >  use_count{ 0 };
    fcontext_t                  fctx{ nullptr };
    stack_context               sctx{};
    bool                        main_ctx{ true };
};

I don't understand what's the use of { 0 } after use_count, { nullptr } after fctx, etc.

Is that a constructor ?

Aucun commentaire:

Enregistrer un commentaire