Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8579589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:38:24+00:00 2026-06-11T20:38:24+00:00

I inherited some badly named code and got lucky when I received an third

  • 0

I inherited some badly named code and got lucky when I received an third party library that made my life even more complicated. This is what I ended up with.

class Something; // third party library

namespace Something {
  class Something;
  class Templated<class TemplateClass>;
}

Now I need to use the class “Something” from the third party library as the TemplateClass parameter for a new class under namespace Something. I thought this should work

class Something; // third party library

namespace Something {
  class Something;
  class Templated<class TemplateClass>;

  class Impl : public Templated< ::Something > {}
}

But the compiler doesn’t like it. The only way I got it to compile was

class Something; // third party library

class Something2 : public Something {} // dirty hack

namespace Something {
  class Something;
  class Templated<class TemplateClass>;

  class Impl : public Templated< Something2 > {}
}

But I don’t really like it. There must be a better way to do this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:38:25+00:00Added an answer on June 11, 2026 at 8:38 pm

    You could use another namespace:

    class Something; // third party library
    
    namespace third_party{
      using ::Something;
    }
    
    namespace Something {
      class Something;
      class Templated<class TemplateClass>;
    
      class Impl : public Templated< ::third_party::Something > {}
    }
    

    In general, though, I think naming your class and namespace exactly the same is a very bad idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've inherited some code on a system that I didn't setup, and I'm running
I've inherited some windows-mobile code that I've been bringing up-to-date. I've come across a
I've inherited some python code that contains a rather cryptic decorator. This decorator sets
I've inherited some code that I need to debug. It isn't working at present.
I have inherited some really old VC6.0 code that I am upgrading to VS2008
I've inherited some C# code that contains about a thousand lines of source that
I've just inherited some C++ code that was written poorly with one cpp file
I have inherited some code which involves a scheduled task that writes data (obtained
I have inherited some code that queries a DB over a WCF service and
I've inherited some code that uses the sqlsrv_connect method to instantiate a connection to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.