Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

[MSVC2013] Template + remove include headers from global namespace

$
0
0
Hello forum!
So as we know VS not supported export templates and extern templates can only assign to explicit decalarations!

So, we have:
//B.h

#pragma once

namespace C
{
    template <typename T>
    class B
    {
        public:
            B()
            {
            }

            ~B()
            {
            }
    };
}
//A.h

#pragma once

#include "B.h"

namespace C
{
    template <typename T>
    class A
    {
        public:
            A()
            {
                //something doing with B
            }

            ~A()
            {
            }
    };
}
//main.h

#include "A.h"

int main()
{
    C:://this place cursor for check

    return 0;
}
As we see - class A using class B only for implementation and if we check namespace C at main? we can see:

How to hide include classes for template implementation from global space (expecting: visible only class A - if include A, but visible both - if include A and B)?




Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>