The PDAL code is also different in the way that we read all the data
right away while in libLAS we just open the file.
To make use of other readers supported by PDAL, see StageFactory class.

The test if the file was loaded successfully, the test of the header
pointer was used with libLAS:

if(LAS_header==NULL){/* fail */}

In general, PDAL will throw a pdal_error exception in case something
is wrong and it can’t recover such in the case when the file can’t be opened.
To handle the exceptional state by yourself, you can wrap the code
in try-catch block:

For LAS format, hasColor() method of LasHeader to see if the
format supports RGB. However, in general, you can test use
hasDim(Id::Red), hasDim(Id::Green) and hasDim(Id::Blue)
method calls on the point, to see if the color was defined.

When using C++ and PDAL, the objects created on stack free the memory
when they go out of scope. When using smart pointers, they will take
care of the memory they manage. This does not apply to special cases
such as exit() function calls.