#include <string>
#include <iostream>

template <class E, class T = std::char_traits<E>, unsigned N = 0>
std::basic_string<E, T> convertLiteral(char const(& lit)[N])
{ return std::basic_string<E, T>(lit, lit+N); }

int main()
{
    std::wstring wfoo(L"Oh my foo!");

    auto tag = convertLiteral<wchar_t>("foo");
    auto pos = wfoo.find(tag);
    if (pos != std::wstring::npos)
      wfoo.replace(pos, tag.length(), L"bar");
    else
      std::wcout << "meh!\n";
    std::wcout << wfoo;
}