If the charger is properly sized the answer is yes, absolutely.
The complete answer is slightly different, especially if your charger is not "properly sized". If your on-board DC loads are larger than your battery charger you can actually be discharging the battery even though the charger is running at full-bore. As an example we had a customer with a 10A charger on a 450Ah bank. On shore power he had an average 15.5A of load.. He was negative -5.5A even with the charger running at full-bore because it was not sized properly. A charger should be sized at a minimum of 10% of Ah capacity, after dockside loads have been accounted for, if that is how you will be using it.
Eg: 450Ah Bank + No Dockside Loads = 45A - 50A Charger
Eg: 450Ah Bank + 10A of Dockside DC Loads = 55A - 60A Charger
How about turning on the lights to cook a meal while the charger is recharging the batteries. Not much difference between the AC charger running and the engine driving the Alternator charging... Do you run in the dark or shut down the electronics while motoring the boat? No.