‘Helper’ functions in C++

Overhead is not an issue, namespaces have some advantages though

  • You can reopen a namespace in another header, grouping things more logically while
    keeping compile dependencies low
  • You can use namespace aliasing to your advantage
    (debug/release, platform specific helpers, ….)

    e.g. I’ve done stuff like

    namespace LittleEndianHelper {
       void Function();
    }
    namespace BigEndianHelper {
       void Function();
    }
    
    #if powerpc
       namespace Helper = BigEndianHelper;
    #elif intel
       namespace Helper = LittleEndianHelper;
    #endif
    

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)