Say you want to charge an empty capacitor to a certain voltage. It's pretty simple to determine analytically the values of all variables versus time in such a system and RC circuits are usually the subject of high-school physics. However even so there is an interesting point to a charging capacitor that is often omitted from the text books.
If you are using a constant voltage source (like in majority of practical cases), any circuit that charges a capacitor can be generalized into the following circuit:
Ucc is the voltage of the source and C is capacitor capacitance. f(u) can be an arbitrary function, provided it describes a passive resistive element (in this case specifically f(u) >= 0 for u > 0 and f(0) = 0).
For example, an ideal resistor has:
f(u) = \frac{u}{R}
And a current source made with transistors can be approximated with:
f(u) = I_c
As you probably know, the energy of a capacitor with capacitance C charged to voltage Ucc is equal to:
W_{capacitor} = \frac{C \cdot U_{cc}^2}{2}
While the work done by the voltage source when charging it is equal to:
W_{source} = \int_0^{\infty} U_{cc} \cdot i \cdot dt = U_{cc} \cdot \int_0^{\infty} i \cdot dt = U_{cc} \cdot Q
W_{source} = U_{cc} \cdot U_{cc} \cdot C = C \cdot U_{cc}^2
You can see here that no matter what the f(u) function of the element in the circuit is, only half of the work done by the source goes to increasing the capacitor energy. The other half is dissipated as heat in the resistor, transistor or any other element connected between the source and the capacitor.
Why is that? One way to understand it is to consider how a small unit of charge gets transferred from the source at potential Ucc to the positive capacitor plate with potential of:
u_c = \frac{q_c}{C}
The very first charge unit has to fall into a potential well of a discharged capacitor (qc = 0). It looses potential energy by doing that and this energy lost must be converted to heat in the resistive element. Following charge units have to gradually loose less and less potential until the capacitor is fully charged and potentials on both sides are equal. This process doesn't depend on the resistance offered to the charge units by the material between the two potentials.
The obvious question here is what happens if you connect an empty capacitor directly to the voltage source? Well, that is a circuit that makes as much sense in circuit theory as statement 1 = 0 in mathematics. Generalizations that permit the use of circuit theory do not allow such an event and indeed it is also impossible in practice, since every capacitor has some series resistance. Even introducing mathematical tricks like the Dirac delta function doesn't give you a consistent answer.
So what if you're environmentally conscious and don't want to waste half of the energy on each charge cycle (or more probably, you're transferring so much energy over that capacitor that it becomes unpractical to cool surrounding elements)?
Since using only resistive elements is obviously out of the question, the circuit must use at least one additional reactive element, specifically a coil. For example like this:
To start charging the capacitor, you close the switch. The circuit then forms a LC circuit that begins to oscillate. When the voltage on the capacitor reaches approximately half of the source voltage, you open the switch. The energy stored in the magnetic field in the coil will then charge the capacitor over the second half of the cycle and the diode will prevent the capacitor from discharging again through the coil. Here's how such a charge cycle looks like in a SPICE simulation:
Upper trace: voltage on the diode. Lower trace: capacitor voltage Uc
Still, some energy is lost on the switch resistance and the diode, but this time that portion depends on variables that are at least to some extent under your control (i.e. "on" resistance of the switch, Uf of the diode). How to calculate that is left as an exercise for the reader.
In conclusion, you see that although ideal capacitors are advertised as lossless elements, charging them includes a hefty tax unless you're doing it in the right way. With low-power devices this doesn't matter much, but when you're pushing some non-trivial power through the capacitor it becomes a problem.
This is the reason why all practical switching DC-to-DC converters with a significant power output use coils as the reactive element whose terminals are switched. It's the consequence of the fact that the sources of power we use are closer to constant voltage than constant current.
In fact, the circuit above is identical to the buck converter. Note however, that if you're using it only for charging an initially empty capacitor, the final voltage can be higher than Ucc and depends on when you turn off the switch.