e.g. in memory, you could have pos, then a, then b. Or, you could have pos and b in one buffer, and a in another buffer.
If your structure was a cbuffer, then yes, the in-memory layout would have to match the HLSL layout. However, HLSL vertex structures are different -- they don't actually exist in memory, they're created at the start of execution of the vertex shader by the "Input Assembler", which reads all the attributes out of the vertex streams.
The "input layout" object is the glue that tells the Input Assembler how to read values out of memory and assemble them into an instance of this structure. When you create an input layout, each element specifies it's layout in memory (which stream, what offset into the stream, what format), and it's location in the HLSL vertex structure (semantic name+index).
You can have any type that can be mapped to one of the formats in the "Input assembler vertex buffer resources" I linked to.
I had someting else in mind - what HLSL types are allowed in the Shader code. So - can I have 'float4' in the input struct? Yes as far as I know. Can I have a 'sampler'? Probably not. Some specification that can answer this questions is what I'm looking for.
e.g. DXGI_FORMAT_R32G32B32A32_FLOAT can represent a float4, but there is no format in the list that can represent a sampler.