Boost logo

Boost Users :

From: Dernoncourt, Wayne CTR NAVAIR 3184, ,10 (wayne.dernoncourt_at_[hidden])
Date: 2004-02-09 05:30:34


Thanks much. I think the folks here have sent a message (I leave here a little after 1:30 on Friday and discussion sometimes takes a while) to the other SDK developers asking if they could put their SDK in a namespace and do this the "right" way instead of this round-about method. But yes this could work as well.

Thanks much.

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]]On Behalf Of Administrator
Sent: Friday, February 06, 2004 12:57
To: 'Boost Users mailing list'
Subject: RE: [Boost-users] configuring boost on MS Visual Studio 6 where
the installation drive isn't C:

Wayne,

There might still be conflicts if the compiler can't place everything into
it's proper namespace. In addition, some sdk's force everything into std
namespace or into the global namespace. If you use "using namespace
boost;", you're basically doing the same thing.

There are a couple of options that could be used separately.

1. One is to not use "using namespace". Preface everything used from there
with boost:: or std::. More typing, less pain, less chance for conflict.

2. The second is wrap the offending sdk in it's own namespace. Here is
what I have come up with. I have three files here. c.h is the original
function. b.h wraps it in it's own namespace, and main.cpp can only use it
with the new namespace. Simple example, but hopefully it illustrates what
I'm trying to get across.

--------------------------------------------------
c.h
-------------------------------------------------
#ifndef _C_H
#define _C_H

inline int garbage_method() { return 0; }

#endif //

--------------------------------------------------
b.h
--------------------------------------------------
#ifndef _B_H
#define _B_H

namespace garbage_namespace {
#include "c.h"
}
#endif //

--------------------------------------------------
main.cpp
--------------------------------------------------
#include "b.h"

int main()
{
        return garbage_namespace::garbage_method();
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net