Topic: Can template functions be qualified with "static


Author: "B. K. Oxley (binkley)" <binkley@pcdocs.com>
Date: 1997/05/23
Raw View
I'm not a language lawyer, but wouldn't it be the same as using an
anonymous namespace declaration to limit the scope of the class to the
current compilation unit?  Ala:

namespace { // anonymous namespace = static
  ... // your example here sans the static keyword
}

--binkley

Andy Philpotts <xyzzy@pobox.com> wrote in article
<33825fed.15188113@news.ipass.net>...
> Is it correct C++  (with respect to the standard, not a particular
> compiler) to qualify a template function with the "static" keyword,
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: xyzzy@pobox.com (Andy Philpotts)
Date: 1997/05/20
Raw View
Is it correct C++  (with respect to the standard, not a particular
compiler) to qualify a template function with the "static" keyword,
for example:

template < class T > static void templatefunction( T* t)
{
   ...
}

If so, what does it mean?

--
Andy P++ <xyzzy@pobox.com> http://www.pobox.com/~xyzzy
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]





Author: Ravikant Iyer <bom@slip.net>
Date: 1997/05/21
Raw View
In article <33825fed.15188113@news.ipass.net>,
Andy Philpotts <xyzzy@pobox.com> wrote:
>Is it correct C++  (with respect to the standard, not a particular
>compiler) to qualify a template function with the "static" keyword,
>for example:
>
>template < class T > static void templatefunction( T* t)
>{
>   ...
>}
>
>If so, what does it mean?
>
Yes .. it is legal.. It means that you want the template function to have an
internal linkage. i.e. each translation unit will have its own
copy of functions instanciated from this function template.

cheers
-bom
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]