Question: I have an input folder full of msg email files, within these there are `inbox, outbox, sent items` etc. 

Is there any way I could use aspsoe to open the PST copy the files and structure to an output folder. 

I have tried 

```
PersonalStorage personalStorage = PersonalStorage.FromFile(InputFolder);
// Get the folders information
FolderInfoCollection folderInfoCollection = personalStorage.RootFolder.GetSubFolders();

```

Any ideas?

Answer: 
It's perfectly fine. There will be no effect--as if you didn't have the `const_cast` at all.

Do note that you can use [`std::is_const`](http://en.cppreference.com/w/cpp/types/is_const) to check if a particular type is const. But if the only reason to do it would be to avoid a no-op `const_cast`, I wouldn't bother.
If an object is not `const`, using `const_cast<>` to remove `const`ness makes no difference. Removing an attribute from something which already lacks that attribute, logically, does nothing.

An exception is if the object is also volatile, for example;

```
 volatile SomeType x;   // const qualifier may also be used here

 SomeType &something = const_cast<SomeType &>(x);

```

which also removes the `volatile` qualifier, whether `x` is `const` or not. Any use of something to access `x` then causes undefined behaviour.

If this example is changed to something like

```
 SomeType y;
 volatile SomeType& x(y);
 SomeType &something = const_cast<SomeType &>(x);

```

then using `something` is legal (since `y` is not volatile), but if `x` is used to modify `y` in some way, the compiler may or may not ensure those changes are reflected when `something` is accessed (or vice versa). This would make it quite challenging to verify that the code works as intended if (say) a signal handler does something to `x`.

For your use case, there is no point in using `const_cast`. It is easy enough to overload a function so it takes a `const` or non-`const` reference.

```
  void func(Something &x);
  void func(const Something &x);

```

where the second will be called if given a `const` object. Using `const_cast` to remove `const`ness has no effect in the first. In the second, it potentially permits changing something that is not changeable, so may result in undefined behaviour (if the non`const` reference is used in that way).