implemented layer set/get values

added a std::for_each like function which handles 2 ranges