[parameter] function types as named template parameters?

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Does Boost.Parameter support function types as named template type parameters? I'm trying to write a metafunction which lets you use Boost.Parameter to specify the template types for a boost::signals2::signal using named type parameters, as was suggested during the review. But it doesn't seem to work for the "Signature" function type. I get errors like: /home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:264: error: function returning a function /home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:270: error: function returning a function /home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:352: error: function returning a function /home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:359: error: function returning a function /home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:365: error: function returning a function I can get it to work if I don't use Boost.Parameter for the "Signature" type, but only use it for the other 6 types. Also, I noticed BOOST_PARAMETER_MAX_ARITY defaults to 5, but signals2::signal has 7 parameters. I can't reliably redefine BOOST_PARAMETER_MAX_ARITY in my library header, since it must be defined before boost/parameter/config.hpp gets included. You can't redefine the arity and then re-include the parameter library headers like you can with Boost.Function. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFJeO/v5vihyNWuA4URAtVIAJ9iHlncV/+QON81+qYYWzmzex3yDACg48Kc 2il7aidDE0Xj7tVUMmZaxLw= =eqjh -----END PGP SIGNATURE-----

on Thu Jan 22 2009, Frank Mori Hess <frank.hess-AT-nist.gov> wrote:
Does Boost.Parameter support function types as named template type parameters? I'm trying to write a metafunction which lets you use Boost.Parameter to specify the template types for a boost::signals2::signal using named type parameters, as was suggested during the review. But it doesn't seem to work for the "Signature" function type. I get errors like:
/home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:264: error: function returning a function /home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:270: error: function returning a function /home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:352: error: function returning a function /home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:359: error: function returning a function /home/fhess/svn/boost/boost/parameter/aux_/arg_list.hpp:365: error: function returning a function
It wouldn't surprise me if we had overlooked that possibility.
I can get it to work if I don't use Boost.Parameter for the "Signature" type, but only use it for the other 6 types.
Can you post a minimal example that reproduces this bug? I'm sure there's a quick fix.
Also, I noticed BOOST_PARAMETER_MAX_ARITY defaults to 5, but signals2::signal has 7 parameters. I can't reliably redefine BOOST_PARAMETER_MAX_ARITY in my library header, since it must be defined before boost/parameter/config.hpp gets included. You can't redefine the arity and then re-include the parameter library headers like you can with Boost.Function.
Oh, that's cool. Please open a ticket with a feature request for that and assign it to Daniel Wallin. -- Dave Abrahams BoostPro Computing http://www.boostpro.com

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 23 January 2009 00:55 am, David Abrahams wrote:
on Thu Jan 22 2009, Frank Mori Hess <frank.hess-AT-nist.gov> wrote:
Does Boost.Parameter support function types as named template type parameters?
Can you post a minimal example that reproduces this bug? I'm sure there's a quick fix.
Here you go. If you undefine NAMED_SIGNATURE_PARAMETER, the test works. Otherwise, it fails to compile (I'm using gcc 4.1.2). -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFJeda65vihyNWuA4URAloCAKCF02pHvbZl8y9foNbyZnoTYY8aywCffI2a Ue1wHc8ArjMwirdVc7RRZYI= =f0fd -----END PGP SIGNATURE-----

on Fri Jan 23 2009, Frank Mori Hess <frank.hess-AT-nist.gov> wrote:
Can you post a minimal example that reproduces this bug? I'm sure there's a quick fix.
Here you go. If you undefine NAMED_SIGNATURE_PARAMETER, the test works. Otherwise, it fails to compile (I'm using gcc 4.1.2).
<schnipp> This can't really be minimal, can it? Can you reduce it any further? -- Dave Abrahams BoostPro Computing http://www.boostpro.com

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 23 January 2009 12:39 pm, David Abrahams wrote:
This can't really be minimal, can it? Can you reduce it any further?
Ok, how about this version? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFJegjY5vihyNWuA4URArnCAKCpuRX9RIfFumpxh5UKjzKaXST+rQCgyI6S EabXtZi3zH4aW4wsYrdX8YM= =msBh -----END PGP SIGNATURE-----

on Fri Jan 23 2009, Frank Mori Hess <frank.hess-AT-nist.gov> wrote:
On Friday 23 January 2009 12:39 pm, David Abrahams wrote:
This can't really be minimal, can it? Can you reduce it any further?
Ok, how about this version?
Better, thanks. Well, several things are wrong here: 1. Our documentation should tell you to use value_type<...> instead of binding<...> for named template parameters 2. You should use value_type<...> instead of binding<...> for named template parameters ;-) 3. template_keyword's reference type should be value_type&. Unfortunately, #3 will break legacy uses of binding for people that followed our old instructions, so the real patch is attached: -- Dave Abrahams BoostPro Computing http://www.boostpro.com

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 23 January 2009 14:59 pm, David Abrahams wrote:
Well, several things are wrong here:
1. Our documentation should tell you to use value_type<...> instead of binding<...> for named template parameters
2. You should use value_type<...> instead of binding<...> for named template parameters ;-)
3. template_keyword's reference type should be value_type&.
Unfortunately, #3 will break legacy uses of binding for people that followed our old instructions, so the real patch is attached:
I've used your patch locally and it seems to work, but I don't see it in the svn trunk yet. I just wanted to make sure it hasn't been forgotten? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFJk0wt5vihyNWuA4URAkcpAKC5QRcNhYa9+HDnzErcV0/HYqymNQCgnaF1 BUz4LW+sZU4L55lOgA9fP+Y= =e/0j -----END PGP SIGNATURE-----
participants (2)
-
David Abrahams
-
Frank Mori Hess