What to do with private member functions when turning static class to namespace in C++?

I have a class that has 5 static public functions and 1 static private function (called from one of the public functions). The class doesn't have any member variables. It seems to me that it should be a namespace and not a class. But what to do with the private function? I prefer it not to be accessible by every namespace user, but there is no access control in namespaces.


There are two ways i know of

Don't declare them in the header

One way is to not declare those functions inside the header. They can be placed into unnamed namespaces within the implementation file, only.

Indeed, you will then have to implement any function that accesses this private function in the implementation file (not inline in the header).

Put them into a detail namespace

Preferably, you put them in a different header, and include them. So the code of them won't disturb your interface header. This is how boost does it, too:

#include "detail/destroy.hpp"

namespace orbit {
  void destroy() {

Need Your Help

foreach loop only dumping one variable

php xml

I have the following code to find an xml element that matches preg_match

HTML Table Sizing Issues

html css table size

What I have is a table that I would like to be placed in the center of the page with two banner ads on both sides of the table, the left and right ads coming as close to the edges of the page as po...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.