CMake: Simple C++ Reflection

simple c++
simple c++

Reflection is a very useful tool and if you aren’t familiar with the state of affairs in simple C++.

The cmake-reflection-template repository is a small working example of a few source files with added reflection which generates serialization and deserialization routines (using std::any<> for simplicity – so it requires C++17 – but it can be rewritten to serialize to JSON instead).

  • Each CMake target that wants to have reflection should have the target_parse_sources() CMake function called on it like so
  • Each source file in the reflected projects has an attached custom CMake command so when it gets modified that command gets ran
  • That command runs the parser on the file – named for example my_type.h – which generates code and dumps it in a file called my_type.h.inl in a gen folder inside CMAKE_BINARY_DIR
  • The resulting my_type.h.inl can be included either directly in my_type.h or perhaps elsewhere – the forward declarations of the generated functions are written inside the classes in my_type.h using the helper FRIENDS_OF_TYPE(MY_TYPE); macro.


It is a bit like what Unreal is doing for reflection of properties – C++ source code is parsed (and annotated with preprocessor identifiers) and each source file includes the generated code for itself.

Read more

CMake 3.16: Support for Precompiled Headers and Unity Builds


Modules are coming in C++20 but it will take a while before they are widely adopted, optimized and supported by tooling.

Release of CMake 3.16 does not require resorting to 3rd party CMake scripts from GitHub for precompiled headers and unity builds:

  • To precompile means that the compiler will parse the C++ headers and save its intermediate representation (IR) into a file, and then when compiling the .cpp files of the target that IR will be prepended to them – as if the headers were included – the contents of the PCH are the first thing each translation unit sees

  • Easy to integrate – doesn’t require any C++ code changes
  • ~20-30% speedup with GCC/Clang (can be up to 50%+ with MSVC)
  • For targets with at least 10 .cpp files (takes space & time to compile)


What to put in a PCH

  • STL & third-party libs like boost (used in at least ~30% of the sources)
  • Some rarely changing project-specific headers (at least 30% use)
    • for example if you have common utilities for logging/etc.
  • Each time any header which ends up in the PCH is changed – the entire PCH is recompiled along with the entire target which includes it
  • Careful not to put too much into a PCH – once it reaches ~150-200MB you might start hitting diminishing returns
  • How to determine which are the most commonly used header files
    • option 1: do a few searches in the codebase/target
      • <algorithm>, <vector>, <boost/asio.hpp>, etc.
      • note that some header might be included only in a few other header files, but if those headers go everywhere, then the other header gets included almost everywhere as well
    • option 2: – use software to visualize includes & dependencies

Read more

How to Remove Malware from WordPress Website

remove malware from wordpress
remove malware from wordpress

WordPress is the most popular CMS platform in the world, so it’s no wonder that WordPress is also the CMS that is most often attacked by hackers and has malware embedded in it.

Sometimes novice WordPress users are confused about how to remove malware from WordPress website.


They become easy targets because they are less careful and less secure in using WordPress scripts, both in terms of WordPress core, plugins and themes.

Actually WordPress CMS is a very safe CMS to use (it can even be said to be the safest CMS currently available). WordPress continues to make improvements both in terms of security and features.


When your WordPress website is exposed to malware, you will usually find these things:

  • Your website redirects itself to another website. But in some cases when you try again, the redirect doesn’t happen.
  • Suddenly you find an outbound link in one of the contents, but the link you have never created before.
  • When you type “” into Google, strange content will appear that you never created.
  • You get a notification from the web hosting provider that your server has a problem, which leads to the server being disabled.

Read more

How to Check for Trojan Horse Manually and Protect Your PC Computer

check for trojan
check for trojan

Trojan Horse or also called by a shorter name, namely Trojan, is one type of malware that is feared by many computer users.

How to check for Trojan Horses on PC computers is very important for you to know because this malware spreads like a virus very quickly.


Trojan Horses burden system performance, causing the computer to feel slower, and also very difficult to remove or destroy with antivirus software.

Indeed, the Trojan Horse has a fail-safe mechanism that can make it safe from detection or from antivirus removal attempts.


What are Trojan Horses?

A Trojan Horse is a form of suspicious software which is also known as malicious software (malware) and can damage a system or network.


So, how is this malware spread?

Trojan are generally infect your computer through flash drives, hard drives, while browsing and infiltrate your computer without realizing it.

Trojan in general do not have an automatic copying mechanism, but when a Trojan is installed on a system, it can perform dangerous actions.

Read more

Download Norton Power Eraser: Free Virus and Malware Removal Tool

norton power eraser
norton power eraser

Often viruses and malware disguise themselves as useful programs and attack your computer.

For example, applications that seem to want to help you solve problems or keygens can also be the cause of the spread of malware to your PC.

You have to be careful when you find suspicious programs, how to deal with this?


Use Norton Power Eraser software that is supported by cloud facilities to find viruses, malware or suspicious programs on your PC or laptop.

Norton Power Eraser has a simple interface and will quickly clean your entire hard drive of virus, malware, adware and trojans.


Clean Virus with Free Norton Power Eraser

Norton Power Eraser (NPE) is a freeware from Symantec to clean viruses, malware and adware.

One of the advantages of Norton Power Eraser is the ability to roll back to your previous system.

This is useful just in case you delete an important file while using Norton antivirus.

Norton Power Eraser runs on the Windows platform and is compatible for Windows XP, Vista, 7, 8, and 10. Here’s how to use Norton Power Eraser:

Read more

Norton Malware Removal to Clean Up Your PC

norton malware removal
norton malware removal

Norton 360 provides the ultimate protection for your computer with 5 layers of protection and cloud features for the security and protection of your internet activities.

Whenever and wherever you are online, your device is protected which is also equipped with automatic backup features, PC Tuneup and also includes Norton malware removal.

History of Norton AntiVirus

Norton AntiVirus is an anti-virus or anti-malware software product since 1991 developed and distributed by NortonLifeLock.

There are many antivirus software developed and one of the best is Norton 360 Deluxe.

Norton 360 is the best and most trusted antivirus solution available for Windows on PC and Macintosh.

Norton AntiVirus is the best antivirus product for cleaning viruses, malware, trojans in files and emails that are accidentally downloaded to your PC.

Read more

How to Recover McAfee Account Locked

mcafee account locked
mcafee account locked

Some potentially unwanted and dangerous programs sometimes you accidentally download from websites.

This program can be a virus or malware that infiltrates your computer system without your knowledge.

If McAfee is not successful in removing the virus, you will receive a notification “McAfee account locked“.


These unwanted installations usually occur through annoying advertisements being clicked or when you download software programs that are not from official websites.

As a result, you are deceived when you download and install this software, which contains malicious malware.


Alerts from McAfee

McAfee gives an alert on your monitor screen “We stopped something dangerous. We caught something trying to hijack one of your apps. Don’t worry we take care of it“.

Read more

McAfee Removal Tool User Guide

mcafee removal tool
mcafee removal tool

McAfee Removal Tool is useful for removing McAfee antivirus software cleanly from your computer.

Sometimes you run into problems while trying to remove McAfee products.

A standard uninstall is like leaving something either a file or a registry key that affects the performance of your computer.

Here you will be guided on how to remove McAfee program cleanly without causing other problems.


McAfee Tool Removal Guide

This guide can also be used to fix problematic uninstalls and reinstall the McAfee program.

Here are the Steps to remove McAfee products from your PC:

Read more