In dissatisfying relationships... yes. I've had marriage trouble for a while, so I'm a master at managing this

.
The problem is if you're going through a 'bad patch' then, the temptation to flirt can be pretty strong. I once had an attractive women on her last day direct her goodbye speech towards me, and pretty much offer herself to me non-verbally! I was speechless - she had a looooooooong term boyfriend (they'd been dating since they were 9, and she was 23), and I had/have a wife.
I can't help being attracted to women, especially seeing as I work in retail which is dominated by female staff, and most of the clientèle are female. I know my wife looks at the sculpted dudes on soaps with attraction, it's not something we can shut down IMO.
Nowadays I make sure I mention my wife in conversations with attractive women so I won't be inclined to (attempt) to flirt. That's the best strategy from my experience, or call them friend, mate (UK thing), buddy, etc. It really put's up a mental barrier. Though some females will still see through that, and tease you.
One other strange thing happened to me, I think that love at first sight is a myth but very soon after I got married (after a very short courtship - I was practising muslim at the time) I was working at customer services and beautiful, sweet young lady who seemed to glow, with a beautiful soft smile and voice asked me if there was any jobs. I apologized and said no, she smiled at me, and left. (Her manner was extremely similar to INFP women on youtube)
To this day I still remember that experience. I've never experienced anything like that before or since - it freaks me out a little.