Boost logo

Boost Users :

Subject: Re: [Boost-users] [Fusion] Adapting read-only fields of ADTs
From: Christopher Schmidt (mr.chr.schmidt_at_[hidden])
Date: 2011-04-12 13:18:20

Joel de Guzman <joel_at_[hidden]> writes:


> That's a good workaround, but really, we ought to have read-only
> adaptors. Doing above would still allow elem = val; albeit will
> be a no-op.
> Please add a trac "feature request" ticket, if you will.
> Regards,

A simple workaround is to fall back to an invalid expression.

--8<---------------cut here---------------start------------->8---

template<typename>struct dummy{};

template<typename T>
typename dummy<T>::this_type_does_not_exist
invalid_operation(T const&)

class A{};

int main()
    A a;
--8<---------------cut here---------------end--------------->8---

This should give a nice and readable error message.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at