A circuit like that is used for power factor correction front end for a DC power supply.
The switching duty cycle is adjusted to fit the line frequency full wave rectified waveform so the input charging current on the cap is also full wave rectified current shaped yielding a good power factor. The average of the full wave charging current must equal the average DC current taken off the capacitor.
Since the input current is line freq at full wave rectification, the output cap value must be large enough to remove most of the ripple voltage. It needs a feedback control circuit to make the switching control adjustments. There are two or three inputs to the control logic. A sample of the full wave rectifier output provides the stencil for the switcher to do the good sinewave shaped capacitor charge. The output voltage is used to adjust the gain of the switcher cycling. The third sense is an output current feedback that may also feed into gain control or just provide current limit detections.