On May 1, 2012, at 7:10 AM, Andreas Grosam <agro...@onlinehome.de> wrote:
> Hm, the library is a header only template library - namely its spirit (from 
> boost), so my chances to never include this library are zero ;)
> 
> Basically, I need something like the following to compile:
> 
> // file foo.m:
> 
> #include <Foundation/Foundation.h>
> 
> namespace nm {
>    struct nil {};
>    struct Nil {};
> }
> 
> NSObject* o = nil;

If you never need to use boost's nil in your own code, you can carefully order 
your includes so the boost headers are always first. 

#include <boost/header-that-uses-nil.h>  // uses nil
#include <Foundation/Foundation.h>       // #defines nil but doesn't affect the 
boost header
NSObject *o = nil;  // uses objc's nil


If you do need to use boost's nil in your own code, you can use macro tricks to 
rename their nil.

#define nil boost_nil
#include <boost/header-that-uses-nil.h>
#undef nil
#include <Foundation/Foundation.h>
// now you have objc's nil and boost::boost_nil


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to