3

In another thread I introduced some techniques we would use for Model-Driven-Development in C++ once C++11 features, in particular user-defined literals, are available. I just revised the plans for GCC 4.5 and even 4.6 and it shows that this particular feature is not supported.

Anyway, do you know if I even have any compiler to test that feature to start designing/implementing the algorithms till the C++11 is approved and implemented in mainstream free compilers (LLVM, GCC)?

Community
  • 1
  • 1
Diego Sevilla
  • 28,636
  • 4
  • 59
  • 87
  • We (see bio) build a C++ front end used for reengineering purposes, and are C++0x as an upcoming standard that we are likely to implement sometime soon. While I understand what user defined literals *are*, I at least admit some puzzlement as to their motivating use case. Yet you seem have a specific use. Can you sketch why user defined literals are interesting, especially for a code generator which presumably can generate any code it likes, including arbitrary goo to initialize a struct? ... Why does a model driven guy even care? – Ira Baxter Nov 01 '10 at 00:50
  • Ira: nice question and you're right. For a code generator this feature is (almost) of little usage, apart from having to generate more classes or a less clean templates. *However* what we want to achieve is a very efficient embeeded DSL for specifying models, metamodels and model transformations in C++. By the help of metaprogramming, transformations can be much more efficient than by using, say, ATL under Java. – Diego Sevilla Nov 01 '10 at 12:31
  • @Ira UDLs and const_expr should be usable to turn strings into hashcodes at compile time. – ohmantics Nov 02 '10 at 01:37

3 Answers3

2

Not yet, although patches for both Clang and GCC have been submitted and rejected for reworking, so you should see something soon.

ohmantics
  • 1,799
  • 14
  • 16
1

None yet, as far as I know.

towi
  • 21,587
  • 28
  • 106
  • 187
1

GCC 4.7 (unreleased as of this posting) supports user-defined literals. For reference see http://gcc.gnu.org/gcc-4.7/changes.html and http://gcc.gnu.org/gcc-4.7/cxx0x_status.html .

Judging just from past GCC release timelines, I guess GCC 4.7 will be released sometime before May 2012.

You can use it right away if you want: I'm using a GCC 4.7 SVN snapshot right now specifically to play with user-defined literals and some other newly implemented C++11 features. They are working very well and I expect to use them in earnest when GCC 4.7 is released.

wjl
  • 7,519
  • 2
  • 32
  • 41