namespace and directory name choice
hello, technically, this is not a boost question. I am writing a library to be used by third-party developers. Internally, i use boost::mpl sequences. Joaquin wrote mpl sequences cross-product metafunctions that i use, i called them sequence2_cross_product and sequence3_cross_product for the x-product of 2 and 3 sequences. I put the metafunction in a separate header file. I don't intend to expose it to my clients. Is there an agreed convention/style as to where such a header file should lie? My namespace hierarchy reflects my directory structure, so this is like asking in which namespace should i put this metafunction. I would have like to see such metafunctions already in boost::mpl., so should/can i highjack boost::mpl namespace in my header? or put it at toplevel right below my namespace ? rds,
on Fri Aug 15 2008, "Hicham Mouline"
hello, technically, this is not a boost question. I am writing a library to be used by third-party developers. Internally, i use boost::mpl sequences. Joaquin wrote mpl sequences cross-product metafunctions that i use, i called them sequence2_cross_product and sequence3_cross_product for the x-product of 2 and 3 sequences.
I put the metafunction in a separate header file. I don't intend to expose it to my clients.
Is there an agreed convention/style as to where such a header file should lie? My namespace hierarchy reflects my directory structure, so this is like asking in which namespace should i put this metafunction. I would have like to see such metafunctions already in boost::mpl., so should/can i highjack boost::mpl namespace in my header?
Bad idea, IMO.
or put it at toplevel right below my namespace ?
You should put it in your own namespace. HTH, -- Dave Abrahams BoostPro Computing http://www.boostpro.com
On Fri, Aug 15, 2008 at 8:43 PM, Hicham Mouline
Is there an agreed convention/style as to where such a header file should lie? My namespace hierarchy reflects my directory structure, so this is like asking in which namespace should i put this metafunction.
I would recommend that your directory structure reflects your namespace hierarchy - not the other way around. There's a small but subtle difference. I would have like to see such metafunctions already in boost::mpl.,
so should/can i highjack boost::mpl namespace in my header?
Declaring your stuff inside other people's namespaces is generally a pretty bad idea. It may not be clear to users which features really are part of boost::mpl, and which are not. Plus you'll have one namespace #included from two different locations - this could be very confusing. or put it at toplevel right below my namespace ? Put it in your own namespace :) Rich
participants (3)
-
David Abrahams
-
Hicham Mouline
-
Richard Dingwall