A shifting device with two positive-locking shifting element halves includes a positive connection between the shifting element halves that is able to be established or released. The respective prevailing operating states of the shifting element halves are determined through a sensor device. The surface areas of an encoder contour relative to a measuring device are formed in a convex or concave manner, whereas a perpendicular gap between the surface areas of the encoder contour and a permanent magnet, starting from a joint area between the surface areas in the direction of an end area of the surface areas increases or decreases in each case.