C++ Logo

sg20

Advanced search

Re: namespace composition

From: Bjarne Stroustrup <bjarne_at_[hidden]>
Date: Fri, 28 Apr 2023 19:46:44 -0400
One of the first things I tried was this


import std;

namespace PPP {
     using namespace std;
     struct vector { void found_our_own() {} };
}

using namespace PPP;

int main() {
     string s;
     vector v;
     v.found_our_own();
}


It would have been ideal for my purposes. I get a double definition of
vector error. language problem? My confusion? Compiler bug?



On 4/28/2023 6:19 PM, Ville Voutilainen wrote:
> #include <string>
> #include <iostream>
> #include <vector>
>
> namespace PPP {
> using namespace std;
> struct vector {void found_our_own() {}};
> }
>
> int main() {
> PPP::string s;
> PPP::vector v;
> v.found_our_own();
> }

Received on 2023-04-28 23:46:46