Boost logo

Boost :

Subject: [boost] [concept] typenames vs. typedefs
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2012-05-04 11:48:59


Hello all,

I have questions about concepts (it's related to Boost.ConceptCheckign and
Boost.Generic, but it's really just about the concept syntax that was
proposed and never adopted for C++11).

What's the difference between typename new_type = old_type and typedef
old_type new_type? Why are they both allowed?

For example, what's the difference between this:

auto concept HasFind < typename T >
{
    typename key_type = typename T::key_type; // use typename
    typename mapped_type;

    std::pair<key_type, mapped_type> find ( T const&, key_type const& );
}

And this:

auto concept HasFind < typename T >
{
    typedef typename T::key_type key_type; // use typedef
    typename mapped_type;

    std::pair<key_type, mapped_type> find ( T const&, key_type const& );
}

Thanks a lot.
--Lorenzo

--
View this message in context: http://boost.2283326.n4.nabble.com/boost-concept-typenames-vs-typedefs-tp4608969.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk