This project has moved. For the latest updates, please go here.
2

Closed

support for boost::optional<T&>

description

I frequently use boost::optional, but have found that the visualizer provided here does not support boost::optional<T&>. I came up with an alternative visualizer for boost::optional that supports value and reference types.
  <Type Name="boost::detail::reference_content&lt;*&gt;">
    <DisplayString>{content_}</DisplayString>
    <Expand>
      <ExpandedItem>content_</ExpandedItem>
    </Expand>
  </Type>

  <Type Name="boost::optional_detail::aligned_storage&lt;*&gt;">
    <DisplayString>{*(($T1 *)dummy_.data)}</DisplayString>
    <Expand>
      <ExpandedItem>*(($T1 *)dummy_.data)</ExpandedItem>
    </Expand>
  </Type>
  
  <Type Name="boost::optional&lt;*&gt;">
    <AlternativeType Name="boost::optional_detail::optional_base&lt;*&gt;" />
    <DisplayString Condition="!m_initialized">empty</DisplayString>
    <DisplayString Condition="m_initialized">{m_storage}</DisplayString>
    <Expand>
      <ExpandedItem Condition="m_initialized">m_storage</ExpandedItem>
    </Expand>
  </Type>
Additionally, this visualizer makes it quicker to access details about the object inside the boost::optional by using ExpandedItem instead of Item.

It would be great to see this addition added to the extension.
Closed Jul 12, 2015 at 12:20 AM by KindDragon
Fixed in version 1.0.18 (version for VS2013 will be released soon)

comments

KindDragon wrote Nov 18, 2014 at 10:09 PM

Thank you. I will add it in next version

mattlindner wrote Nov 18, 2014 at 10:51 PM

Great! Thank you!